diff --git a/MOLPayReactExampleProject/.babelrc b/MOLPayReactExampleProject/.babelrc deleted file mode 100644 index a9ce136..0000000 --- a/MOLPayReactExampleProject/.babelrc +++ /dev/null @@ -1,3 +0,0 @@ -{ - "presets": ["react-native"] -} diff --git a/MOLPayReactExampleProject/.flowconfig b/MOLPayReactExampleProject/.flowconfig index 8346120..47d80d9 100644 --- a/MOLPayReactExampleProject/.flowconfig +++ b/MOLPayReactExampleProject/.flowconfig @@ -12,34 +12,58 @@ ; For RN Apps installed via npm, "Libraries" folder is inside ; "node_modules/react-native" but in the source repo it is in the root .*/Libraries/react-native/React.js -.*/Libraries/react-native/ReactNative.js + +; Ignore polyfills +.*/Libraries/polyfills/.* + +; Ignore metro +.*/node_modules/metro/.* [include] [libs] node_modules/react-native/Libraries/react-native/react-native-interface.js -node_modules/react-native/flow -flow/ +node_modules/react-native/flow/ [options] emoji=true +esproposal.optional_chaining=enable +esproposal.nullish_coalescing=enable + module.system=haste +module.system.haste.use_name_reducers=true +# get basename +module.system.haste.name_reducers='^.*/\([a-zA-Z0-9$_.-]+\.js\(\.flow\)?\)$' -> '\1' +# strip .js or .js.flow suffix +module.system.haste.name_reducers='^\(.*\)\.js\(\.flow\)?$' -> '\1' +# strip .ios suffix +module.system.haste.name_reducers='^\(.*\)\.ios$' -> '\1' +module.system.haste.name_reducers='^\(.*\)\.android$' -> '\1' +module.system.haste.name_reducers='^\(.*\)\.native$' -> '\1' +module.system.haste.paths.blacklist=.*/__tests__/.* +module.system.haste.paths.blacklist=.*/__mocks__/.* +module.system.haste.paths.blacklist=/node_modules/react-native/Libraries/Animated/src/polyfills/.* +module.system.haste.paths.whitelist=/node_modules/react-native/Libraries/.* munge_underscores=true module.name_mapper='^[./a-zA-Z0-9$_-]+\.\(bmp\|gif\|jpg\|jpeg\|png\|psd\|svg\|webp\|m4v\|mov\|mp4\|mpeg\|mpg\|webm\|aac\|aiff\|caf\|m4a\|mp3\|wav\|html\|pdf\)$' -> 'RelativeImageStub' +module.file_ext=.js +module.file_ext=.jsx +module.file_ext=.json +module.file_ext=.native.js + suppress_type=$FlowIssue suppress_type=$FlowFixMe -suppress_type=$FixMe +suppress_type=$FlowFixMeProps +suppress_type=$FlowFixMeState -suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) -suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(>=0\\.\\(4[0-9]\\|[1-3][0-9]\\|[0-9]\\).[0-9]\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ +suppress_comment=\\(.\\|\n\\)*\\$FlowFixMe\\($\\|[^(]\\|(\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\) +suppress_comment=\\(.\\|\n\\)*\\$FlowIssue\\((\\(\\)? *\\(site=[a-z,_]*react_native[a-z,_]*\\)?)\\)?:? #[0-9]+ suppress_comment=\\(.\\|\n\\)*\\$FlowFixedInNextDeploy suppress_comment=\\(.\\|\n\\)*\\$FlowExpectedError -unsafe.enable_getters_and_setters=true - [version] -^0.49.1 +^0.92.0 diff --git a/MOLPayReactExampleProject/.gitignore b/MOLPayReactExampleProject/.gitignore index 10be197..5d64756 100644 --- a/MOLPayReactExampleProject/.gitignore +++ b/MOLPayReactExampleProject/.gitignore @@ -46,8 +46,11 @@ buck-out/ # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the # screenshots whenever they are needed. # For more information about the recommended setup visit: -# https://github.com/fastlane/fastlane/blob/master/fastlane/docs/Gitignore.md +# https://docs.fastlane.tools/best-practices/source-control/ -fastlane/report.xml -fastlane/Preview.html -fastlane/screenshots +*/fastlane/report.xml +*/fastlane/Preview.html +*/fastlane/screenshots + +# Bundle artifact +*.jsbundle diff --git a/MOLPayReactExampleProject/App.js b/MOLPayReactExampleProject/App.js new file mode 100644 index 0000000..f2eb241 --- /dev/null +++ b/MOLPayReactExampleProject/App.js @@ -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 { + 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': 'example@email.com', + '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 ( + + Welcome to React Native! + To get started, edit App.js + {instructions} + {this.state.string} +