Commit 1569ba22 by Giang Tran

update code

parent 6b716ac5
...@@ -30,6 +30,10 @@ allprojects { ...@@ -30,6 +30,10 @@ allprojects {
maven { maven {
// Android JSC is installed from npm // Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist") url("$rootDir/../node_modules/jsc-android/dist")
}
maven {
url("$rootDir/../node_modules/react-native-vnpay-merchant/android/repo")
} }
// ADD THIS // ADD THIS
maven { url 'https://maven.google.com' } maven { url 'https://maven.google.com' }
......
...@@ -5,5 +5,6 @@ ...@@ -5,5 +5,6 @@
import {AppRegistry} from 'react-native'; import {AppRegistry} from 'react-native';
import App from './App'; import App from './App';
import {name as appName} from './app.json'; import {name as appName} from './app.json';
import Payment from './src/Screens/Payment/Payment';
AppRegistry.registerComponent(appName, () => App); AppRegistry.registerComponent(appName, () => Payment);
...@@ -296,6 +296,7 @@ ...@@ -296,6 +296,7 @@
00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */, 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
D10F3A5D59847BD5B121672E /* [CP] Embed Pods Frameworks */, D10F3A5D59847BD5B121672E /* [CP] Embed Pods Frameworks */,
6CC873A1E6FA7C328D7B37A9 /* ShellScript */, 6CC873A1E6FA7C328D7B37A9 /* ShellScript */,
B6300C27D48C95A66927365E /* [CP] Copy Pods Resources */,
); );
buildRules = ( buildRules = (
); );
......
...@@ -16,6 +16,7 @@ ...@@ -16,6 +16,7 @@
#import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h> #import <FlipperKitNetworkPlugin/FlipperKitNetworkPlugin.h>
#import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h> #import <SKIOSNetworkPlugin/SKIOSNetworkAdapter.h>
#import <FlipperKitReactPlugin/FlipperKitReactPlugin.h> #import <FlipperKitReactPlugin/FlipperKitReactPlugin.h>
#import <CallAppSDK/CallAppInterface.h>
static void InitializeFlipper(UIApplication *application) { static void InitializeFlipper(UIApplication *application) {
FlipperClient *client = [FlipperClient sharedClient]; FlipperClient *client = [FlipperClient sharedClient];
...@@ -39,8 +40,6 @@ static void InitializeFlipper(UIApplication *application) { ...@@ -39,8 +40,6 @@ static void InitializeFlipper(UIApplication *application) {
[FIRApp configure]; [FIRApp configure];
[[UNUserNotificationCenter currentNotificationCenter] setDelegate:self]; [[UNUserNotificationCenter currentNotificationCenter] setDelegate:self];
RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions]; RCTBridge *bridge = [[RCTBridge alloc] initWithDelegate:self launchOptions:launchOptions];
RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge RCTRootView *rootView = [[RCTRootView alloc] initWithBridge:bridge
moduleName:@"Invest" moduleName:@"Invest"
...@@ -53,6 +52,8 @@ static void InitializeFlipper(UIApplication *application) { ...@@ -53,6 +52,8 @@ static void InitializeFlipper(UIApplication *application) {
rootViewController.view = rootView; rootViewController.view = rootView;
self.window.rootViewController = rootViewController; self.window.rootViewController = rootViewController;
[self.window makeKeyAndVisible]; [self.window makeKeyAndVisible];
[CallAppInterface setHomeViewController:rootViewController];
return YES; return YES;
} }
......
...@@ -325,6 +325,8 @@ PODS: ...@@ -325,6 +325,8 @@ PODS:
- React-jsinspector (0.62.2) - React-jsinspector (0.62.2)
- react-native-safe-area-context (3.1.9): - react-native-safe-area-context (3.1.9):
- React-Core - React-Core
- react-native-vnpay-merchant (1.0.0):
- React
- React-RCTActionSheet (0.62.2): - React-RCTActionSheet (0.62.2):
- React-Core/RCTActionSheetHeaders (= 0.62.2) - React-Core/RCTActionSheetHeaders (= 0.62.2)
- React-RCTAnimation (0.62.2): - React-RCTAnimation (0.62.2):
...@@ -460,6 +462,7 @@ DEPENDENCIES: ...@@ -460,6 +462,7 @@ DEPENDENCIES:
- React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`) - React-jsiexecutor (from `../node_modules/react-native/ReactCommon/jsiexecutor`)
- React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`) - React-jsinspector (from `../node_modules/react-native/ReactCommon/jsinspector`)
- react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`) - react-native-safe-area-context (from `../node_modules/react-native-safe-area-context`)
- react-native-vnpay-merchant (from `../node_modules/react-native-vnpay-merchant`)
- React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`) - React-RCTActionSheet (from `../node_modules/react-native/Libraries/ActionSheetIOS`)
- React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`) - React-RCTAnimation (from `../node_modules/react-native/Libraries/NativeAnimation`)
- React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`) - React-RCTBlob (from `../node_modules/react-native/Libraries/Blob`)
...@@ -547,6 +550,8 @@ EXTERNAL SOURCES: ...@@ -547,6 +550,8 @@ EXTERNAL SOURCES:
:path: "../node_modules/react-native/ReactCommon/jsinspector" :path: "../node_modules/react-native/ReactCommon/jsinspector"
react-native-safe-area-context: react-native-safe-area-context:
:path: "../node_modules/react-native-safe-area-context" :path: "../node_modules/react-native-safe-area-context"
react-native-vnpay-merchant:
:path: "../node_modules/react-native-vnpay-merchant"
React-RCTActionSheet: React-RCTActionSheet:
:path: "../node_modules/react-native/Libraries/ActionSheetIOS" :path: "../node_modules/react-native/Libraries/ActionSheetIOS"
React-RCTAnimation: React-RCTAnimation:
...@@ -631,6 +636,7 @@ SPEC CHECKSUMS: ...@@ -631,6 +636,7 @@ SPEC CHECKSUMS:
React-jsiexecutor: 1540d1c01bb493ae3124ed83351b1b6a155db7da React-jsiexecutor: 1540d1c01bb493ae3124ed83351b1b6a155db7da
React-jsinspector: 512e560d0e985d0e8c479a54a4e5c147a9c83493 React-jsinspector: 512e560d0e985d0e8c479a54a4e5c147a9c83493
react-native-safe-area-context: b6e0e284002381d2ff29fa4fff42b4d8282e3c94 react-native-safe-area-context: b6e0e284002381d2ff29fa4fff42b4d8282e3c94
react-native-vnpay-merchant: c9f1ebb375802c7004045e3646240f043acaaf61
React-RCTActionSheet: f41ea8a811aac770e0cc6e0ad6b270c644ea8b7c React-RCTActionSheet: f41ea8a811aac770e0cc6e0ad6b270c644ea8b7c
React-RCTAnimation: 49ab98b1c1ff4445148b72a3d61554138565bad0 React-RCTAnimation: 49ab98b1c1ff4445148b72a3d61554138565bad0
React-RCTBlob: a332773f0ebc413a0ce85942a55b064471587a71 React-RCTBlob: a332773f0ebc413a0ce85942a55b064471587a71
......
...@@ -35,6 +35,7 @@ ...@@ -35,6 +35,7 @@
"react-native-screens": "^2.17.1", "react-native-screens": "^2.17.1",
"react-native-tab-view": "^2.15.2", "react-native-tab-view": "^2.15.2",
"react-native-vector-icons": "^8.0.0", "react-native-vector-icons": "^8.0.0",
"react-native-vnpay-merchant": "/Users/macbookpro/Documents/Company/ReactNative/Invest/node_modules/react-native-vnpay-merchant",
"react-redux": "^7.2.2", "react-redux": "^7.2.2",
"redux": "^4.0.5", "redux": "^4.0.5",
"redux-saga": "^1.1.3" "redux-saga": "^1.1.3"
......
import React, {useEffect, useState} from 'react';
import {
SafeAreaView,
Text,
StatusBar,
TouchableOpacity,
DeviceEventEmitter,
NativeEventEmitter,
Alert,
View,
} from 'react-native';
import VnpayMerchant, {VnpayMerchantModule} from 'react-native-vnpay-merchant';
const eventEmitter = new NativeEventEmitter(VnpayMerchantModule);
const Payment = (props) => {
const [text, setText] = useState('OpenSDK');
useEffect(() => {
// mở sdk
eventEmitter.addListener('PaymentBack', (e) => {
console.log('Sdk back!');
// Đã available trên cả ios, android
if (e) {
switch (e.resultCode) {
case 0:
console.log('Sdk closed');
break;
case -1:
console.log('Người dùng nhấn back từ sdk để quay lại');
break;
case 10: //ios
console.log(
'Người dùng nhấn chọn thanh toán qua app thanh toán (Mobile Banking, Ví...)',
);
break;
case 99:
console.log(
'Người dùng nhấn back từ trang thanh toán thành công khi thanh toán qua thẻ khi gọi đến http://sdk.merchantbackapp',
);
}
}
});
return () => {
// khi tắt sdk
eventEmitter.removeAllListeners('PaymentBack');
};
}, []);
return (
<View style={{flex: 1, justifyContent: 'center', alignItems: 'center'}}>
<TouchableOpacity
style={{
paddingHorizontal: 24,
paddingVertical: 10,
backgroundColor: 'blue',
borderRadius: 10,
}}
onPress={() => {
VnpayMerchant.show({
iconBackName: 'ic_back',
paymentUrl:
'https://sandbox.vnpayment.vn/tryitnow/Home/CreateOrder',
scheme: 'sampleapp',
tmn_code: 'FAHASA03',
});
setText('Sdk opened');
}}>
<Text style={{color: 'white'}}>{text}</Text>
</TouchableOpacity>
</View>
);
};
export default Payment;
...@@ -6129,6 +6129,9 @@ react-native-vector-icons@^8.0.0: ...@@ -6129,6 +6129,9 @@ react-native-vector-icons@^8.0.0:
prop-types "^15.7.2" prop-types "^15.7.2"
yargs "^16.1.1" yargs "^16.1.1"
react-native-vnpay-merchant@/Users/macbookpro/Documents/Company/ReactNative/Invest/node_modules/react-native-vnpay-merchant:
version "1.0.0"
react-native@0.62.2: react-native@0.62.2:
version "0.62.2" version "0.62.2"
resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.62.2.tgz#d831e11a3178705449142df19a70ac2ca16bad10" resolved "https://registry.yarnpkg.com/react-native/-/react-native-0.62.2.tgz#d831e11a3178705449142df19a70ac2ca16bad10"
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment