asiapay v0.1.3
Prototype of React Native Bridge for AsiaPay PaySDK
Environment Setup
Environment Requirement
For General
react-native version: 0.60.0+
iOS
Xcode version: 12+ iOS simulator/device version: 11+
Android
Android SDK version: 21+
General Setup
For IDE tool, you can install Visual Studio Code
PaySDK Version
Below information show the version of AsiaPay PaySDK.
iOS: 2.6.16
Android: PaySDK-2.7.69
Installation
React Native Setup
Below installation steps are for the 1st time installation or any situation happen only.
Run below command to mount to path of example app
cd {project_root_path}
Run below command to install all packages in
package.json
in root levelnpm install
Run below command to mount to path of example app
cd {project_root_path}/example
Run below command to install all packages in
package.json
in example app levelnpm install
Run below command to install rest of packages from yarn platform
yarn add ../
The info of React Native related softwares can be shown running by the below command (Can add "--verbose" at the end of the command for details):
react-native doctor
Or
react-native info
Update Merchant ID
Open
App.js
to update merchant id on the below code, :React.useEffect(() => { simpleJsiModule.setup('SANDBOX', '{your_merchant_id}'); }, []);
Update Public Key for PaySDK
Android
For further description kindly follow PaySDK Guide on Android
iOS
For further description kindly follow PaySDK Guide on iOS
Run Example App
Before running example app, please make sure example path is mounted.
Turn on React Native Metro Server
Run below command on command line console on Windows or terminal on MacOS.
react-native start
If you want to clear cache from metro server, please run below command to turn on react native metro server:
react-native start --reset-cache
If the current path is mounted on the example app level, you can run below command which is set script on
package.json
instead of the previous commandnpm run start
Android
Run below command on command line console on Windows or terminal on MacOS.
react-native run-android
If the current path is mounted on the example app level, you can run below command which is set script on
package.json
instead of the previous commandnpm run android
iOS
Remove below code for fbRecatNativeSpec
Path - node_modules/react-native/scripts/find-node.sh
if [[ -s "$HOME/.nvm/nvm.sh" ]]; then
# shellcheck source=/dev/null
. "$HOME/.nvm/nvm.sh" --no-use
nvm use 2> /dev/null || nvm use default
elif [[ -x "$(command -v brew)" && -s "$(brew --prefix nvm)/nvm.sh" ]]; then
# shellcheck source=/dev/null
. "$(brew --prefix nvm)/nvm.sh" --no-use
nvm use 2> /dev/null || nvm use default
fi
Xcode Setting
- Add bundle ID to project setting general tab(if required)
- If required add
armv7
orarmv64
toPod -> Target -> asiapay -> build setting -> excluded architecture -> any simulator iOS SDK
Update RSA Key for PaySDK x
- Add
paysdk.plist
and set value of certificate and "Domain" key value pair. Value for the Domain is optional For further description kindly follow PaySDK Guide on iOS
- Add
- Run React Native iOS App with two ways:-
A. From React native project
1. start the metro with below command in another terminal window
react-native start --reset-cache
Note - Run the single metro at a time
2. Run the ios app with below command`
npx react-native run-ios
B. Directly from Xcode A. you can also run the project from ios folder 1. open the workspace project from ios folder and run the project Note :- No need to start metro it will automatically start the metro
If Getting the below issue 1. “macOS cannot verify that this app is free from malware” - give the permission for metro libraries from securiry and privacy section in mac preferences 2. Herms fremework not found - app crash after launching
add herms.xcframework to xcode setting general tab "Frame Library and embedded content" section
Run below command on command line console on Windows or terminal on MacOS.
```
react-native run-ios
```
If the current path is mounted on the example app level, you can run below command which is set script on
package.json
instead of the previous command
```
npm run ios
```
For install aispay lib
``` npm install asiapay ```
For detailed description kindly follow AsiaPay
Android
> if getting Execution failed for task ':gradle-plugin:compileKotlin'.
What went wrong:
Execution failed for task ':gradle-plugin:compileKotlin'.
> A failure occurred while executing org.jetbrains.kotlin.compilerRunner.GradleCompilerRunnerWithWorkers$GradleKotlinCompilerWorkAction
> Internal compiler error. See log for more details
buildscript {
ext {
kotlinVersion = "1.7.10"
}
dependencies {
classpath "org.jetbrains.kotlin:kotlin-gradle-plugin:$kotlinVersion"
}
}
> if not find PaySDK-2.7.69 then add below code in build.gradle app after buildscript block
allprojects {
repositories {
maven {
// All of React Native (JS, Obj-C sources, Android binaries) is installed from npm
url("$rootDir/../node_modules/react-native/android")
}
maven {
// Android JSC is installed from npm
url("$rootDir/../node_modules/jsc-android/dist")
}
mavenCentral {
// We don't want to fetch react-native from Maven Central as there are
// older versions over there.
content {
excludeGroup "com.facebook.react"
}
}
google()
jcenter()
maven { url 'https://www.jitpack.io' }
flatDir {
dirs "$rootDir/../node_modules/asiapay/android/libs"
//dirs 'libs'
}
}
}
**iOS**