-
Notifications
You must be signed in to change notification settings - Fork 13
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
56 changed files
with
874 additions
and
781 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,134 @@ | ||
/** | ||
* Sample React Native App | ||
* https://github.com/facebook/react-native | ||
* | ||
* @format | ||
* @flow | ||
*/ | ||
|
||
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', | ||
android: | ||
'Double tap R on your keyboard to reload,\n' + | ||
'Shake or press menu button for dev menu', | ||
}); | ||
|
||
type Props = {}; | ||
export default class App extends Component<Props> { | ||
state = { | ||
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': 1.1, | ||
|
||
// Mandatory String. Values obtained from MOLPay | ||
'mp_username': 'username', | ||
'mp_password': 'password', | ||
'mp_merchant_ID': 'merchantID', | ||
'mp_app_name': 'appname', | ||
'mp_verification_key': '12345123451234512345', | ||
|
||
// Mandatory String. Payment values | ||
'mp_order_ID': 'React0002', | ||
'mp_currency': 'MYR', | ||
'mp_country': 'MY', | ||
|
||
// Optional String. | ||
'mp_channel': '', // 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': 'test payment', | ||
'mp_bill_name': 'anyname', | ||
'mp_bill_email': '[email protected]', | ||
'mp_bill_mobile': '0161111111', | ||
// '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, | ||
|
||
}; | ||
// 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" /> | ||
</View> | ||
); | ||
} | ||
} | ||
|
||
const styles = StyleSheet.create({ | ||
container: { | ||
flex: 1, | ||
justifyContent: 'center', | ||
alignItems: 'center', | ||
backgroundColor: '#F5FCFF', | ||
}, | ||
welcome: { | ||
fontSize: 20, | ||
textAlign: 'center', | ||
margin: 10, | ||
}, | ||
instructions: { | ||
textAlign: 'center', | ||
color: '#333333', | ||
marginBottom: 5, | ||
}, | ||
}); |
10 changes: 6 additions & 4 deletions
10
...eactExampleProject/__tests__/index.ios.js → ...ReactExampleProject/__tests__/App-test.js
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,12 +1,14 @@ | ||
/** | ||
* @format | ||
*/ | ||
|
||
import 'react-native'; | ||
import React from 'react'; | ||
import Index from '../index.ios.js'; | ||
import App from '../App'; | ||
|
||
// Note: test renderer must be required after react-native. | ||
import renderer from 'react-test-renderer'; | ||
|
||
it('renders correctly', () => { | ||
const tree = renderer.create( | ||
<Index /> | ||
); | ||
renderer.create(<App />); | ||
}); |
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
"""Helper definitions to glob .aar and .jar targets""" | ||
|
||
def create_aar_targets(aarfiles): | ||
for aarfile in aarfiles: | ||
name = "aars__" + aarfile[aarfile.rindex("/") + 1:aarfile.rindex(".aar")] | ||
lib_deps.append(":" + name) | ||
android_prebuilt_aar( | ||
name = name, | ||
aar = aarfile, | ||
) | ||
|
||
def create_jar_targets(jarfiles): | ||
for jarfile in jarfiles: | ||
name = "jars__" + jarfile[jarfile.rindex("/") + 1:jarfile.rindex(".jar")] | ||
lib_deps.append(":" + name) | ||
prebuilt_jar( | ||
name = name, | ||
binary_jar = jarfile, | ||
) |
Oops, something went wrong.