Skip to content

Commit 6ed2630

Browse files
author
hisyam
committed
Release 0.29.1
1 parent 5710472 commit 6ed2630

5 files changed

Lines changed: 129 additions & 95 deletions

File tree

MOLPayReactExampleProject/App.js

Lines changed: 84 additions & 84 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66
* @flow
77
*/
88

9-
import React, {Component} from 'react';
10-
import {Platform, StyleSheet, Text, View,Button} from 'react-native';
9+
import React, { Component } from 'react';
10+
import { Platform, StyleSheet, Text, View, Button } from 'react-native';
1111

1212
const instructions = Platform.select({
1313
ios: 'Press Cmd+R to reload,\n' + 'Cmd+D or shake for dev menu',
@@ -19,97 +19,97 @@ const instructions = Platform.select({
1919
type Props = {};
2020
export default class App extends Component<Props> {
2121
state = {
22-
string : ""
22+
string: ""
2323
};
2424

25-
buttonClicked(){
26-
var c = this;
27-
var molpay = require("molpay-mobile-xdk-reactnative-beta");
28-
var paymentDetails = {
29-
// Mandatory String. A value more than '1.00'
30-
'mp_amount': '',
31-
32-
// Mandatory String. Values obtained from MOLPay
33-
'mp_username': '',
34-
'mp_password': '',
35-
'mp_merchant_ID': '',
36-
'mp_app_name': '',
37-
'mp_verification_key': '',
38-
39-
// Mandatory String. Payment values
40-
'mp_order_ID': '1528478239',
41-
'mp_currency': 'MYR',
42-
'mp_country': 'MY',
43-
44-
// Optional String.
45-
'mp_channel': 'multi', // Use 'multi' for all available channels option. For individual channel seletion, please refer to "Channel Parameter" in "Channel Lists" in the MOLPay API Spec for Merchant pdf.
46-
'mp_bill_description': 'description',
47-
'mp_bill_name': 'name',
48-
'mp_bill_email': 'example@email.com',
49-
'mp_bill_mobile': '+60123456789',
50-
// 'mp_channel_editing': true, // Option to allow channel selection.
51-
//'mp_editing_enabled': true, // Option to allow billing information editing.
52-
53-
// Optional for Escrow
54-
// 'mp_is_escrow': '', // Optional for Escrow, put "1" to enable escrow
55-
56-
// Optional for credit card BIN restrictions
57-
//'mp_bin_lock': ['414170', '414171'], // Optional for credit card BIN restrictions
58-
//'mp_bin_lock_err_msg': 'Only UOB allowed', // Optional for credit card BIN restrictions
59-
60-
// For transaction request use only, do not use this on payment process
61-
// 'mp_transaction_id': '', // Optional, provide a valid cash channel transaction id here will display a payment instruction screen.
62-
// 'mp_request_type': '', // Optional, set 'Status' when doing a transactionRequest
63-
64-
// Optional, use this to customize the UI theme for the payment info screen, the original XDK custom.css file is provided at Example project source for reference and implementation.
65-
// 'mp_custom_css_url': '',
66-
67-
// Optional, set the token id to nominate a preferred token as the default selection, set "new" to allow new card only
68-
// 'mp_preferred_token': '',
69-
70-
// Optional, credit card transaction type, set "AUTH" to authorize the transaction
71-
// 'mp_tcctype': '',
72-
73-
// Optional, set true to process this transaction through the recurring api, please refer the MOLPay Recurring API pdf
74-
// // 'mp_is_recurring': false,
75-
76-
// Optional for channels restriction
77-
// 'mp_allowed_channels': ['credit','credit3'],
78-
79-
// Optional for sandboxed development environment, set boolean value to enable.
80-
// 'mp_sandbox_mode': false,
81-
82-
// Optional, required a valid mp_channel value, this will skip the payment info page and go direct to the payment screen.
83-
// 'mp_express_mode': false,
84-
// "mp_bill_description_edit_disabled": false,
85-
// "mp_dev_mode": true
86-
87-
};
88-
// start molpay payment
89-
molpay.startMolpay(paymentDetails,function(data){
90-
console.log(data);
91-
//console.log(paymentDetails);
92-
console.log(this);
93-
alert(JSON.stringify(data));
94-
//callback after payment success
95-
c.setState({
96-
string : data
97-
})
98-
99-
});
100-
};
25+
buttonClicked() {
26+
var c = this;
27+
var molpay = require("molpay-mobile-xdk-reactnative-beta");
28+
var paymentDetails = {
29+
// Mandatory String. A value more than '1.00'
30+
'mp_amount': '1.10',
31+
32+
// Mandatory String. Values obtained from MOLPay
33+
'mp_username': '',
34+
'mp_password': '',
35+
'mp_merchant_ID': '',
36+
'mp_app_name': '',
37+
'mp_verification_key': '',
38+
39+
// Mandatory String. Payment values
40+
'mp_order_ID': '1528478556',
41+
'mp_currency': 'MYR',
42+
'mp_country': 'MY',
43+
44+
// Optional String.
45+
'mp_channel': 'multi', // Use 'multi' for all available channels option. For individual channel seletion, please refer to "Channel Parameter" in "Channel Lists" in the MOLPay API Spec for Merchant pdf.
46+
'mp_bill_description': 'description',
47+
'mp_bill_name': 'biller name',
48+
'mp_bill_email': 'example@gmail.com',
49+
'mp_bill_mobile': '+60123456789',
50+
// 'mp_channel_editing': true, // Option to allow channel selection.
51+
//'mp_editing_enabled': true, // Option to allow billing information editing.
52+
53+
// Optional for Escrow
54+
// 'mp_is_escrow': '', // Optional for Escrow, put "1" to enable escrow
55+
56+
// Optional for credit card BIN restrictions
57+
//'mp_bin_lock': ['414170', '414171'], // Optional for credit card BIN restrictions
58+
//'mp_bin_lock_err_msg': 'Only UOB allowed', // Optional for credit card BIN restrictions
59+
60+
// For transaction request use only, do not use this on payment process
61+
// 'mp_transaction_id': '', // Optional, provide a valid cash channel transaction id here will display a payment instruction screen.
62+
// 'mp_request_type': '', // Optional, set 'Status' when doing a transactionRequest
63+
64+
// Optional, use this to customize the UI theme for the payment info screen, the original XDK custom.css file is provided at Example project source for reference and implementation.
65+
// 'mp_custom_css_url': '',
66+
67+
// Optional, set the token id to nominate a preferred token as the default selection, set "new" to allow new card only
68+
// 'mp_preferred_token': '',
69+
70+
// Optional, credit card transaction type, set "AUTH" to authorize the transaction
71+
// 'mp_tcctype': '',
72+
73+
// Optional, set true to process this transaction through the recurring api, please refer the MOLPay Recurring API pdf
74+
// // 'mp_is_recurring': false,
75+
76+
// Optional for channels restriction
77+
// 'mp_allowed_channels': ['credit','credit3'],
78+
79+
// Optional for sandboxed development environment, set boolean value to enable.
80+
// 'mp_sandbox_mode': false,
81+
82+
// Optional, required a valid mp_channel value, this will skip the payment info page and go direct to the payment screen.
83+
// 'mp_express_mode': false,
84+
// "mp_bill_description_edit_disabled": false,
85+
// "mp_dev_mode": true
86+
87+
};
88+
// start molpay payment
89+
molpay.startMolpay(paymentDetails, function (data) {
90+
console.log(data);
91+
//console.log(paymentDetails);
92+
console.log(this);
93+
alert(JSON.stringify(data));
94+
//callback after payment success
95+
c.setState({
96+
string: data
97+
})
98+
99+
});
100+
};
101101

102102
render() {
103103
return (
104104
<View style={styles.container}>
105105
<Text style={styles.welcome}>Welcome to React Native!</Text>
106106
<Text style={styles.instructions}>To get started, edit App.js</Text>
107107
<Text style={styles.instructions}>{instructions}</Text>
108-
<Text style={styles.instructions}>{this.state.string}</Text>
109-
<Button
110-
style={{backgroundColor: 'grey', flex: 0.5}}
111-
onPress={this.buttonClicked.bind(this)}
112-
title="Start Molpay" />
108+
<Text style={styles.instructions}>{this.state.string}</Text>
109+
<Button
110+
style={{ backgroundColor: 'grey', flex: 0.5 }}
111+
onPress={this.buttonClicked.bind(this)}
112+
title="Start Molpay" />
113113
</View>
114114
);
115115
}

MOLPayReactExampleProject/android/app/src/main/AndroidManifest.xml

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -19,15 +19,17 @@
1919
<action android:name="android.intent.action.MAIN" />
2020
<category android:name="android.intent.category.LAUNCHER" />
2121
</intent-filter>
22-
<intent-filter>
23-
<action android:name="android.intent.action.VIEW" />
22+
</activity>
23+
<activity android:name=".DeepLinkActivity">
24+
<intent-filter>
25+
<action android:name="android.intent.action.VIEW" />
2426

25-
<category android:name="android.intent.category.DEFAULT" />
26-
<category android:name="android.intent.category.BROWSABLE" />
27+
<category android:name="android.intent.category.DEFAULT" />
28+
<category android:name="android.intent.category.BROWSABLE" />
2729

28-
<data
29-
android:scheme="testappurl" />
30-
</intent-filter>
30+
<data
31+
android:scheme="testappurl" />
32+
</intent-filter>
3133
</activity>
3234
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
3335
</application>
Lines changed: 32 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,32 @@
1+
package com.test0270;
2+
3+
import android.app.Activity;
4+
import android.content.Intent;
5+
import android.os.Bundle;
6+
7+
public class DeepLinkActivity extends Activity {
8+
9+
@Override
10+
protected void onCreate(Bundle savedInstanceState) {
11+
super.onCreate(savedInstanceState);
12+
13+
if (isTaskRoot()) {
14+
// This Activity is the only Activity, so
15+
// the app wasn't running. So start the app from the
16+
// beginning (redirect to MainActivity)
17+
Intent intent = getIntent(); // Copy the Intent used to launch me
18+
// Launch the real root Activity (launch Intent)
19+
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
20+
intent.setClass(this, MainActivity.class);
21+
// I'm done now, so finish()
22+
23+
startActivity(intent);
24+
finish();
25+
} else {
26+
// App was already running, so just finish, which will drop the user
27+
// in to the activity that was at the top of the task stack
28+
finish();
29+
}
30+
31+
}
32+
}

MOLPayReactExampleProject/package-lock.json

Lines changed: 3 additions & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

MOLPayReactExampleProject/package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"test": "jest"
88
},
99
"dependencies": {
10-
"molpay-mobile-xdk-reactnative-beta": "^0.29.0",
10+
"molpay-mobile-xdk-reactnative-beta": "^0.29.1",
1111
"react": "16.8.3",
1212
"react-native": "0.59.9"
1313
},

0 commit comments

Comments
 (0)