Skip to content

Commit

Permalink
Release 0.29.1
Browse files Browse the repository at this point in the history
  • Loading branch information
hisyam committed Feb 8, 2021
1 parent 5710472 commit 6ed2630
Show file tree
Hide file tree
Showing 5 changed files with 129 additions and 95 deletions.
168 changes: 84 additions & 84 deletions MOLPayReactExampleProject/App.js
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@
* @flow
*/

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

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

buttonClicked(){
var c = this;
var molpay = require("molpay-mobile-xdk-reactnative-beta");
var paymentDetails = {
// Mandatory String. A value more than '1.00'
'mp_amount': '',

// Mandatory String. Values obtained from MOLPay
'mp_username': '',
'mp_password': '',
'mp_merchant_ID': '',
'mp_app_name': '',
'mp_verification_key': '',

// Mandatory String. Payment values
'mp_order_ID': '1528478239',
'mp_currency': 'MYR',
'mp_country': 'MY',

// Optional String.
'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.
'mp_bill_description': 'description',
'mp_bill_name': 'name',
'mp_bill_email': 'example@email.com',
'mp_bill_mobile': '+60123456789',
// 'mp_channel_editing': true, // Option to allow channel selection.
//'mp_editing_enabled': true, // Option to allow billing information editing.

// Optional for Escrow
// 'mp_is_escrow': '', // Optional for Escrow, put "1" to enable escrow

// Optional for credit card BIN restrictions
//'mp_bin_lock': ['414170', '414171'], // Optional for credit card BIN restrictions
//'mp_bin_lock_err_msg': 'Only UOB allowed', // Optional for credit card BIN restrictions

// For transaction request use only, do not use this on payment process
// 'mp_transaction_id': '', // Optional, provide a valid cash channel transaction id here will display a payment instruction screen.
// 'mp_request_type': '', // Optional, set 'Status' when doing a transactionRequest

// 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.
// 'mp_custom_css_url': '',

// Optional, set the token id to nominate a preferred token as the default selection, set "new" to allow new card only
// 'mp_preferred_token': '',

// Optional, credit card transaction type, set "AUTH" to authorize the transaction
// 'mp_tcctype': '',

// Optional, set true to process this transaction through the recurring api, please refer the MOLPay Recurring API pdf
// // 'mp_is_recurring': false,

// Optional for channels restriction
// 'mp_allowed_channels': ['credit','credit3'],

// Optional for sandboxed development environment, set boolean value to enable.
// 'mp_sandbox_mode': false,

// Optional, required a valid mp_channel value, this will skip the payment info page and go direct to the payment screen.
// 'mp_express_mode': false,
// "mp_bill_description_edit_disabled": false,
// "mp_dev_mode": true

};
// start molpay payment
molpay.startMolpay(paymentDetails,function(data){
console.log(data);
//console.log(paymentDetails);
console.log(this);
alert(JSON.stringify(data));
//callback after payment success
c.setState({
string : data
})
});
};
buttonClicked() {
var c = this;
var molpay = require("molpay-mobile-xdk-reactnative-beta");
var paymentDetails = {
// Mandatory String. A value more than '1.00'
'mp_amount': '1.10',

// Mandatory String. Values obtained from MOLPay
'mp_username': '',
'mp_password': '',
'mp_merchant_ID': '',
'mp_app_name': '',
'mp_verification_key': '',

// Mandatory String. Payment values
'mp_order_ID': '1528478556',
'mp_currency': 'MYR',
'mp_country': 'MY',

// Optional String.
'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.
'mp_bill_description': 'description',
'mp_bill_name': 'biller name',
'mp_bill_email': 'example@gmail.com',
'mp_bill_mobile': '+60123456789',
// 'mp_channel_editing': true, // Option to allow channel selection.
//'mp_editing_enabled': true, // Option to allow billing information editing.

// Optional for Escrow
// 'mp_is_escrow': '', // Optional for Escrow, put "1" to enable escrow

// Optional for credit card BIN restrictions
//'mp_bin_lock': ['414170', '414171'], // Optional for credit card BIN restrictions
//'mp_bin_lock_err_msg': 'Only UOB allowed', // Optional for credit card BIN restrictions

// For transaction request use only, do not use this on payment process
// 'mp_transaction_id': '', // Optional, provide a valid cash channel transaction id here will display a payment instruction screen.
// 'mp_request_type': '', // Optional, set 'Status' when doing a transactionRequest

// 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.
// 'mp_custom_css_url': '',

// Optional, set the token id to nominate a preferred token as the default selection, set "new" to allow new card only
// 'mp_preferred_token': '',

// Optional, credit card transaction type, set "AUTH" to authorize the transaction
// 'mp_tcctype': '',

// Optional, set true to process this transaction through the recurring api, please refer the MOLPay Recurring API pdf
// // 'mp_is_recurring': false,

// Optional for channels restriction
// 'mp_allowed_channels': ['credit','credit3'],

// Optional for sandboxed development environment, set boolean value to enable.
// 'mp_sandbox_mode': false,

// Optional, required a valid mp_channel value, this will skip the payment info page and go direct to the payment screen.
// 'mp_express_mode': false,
// "mp_bill_description_edit_disabled": false,
// "mp_dev_mode": true

};
// start molpay payment
molpay.startMolpay(paymentDetails, function (data) {
console.log(data);
//console.log(paymentDetails);
console.log(this);
alert(JSON.stringify(data));
//callback after payment success
c.setState({
string: data
})

});
};

render() {
return (
<View style={styles.container}>
<Text style={styles.welcome}>Welcome to React Native!</Text>
<Text style={styles.instructions}>To get started, edit App.js</Text>
<Text style={styles.instructions}>{instructions}</Text>
<Text style={styles.instructions}>{this.state.string}</Text>
<Button
style={{backgroundColor: 'grey', flex: 0.5}}
onPress={this.buttonClicked.bind(this)}
title="Start Molpay" />
<Text style={styles.instructions}>{this.state.string}</Text>
<Button
style={{ backgroundColor: 'grey', flex: 0.5 }}
onPress={this.buttonClicked.bind(this)}
title="Start Molpay" />
</View>
);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -19,15 +19,17 @@
<action android:name="android.intent.action.MAIN" />
<category android:name="android.intent.category.LAUNCHER" />
</intent-filter>
<intent-filter>
<action android:name="android.intent.action.VIEW" />
</activity>
<activity android:name=".DeepLinkActivity">
<intent-filter>
<action android:name="android.intent.action.VIEW" />

<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />
<category android:name="android.intent.category.DEFAULT" />
<category android:name="android.intent.category.BROWSABLE" />

<data
android:scheme="testappurl" />
</intent-filter>
<data
android:scheme="testappurl" />
</intent-filter>
</activity>
<activity android:name="com.facebook.react.devsupport.DevSettingsActivity" />
</application>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
package com.test0270;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;

public class DeepLinkActivity extends Activity {

@Override
protected void onCreate(Bundle savedInstanceState) {
super.onCreate(savedInstanceState);

if (isTaskRoot()) {
// This Activity is the only Activity, so
// the app wasn't running. So start the app from the
// beginning (redirect to MainActivity)
Intent intent = getIntent(); // Copy the Intent used to launch me
// Launch the real root Activity (launch Intent)
intent.addFlags(Intent.FLAG_ACTIVITY_REORDER_TO_FRONT | Intent.FLAG_ACTIVITY_CLEAR_TASK | Intent.FLAG_ACTIVITY_NEW_TASK);
intent.setClass(this, MainActivity.class);
// I'm done now, so finish()

startActivity(intent);
finish();
} else {
// App was already running, so just finish, which will drop the user
// in to the activity that was at the top of the task stack
finish();
}

}
}
6 changes: 3 additions & 3 deletions MOLPayReactExampleProject/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion MOLPayReactExampleProject/package.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"test": "jest"
},
"dependencies": {
"molpay-mobile-xdk-reactnative-beta": "^0.29.0",
"molpay-mobile-xdk-reactnative-beta": "^0.29.1",
"react": "16.8.3",
"react-native": "0.59.9"
},
Expand Down

0 comments on commit 6ed2630

Please sign in to comment.