0.1.3 • Published 4 days ago

asiapay v0.1.3

Weekly downloads
-
License
MIT
Repository
github
Last release
4 days ago

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

    1. React Native

    2. 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.

    1. Run below command to mount to path of example app

      cd {project_root_path}
    2. Run below command to install all packages in package.json in root level

      npm install
    3. Run below command to mount to path of example app

      cd {project_root_path}/example
    4. Run below command to install all packages in package.json in example app level

      npm install
    5. Run below command to install rest of packages from yarn platform

      yarn add ../
    6. 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

Run Example App

Before running example app, please make sure example path is mounted.

  1. 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 command

    npm 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 command

    npm 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

    1. Add bundle ID to project setting general tab(if required)
    2. If required add armv7 or armv64 to Pod -> Target -> asiapay -> build setting -> excluded architecture -> any simulator iOS SDK
  • Update RSA Key for PaySDK x

    1. Add paysdk.plist and set value of certificate and "Domain" key value pair. Value for the Domain is optional
    2. For further description kindly follow PaySDK Guide on iOS

  • 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**
0.1.3

4 days ago

0.1.2

1 year ago

0.1.1

1 year ago

0.1.0

1 year ago