5 | @end
6 |
--------------------------------------------------------------------------------
/example/index.js:
--------------------------------------------------------------------------------
1 | /**
2 | * @format
3 | */
4 |
5 | import {AppRegistry} from 'react-native';
6 | import App from './App';
7 | import {name as appName} from './app.json';
8 |
9 | AppRegistry.registerComponent(appName, () => App);
10 |
--------------------------------------------------------------------------------
/ios/RNGosellSdkReactNative.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 |
3 |
5 |
7 |
8 |
9 |
--------------------------------------------------------------------------------
/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | #Tue Nov 16 09:48:21 EET 2021
2 | distributionBase=GRADLE_USER_HOME
3 | distributionPath=wrapper/dists
4 | zipStoreBase=GRADLE_USER_HOME
5 | zipStorePath=wrapper/dists
6 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-bin.zip
7 |
--------------------------------------------------------------------------------
/android/src/main/java/company/tap/goSellSDKExamplee/Constants.java:
--------------------------------------------------------------------------------
1 | package company.tap.goSellSDKExamplee;
2 | public class Constants {
3 | public static int ERROR_CODE_INVALID_CUSTOMER_ID=501;
4 | public static int ERROR_CODE_INVALID_TRX_MODE=502;
5 | public static int ERROR_CODE_BACKEND_UNKNOWN_ERROR=503;
6 | }
--------------------------------------------------------------------------------
/example/ios/example.xcworkspace/contents.xcworkspacedata:
--------------------------------------------------------------------------------
1 |
2 |
4 |
6 |
7 |
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/android/gradle/wrapper/gradle-wrapper.properties:
--------------------------------------------------------------------------------
1 | distributionBase=GRADLE_USER_HOME
2 | distributionPath=wrapper/dists
3 | distributionUrl=https\://services.gradle.org/distributions/gradle-8.10.2-all.zip
4 | networkTimeout=10000
5 | validateDistributionUrl=true
6 | zipStoreBase=GRADLE_USER_HOME
7 | zipStorePath=wrapper/dists
8 |
--------------------------------------------------------------------------------
/example/jest.config.js:
--------------------------------------------------------------------------------
1 | module.exports = {
2 | preset: 'react-native',
3 | transformIgnorePatterns: [
4 | 'node_modules/(?!(react-native|@react-native|@react-native-community|@tap-payments)/)'
5 | ],
6 | transform: {
7 | '^.+\\.(js|jsx|ts|tsx)$': ['babel-jest', { configFile: './babel.config.js' }],
8 | },
9 | };
10 |
--------------------------------------------------------------------------------
/example/android/app/src/main/res/values/styles.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
8 |
9 |
10 |
--------------------------------------------------------------------------------
/example/metro.config.js:
--------------------------------------------------------------------------------
1 | const {getDefaultConfig, mergeConfig} = require('@react-native/metro-config');
2 |
3 | /**
4 | * Metro configuration
5 | * https://reactnative.dev/docs/metro
6 | *
7 | * @type {import('@react-native/metro-config').MetroConfig}
8 | */
9 | const config = {};
10 |
11 | module.exports = mergeConfig(getDefaultConfig(__dirname), config);
12 |
--------------------------------------------------------------------------------
/example/android/settings.gradle:
--------------------------------------------------------------------------------
1 | pluginManagement { includeBuild("../node_modules/@react-native/gradle-plugin") }
2 | plugins { id("com.facebook.react.settings") }
3 | extensions.configure(com.facebook.react.ReactSettingsExtension){ ex -> ex.autolinkLibrariesFromCommand() }
4 | rootProject.name = 'example'
5 | include ':app'
6 | includeBuild('../node_modules/@react-native/gradle-plugin')
7 |
--------------------------------------------------------------------------------
/example/android/app/src/debug/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
4 |
5 |
9 |
10 |
--------------------------------------------------------------------------------
/index.js:
--------------------------------------------------------------------------------
1 |
2 | import { NativeModules, NativeEventEmitter } from 'react-native';
3 | import goSellModels from './models'
4 | const { RNGosellSdkReactNative } = NativeModules;
5 |
6 | const RNGosellEmitter = new NativeEventEmitter(RNGosellSdkReactNative);
7 |
8 | module.exports = { goSellSDK: RNGosellSdkReactNative, goSellSDKModels: { ...goSellModels }, goSellListener: RNGosellEmitter };
9 |
10 |
11 |
--------------------------------------------------------------------------------
/example/Gemfile:
--------------------------------------------------------------------------------
1 | source 'https://rubygems.org'
2 |
3 | # You may use http://rbenv.org/ or https://rvm.io/ to install and use this version
4 | ruby ">= 2.6.10"
5 |
6 | # Exclude problematic versions of cocoapods and activesupport that causes build failures.
7 | gem 'cocoapods', '>= 1.13', '!= 1.15.0', '!= 1.15.1'
8 | gem 'activesupport', '>= 6.1.7.5', '!= 7.1.0'
9 | gem 'xcodeproj', '< 1.26.0'
10 | gem 'concurrent-ruby', '< 1.3.4'
11 |
--------------------------------------------------------------------------------
/android/src/main/java/company/tap/goSellSDKExamplee/SDKCallBack.java:
--------------------------------------------------------------------------------
1 | package company.tap.goSellSDKExamplee;
2 |
3 | import java.util.HashMap;
4 | import java.util.Map;
5 |
6 | /**
7 | * Created by AhlaamK on 10/12/20.
8 | *
9 | * Copyright (c) 2020 Tap Payments.
10 | * All rights reserved.
11 | **/
12 | public interface SDKCallBack {
13 | public void onSuccess(HashMap result);
14 | public void onFailure(Map error);
15 | public void onPaymentInit(HashMap result);
16 | }
--------------------------------------------------------------------------------
/example/ios/.xcode.env:
--------------------------------------------------------------------------------
1 | # This `.xcode.env` file is versioned and is used to source the environment
2 | # used when running script phases inside Xcode.
3 | # To customize your local environment, you can create an `.xcode.env.local`
4 | # file that is not versioned.
5 |
6 | # NODE_BINARY variable contains the PATH to the node executable.
7 | #
8 | # Customize the NODE_BINARY variable here.
9 | # For example, to use nvm with brew, add the following line
10 | # . "$(brew --prefix nvm)/nvm.sh" --no-use
11 | export NODE_BINARY=$(command -v node)
12 |
--------------------------------------------------------------------------------
/example/android/build.gradle:
--------------------------------------------------------------------------------
1 | buildscript {
2 | ext {
3 | buildToolsVersion = "35.0.0"
4 | minSdkVersion = 24
5 | compileSdkVersion = 35
6 | targetSdkVersion = 34
7 | ndkVersion = "27.1.12297006"
8 | kotlinVersion = "2.0.21"
9 | }
10 | repositories {
11 | google()
12 | mavenCentral()
13 | }
14 | dependencies {
15 | classpath("com.android.tools.build:gradle")
16 | classpath("com.facebook.react:react-native-gradle-plugin")
17 | classpath("org.jetbrains.kotlin:kotlin-gradle-plugin")
18 | }
19 | }
20 |
21 | apply plugin: "com.facebook.react.rootproject"
22 |
--------------------------------------------------------------------------------
/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "@tap-payments/gosell-sdk-react-native",
3 | "version": "2.3.70",
4 | "description": "React-Native plugin compatible version of goSellSDK library for both Android and iOS that fully covers payment/authorization/card saving/card tokenization process inside your Android application. Original SDKS",
5 | "main": "index.js",
6 | "author": "Tap Payments",
7 | "scripts": {
8 | "test": "echo \"Error: no test specified\" && exit 1"
9 | },
10 | "keywords": [
11 | "react-native"
12 | ],
13 | "license": "ISC",
14 | "peerDependencies": {
15 | "react-native": ">=0.41.2"
16 | },
17 | "bugs": {
18 | "url": "https://github.com/Tap-Payments/gosellSDK-ReactNative/issues"
19 | }
20 | }
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/example/MainActivity.kt:
--------------------------------------------------------------------------------
1 | package com.example
2 |
3 | import com.facebook.react.ReactActivity
4 | import com.facebook.react.ReactActivityDelegate
5 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.fabricEnabled
6 | import com.facebook.react.defaults.DefaultReactActivityDelegate
7 |
8 | class MainActivity : ReactActivity() {
9 |
10 | /**
11 | * Returns the name of the main component registered from JavaScript. This is used to schedule
12 | * rendering of the component.
13 | */
14 | override fun getMainComponentName(): String = "example"
15 |
16 | /**
17 | * Returns the instance of the [ReactActivityDelegate]. We use [DefaultReactActivityDelegate]
18 | * which allows you to enable New Architecture with a single boolean flags [fabricEnabled]
19 | */
20 | override fun createReactActivityDelegate(): ReactActivityDelegate =
21 | DefaultReactActivityDelegate(this, mainComponentName, fabricEnabled)
22 | }
23 |
--------------------------------------------------------------------------------
/example/components/Header.tsx:
--------------------------------------------------------------------------------
1 | import React, {
2 | ReactElement,
3 | JSXElementConstructor,
4 | ReactNode,
5 | ReactPortal,
6 | } from 'react';
7 | import {StyleSheet, Text, View} from 'react-native';
8 |
9 | const Header = (props: {
10 | title:
11 | | string
12 | | number
13 | | boolean
14 | | ReactElement>
15 | | Iterable
16 | | ReactPortal
17 | | null
18 | | undefined;
19 | }) => {
20 | return (
21 |
22 | {props.title}
23 |
24 | );
25 | };
26 |
27 | const styles = StyleSheet.create({
28 | header: {
29 | backgroundColor: '#000',
30 | height: 60,
31 | alignItems: 'center',
32 | justifyContent: 'center',
33 | },
34 | title: {
35 | color: '#F3F3F3',
36 | fontSize: 28,
37 | fontWeight: '900',
38 | textTransform: 'uppercase',
39 | },
40 | });
41 |
42 | export default Header;
43 |
--------------------------------------------------------------------------------
/android/build.gradle:
--------------------------------------------------------------------------------
1 |
2 | buildscript {
3 | repositories {
4 | google()
5 | mavenCentral()
6 | maven { url 'https://jitpack.io' }
7 | }
8 |
9 | dependencies {
10 | classpath 'com.android.tools.build:gradle:8.6.0'
11 | }
12 | }
13 |
14 | rootProject.allprojects {
15 | repositories {
16 | google()
17 | mavenCentral()
18 | maven { url 'https://jitpack.io' }
19 | }
20 | }
21 |
22 | apply plugin: 'com.android.library'
23 |
24 | android {
25 | compileSdkVersion 35
26 | defaultConfig {
27 | minSdkVersion 21
28 | targetSdkVersion 35
29 | versionCode 1
30 | versionName "1.0"
31 | }
32 | lintOptions {
33 | abortOnError false
34 | }
35 | }
36 |
37 | repositories {
38 | mavenCentral()
39 | }
40 |
41 | dependencies {
42 | implementation 'com.facebook.react:react-native:+'
43 | implementation('com.github.Tap-Payments:goSellSDK-AndroidX:3.19.44')
44 | implementation 'com.google.android.gms:play-services-wallet:19.4.0'
45 | }
46 |
--------------------------------------------------------------------------------
/example/ios/example/AppDelegate.swift:
--------------------------------------------------------------------------------
1 | import UIKit
2 | import React
3 | import React_RCTAppDelegate
4 | import ReactAppDependencyProvider
5 |
6 | @main
7 | class AppDelegate: RCTAppDelegate {
8 | override func application(_ application: UIApplication, didFinishLaunchingWithOptions launchOptions: [UIApplication.LaunchOptionsKey : Any]? = nil) -> Bool {
9 | self.moduleName = "example"
10 | self.dependencyProvider = RCTAppDependencyProvider()
11 |
12 | // You can add your custom initial props in the dictionary below.
13 | // They will be passed down to the ViewController used by React Native.
14 | self.initialProps = [:]
15 |
16 | return super.application(application, didFinishLaunchingWithOptions: launchOptions)
17 | }
18 |
19 | override func sourceURL(for bridge: RCTBridge) -> URL? {
20 | self.bundleURL()
21 | }
22 |
23 | override func bundleURL() -> URL? {
24 | #if DEBUG
25 | RCTBundleURLProvider.sharedSettings().jsBundleURL(forBundleRoot: "index")
26 | #else
27 | Bundle.main.url(forResource: "main", withExtension: "jsbundle")
28 | #endif
29 | }
30 | }
31 |
--------------------------------------------------------------------------------
/android/src/main/java/company/tap/goSellSDKExamplee/RNGosellSdkReactNativePackage.java:
--------------------------------------------------------------------------------
1 |
2 | package company.tap.goSellSDKExamplee;
3 |
4 | import java.util.Arrays;
5 | import java.util.Collections;
6 | import java.util.List;
7 |
8 | import com.facebook.react.ReactPackage;
9 | import com.facebook.react.bridge.NativeModule;
10 | import com.facebook.react.bridge.ReactApplicationContext;
11 | import com.facebook.react.uimanager.ViewManager;
12 | import com.facebook.react.bridge.JavaScriptModule;
13 | public class RNGosellSdkReactNativePackage implements ReactPackage {
14 | @Override
15 | public List createNativeModules(ReactApplicationContext reactContext) {
16 | return Arrays.asList(new RNGosellSdkReactNativeModule(reactContext));
17 | }
18 |
19 | // Deprecated from RN 0.47
20 | public List> createJSModules() {
21 | return Collections.emptyList();
22 | }
23 |
24 | @Override
25 | public List createViewManagers(ReactApplicationContext reactContext) {
26 | return Collections.emptyList();
27 | }
28 | }
--------------------------------------------------------------------------------
/example/android/app/src/main/AndroidManifest.xml:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
13 |
20 |
21 |
22 |
23 |
24 |
25 |
26 |
27 |
--------------------------------------------------------------------------------
/example/ios/example/Images.xcassets/AppIcon.appiconset/Contents.json:
--------------------------------------------------------------------------------
1 | {
2 | "images" : [
3 | {
4 | "idiom" : "iphone",
5 | "scale" : "2x",
6 | "size" : "20x20"
7 | },
8 | {
9 | "idiom" : "iphone",
10 | "scale" : "3x",
11 | "size" : "20x20"
12 | },
13 | {
14 | "idiom" : "iphone",
15 | "scale" : "2x",
16 | "size" : "29x29"
17 | },
18 | {
19 | "idiom" : "iphone",
20 | "scale" : "3x",
21 | "size" : "29x29"
22 | },
23 | {
24 | "idiom" : "iphone",
25 | "scale" : "2x",
26 | "size" : "40x40"
27 | },
28 | {
29 | "idiom" : "iphone",
30 | "scale" : "3x",
31 | "size" : "40x40"
32 | },
33 | {
34 | "idiom" : "iphone",
35 | "scale" : "2x",
36 | "size" : "60x60"
37 | },
38 | {
39 | "idiom" : "iphone",
40 | "scale" : "3x",
41 | "size" : "60x60"
42 | },
43 | {
44 | "idiom" : "ios-marketing",
45 | "scale" : "1x",
46 | "size" : "1024x1024"
47 | }
48 | ],
49 | "info" : {
50 | "author" : "xcode",
51 | "version" : 1
52 | }
53 | }
54 |
--------------------------------------------------------------------------------
/example/ios/example/PrivacyInfo.xcprivacy:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | NSPrivacyAccessedAPITypes
6 |
7 |
8 | NSPrivacyAccessedAPIType
9 | NSPrivacyAccessedAPICategoryFileTimestamp
10 | NSPrivacyAccessedAPITypeReasons
11 |
12 | C617.1
13 |
14 |
15 |
16 | NSPrivacyAccessedAPIType
17 | NSPrivacyAccessedAPICategoryUserDefaults
18 | NSPrivacyAccessedAPITypeReasons
19 |
20 | CA92.1
21 |
22 |
23 |
24 | NSPrivacyAccessedAPIType
25 | NSPrivacyAccessedAPICategorySystemBootTime
26 | NSPrivacyAccessedAPITypeReasons
27 |
28 | 35F9.1
29 |
30 |
31 |
32 | NSPrivacyCollectedDataTypes
33 |
34 | NSPrivacyTracking
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/example/ios/Podfile:
--------------------------------------------------------------------------------
1 | # Resolve react_native_pods.rb with node to allow for hoisting
2 | require Pod::Executable.execute_command('node', ['-p',
3 | 'require.resolve(
4 | "react-native/scripts/react_native_pods.rb",
5 | {paths: [process.argv[1]]},
6 | )', __dir__]).strip
7 |
8 | platform :ios, min_ios_version_supported
9 | prepare_react_native_project!
10 |
11 | linkage = ENV['USE_FRAMEWORKS']
12 | if linkage != nil
13 | Pod::UI.puts "Configuring Pod with #{linkage}ally linked Frameworks".green
14 | use_frameworks! :linkage => linkage.to_sym
15 | end
16 |
17 | target 'example' do
18 | config = use_native_modules!
19 |
20 | use_react_native!(
21 | :path => config[:reactNativePath],
22 | # An absolute path to your application root.
23 | :app_path => "#{Pod::Config.instance.installation_root}/.."
24 | )
25 |
26 | post_install do |installer|
27 | # https://github.com/facebook/react-native/blob/main/packages/react-native/scripts/react_native_pods.rb#L197-L202
28 | react_native_post_install(
29 | installer,
30 | config[:reactNativePath],
31 | :mac_catalyst_enabled => false,
32 | # :ccache_enabled => true
33 | )
34 | end
35 | end
36 |
--------------------------------------------------------------------------------
/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | project.xcworkspace
24 | Podfile.lock
25 | Pods/
26 | # Android/IntelliJ
27 | #
28 | build/
29 | .idea
30 | .gradle
31 | local.properties
32 | *.iml
33 |
34 | # node.js
35 | #
36 | node_modules/
37 | npm-debug.log
38 | yarn-error.log
39 | package-lock.json
40 |
41 | # BUCK
42 | buck-out/
43 | \.buckd/
44 | *.keystore
45 | !debug.keystore
46 |
47 | # fastlane
48 | #
49 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
50 | # screenshots whenever they are needed.
51 | # For more information about the recommended setup visit:
52 | # https://docs.fastlane.tools/best-practices/source-control/
53 |
54 | */fastlane/report.xml
55 | */fastlane/Preview.html
56 | */fastlane/screenshots
57 |
58 | # Bundle artifact
59 | *.jsbundle
60 |
61 | # CocoaPods
62 | /ios/Pods/
63 | /sample/ios/Pods/
64 | /example/ios/Pods/
65 |
--------------------------------------------------------------------------------
/RNGosellSdkReactNative.podspec:
--------------------------------------------------------------------------------
1 | Pod::Spec.new do |s|
2 |
3 | s.name = "RNGosellSdkReactNative"
4 | s.version = "1.0.8"
5 | s.summary = "RNGosellSdkReactNative"
6 | s.description = <<-DESC
7 | RNGosellSdkReactNative
8 | DESC
9 | s.homepage = "https://github.com/Tap-Payments/gosellSDK-ReactNative"
10 | s.license = "MIT"
11 | # s.license = { :type => "MIT", :file => "FILE_LICENSE" }
12 | s.author = { "author" => "author@domain.cn" }
13 | s.platform = :ios, "11.0"
14 | s.source = { :git => "https://github.com/Tap-Payments/gosellSDK-ReactNative.git", :tag => "master" }
15 | # s.source_files = "RNGosellSdkReactNative/*/.{h,m}"
16 | s.source_files = 'ios/Classes/**/*'
17 | s.public_header_files = 'ios/Classes/**/*.h'
18 | s.requires_arc = true
19 | s.dependency 'goSellSDK', '2.3.46'
20 | s.dependency 'React-Core'
21 |
22 | s.pod_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
23 | s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64' }
24 |
25 | # s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES'}
26 | # s.pod_target_xcconfig = { 'DEFINES_MODULE' => 'YES', 'VALID_ARCHS[sdk=iphonesimulator*]' => 'x86_64' }
27 | #s.dependency "others"
28 |
29 | end
--------------------------------------------------------------------------------
/example/package.json:
--------------------------------------------------------------------------------
1 | {
2 | "name": "example",
3 | "version": "0.0.1",
4 | "private": true,
5 | "scripts": {
6 | "android": "react-native run-android",
7 | "ios": "react-native run-ios",
8 | "lint": "eslint .",
9 | "start": "react-native start",
10 | "test": "jest"
11 | },
12 | "dependencies": {
13 | "react": "18.3.1",
14 | "react-native": "0.77.3",
15 | "@tap-payments/gosell-sdk-react-native": "^2.3.69"
16 | },
17 | "devDependencies": {
18 | "@babel/core": "^7.25.2",
19 | "@babel/preset-env": "^7.25.3",
20 | "@babel/runtime": "^7.25.0",
21 | "babel-jest": "^29.6.3",
22 | "@react-native-community/cli": "15.0.1",
23 | "@react-native-community/cli-platform-android": "15.0.1",
24 | "@react-native-community/cli-platform-ios": "15.0.1",
25 | "@react-native/babel-preset": "0.77.3",
26 | "@react-native/eslint-config": "0.77.3",
27 | "@react-native/metro-config": "0.77.3",
28 | "@react-native/typescript-config": "0.77.3",
29 | "@types/jest": "^29.5.13",
30 | "@types/react": "^18.2.6",
31 | "@types/react-test-renderer": "^18.0.0",
32 | "eslint": "^8.19.0",
33 | "jest": "^29.6.3",
34 | "prettier": "2.8.8",
35 | "react-test-renderer": "18.3.1",
36 | "typescript": "5.0.4"
37 | },
38 | "engines": {
39 | "node": ">=18"
40 | }
41 | }
42 |
--------------------------------------------------------------------------------
/models.js:
--------------------------------------------------------------------------------
1 | const Languages = {
2 | EN: 'en',
3 | AR: 'ar',
4 | };
5 |
6 | const PaymentTypes = {
7 | ALL: 'PaymentType.ALL',
8 | CARD: 'PaymentType.CARD',
9 | WEB: 'PaymentType.WEB',
10 | APPLE_PAY: 'PaymentType.APPLE_PAY'
11 | }
12 |
13 |
14 | const AllowedCadTypes = {
15 | CREDIT: 'CREDIT',
16 | DEBIT: 'DEBIT',
17 | ALL: 'ALL'
18 | }
19 |
20 | const UiDisplayModes = {
21 | FOLLOW_DEVICE: 'FOLLOW_DEVICE',
22 | LIGHT: 'LIGHT',
23 | DARK: 'DARK'
24 | }
25 |
26 | const TrxMode = {
27 | PURCHASE: 'TransactionMode.PURCHASE',
28 | AUTHORIZE_CAPTURE: 'TransactionMode.AUTHORIZE_CAPTURE',
29 | SAVE_CARD: 'TransactionMode.SAVE_CARD',
30 | TOKENIZE_CARD: 'TransactionMode.TOKENIZE_CARD'
31 | }
32 |
33 | const SDKMode = {
34 | Sandbox: 'SDKMode.Sandbox',
35 | Production: 'SDKMode.Production'
36 | }
37 |
38 |
39 | const Listener = {
40 | paymentInit: 'paymentInit',
41 | applePayCancelled: 'applePayCancelled',
42 | }
43 |
44 | const SDKAppearanceMode = {
45 | Fullscreen: 1,
46 | Windowed: 0,
47 | }
48 |
49 |
50 | module.exports = {
51 | Languages: Languages,
52 | PaymentTypes: PaymentTypes,
53 | AllowedCadTypes: AllowedCadTypes,
54 | TrxMode: TrxMode,
55 | SDKMode: SDKMode,
56 | UiDisplayModes: UiDisplayModes,
57 | Listener: Listener,
58 | SDKAppearanceMode: SDKAppearanceMode
59 | }
60 |
--------------------------------------------------------------------------------
/example/.gitignore:
--------------------------------------------------------------------------------
1 | # OSX
2 | #
3 | .DS_Store
4 |
5 | # Xcode
6 | #
7 | build/
8 | *.pbxuser
9 | !default.pbxuser
10 | *.mode1v3
11 | !default.mode1v3
12 | *.mode2v3
13 | !default.mode2v3
14 | *.perspectivev3
15 | !default.perspectivev3
16 | xcuserdata
17 | *.xccheckout
18 | *.moved-aside
19 | DerivedData
20 | *.hmap
21 | *.ipa
22 | *.xcuserstate
23 | **/.xcode.env.local
24 |
25 | # Android/IntelliJ
26 | #
27 | build/
28 | .idea
29 | .gradle
30 | local.properties
31 | *.iml
32 | *.hprof
33 | .cxx/
34 | *.keystore
35 | !debug.keystore
36 |
37 | # node.js
38 | #
39 | node_modules/
40 | npm-debug.log
41 | yarn-error.log
42 |
43 | # fastlane
44 | #
45 | # It is recommended to not store the screenshots in the git repo. Instead, use fastlane to re-generate the
46 | # screenshots whenever they are needed.
47 | # For more information about the recommended setup visit:
48 | # https://docs.fastlane.tools/best-practices/source-control/
49 |
50 | **/fastlane/report.xml
51 | **/fastlane/Preview.html
52 | **/fastlane/screenshots
53 | **/fastlane/test_output
54 |
55 | # Bundle artifact
56 | *.jsbundle
57 |
58 | # Ruby / CocoaPods
59 | **/Pods/
60 | /vendor/bundle/
61 |
62 | # Temporary files created by Metro to check the health of the file watcher
63 | .metro-health-check*
64 |
65 | # testing
66 | /coverage
67 |
68 | # Yarn
69 | .yarn/*
70 | !.yarn/patches
71 | !.yarn/plugins
72 | !.yarn/releases
73 | !.yarn/sdks
74 | !.yarn/versions
75 |
--------------------------------------------------------------------------------
/example/ios/example/Info.plist:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 | CFBundleDevelopmentRegion
6 | en
7 | CFBundleDisplayName
8 | example
9 | CFBundleExecutable
10 | $(EXECUTABLE_NAME)
11 | CFBundleIdentifier
12 | $(PRODUCT_BUNDLE_IDENTIFIER)
13 | CFBundleInfoDictionaryVersion
14 | 6.0
15 | CFBundleName
16 | $(PRODUCT_NAME)
17 | CFBundlePackageType
18 | APPL
19 | CFBundleShortVersionString
20 | $(MARKETING_VERSION)
21 | CFBundleSignature
22 | ????
23 | CFBundleVersion
24 | $(CURRENT_PROJECT_VERSION)
25 | LSRequiresIPhoneOS
26 |
27 | NSAppTransportSecurity
28 |
29 |
30 | NSAllowsArbitraryLoads
31 |
32 | NSAllowsLocalNetworking
33 |
34 |
35 | NSLocationWhenInUseUsageDescription
36 |
37 | UILaunchStoryboardName
38 | LaunchScreen
39 | UIRequiredDeviceCapabilities
40 |
41 | arm64
42 |
43 | UISupportedInterfaceOrientations
44 |
45 | UIInterfaceOrientationPortrait
46 | UIInterfaceOrientationLandscapeLeft
47 | UIInterfaceOrientationLandscapeRight
48 |
49 | UIViewControllerBasedStatusBarAppearance
50 |
51 |
52 |
53 |
--------------------------------------------------------------------------------
/example/android/app/src/main/java/com/example/MainApplication.kt:
--------------------------------------------------------------------------------
1 | package com.example
2 |
3 | import android.app.Application
4 | import com.facebook.react.PackageList
5 | import com.facebook.react.ReactApplication
6 | import com.facebook.react.ReactHost
7 | import com.facebook.react.ReactNativeHost
8 | import com.facebook.react.ReactPackage
9 | import com.facebook.react.defaults.DefaultNewArchitectureEntryPoint.load
10 | import com.facebook.react.defaults.DefaultReactHost.getDefaultReactHost
11 | import com.facebook.react.defaults.DefaultReactNativeHost
12 | import com.facebook.react.soloader.OpenSourceMergedSoMapping
13 | import com.facebook.soloader.SoLoader
14 |
15 | class MainApplication : Application(), ReactApplication {
16 |
17 | override val reactNativeHost: ReactNativeHost =
18 | object : DefaultReactNativeHost(this) {
19 | override fun getPackages(): List =
20 | PackageList(this).packages.apply {
21 | // Packages that cannot be autolinked yet can be added manually here, for example:
22 | // add(MyReactNativePackage())
23 | }
24 |
25 | override fun getJSMainModuleName(): String = "index"
26 |
27 | override fun getUseDeveloperSupport(): Boolean = BuildConfig.DEBUG
28 |
29 | override val isNewArchEnabled: Boolean = BuildConfig.IS_NEW_ARCHITECTURE_ENABLED
30 | override val isHermesEnabled: Boolean = BuildConfig.IS_HERMES_ENABLED
31 | }
32 |
33 | override val reactHost: ReactHost
34 | get() = getDefaultReactHost(applicationContext, reactNativeHost)
35 |
36 | override fun onCreate() {
37 | super.onCreate()
38 | SoLoader.init(this, OpenSourceMergedSoMapping)
39 | if (BuildConfig.IS_NEW_ARCHITECTURE_ENABLED) {
40 | // If you opted-in for the New Architecture, we load the native entry point for this app.
41 | load()
42 | }
43 | }
44 | }
45 |
--------------------------------------------------------------------------------
/example/android/gradle.properties:
--------------------------------------------------------------------------------
1 | # Project-wide Gradle settings.
2 |
3 | # IDE (e.g. Android Studio) users:
4 | # Gradle settings configured through the IDE *will override*
5 | # any settings specified in this file.
6 |
7 | # For more details on how to configure your build environment visit
8 | # http://www.gradle.org/docs/current/userguide/build_environment.html
9 |
10 | # Specifies the JVM arguments used for the daemon process.
11 | # The setting is particularly useful for tweaking memory settings.
12 | # Default value: -Xmx512m -XX:MaxMetaspaceSize=256m
13 | org.gradle.jvmargs=-Xmx2048m -XX:MaxMetaspaceSize=512m
14 |
15 | # When configured, Gradle will run in incubating parallel mode.
16 | # This option should only be used with decoupled projects. More details, visit
17 | # http://www.gradle.org/docs/current/userguide/multi_project_builds.html#sec:decoupled_projects
18 | # org.gradle.parallel=true
19 |
20 | # AndroidX package structure to make it clearer which packages are bundled with the
21 | # Android operating system, and which are packaged with your app's APK
22 | # https://developer.android.com/topic/libraries/support-library/androidx-rn
23 | android.useAndroidX=true
24 |
25 | # Use this property to specify which architecture you want to build.
26 | # You can also override it from the CLI using
27 | # ./gradlew -PreactNativeArchitectures=x86_64
28 | reactNativeArchitectures=armeabi-v7a,arm64-v8a,x86,x86_64
29 |
30 | # Use this property to enable support to the new architecture.
31 | # This will allow you to use TurboModules and the Fabric render in
32 | # your application. You should enable this flag either if you want
33 | # to write custom TurboModules/Fabric components OR use libraries that
34 | # are providing them.
35 | newArchEnabled=true
36 |
37 | # Use this property to enable or disable the Hermes JS engine.
38 | # If set to false, you will be using JSC instead.
39 | hermesEnabled=true
40 |
--------------------------------------------------------------------------------
/example/android/app/proguard-rules.pro:
--------------------------------------------------------------------------------
1 | # Add project specific ProGuard rules here.
2 | # You can control the set of applied configuration files using the
3 | # proguardFiles setting in build.gradle.
4 |
5 | # Retrofit
6 | -keepattributes Signature
7 | -keepattributes Exceptions
8 | -keepattributes *Annotation*
9 | -keepattributes RuntimeVisibleAnnotations
10 | -keepattributes RuntimeInvisibleAnnotations
11 | -keepattributes RuntimeVisibleParameterAnnotations
12 | -keepattributes RuntimeInvisibleParameterAnnotations
13 | -keepattributes EnclosingMethod
14 |
15 | -keepclasseswithmembers class * {
16 | @retrofit2.http.* ;
17 | }
18 |
19 | -keepclassmembernames interface * {
20 | @retrofit2.http.* ;
21 | }
22 |
23 | # Retrofit generic types
24 | -keepattributes Signature
25 | -keep class retrofit2.** { *; }
26 | -keepclasseswithmembers class * {
27 | @retrofit2.* ;
28 | }
29 |
30 | # OkHttp
31 | -dontwarn okhttp3.**
32 | -dontwarn okio.**
33 | -keep class okhttp3.** { *; }
34 | -keep interface okhttp3.** { *; }
35 |
36 | # Gson
37 | -keepattributes Signature
38 | -keepattributes *Annotation*
39 | -dontwarn sun.misc.**
40 | -keep class com.google.gson.** { *; }
41 | -keep class * implements com.google.gson.TypeAdapterFactory
42 | -keep class * implements com.google.gson.JsonSerializer
43 | -keep class * implements com.google.gson.JsonDeserializer
44 |
45 | # goSell SDK - Keep all API interfaces and models
46 | -keep class company.tap.gosellapi.** { *; }
47 | -keep interface company.tap.gosellapi.** { *; }
48 | -keep class company.tap.goSellSDKExamplee.** { *; }
49 |
50 | # Keep API Service interfaces
51 | -keep interface * {
52 | @retrofit2.http.* ;
53 | }
54 |
55 | # Keep generic signature of Call, Response (R8 full mode strips signatures from non-kept items).
56 | -keep,allowobfuscation,allowshrinking interface retrofit2.Call
57 | -keep,allowobfuscation,allowshrinking class retrofit2.Response
58 |
59 | # With R8 full mode generic signatures are stripped for classes that are not kept.
60 | -keep,allowobfuscation,allowshrinking class kotlin.coroutines.Continuation
--------------------------------------------------------------------------------
/example/android/app/src/main/res/drawable/rn_edit_text_material.xml:
--------------------------------------------------------------------------------
1 |
2 |
16 |
22 |
23 |
24 |
33 |
34 |
35 |
36 |
37 |
38 |
--------------------------------------------------------------------------------
/ios/Classes/RNGosellSdkReactNative.m:
--------------------------------------------------------------------------------
1 | #if __has_include()
2 | // For cocoapods framework, the generated swift header will be inside ExpoModulesCore module
3 | #import
4 | #else
5 | #import "RNGosellSdkReactNative-Swift.h"
6 | #endif
7 | #import "RNGosellSdkReactNative.h"
8 | #import
9 |
10 | @class Bridge;
11 | @implementation RNGosellSdkReactNative {
12 | Bridge* bridge;
13 | bool hasListeners;
14 | }
15 | - (instancetype)init {
16 | self = [super init];
17 | if (self) {
18 | bridge = [[Bridge alloc] init];
19 | }
20 | return self;
21 | }
22 |
23 | // Will be called when this module's first listener is added.
24 | -(void)startObserving {
25 | hasListeners = YES;
26 | // Set up any upstream listeners or background tasks as necessary
27 | }
28 |
29 | // Will be called when this module's last listener is removed, or on dealloc.
30 | -(void)stopObserving {
31 | hasListeners = NO;
32 | // Remove upstream listeners, stop unnecessary background tasks
33 | }
34 |
35 | - (dispatch_queue_t)methodQueue
36 | {
37 | return dispatch_get_main_queue();
38 | }
39 |
40 | - (NSArray *)supportedEvents {
41 | return @[@"paymentInit", @"applePayCancelled"];
42 | }
43 |
44 | + (BOOL)requiresMainQueueSetup
45 | {
46 | return YES;
47 | }
48 |
49 |
50 |
51 | RCT_EXPORT_MODULE();
52 | RCT_EXPORT_METHOD(kareem:(RCTResponseSenderBlock)callback){
53 | callback(@[@"kareem info"]);
54 | }
55 | RCT_EXPORT_METHOD(startPayment:(NSDictionary *)arguments timeout:(int)timeout callback:(RCTResponseSenderBlock)callback){
56 | [bridge startPayment:arguments timeout:timeout callback:callback paymentInitCallback: ^(NSDictionary* value) {
57 | if (self->hasListeners) { // Only send events if anyone is listening
58 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
59 | [self sendEventWithName:@"paymentInit" body:value];
60 | });
61 | }
62 | } applePayCancelledCallback: ^(NSDictionary* value) {
63 | if (self->hasListeners) { // Only send events if anyone is listening
64 | dispatch_async(dispatch_get_global_queue(DISPATCH_QUEUE_PRIORITY_DEFAULT, 0), ^{
65 | [self sendEventWithName:@"applePayCancelled" body:value];
66 | });
67 | }
68 | }
69 | ];
70 | }
71 | @end
72 |
--------------------------------------------------------------------------------
/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @if "%DEBUG%" == "" @echo off
2 | @rem ##########################################################################
3 | @rem
4 | @rem Gradle startup script for Windows
5 | @rem
6 | @rem ##########################################################################
7 |
8 | @rem Set local scope for the variables with windows NT shell
9 | if "%OS%"=="Windows_NT" setlocal
10 |
11 | set DIRNAME=%~dp0
12 | if "%DIRNAME%" == "" set DIRNAME=.
13 | set APP_BASE_NAME=%~n0
14 | set APP_HOME=%DIRNAME%
15 |
16 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
17 | set DEFAULT_JVM_OPTS=
18 |
19 | @rem Find java.exe
20 | if defined JAVA_HOME goto findJavaFromJavaHome
21 |
22 | set JAVA_EXE=java.exe
23 | %JAVA_EXE% -version >NUL 2>&1
24 | if "%ERRORLEVEL%" == "0" goto init
25 |
26 | echo.
27 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
28 | echo.
29 | echo Please set the JAVA_HOME variable in your environment to match the
30 | echo location of your Java installation.
31 |
32 | goto fail
33 |
34 | :findJavaFromJavaHome
35 | set JAVA_HOME=%JAVA_HOME:"=%
36 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
37 |
38 | if exist "%JAVA_EXE%" goto init
39 |
40 | echo.
41 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
42 | echo.
43 | echo Please set the JAVA_HOME variable in your environment to match the
44 | echo location of your Java installation.
45 |
46 | goto fail
47 |
48 | :init
49 | @rem Get command-line arguments, handling Windows variants
50 |
51 | if not "%OS%" == "Windows_NT" goto win9xME_args
52 |
53 | :win9xME_args
54 | @rem Slurp the command line arguments.
55 | set CMD_LINE_ARGS=
56 | set _SKIP=2
57 |
58 | :win9xME_args_slurp
59 | if "x%~1" == "x" goto execute
60 |
61 | set CMD_LINE_ARGS=%*
62 |
63 | :execute
64 | @rem Setup the command line
65 |
66 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
67 |
68 | @rem Execute Gradle
69 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %CMD_LINE_ARGS%
70 |
71 | :end
72 | @rem End local scope for the variables with windows NT shell
73 | if "%ERRORLEVEL%"=="0" goto mainEnd
74 |
75 | :fail
76 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
77 | rem the _cmd.exe /c_ return code!
78 | if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
79 | exit /b 1
80 |
81 | :mainEnd
82 | if "%OS%"=="Windows_NT" endlocal
83 |
84 | :omega
85 |
--------------------------------------------------------------------------------
/example/android/gradlew.bat:
--------------------------------------------------------------------------------
1 | @rem
2 | @rem Copyright 2015 the original author or authors.
3 | @rem
4 | @rem Licensed under the Apache License, Version 2.0 (the "License");
5 | @rem you may not use this file except in compliance with the License.
6 | @rem You may obtain a copy of the License at
7 | @rem
8 | @rem https://www.apache.org/licenses/LICENSE-2.0
9 | @rem
10 | @rem Unless required by applicable law or agreed to in writing, software
11 | @rem distributed under the License is distributed on an "AS IS" BASIS,
12 | @rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13 | @rem See the License for the specific language governing permissions and
14 | @rem limitations under the License.
15 | @rem
16 | @rem SPDX-License-Identifier: Apache-2.0
17 | @rem
18 |
19 | @if "%DEBUG%"=="" @echo off
20 | @rem ##########################################################################
21 | @rem
22 | @rem Gradle startup script for Windows
23 | @rem
24 | @rem ##########################################################################
25 |
26 | @rem Set local scope for the variables with windows NT shell
27 | if "%OS%"=="Windows_NT" setlocal
28 |
29 | set DIRNAME=%~dp0
30 | if "%DIRNAME%"=="" set DIRNAME=.
31 | @rem This is normally unused
32 | set APP_BASE_NAME=%~n0
33 | set APP_HOME=%DIRNAME%
34 |
35 | @rem Resolve any "." and ".." in APP_HOME to make it shorter.
36 | for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
37 |
38 | @rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
39 | set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
40 |
41 | @rem Find java.exe
42 | if defined JAVA_HOME goto findJavaFromJavaHome
43 |
44 | set JAVA_EXE=java.exe
45 | %JAVA_EXE% -version >NUL 2>&1
46 | if %ERRORLEVEL% equ 0 goto execute
47 |
48 | echo. 1>&2
49 | echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH. 1>&2
50 | echo. 1>&2
51 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
52 | echo location of your Java installation. 1>&2
53 |
54 | goto fail
55 |
56 | :findJavaFromJavaHome
57 | set JAVA_HOME=%JAVA_HOME:"=%
58 | set JAVA_EXE=%JAVA_HOME%/bin/java.exe
59 |
60 | if exist "%JAVA_EXE%" goto execute
61 |
62 | echo. 1>&2
63 | echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME% 1>&2
64 | echo. 1>&2
65 | echo Please set the JAVA_HOME variable in your environment to match the 1>&2
66 | echo location of your Java installation. 1>&2
67 |
68 | goto fail
69 |
70 | :execute
71 | @rem Setup the command line
72 |
73 | set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
74 |
75 |
76 | @rem Execute Gradle
77 | "%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
78 |
79 | :end
80 | @rem End local scope for the variables with windows NT shell
81 | if %ERRORLEVEL% equ 0 goto mainEnd
82 |
83 | :fail
84 | rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
85 | rem the _cmd.exe /c_ return code!
86 | set EXIT_CODE=%ERRORLEVEL%
87 | if %EXIT_CODE% equ 0 set EXIT_CODE=1
88 | if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
89 | exit /b %EXIT_CODE%
90 |
91 | :mainEnd
92 | if "%OS%"=="Windows_NT" endlocal
93 |
94 | :omega
95 |
--------------------------------------------------------------------------------
/example/ios/example.xcodeproj/xcshareddata/xcschemes/example.xcscheme:
--------------------------------------------------------------------------------
1 |
2 |
5 |
8 |
9 |
15 |
21 |
22 |
23 |
24 |
25 |
30 |
31 |
33 |
39 |
40 |
41 |
42 |
43 |
53 |
55 |
61 |
62 |
63 |
64 |
70 |
72 |
78 |
79 |
80 |
81 |
83 |
84 |
87 |
88 |
89 |
--------------------------------------------------------------------------------
/example/README.md:
--------------------------------------------------------------------------------
1 | This is a new [**React Native**](https://reactnative.dev) project, bootstrapped using [`@react-native-community/cli`](https://github.com/react-native-community/cli).
2 |
3 | # Getting Started
4 |
5 | > **Note**: Make sure you have completed the [Set Up Your Environment](https://reactnative.dev/docs/set-up-your-environment) guide before proceeding.
6 |
7 | ## Step 1: Start Metro
8 |
9 | First, you will need to run **Metro**, the JavaScript build tool for React Native.
10 |
11 | To start the Metro dev server, run the following command from the root of your React Native project:
12 |
13 | ```sh
14 | # Using npm
15 | npm start
16 |
17 | # OR using Yarn
18 | yarn start
19 | ```
20 |
21 | ## Step 2: Build and run your app
22 |
23 | With Metro running, open a new terminal window/pane from the root of your React Native project, and use one of the following commands to build and run your Android or iOS app:
24 |
25 | ### Android
26 |
27 | ```sh
28 | # Using npm
29 | npm run android
30 |
31 | # OR using Yarn
32 | yarn android
33 | ```
34 |
35 | ### iOS
36 |
37 | For iOS, remember to install CocoaPods dependencies (this only needs to be run on first clone or after updating native deps).
38 |
39 | The first time you create a new project, run the Ruby bundler to install CocoaPods itself:
40 |
41 | ```sh
42 | bundle install
43 | ```
44 |
45 | Then, and every time you update your native dependencies, run:
46 |
47 | ```sh
48 | bundle exec pod install
49 | ```
50 |
51 | For more information, please visit [CocoaPods Getting Started guide](https://guides.cocoapods.org/using/getting-started.html).
52 |
53 | ```sh
54 | # Using npm
55 | npm run ios
56 |
57 | # OR using Yarn
58 | yarn ios
59 | ```
60 |
61 | If everything is set up correctly, you should see your new app running in the Android Emulator, iOS Simulator, or your connected device.
62 |
63 | This is one way to run your app — you can also build it directly from Android Studio or Xcode.
64 |
65 | ## Step 3: Modify your app
66 |
67 | Now that you have successfully run the app, let's make changes!
68 |
69 | Open `App.tsx` in your text editor of choice and make some changes. When you save, your app will automatically update and reflect these changes — this is powered by [Fast Refresh](https://reactnative.dev/docs/fast-refresh).
70 |
71 | When you want to forcefully reload, for example to reset the state of your app, you can perform a full reload:
72 |
73 | - **Android**: Press the R key twice or select **"Reload"** from the **Dev Menu**, accessed via Ctrl + M (Windows/Linux) or Cmd ⌘ + M (macOS).
74 | - **iOS**: Press R in iOS Simulator.
75 |
76 | ## Congratulations! :tada:
77 |
78 | You've successfully run and modified your React Native App. :partying_face:
79 |
80 | ### Now what?
81 |
82 | - If you want to add this new React Native code to an existing application, check out the [Integration guide](https://reactnative.dev/docs/integration-with-existing-apps).
83 | - If you're curious to learn more about React Native, check out the [docs](https://reactnative.dev/docs/getting-started).
84 |
85 | # Troubleshooting
86 |
87 | If you're having issues getting the above steps to work, see the [Troubleshooting](https://reactnative.dev/docs/troubleshooting) page.
88 |
89 | # Learn More
90 |
91 | To learn more about React Native, take a look at the following resources:
92 |
93 | - [React Native Website](https://reactnative.dev) - learn more about React Native.
94 | - [Getting Started](https://reactnative.dev/docs/environment-setup) - an **overview** of React Native and how setup your environment.
95 | - [Learn the Basics](https://reactnative.dev/docs/getting-started) - a **guided tour** of the React Native **basics**.
96 | - [Blog](https://reactnative.dev/blog) - read the latest official React Native **Blog** posts.
97 | - [`@facebook/react-native`](https://github.com/facebook/react-native) - the Open Source; GitHub **repository** for React Native.
98 |
--------------------------------------------------------------------------------
/example/sdkConfigurations.js:
--------------------------------------------------------------------------------
1 | import RNGoSell from '@tap-payments/gosell-sdk-react-native';
2 | const {
3 | Languages,
4 | PaymentTypes,
5 | AllowedCadTypes,
6 | TrxMode,
7 | SDKMode,
8 | UiDisplayModes,
9 | } = RNGoSell.goSellSDKModels;
10 |
11 | const transactionCurrency = 'kwd';
12 | const shipping = [
13 | {
14 | name: 'shipping 1',
15 | description: 'shiping description 1',
16 | amount: 100.0,
17 | },
18 | ];
19 |
20 | const paymentitems = [
21 | {
22 | amount_per_unit: 1,
23 | description: 'Item 1 Apple',
24 | discount: {
25 | type: 'F',
26 | value: 10,
27 | maximum_fee: 10,
28 | minimum_fee: 1,
29 | },
30 | name: 'item1',
31 | quantity: {
32 | value: 1,
33 | },
34 | taxes: [
35 | {
36 | name: 'tax1',
37 | description: 'tax describtion',
38 | amount: {
39 | type: 'F',
40 | value: 10,
41 | maximum_fee: 10,
42 | minimum_fee: 1,
43 | },
44 | },
45 | ],
46 | total_amount: 100,
47 | },
48 | ];
49 |
50 | const taxes = [
51 | {
52 | name: 'tax1',
53 | description: 'tax describtion',
54 | amount: { type: 'F', value: 10.0, maximum_fee: 10.0, minimum_fee: 1.0 },
55 | },
56 | {
57 | name: 'tax1',
58 | description: 'tax describtion',
59 | amount: { type: 'F', value: 10.0, maximum_fee: 10.0, minimum_fee: 1.0 },
60 | },
61 | ];
62 | const customer = {
63 | // Here we can set the customer object as on of the available options on this URL:
64 | // See [https://github.com/Tap-Payments/gosellSDK-ReactNative#customer] to get more details of setting the customer
65 | isdNumber: '965',
66 | number: '00000000',
67 | customerId: '',
68 | first_name: 'test',
69 | middle_name: 'test',
70 | last_name: 'test',
71 | email: 'test@test.com',
72 | };
73 | const paymentReference = {
74 | track: 'track',
75 | payment: 'payment',
76 | gateway: 'gateway',
77 | acquirer: 'acquirer',
78 | transaction: 'trans_910101',
79 | order: 'order_262625',
80 | gosellID: null,
81 | };
82 |
83 |
84 | const appCredentials = {
85 | production_secrete_key: (Platform.OS == 'ios') ? 'iOS-Live-KEY' : 'Android-Live-KEY',
86 | language: Languages.EN,
87 | sandbox_secrete_key: (Platform.OS == 'ios') ? 'iOS-SANDBOX-KEY' : 'Android-SANDBOX-KEY',
88 | bundleID: (Platform.OS == 'ios') ? 'iOS-PACKAGE-NAME' : 'ANDROIID-PACKAGE-NAME',
89 | }
90 |
91 | const allConfigurations = {
92 | appCredentials: appCredentials,
93 | sessionParameters: {
94 | paymentStatementDescriptor: 'paymentStatementDescriptor',
95 | transactionCurrency: 'kwd',
96 | isUserAllowedToSaveCard: true,
97 | paymentType: PaymentTypes.ALL,
98 | amount: '100',
99 | shipping: shipping,
100 | allowedCadTypes: AllowedCadTypes.ALL,
101 | paymentitems: paymentitems,
102 | paymenMetaData: { a: 'a meta', b: 'b meta' },
103 | applePayMerchantID: 'merchant.applePayMerchantID',
104 | authorizeAction: { timeInHours: 10, time: 10, type: 'CAPTURE' },
105 | cardHolderName: 'Card Holder NAME',
106 | editCardHolderName: false,
107 | postURL: 'https://tap.company',
108 | paymentDescription: 'paymentDescription',
109 | destinations: 'null',
110 | // Here we can set the transaction mode as on of the available options on this URL:
111 | // See [https://github.com/Tap-Payments/gosellSDK-ReactNative#transaction_modes] to get transaction modes
112 | trxMode: TrxMode.PURCHASE,
113 | taxes: taxes,
114 | merchantID: '',
115 | SDKMode: SDKMode.Sandbox,
116 | customer: customer,
117 | isRequires3DSecure: false,
118 | receiptSettings: { id: null, email: false, sms: true },
119 | allowsToSaveSameCardMoreThanOnce: false,
120 | paymentReference: paymentReference,
121 | uiDisplayMode: UiDisplayModes.LIGHT,
122 | },
123 | };
124 |
125 | export default allConfigurations
--------------------------------------------------------------------------------
/example/ios/example/LaunchScreen.storyboard:
--------------------------------------------------------------------------------
1 |
2 |
3 |
4 |
5 |
6 |
7 |
8 |
9 |
10 |
11 |
12 |
13 |
14 |
15 |
16 |
17 |
18 |
19 |
24 |
29 |
30 |
31 |
32 |
33 |
34 |
35 |
36 |
37 |
38 |
39 |
40 |
41 |
42 |
43 |
44 |
45 |
46 |
47 |
48 |
--------------------------------------------------------------------------------
/android/src/main/java/company/tap/goSellSDKExamplee/RNGosellSdkReactNativeModule.java:
--------------------------------------------------------------------------------
1 |
2 | package company.tap.goSellSDKExamplee;
3 |
4 | import android.app.Activity;
5 | import android.app.Application;
6 | import android.os.Build;
7 |
8 | import androidx.annotation.RequiresApi;
9 |
10 | import com.facebook.react.bridge.Arguments;
11 | import com.facebook.react.bridge.ReactApplicationContext;
12 | import com.facebook.react.bridge.ReactContextBaseJavaModule;
13 | import com.facebook.react.bridge.ReactMethod;
14 | import com.facebook.react.bridge.Callback;
15 | import com.facebook.react.bridge.ReadableMap;
16 | import com.facebook.react.bridge.WritableMap;
17 | import com.facebook.react.bridge.WritableNativeMap;
18 | import com.facebook.react.modules.core.DeviceEventManagerModule;
19 |
20 | import java.util.HashMap;
21 | import java.util.Map;
22 |
23 | public class RNGosellSdkReactNativeModule extends ReactContextBaseJavaModule implements SDKCallBack {
24 |
25 | private Callback jsCallback;
26 | private GoSellSdKDelegate delegate;
27 | private Application application;
28 | private final ReactApplicationContext reactContext;
29 | private Activity _activity;
30 |
31 |
32 |
33 | public RNGosellSdkReactNativeModule(ReactApplicationContext reactContext) {
34 | super(reactContext);
35 | this.reactContext = reactContext;
36 | this.application = (Application) reactContext.getApplicationContext();
37 | this._activity = reactContext.getCurrentActivity();
38 | System.out.println("_activity = " + _activity);
39 | setup(application, _activity);
40 |
41 | }
42 |
43 | @Override
44 | public String getName() {
45 | return "RNGosellSdkReactNative";
46 | }
47 |
48 | @Override
49 | public void onPaymentInit(HashMap result) {
50 | System.out.println(result);
51 | WritableMap writableMap = new WritableNativeMap();
52 | for (Map.Entry entry : result.entrySet()) {
53 | writableMap.putString(entry.getKey(), (String) entry.getValue());
54 | }
55 | this.reactContext
56 | .getJSModule(DeviceEventManagerModule.RCTDeviceEventEmitter.class)
57 | .emit("paymentInit", writableMap);
58 | }
59 |
60 |
61 |
62 | @Override
63 | public void onSuccess(HashMap result) {
64 | System.out.println(" on success callback : "+ result);
65 | WritableMap writableMap = new WritableNativeMap();
66 | for (Map.Entry entry : result.entrySet()) {
67 | if(entry.getValue() instanceof String) {
68 | writableMap.putString(entry.getKey(), (String) entry.getValue());
69 | } else if (entry.getValue() instanceof HashMap) {
70 | writableMap.putMap(entry.getKey(), DeserializationUtil.convertHashMapToWritableMap((HashMap) entry.getValue()));
71 | } else {
72 | writableMap.putString(entry.getKey(), (String) entry.getValue());
73 | }
74 | }
75 | System.out.println(" on success callback : "+ writableMap);
76 | jsCallback.invoke(null, writableMap);
77 | }
78 |
79 | @Override
80 | public void onFailure(Map resultMap) {
81 | System.out.println(" on failure callback : "+resultMap);
82 | WritableMap writableMap = new WritableNativeMap();
83 | for (Map.Entry entry : resultMap.entrySet()) {
84 | writableMap.putString(entry.getKey(), entry.getValue());
85 | }
86 | System.out.println(" on failure writableMap : "+writableMap);
87 | jsCallback.invoke(null,writableMap);
88 | }
89 |
90 | /**
91 | * setup
92 | */
93 |
94 | private void setup(
95 | final Application application,
96 | final Activity activity) {
97 | this.application = application;
98 | this.delegate = constructDelegate(activity);
99 | }
100 |
101 |
102 | /**
103 | * construct delegate
104 | */
105 |
106 | private final GoSellSdKDelegate constructDelegate(final Activity setupActivity) {
107 | System.out.println("setupActivity = " + setupActivity + "delegate>>>" + delegate);
108 | return new GoSellSdKDelegate(setupActivity);
109 | }
110 |
111 |
112 |
113 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
114 | @ReactMethod
115 | public void startPayment(ReadableMap readableMap, int timeout, Callback callback) {
116 | jsCallback = callback;
117 | HashMap args = readableMap.toHashMap();
118 | System.out.println("args : " + args);
119 | System.out.println("readableMap : " + readableMap);
120 | System.out.println("callback..... started" + delegate);
121 | Activity currentActivity = getCurrentActivity();
122 | if (currentActivity == null) {
123 | jsCallback.invoke("no_activity", "SDK plugin requires a foreground activity.", null);
124 | return;
125 | }
126 |
127 | System.out.println("call back invoked " + jsCallback);
128 | delegate.startSDK(args, this , currentActivity, timeout);
129 |
130 | }
131 |
132 | }
--------------------------------------------------------------------------------
/example/android/app/build.gradle:
--------------------------------------------------------------------------------
1 | apply plugin: "com.android.application"
2 | apply plugin: "org.jetbrains.kotlin.android"
3 | apply plugin: "com.facebook.react"
4 |
5 | /**
6 | * This is the configuration block to customize your React Native Android app.
7 | * By default you don't need to apply any configuration, just uncomment the lines you need.
8 | */
9 | react {
10 | /* Folders */
11 | // The root of your project, i.e. where "package.json" lives. Default is '../..'
12 | // root = file("../../")
13 | // The folder where the react-native NPM package is. Default is ../../node_modules/react-native
14 | // reactNativeDir = file("../../node_modules/react-native")
15 | // The folder where the react-native Codegen package is. Default is ../../node_modules/@react-native/codegen
16 | // codegenDir = file("../../node_modules/@react-native/codegen")
17 | // The cli.js file which is the React Native CLI entrypoint. Default is ../../node_modules/react-native/cli.js
18 | // cliFile = file("../../node_modules/react-native/cli.js")
19 |
20 | /* Variants */
21 | // The list of variants to that are debuggable. For those we're going to
22 | // skip the bundling of the JS bundle and the assets. By default is just 'debug'.
23 | // If you add flavors like lite, prod, etc. you'll have to list your debuggableVariants.
24 | // debuggableVariants = ["liteDebug", "prodDebug"]
25 |
26 | /* Bundling */
27 | // A list containing the node command and its flags. Default is just 'node'.
28 | // nodeExecutableAndArgs = ["node"]
29 | //
30 | // The command to run when bundling. By default is 'bundle'
31 | // bundleCommand = "ram-bundle"
32 | //
33 | // The path to the CLI configuration file. Default is empty.
34 | // bundleConfig = file(../rn-cli.config.js)
35 | //
36 | // The name of the generated asset file containing your JS bundle
37 | // bundleAssetName = "MyApplication.android.bundle"
38 | //
39 | // The entry file for bundle generation. Default is 'index.android.js' or 'index.js'
40 | // entryFile = file("../js/MyApplication.android.js")
41 | //
42 | // A list of extra flags to pass to the 'bundle' commands.
43 | // See https://github.com/react-native-community/cli/blob/main/docs/commands.md#bundle
44 | // extraPackagerArgs = []
45 |
46 | /* Hermes Commands */
47 | // The hermes compiler command to run. By default it is 'hermesc'
48 | // hermesCommand = "$rootDir/my-custom-hermesc/bin/hermesc"
49 | //
50 | // The list of flags to pass to the Hermes compiler. By default is "-O", "-output-source-map"
51 | // hermesFlags = ["-O", "-output-source-map"]
52 |
53 | /* Autolinking */
54 | autolinkLibrariesWithApp()
55 | }
56 |
57 | /**
58 | * Set this to true to Run Proguard on Release builds to minify the Java bytecode.
59 | */
60 | def enableProguardInReleaseBuilds = false
61 |
62 | /**
63 | * The preferred build flavor of JavaScriptCore (JSC)
64 | *
65 | * For example, to use the international variant, you can use:
66 | * `def jscFlavor = 'org.webkit:android-jsc-intl:+'`
67 | *
68 | * The international variant includes ICU i18n library and necessary data
69 | * allowing to use e.g. `Date.toLocaleString` and `String.localeCompare` that
70 | * give correct results when using with locales other than en-US. Note that
71 | * this variant is about 6MiB larger per architecture than default.
72 | */
73 | def jscFlavor = 'org.webkit:android-jsc:+'
74 |
75 | android {
76 | ndkVersion rootProject.ext.ndkVersion
77 | buildToolsVersion rootProject.ext.buildToolsVersion
78 | compileSdk rootProject.ext.compileSdkVersion
79 |
80 | namespace "com.example"
81 | defaultConfig {
82 | applicationId "com.example"
83 | minSdkVersion rootProject.ext.minSdkVersion
84 | targetSdkVersion rootProject.ext.targetSdkVersion
85 | versionCode 1
86 | versionName "1.0"
87 | }
88 | signingConfigs {
89 | debug {
90 | storeFile file('debug.keystore')
91 | storePassword 'android'
92 | keyAlias 'androiddebugkey'
93 | keyPassword 'android'
94 | }
95 | }
96 | buildTypes {
97 | debug {
98 | signingConfig signingConfigs.debug
99 | }
100 | release {
101 | // Caution! In production, you need to generate your own keystore file.
102 | // see https://reactnative.dev/docs/signed-apk-android.
103 | signingConfig signingConfigs.debug
104 | minifyEnabled enableProguardInReleaseBuilds
105 | proguardFiles getDefaultProguardFile("proguard-android.txt"), "proguard-rules.pro"
106 | }
107 | }
108 | }
109 |
110 | dependencies {
111 | // The version of react-native is set by the React Native Gradle Plugin
112 | implementation("com.facebook.react:react-android")
113 |
114 | if (hermesEnabled.toBoolean()) {
115 | implementation("com.facebook.react:hermes-android")
116 | } else {
117 | implementation jscFlavor
118 | }
119 | }
120 |
--------------------------------------------------------------------------------
/example/types/gosell-sdk-react-native.d.ts:
--------------------------------------------------------------------------------
1 | declare module '@tap-payments/gosell-sdk-react-native' {
2 | import {NativeEventEmitter, EmitterSubscription} from 'react-native';
3 |
4 | // Models and Enums
5 | export interface Languages {
6 | EN: 'en';
7 | AR: 'ar';
8 | }
9 |
10 | export interface PaymentTypes {
11 | ALL: 'PaymentType.ALL';
12 | CARD: 'PaymentType.CARD';
13 | WEB: 'PaymentType.WEB';
14 | APPLE_PAY: 'PaymentType.APPLE_PAY';
15 | }
16 |
17 | export interface AllowedCadTypes {
18 | CREDIT: 'CREDIT';
19 | DEBIT: 'DEBIT';
20 | ALL: 'ALL';
21 | }
22 |
23 | export interface UiDisplayModes {
24 | FOLLOW_DEVICE: 'FOLLOW_DEVICE';
25 | LIGHT: 'LIGHT';
26 | DARK: 'DARK';
27 | }
28 |
29 | export interface TrxMode {
30 | PURCHASE: 'TransactionMode.PURCHASE';
31 | AUTHORIZE_CAPTURE: 'TransactionMode.AUTHORIZE_CAPTURE';
32 | SAVE_CARD: 'TransactionMode.SAVE_CARD';
33 | TOKENIZE_CARD: 'TransactionMode.TOKENIZE_CARD';
34 | }
35 |
36 | export interface SDKMode {
37 | Sandbox: 'SDKMode.Sandbox';
38 | Production: 'SDKMode.Production';
39 | }
40 |
41 | export interface Listener {
42 | paymentInit: 'paymentInit';
43 | applePayCancelled: 'applePayCancelled';
44 | }
45 |
46 | export interface SDKAppearanceMode {
47 | Fullscreen: 1;
48 | Windowed: 0;
49 | }
50 |
51 | // Configuration Types
52 | export interface Customer {
53 | isdNumber?: string;
54 | number?: string;
55 | customerId?: string;
56 | first_name?: string;
57 | middle_name?: string;
58 | last_name?: string;
59 | email?: string;
60 | }
61 |
62 | export interface PaymentReference {
63 | track?: string;
64 | payment?: string;
65 | gateway?: string;
66 | acquirer?: string;
67 | transaction?: string;
68 | order?: string;
69 | gosellID?: string | null;
70 | }
71 |
72 | export interface AppCredentials {
73 | production_secrete_key: string;
74 | language: string;
75 | sandbox_secrete_key: string;
76 | bundleID: string;
77 | }
78 |
79 | export interface Shipping {
80 | name: string;
81 | description: string;
82 | amount: number;
83 | }
84 |
85 | export interface Discount {
86 | type: string;
87 | value: number;
88 | maximum_fee: number;
89 | minimum_fee: number;
90 | }
91 |
92 | export interface Quantity {
93 | value: number;
94 | }
95 |
96 | export interface Tax {
97 | name: string;
98 | description: string;
99 | amount: {
100 | type: string;
101 | value: number;
102 | maximum_fee: number;
103 | minimum_fee: number;
104 | };
105 | }
106 |
107 | export interface PaymentItem {
108 | amount_per_unit: number;
109 | description: string;
110 | discount?: Discount;
111 | name: string;
112 | quantity: Quantity;
113 | taxes?: Tax[];
114 | total_amount: number;
115 | }
116 |
117 | export interface AuthorizeAction {
118 | timeInHours: number;
119 | time: number;
120 | type: string;
121 | }
122 |
123 | export interface ReceiptSettings {
124 | id: string | null;
125 | email: boolean;
126 | sms: boolean;
127 | }
128 |
129 | export interface SessionParameters {
130 | paymentStatementDescriptor?: string;
131 | transactionCurrency: string;
132 | isUserAllowedToSaveCard?: boolean;
133 | paymentType: string;
134 | amount: string;
135 | shipping?: Shipping[];
136 | allowedCadTypes?: string;
137 | paymentitems?: PaymentItem[];
138 | paymenMetaData?: Record;
139 | applePayMerchantID?: string;
140 | authorizeAction?: AuthorizeAction;
141 | cardHolderName?: string;
142 | editCardHolderName?: boolean;
143 | postURL?: string;
144 | paymentDescription?: string;
145 | destinations?: string | null;
146 | trxMode: string;
147 | taxes?: Tax[];
148 | merchantID?: string;
149 | SDKMode: string;
150 | customer?: Customer;
151 | isRequires3DSecure?: boolean;
152 | receiptSettings?: ReceiptSettings;
153 | allowsToSaveSameCardMoreThanOnce?: boolean;
154 | paymentReference?: PaymentReference;
155 | uiDisplayMode?: string;
156 | }
157 |
158 | export interface SDKConfiguration {
159 | appCredentials: AppCredentials;
160 | sessionParameters: SessionParameters;
161 | }
162 |
163 | // Result Types
164 | export interface SDKResult {
165 | trx_mode: 'CHARGE' | 'AUTHORIZE' | 'SAVE_CARD' | 'TOKENIZE';
166 | sdk_result: 'SUCCESS' | 'FAILED' | 'SDK_ERROR' | 'NOT_IMPLEMENTED';
167 | sdk_error_code?: string;
168 | sdk_error_message?: string;
169 | sdk_error_description?: string;
170 | token?: string;
171 | [key: string]: any;
172 | }
173 |
174 | export type ResultCallback = (error: any, status: SDKResult) => void;
175 |
176 | // SDK Interface
177 | export interface GoSellSDK {
178 | startPayment(
179 | configuration: SDKConfiguration,
180 | timeoutInMilliseconds: number,
181 | callback: ResultCallback,
182 | ): void;
183 | }
184 |
185 | // Models Interface
186 | export interface GoSellSDKModels {
187 | Languages: Languages;
188 | PaymentTypes: PaymentTypes;
189 | AllowedCadTypes: AllowedCadTypes;
190 | TrxMode: TrxMode;
191 | SDKMode: SDKMode;
192 | UiDisplayModes: UiDisplayModes;
193 | Listener: Listener;
194 | SDKAppearanceMode: SDKAppearanceMode;
195 | }
196 |
197 | // Listener Interface
198 | export interface GoSellListener extends NativeEventEmitter {
199 | addListener(eventName: string, callback: (data: any) => void): EmitterSubscription;
200 | }
201 |
202 | // Main Module Interface
203 | export interface RNGoSell {
204 | goSellSDK: GoSellSDK;
205 | goSellSDKModels: GoSellSDKModels;
206 | goSellListener: GoSellListener;
207 | }
208 |
209 | const RNGoSell: RNGoSell;
210 | export default RNGoSell;
211 | }
212 |
--------------------------------------------------------------------------------
/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/usr/bin/env sh
2 |
3 | ##############################################################################
4 | ##
5 | ## Gradle start up script for UN*X
6 | ##
7 | ##############################################################################
8 |
9 | # Attempt to set APP_HOME
10 | # Resolve links: $0 may be a link
11 | PRG="$0"
12 | # Need this for relative symlinks.
13 | while [ -h "$PRG" ] ; do
14 | ls=`ls -ld "$PRG"`
15 | link=`expr "$ls" : '.*-> \(.*\)$'`
16 | if expr "$link" : '/.*' > /dev/null; then
17 | PRG="$link"
18 | else
19 | PRG=`dirname "$PRG"`"/$link"
20 | fi
21 | done
22 | SAVED="`pwd`"
23 | cd "`dirname \"$PRG\"`/" >/dev/null
24 | APP_HOME="`pwd -P`"
25 | cd "$SAVED" >/dev/null
26 |
27 | APP_NAME="Gradle"
28 | APP_BASE_NAME=`basename "$0"`
29 |
30 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
31 | DEFAULT_JVM_OPTS=""
32 |
33 | # Use the maximum available, or set MAX_FD != -1 to use that value.
34 | MAX_FD="maximum"
35 |
36 | warn () {
37 | echo "$*"
38 | }
39 |
40 | die () {
41 | echo
42 | echo "$*"
43 | echo
44 | exit 1
45 | }
46 |
47 | # OS specific support (must be 'true' or 'false').
48 | cygwin=false
49 | msys=false
50 | darwin=false
51 | nonstop=false
52 | case "`uname`" in
53 | CYGWIN* )
54 | cygwin=true
55 | ;;
56 | Darwin* )
57 | darwin=true
58 | ;;
59 | MINGW* )
60 | msys=true
61 | ;;
62 | NONSTOP* )
63 | nonstop=true
64 | ;;
65 | esac
66 |
67 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
68 |
69 | # Determine the Java command to use to start the JVM.
70 | if [ -n "$JAVA_HOME" ] ; then
71 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
72 | # IBM's JDK on AIX uses strange locations for the executables
73 | JAVACMD="$JAVA_HOME/jre/sh/java"
74 | else
75 | JAVACMD="$JAVA_HOME/bin/java"
76 | fi
77 | if [ ! -x "$JAVACMD" ] ; then
78 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
79 |
80 | Please set the JAVA_HOME variable in your environment to match the
81 | location of your Java installation."
82 | fi
83 | else
84 | JAVACMD="java"
85 | which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
86 |
87 | Please set the JAVA_HOME variable in your environment to match the
88 | location of your Java installation."
89 | fi
90 |
91 | # Increase the maximum file descriptors if we can.
92 | if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
93 | MAX_FD_LIMIT=`ulimit -H -n`
94 | if [ $? -eq 0 ] ; then
95 | if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
96 | MAX_FD="$MAX_FD_LIMIT"
97 | fi
98 | ulimit -n $MAX_FD
99 | if [ $? -ne 0 ] ; then
100 | warn "Could not set maximum file descriptor limit: $MAX_FD"
101 | fi
102 | else
103 | warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
104 | fi
105 | fi
106 |
107 | # For Darwin, add options to specify how the application appears in the dock
108 | if $darwin; then
109 | GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
110 | fi
111 |
112 | # For Cygwin, switch paths to Windows format before running java
113 | if $cygwin ; then
114 | APP_HOME=`cygpath --path --mixed "$APP_HOME"`
115 | CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
116 | JAVACMD=`cygpath --unix "$JAVACMD"`
117 |
118 | # We build the pattern for arguments to be converted via cygpath
119 | ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
120 | SEP=""
121 | for dir in $ROOTDIRSRAW ; do
122 | ROOTDIRS="$ROOTDIRS$SEP$dir"
123 | SEP="|"
124 | done
125 | OURCYGPATTERN="(^($ROOTDIRS))"
126 | # Add a user-defined pattern to the cygpath arguments
127 | if [ "$GRADLE_CYGPATTERN" != "" ] ; then
128 | OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
129 | fi
130 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
131 | i=0
132 | for arg in "$@" ; do
133 | CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
134 | CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
135 |
136 | if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
137 | eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
138 | else
139 | eval `echo args$i`="\"$arg\""
140 | fi
141 | i=$((i+1))
142 | done
143 | case $i in
144 | (0) set -- ;;
145 | (1) set -- "$args0" ;;
146 | (2) set -- "$args0" "$args1" ;;
147 | (3) set -- "$args0" "$args1" "$args2" ;;
148 | (4) set -- "$args0" "$args1" "$args2" "$args3" ;;
149 | (5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
150 | (6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
151 | (7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
152 | (8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
153 | (9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
154 | esac
155 | fi
156 |
157 | # Escape application args
158 | save () {
159 | for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
160 | echo " "
161 | }
162 | APP_ARGS=$(save "$@")
163 |
164 | # Collect all arguments for the java command, following the shell quoting and substitution rules
165 | eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
166 |
167 | # by default we should be in the correct project dir, but when run from Finder on Mac, the cwd is wrong
168 | if [ "$(uname)" = "Darwin" ] && [ "$HOME" = "$PWD" ]; then
169 | cd "$(dirname "$0")"
170 | fi
171 |
172 | exec "$JAVACMD" "$@"
173 |
--------------------------------------------------------------------------------
/example/App.tsx:
--------------------------------------------------------------------------------
1 | /**
2 | * Sample React Native App
3 | * https://github.com/facebook/react-native
4 | *
5 | * @format
6 | * @flow strict-local
7 | */
8 |
9 | import React, {useState, useEffect, useRef, useCallback} from 'react';
10 | import {
11 | StyleSheet,
12 | Text,
13 | View,
14 | Button,
15 | Platform,
16 | StatusBar,
17 | SafeAreaView,
18 | TouchableOpacity,
19 | EmitterSubscription,
20 | } from 'react-native';
21 | import Header from './components/Header';
22 | import RNGoSell, {
23 | GoSellSDK,
24 | GoSellSDKModels,
25 | SDKResult,
26 | } from '@tap-payments/gosell-sdk-react-native';
27 | import sdkConfigurations from './sdkConfigurations';
28 |
29 | const App = () => {
30 | const [statusNow, setStatusNow] = useState('not started');
31 | const [result, setResult] = useState('');
32 |
33 | const sdkModuleRef = useRef(null);
34 | const sdkModelsRef = useRef(null);
35 | const subscriptionRef = useRef(null);
36 |
37 | const printSDKResult = useCallback((result: SDKResult) => {
38 | if (!result) return;
39 | Object.keys(result).map(key => {
40 | console.log(`${result['trx_mode']}\t${key}:\t\t\t${result[key]}`);
41 | });
42 | }, []);
43 |
44 | const handleSDKResult = useCallback(
45 | (result: SDKResult) => {
46 | console.log('trx_mode::::');
47 | console.log(result['trx_mode']);
48 | switch (result['trx_mode']) {
49 | case 'CHARGE':
50 | console.log('Charge');
51 | console.log(result);
52 | printSDKResult(result);
53 | break;
54 |
55 | case 'AUTHORIZE':
56 | printSDKResult(result);
57 | break;
58 |
59 | case 'SAVE_CARD':
60 | printSDKResult(result);
61 | break;
62 |
63 | case 'TOKENIZE':
64 | Object.keys(result).map(key => {
65 | console.log(
66 | `TOKENIZE \t${key}:\t\t\t${JSON.stringify(result[key])}`,
67 | );
68 | });
69 | // responseID = tapSDKResult['token'];
70 | break;
71 | }
72 | },
73 | [printSDKResult],
74 | );
75 |
76 | const changeState = useCallback(
77 | (
78 | newName: React.SetStateAction,
79 | resultValue: React.SetStateAction,
80 | callback: () => void,
81 | ) => {
82 | console.log('the new value is' + newName);
83 | setStatusNow(newName);
84 | setResult(resultValue);
85 | if (callback) callback();
86 | },
87 | [],
88 | );
89 |
90 | const handleResult = useCallback(
91 | (error: any, status: SDKResult) => {
92 | var myString = JSON.stringify(status, null, 2);
93 | console.log('status is ' + status.sdk_result);
94 | console.log(myString);
95 | var resultStr = String(status.sdk_result);
96 | switch (resultStr) {
97 | case 'SUCCESS':
98 | handleSDKResult(status);
99 | break;
100 | case 'FAILED':
101 | handleSDKResult(status);
102 | break;
103 | case 'SDK_ERROR':
104 | console.log('sdk error............');
105 | console.log(status['sdk_error_code']);
106 | console.log(status['sdk_error_message']);
107 | console.log(status['sdk_error_description']);
108 | console.log('sdk error............');
109 | break;
110 | case 'NOT_IMPLEMENTED':
111 | break;
112 | }
113 | changeState(resultStr, myString, () => {
114 | console.log('done');
115 | });
116 | },
117 | [handleSDKResult, changeState],
118 | );
119 |
120 | const startSDK = useCallback(() => {
121 | console.log('start SDK');
122 | console.log(sdkModuleRef.current);
123 |
124 | // startPayment(sdkConfigurations, terminationTimeoutInMilliseconds, handleResult)
125 | // Set terminationTimeoutInMilliseconds to 0 to prevent termination the session automatically
126 | sdkModuleRef.current &&
127 | sdkModuleRef.current.startPayment(sdkConfigurations, 0, handleResult);
128 | }, [handleResult]);
129 |
130 | useEffect(() => {
131 | // Initialize SDK modules
132 | if (!sdkModuleRef.current && RNGoSell && RNGoSell.goSellSDK) {
133 | sdkModuleRef.current = RNGoSell.goSellSDK;
134 | }
135 | if (!sdkModelsRef.current && RNGoSell && RNGoSell.goSellSDKModels) {
136 | sdkModelsRef.current = RNGoSell.goSellSDKModels;
137 | }
138 |
139 | // Set up listener
140 | if (RNGoSell && RNGoSell.goSellListener && RNGoSell.goSellSDKModels) {
141 | subscriptionRef.current = RNGoSell.goSellListener.addListener(
142 | RNGoSell.goSellSDKModels.Listener.paymentInit,
143 | (charge: any) => {
144 | console.log(charge);
145 | },
146 | );
147 | }
148 |
149 | // Cleanup function
150 | return () => {
151 | if (subscriptionRef.current) {
152 | subscriptionRef.current.remove();
153 | }
154 | };
155 | }, []);
156 |
157 | const statusbar =
158 | Platform.OS == 'ios' ? (
159 |
160 | ) : (
161 |
162 | );
163 |
164 | return (
165 |
166 |
167 | {statusbar}
168 |
169 | Status: {statusNow}
170 | {result}
171 |
172 | {Platform.OS == 'ios' ? (
173 |
174 |
175 | Start Payment
176 |
177 |
178 | ) : (
179 |
184 | )}
185 |
186 |
187 |
188 | );
189 | };
190 |
191 | export default App;
192 | const styles = StyleSheet.create({
193 | safeAreaView: {
194 | flex: 1,
195 | backgroundColor: '#000',
196 | },
197 | container: {
198 | flex: 1,
199 | backgroundColor: '#F5FCFF',
200 | },
201 | statusbar: {
202 | height: 20,
203 | },
204 | payButtonBg: {
205 | alignItems: 'center',
206 | color: '#25cf1f',
207 | backgroundColor: '#25cf1f',
208 | paddingVertical: 12,
209 | paddingHorizontal: 25,
210 | borderRadius: 25,
211 | position: 'absolute',
212 | bottom: 0,
213 | width: '90%',
214 | marginLeft: '6%',
215 | marginRight: '10%',
216 | },
217 | payButtonText: {
218 | color: '#FFF',
219 | fontSize: 20,
220 | },
221 | bottom: {
222 | flex: 1,
223 | justifyContent: 'flex-end',
224 | marginBottom: 36,
225 | },
226 | statusText: {
227 | textAlign: 'center',
228 | fontWeight: 'bold',
229 | fontSize: 25,
230 | },
231 | resultText: {
232 | textAlign: 'center',
233 | fontSize: 15,
234 | width: '90%',
235 | marginLeft: '6%',
236 | marginRight: '10%',
237 | },
238 | });
239 |
--------------------------------------------------------------------------------
/example/android/gradlew:
--------------------------------------------------------------------------------
1 | #!/bin/sh
2 |
3 | #
4 | # Copyright © 2015-2021 the original authors.
5 | #
6 | # Licensed under the Apache License, Version 2.0 (the "License");
7 | # you may not use this file except in compliance with the License.
8 | # You may obtain a copy of the License at
9 | #
10 | # https://www.apache.org/licenses/LICENSE-2.0
11 | #
12 | # Unless required by applicable law or agreed to in writing, software
13 | # distributed under the License is distributed on an "AS IS" BASIS,
14 | # WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15 | # See the License for the specific language governing permissions and
16 | # limitations under the License.
17 | #
18 | # SPDX-License-Identifier: Apache-2.0
19 | #
20 |
21 | ##############################################################################
22 | #
23 | # Gradle start up script for POSIX generated by Gradle.
24 | #
25 | # Important for running:
26 | #
27 | # (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
28 | # noncompliant, but you have some other compliant shell such as ksh or
29 | # bash, then to run this script, type that shell name before the whole
30 | # command line, like:
31 | #
32 | # ksh Gradle
33 | #
34 | # Busybox and similar reduced shells will NOT work, because this script
35 | # requires all of these POSIX shell features:
36 | # * functions;
37 | # * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
38 | # «${var#prefix}», «${var%suffix}», and «$( cmd )»;
39 | # * compound commands having a testable exit status, especially «case»;
40 | # * various built-in commands including «command», «set», and «ulimit».
41 | #
42 | # Important for patching:
43 | #
44 | # (2) This script targets any POSIX shell, so it avoids extensions provided
45 | # by Bash, Ksh, etc; in particular arrays are avoided.
46 | #
47 | # The "traditional" practice of packing multiple parameters into a
48 | # space-separated string is a well documented source of bugs and security
49 | # problems, so this is (mostly) avoided, by progressively accumulating
50 | # options in "$@", and eventually passing that to Java.
51 | #
52 | # Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
53 | # and GRADLE_OPTS) rely on word-splitting, this is performed explicitly;
54 | # see the in-line comments for details.
55 | #
56 | # There are tweaks for specific operating systems such as AIX, CygWin,
57 | # Darwin, MinGW, and NonStop.
58 | #
59 | # (3) This script is generated from the Groovy template
60 | # https://github.com/gradle/gradle/blob/HEAD/platforms/jvm/plugins-application/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
61 | # within the Gradle project.
62 | #
63 | # You can find Gradle at https://github.com/gradle/gradle/.
64 | #
65 | ##############################################################################
66 |
67 | # Attempt to set APP_HOME
68 |
69 | # Resolve links: $0 may be a link
70 | app_path=$0
71 |
72 | # Need this for daisy-chained symlinks.
73 | while
74 | APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
75 | [ -h "$app_path" ]
76 | do
77 | ls=$( ls -ld "$app_path" )
78 | link=${ls#*' -> '}
79 | case $link in #(
80 | /*) app_path=$link ;; #(
81 | *) app_path=$APP_HOME$link ;;
82 | esac
83 | done
84 |
85 | # This is normally unused
86 | # shellcheck disable=SC2034
87 | APP_BASE_NAME=${0##*/}
88 | # Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
89 | APP_HOME=$( cd -P "${APP_HOME:-./}" > /dev/null && printf '%s
90 | ' "$PWD" ) || exit
91 |
92 | # Use the maximum available, or set MAX_FD != -1 to use that value.
93 | MAX_FD=maximum
94 |
95 | warn () {
96 | echo "$*"
97 | } >&2
98 |
99 | die () {
100 | echo
101 | echo "$*"
102 | echo
103 | exit 1
104 | } >&2
105 |
106 | # OS specific support (must be 'true' or 'false').
107 | cygwin=false
108 | msys=false
109 | darwin=false
110 | nonstop=false
111 | case "$( uname )" in #(
112 | CYGWIN* ) cygwin=true ;; #(
113 | Darwin* ) darwin=true ;; #(
114 | MSYS* | MINGW* ) msys=true ;; #(
115 | NONSTOP* ) nonstop=true ;;
116 | esac
117 |
118 | CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
119 |
120 |
121 | # Determine the Java command to use to start the JVM.
122 | if [ -n "$JAVA_HOME" ] ; then
123 | if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
124 | # IBM's JDK on AIX uses strange locations for the executables
125 | JAVACMD=$JAVA_HOME/jre/sh/java
126 | else
127 | JAVACMD=$JAVA_HOME/bin/java
128 | fi
129 | if [ ! -x "$JAVACMD" ] ; then
130 | die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
131 |
132 | Please set the JAVA_HOME variable in your environment to match the
133 | location of your Java installation."
134 | fi
135 | else
136 | JAVACMD=java
137 | if ! command -v java >/dev/null 2>&1
138 | then
139 | die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
140 |
141 | Please set the JAVA_HOME variable in your environment to match the
142 | location of your Java installation."
143 | fi
144 | fi
145 |
146 | # Increase the maximum file descriptors if we can.
147 | if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
148 | case $MAX_FD in #(
149 | max*)
150 | # In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
151 | # shellcheck disable=SC2039,SC3045
152 | MAX_FD=$( ulimit -H -n ) ||
153 | warn "Could not query maximum file descriptor limit"
154 | esac
155 | case $MAX_FD in #(
156 | '' | soft) :;; #(
157 | *)
158 | # In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
159 | # shellcheck disable=SC2039,SC3045
160 | ulimit -n "$MAX_FD" ||
161 | warn "Could not set maximum file descriptor limit to $MAX_FD"
162 | esac
163 | fi
164 |
165 | # Collect all arguments for the java command, stacking in reverse order:
166 | # * args from the command line
167 | # * the main class name
168 | # * -classpath
169 | # * -D...appname settings
170 | # * --module-path (only if needed)
171 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, and GRADLE_OPTS environment variables.
172 |
173 | # For Cygwin or MSYS, switch paths to Windows format before running java
174 | if "$cygwin" || "$msys" ; then
175 | APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
176 | CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
177 |
178 | JAVACMD=$( cygpath --unix "$JAVACMD" )
179 |
180 | # Now convert the arguments - kludge to limit ourselves to /bin/sh
181 | for arg do
182 | if
183 | case $arg in #(
184 | -*) false ;; # don't mess with options #(
185 | /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
186 | [ -e "$t" ] ;; #(
187 | *) false ;;
188 | esac
189 | then
190 | arg=$( cygpath --path --ignore --mixed "$arg" )
191 | fi
192 | # Roll the args list around exactly as many times as the number of
193 | # args, so each arg winds up back in the position where it started, but
194 | # possibly modified.
195 | #
196 | # NB: a `for` loop captures its iteration list before it begins, so
197 | # changing the positional parameters here affects neither the number of
198 | # iterations, nor the values presented in `arg`.
199 | shift # remove old arg
200 | set -- "$@" "$arg" # push replacement arg
201 | done
202 | fi
203 |
204 |
205 | # Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
206 | DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
207 |
208 | # Collect all arguments for the java command:
209 | # * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
210 | # and any embedded shellness will be escaped.
211 | # * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
212 | # treated as '${Hostname}' itself on the command line.
213 |
214 | set -- \
215 | "-Dorg.gradle.appname=$APP_BASE_NAME" \
216 | -classpath "$CLASSPATH" \
217 | org.gradle.wrapper.GradleWrapperMain \
218 | "$@"
219 |
220 | # Stop when "xargs" is not available.
221 | if ! command -v xargs >/dev/null 2>&1
222 | then
223 | die "xargs is not available"
224 | fi
225 |
226 | # Use "xargs" to parse quoted args.
227 | #
228 | # With -n1 it outputs one arg per line, with the quotes and backslashes removed.
229 | #
230 | # In Bash we could simply go:
231 | #
232 | # readarray ARGS < <( xargs -n1 <<<"$var" ) &&
233 | # set -- "${ARGS[@]}" "$@"
234 | #
235 | # but POSIX shell has neither arrays nor command substitution, so instead we
236 | # post-process each arg (as a line of input to sed) to backslash-escape any
237 | # character that might be a shell metacharacter, then use eval to reverse
238 | # that process (while maintaining the separation between arguments), and wrap
239 | # the whole thing up as a single "set" statement.
240 | #
241 | # This will of course break if any of these variables contains a newline or
242 | # an unmatched quote.
243 | #
244 |
245 | eval "set -- $(
246 | printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS" |
247 | xargs -n1 |
248 | sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
249 | tr '\n' ' '
250 | )" '"$@"'
251 |
252 | exec "$JAVACMD" "$@"
253 |
--------------------------------------------------------------------------------
/ios/RNGosellSdkReactNative.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 46;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 6208603C25347A9800096497 /* RNGosellSdkReactNative.swift in Sources */ = {isa = PBXBuildFile; fileRef = 6208603B25347A9800096497 /* RNGosellSdkReactNative.swift */; };
11 | B3E7B58A1CC2AC0600A0062D /* RNGosellSdkReactNative.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* RNGosellSdkReactNative.m */; };
12 | /* End PBXBuildFile section */
13 |
14 | /* Begin PBXCopyFilesBuildPhase section */
15 | 58B511D91A9E6C8500147676 /* CopyFiles */ = {
16 | isa = PBXCopyFilesBuildPhase;
17 | buildActionMask = 2147483647;
18 | dstPath = "include/$(PRODUCT_NAME)";
19 | dstSubfolderSpec = 16;
20 | files = (
21 | );
22 | runOnlyForDeploymentPostprocessing = 0;
23 | };
24 | /* End PBXCopyFilesBuildPhase section */
25 |
26 | /* Begin PBXFileReference section */
27 | 134814201AA4EA6300B7C361 /* libRNGosellSdkReactNative.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libRNGosellSdkReactNative.a; sourceTree = BUILT_PRODUCTS_DIR; };
28 | 6208603A25347A9800096497 /* RNGosellSdkReactNative-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "RNGosellSdkReactNative-Bridging-Header.h"; sourceTree = ""; };
29 | 6208603B25347A9800096497 /* RNGosellSdkReactNative.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = RNGosellSdkReactNative.swift; sourceTree = ""; };
30 | B3E7B5881CC2AC0600A0062D /* RNGosellSdkReactNative.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = RNGosellSdkReactNative.h; sourceTree = ""; };
31 | B3E7B5891CC2AC0600A0062D /* RNGosellSdkReactNative.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = RNGosellSdkReactNative.m; sourceTree = ""; };
32 | /* End PBXFileReference section */
33 |
34 | /* Begin PBXFrameworksBuildPhase section */
35 | 58B511D81A9E6C8500147676 /* Frameworks */ = {
36 | isa = PBXFrameworksBuildPhase;
37 | buildActionMask = 2147483647;
38 | files = (
39 | );
40 | runOnlyForDeploymentPostprocessing = 0;
41 | };
42 | /* End PBXFrameworksBuildPhase section */
43 |
44 | /* Begin PBXGroup section */
45 | 134814211AA4EA7D00B7C361 /* Products */ = {
46 | isa = PBXGroup;
47 | children = (
48 | 134814201AA4EA6300B7C361 /* libRNGosellSdkReactNative.a */,
49 | );
50 | name = Products;
51 | sourceTree = "";
52 | };
53 | 58B511D21A9E6C8500147676 = {
54 | isa = PBXGroup;
55 | children = (
56 | B3E7B5881CC2AC0600A0062D /* RNGosellSdkReactNative.h */,
57 | B3E7B5891CC2AC0600A0062D /* RNGosellSdkReactNative.m */,
58 | 6208603B25347A9800096497 /* RNGosellSdkReactNative.swift */,
59 | 134814211AA4EA7D00B7C361 /* Products */,
60 | 6208603A25347A9800096497 /* RNGosellSdkReactNative-Bridging-Header.h */,
61 | );
62 | sourceTree = "";
63 | };
64 | /* End PBXGroup section */
65 |
66 | /* Begin PBXNativeTarget section */
67 | 58B511DA1A9E6C8500147676 /* RNGosellSdkReactNative */ = {
68 | isa = PBXNativeTarget;
69 | buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNGosellSdkReactNative" */;
70 | buildPhases = (
71 | 58B511D71A9E6C8500147676 /* Sources */,
72 | 58B511D81A9E6C8500147676 /* Frameworks */,
73 | 58B511D91A9E6C8500147676 /* CopyFiles */,
74 | );
75 | buildRules = (
76 | );
77 | dependencies = (
78 | );
79 | name = RNGosellSdkReactNative;
80 | productName = RCTDataManager;
81 | productReference = 134814201AA4EA6300B7C361 /* libRNGosellSdkReactNative.a */;
82 | productType = "com.apple.product-type.library.static";
83 | };
84 | /* End PBXNativeTarget section */
85 |
86 | /* Begin PBXProject section */
87 | 58B511D31A9E6C8500147676 /* Project object */ = {
88 | isa = PBXProject;
89 | attributes = {
90 | LastUpgradeCheck = 0830;
91 | ORGANIZATIONNAME = Facebook;
92 | TargetAttributes = {
93 | 58B511DA1A9E6C8500147676 = {
94 | CreatedOnToolsVersion = 6.1.1;
95 | LastSwiftMigration = 1200;
96 | };
97 | };
98 | };
99 | buildConfigurationList = 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNGosellSdkReactNative" */;
100 | compatibilityVersion = "Xcode 3.2";
101 | developmentRegion = English;
102 | hasScannedForEncodings = 0;
103 | knownRegions = (
104 | English,
105 | en,
106 | );
107 | mainGroup = 58B511D21A9E6C8500147676;
108 | productRefGroup = 58B511D21A9E6C8500147676;
109 | projectDirPath = "";
110 | projectRoot = "";
111 | targets = (
112 | 58B511DA1A9E6C8500147676 /* RNGosellSdkReactNative */,
113 | );
114 | };
115 | /* End PBXProject section */
116 |
117 | /* Begin PBXSourcesBuildPhase section */
118 | 58B511D71A9E6C8500147676 /* Sources */ = {
119 | isa = PBXSourcesBuildPhase;
120 | buildActionMask = 2147483647;
121 | files = (
122 | B3E7B58A1CC2AC0600A0062D /* RNGosellSdkReactNative.m in Sources */,
123 | 6208603C25347A9800096497 /* RNGosellSdkReactNative.swift in Sources */,
124 | );
125 | runOnlyForDeploymentPostprocessing = 0;
126 | };
127 | /* End PBXSourcesBuildPhase section */
128 |
129 | /* Begin XCBuildConfiguration section */
130 | 58B511ED1A9E6C8500147676 /* Debug */ = {
131 | isa = XCBuildConfiguration;
132 | buildSettings = {
133 | ALWAYS_SEARCH_USER_PATHS = NO;
134 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
135 | CLANG_CXX_LIBRARY = "libc++";
136 | CLANG_ENABLE_MODULES = YES;
137 | CLANG_ENABLE_OBJC_ARC = YES;
138 | CLANG_WARN_BOOL_CONVERSION = YES;
139 | CLANG_WARN_CONSTANT_CONVERSION = YES;
140 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
141 | CLANG_WARN_EMPTY_BODY = YES;
142 | CLANG_WARN_ENUM_CONVERSION = YES;
143 | CLANG_WARN_INFINITE_RECURSION = YES;
144 | CLANG_WARN_INT_CONVERSION = YES;
145 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
146 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
147 | CLANG_WARN_UNREACHABLE_CODE = YES;
148 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
149 | COPY_PHASE_STRIP = NO;
150 | ENABLE_STRICT_OBJC_MSGSEND = YES;
151 | ENABLE_TESTABILITY = YES;
152 | GCC_C_LANGUAGE_STANDARD = gnu99;
153 | GCC_DYNAMIC_NO_PIC = NO;
154 | GCC_NO_COMMON_BLOCKS = YES;
155 | GCC_OPTIMIZATION_LEVEL = 0;
156 | GCC_PREPROCESSOR_DEFINITIONS = (
157 | "DEBUG=1",
158 | "$(inherited)",
159 | );
160 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
161 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
162 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
163 | GCC_WARN_UNDECLARED_SELECTOR = YES;
164 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
165 | GCC_WARN_UNUSED_FUNCTION = YES;
166 | GCC_WARN_UNUSED_VARIABLE = YES;
167 | IPHONEOS_DEPLOYMENT_TARGET = 11.0;
168 | MTL_ENABLE_DEBUG_INFO = YES;
169 | ONLY_ACTIVE_ARCH = YES;
170 | SDKROOT = iphoneos;
171 | };
172 | name = Debug;
173 | };
174 | 58B511EE1A9E6C8500147676 /* Release */ = {
175 | isa = XCBuildConfiguration;
176 | buildSettings = {
177 | ALWAYS_SEARCH_USER_PATHS = NO;
178 | CLANG_CXX_LANGUAGE_STANDARD = "gnu++0x";
179 | CLANG_CXX_LIBRARY = "libc++";
180 | CLANG_ENABLE_MODULES = YES;
181 | CLANG_ENABLE_OBJC_ARC = YES;
182 | CLANG_WARN_BOOL_CONVERSION = YES;
183 | CLANG_WARN_CONSTANT_CONVERSION = YES;
184 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
185 | CLANG_WARN_EMPTY_BODY = YES;
186 | CLANG_WARN_ENUM_CONVERSION = YES;
187 | CLANG_WARN_INFINITE_RECURSION = YES;
188 | CLANG_WARN_INT_CONVERSION = YES;
189 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
190 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
191 | CLANG_WARN_UNREACHABLE_CODE = YES;
192 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
193 | COPY_PHASE_STRIP = YES;
194 | ENABLE_NS_ASSERTIONS = NO;
195 | ENABLE_STRICT_OBJC_MSGSEND = YES;
196 | GCC_C_LANGUAGE_STANDARD = gnu99;
197 | GCC_NO_COMMON_BLOCKS = YES;
198 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
199 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
200 | GCC_WARN_UNDECLARED_SELECTOR = YES;
201 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
202 | GCC_WARN_UNUSED_FUNCTION = YES;
203 | GCC_WARN_UNUSED_VARIABLE = YES;
204 | IPHONEOS_DEPLOYMENT_TARGET = 11.0;
205 | MTL_ENABLE_DEBUG_INFO = NO;
206 | SDKROOT = iphoneos;
207 | VALIDATE_PRODUCT = YES;
208 | };
209 | name = Release;
210 | };
211 | 58B511F01A9E6C8500147676 /* Debug */ = {
212 | isa = XCBuildConfiguration;
213 | buildSettings = {
214 | CLANG_ENABLE_MODULES = YES;
215 | HEADER_SEARCH_PATHS = (
216 | "$(inherited)",
217 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
218 | "$(SRCROOT)/../../../React/**",
219 | "$(SRCROOT)/../../react-native/React/**",
220 | );
221 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
222 | LIBRARY_SEARCH_PATHS = "$(inherited)";
223 | OTHER_LDFLAGS = "-ObjC";
224 | PRODUCT_NAME = RNGosellSdkReactNative;
225 | SKIP_INSTALL = YES;
226 | SWIFT_OBJC_BRIDGING_HEADER = "RNGosellSdkReactNative-Bridging-Header.h";
227 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
228 | SWIFT_VERSION = 5.0;
229 | };
230 | name = Debug;
231 | };
232 | 58B511F11A9E6C8500147676 /* Release */ = {
233 | isa = XCBuildConfiguration;
234 | buildSettings = {
235 | CLANG_ENABLE_MODULES = YES;
236 | HEADER_SEARCH_PATHS = (
237 | "$(inherited)",
238 | /Applications/Xcode.app/Contents/Developer/Toolchains/XcodeDefault.xctoolchain/usr/include,
239 | "$(SRCROOT)/../../../React/**",
240 | "$(SRCROOT)/../../react-native/React/**",
241 | );
242 | LD_RUNPATH_SEARCH_PATHS = "$(inherited) @executable_path/Frameworks @loader_path/Frameworks";
243 | LIBRARY_SEARCH_PATHS = "$(inherited)";
244 | OTHER_LDFLAGS = "-ObjC";
245 | PRODUCT_NAME = RNGosellSdkReactNative;
246 | SKIP_INSTALL = YES;
247 | SWIFT_OBJC_BRIDGING_HEADER = "RNGosellSdkReactNative-Bridging-Header.h";
248 | SWIFT_VERSION = 5.0;
249 | };
250 | name = Release;
251 | };
252 | /* End XCBuildConfiguration section */
253 |
254 | /* Begin XCConfigurationList section */
255 | 58B511D61A9E6C8500147676 /* Build configuration list for PBXProject "RNGosellSdkReactNative" */ = {
256 | isa = XCConfigurationList;
257 | buildConfigurations = (
258 | 58B511ED1A9E6C8500147676 /* Debug */,
259 | 58B511EE1A9E6C8500147676 /* Release */,
260 | );
261 | defaultConfigurationIsVisible = 0;
262 | defaultConfigurationName = Release;
263 | };
264 | 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "RNGosellSdkReactNative" */ = {
265 | isa = XCConfigurationList;
266 | buildConfigurations = (
267 | 58B511F01A9E6C8500147676 /* Debug */,
268 | 58B511F11A9E6C8500147676 /* Release */,
269 | );
270 | defaultConfigurationIsVisible = 0;
271 | defaultConfigurationName = Release;
272 | };
273 | /* End XCConfigurationList section */
274 | };
275 | rootObject = 58B511D31A9E6C8500147676 /* Project object */;
276 | }
277 |
--------------------------------------------------------------------------------
/android/src/main/java/company/tap/goSellSDKExamplee/DeserializationUtil.java:
--------------------------------------------------------------------------------
1 | package company.tap.goSellSDKExamplee;
2 |
3 |
4 | import com.facebook.react.bridge.WritableMap;
5 | import com.facebook.react.bridge.WritableNativeMap;
6 | import com.google.gson.Gson;
7 | import com.google.gson.GsonBuilder;
8 | import com.google.gson.JsonArray;
9 | import com.google.gson.JsonElement;
10 | import com.google.gson.JsonObject;
11 | import com.google.gson.JsonParser;
12 | import com.google.gson.reflect.TypeToken;
13 |
14 | import org.jetbrains.annotations.Nullable;
15 | import org.json.JSONException;
16 | import org.json.JSONObject;
17 |
18 | import java.lang.reflect.Type;
19 | import java.util.ArrayList;
20 | import java.util.HashMap;
21 | import java.util.List;
22 | import java.util.Map;
23 |
24 | import company.tap.gosellapi.internal.api.models.PhoneNumber;
25 | import company.tap.gosellapi.open.enums.AppearanceMode;
26 | import company.tap.gosellapi.open.enums.CardType;
27 | import company.tap.gosellapi.open.enums.TransactionMode;
28 | import company.tap.gosellapi.open.models.AuthorizeAction;
29 | import company.tap.gosellapi.open.models.Customer;
30 | import company.tap.gosellapi.open.models.Destinations;
31 | import company.tap.gosellapi.open.models.PaymentItem;
32 | import company.tap.gosellapi.open.models.Receipt;
33 | import company.tap.gosellapi.open.models.Reference;
34 | import company.tap.gosellapi.open.models.Shipping;
35 | import company.tap.gosellapi.open.models.Tax;
36 |
37 | public class DeserializationUtil {
38 |
39 | static private boolean validJsonString(String jsonString) {
40 | System.out.println("json string:::: " + jsonString);
41 | if (jsonString == null || "null".equalsIgnoreCase(jsonString.toString()) || "".equalsIgnoreCase(jsonString.toString().trim())
42 | ) return false;
43 | return true;
44 | }
45 |
46 | static private JsonElement getJsonElement(String jsonString, String type) {
47 | JsonParser jsonParser = new JsonParser();
48 | JsonElement jsonElement;
49 |
50 | if ("array".equalsIgnoreCase(type)) {
51 | JsonArray jsonArray = (JsonArray) jsonParser.parse(jsonString);
52 | jsonElement = jsonArray;
53 | } else {
54 | JsonObject jsonObject = (JsonObject) jsonParser.parse(jsonString);
55 | jsonElement = jsonObject;
56 | }
57 | return jsonElement;
58 | }
59 |
60 | // shipping
61 | static public ArrayList getShipping(Object jsonString) {
62 | Gson gson = new GsonBuilder().create();
63 | String jsonString1 = gson.toJson(jsonString);
64 | try{
65 | JsonArray parsed = gson.fromJson(jsonString1, JsonArray.class);
66 | if (!validJsonString(jsonString1.toString())) return null;
67 | JsonElement jsonElement = getJsonElement(jsonString1.toString(), "array");
68 | Type listType = new TypeToken>() {
69 | }.getType();
70 | List shippingList = new Gson().fromJson(jsonElement, listType);
71 | return (ArrayList) shippingList;
72 | }catch (Exception e) {
73 | return null;
74 | }
75 | }
76 |
77 | // taxes
78 | static public ArrayList getTaxes(Object jsonString) {
79 | Gson gson = new GsonBuilder().create();
80 | String jsonString1 = gson.toJson(jsonString);
81 | if (!validJsonString(jsonString1.toString())) return null;
82 | JsonElement jsonElement = getJsonElement(jsonString1.toString(), "array");
83 | Type listType = new TypeToken>() {
84 | }.getType();
85 | List taxesList = new Gson().fromJson(jsonElement, listType);
86 | return (ArrayList) taxesList;
87 | }
88 |
89 |
90 | // taxes
91 | static public ArrayList getPaymentItems(Object jsonString) {
92 | Gson gson = new GsonBuilder().create();
93 | String jsonString1 = gson.toJson(jsonString);
94 | System.out.println("jsonString1 = " + jsonString1);
95 | if (!validJsonString(jsonString1.toString())) return null;
96 | JsonElement jsonElement = getJsonElement(jsonString1.toString(), "array");
97 | Type listType = new TypeToken>() {
98 | }.getType();
99 | List taxesList = new Gson().fromJson(jsonElement, listType);
100 | return (ArrayList) taxesList;
101 | }
102 |
103 |
104 | // metadata
105 | static public HashMap getMetaData(Object jsonString) {
106 | Gson gson = new GsonBuilder().create();
107 | String jsonString1 = gson.toJson(jsonString);
108 | if (!validJsonString(jsonString1.toString())) return null;
109 | JsonElement jsonElement = getJsonElement(jsonString1.toString(), "object");
110 | Type listType = new TypeToken>() {
111 | }.getType();
112 | HashMap metaMap = new Gson().fromJson(jsonElement, listType);
113 | System.out.println(metaMap.size());
114 | return metaMap;
115 | }
116 |
117 |
118 | public static Reference getReference(Object jsonString) {
119 | Gson gson = new GsonBuilder().create();
120 | String jsonString1 = gson.toJson(jsonString);
121 | if (!validJsonString(jsonString1.toString())) return null;
122 | JsonElement jsonElement = getJsonElement(jsonString1.toString(), "object");
123 | Type listType = new TypeToken() {
124 | }.getType();
125 | Reference reference = new Gson().fromJson(jsonElement, listType);
126 | System.out.println(reference.getOrder());
127 | return reference;
128 | }
129 |
130 | public static Receipt getReceipt(Object jsonString) {
131 | if (!validJsonString(jsonString.toString())) return null;
132 | JsonElement jsonElement = getJsonElement(jsonString.toString(), "object");
133 | Type listType = new TypeToken() {
134 | }.getType();
135 | Receipt receipt = new Gson().fromJson(jsonElement, listType);
136 | System.out.println(receipt.getId());
137 | System.out.println(receipt.isEmail());
138 | System.out.println(receipt.isSms());
139 | return receipt;
140 | }
141 |
142 | public static AuthorizeAction getAuthorizeAction(Object jsonString) {
143 | if (!validJsonString(jsonString.toString())) return null;
144 | JsonElement jsonElement = getJsonElement(jsonString.toString(), "object");
145 | Type listType = new TypeToken() {
146 | }.getType();
147 | AuthorizeAction authorizeAction = new Gson().fromJson(jsonElement, listType);
148 | System.out.println("authorizeAction : " + authorizeAction.getType());
149 | System.out.println("authorizeAction : " + authorizeAction.getTimeInHours());
150 | return authorizeAction;
151 | }
152 |
153 | public static Destinations getDestinations(Object jsonString) {
154 | if (!validJsonString(jsonString.toString())) return null;
155 | JsonElement jsonElement = getJsonElement(jsonString.toString(), "object");
156 | Type listType = new TypeToken() {
157 | }.getType();
158 | Destinations destinations = new Gson().fromJson(jsonElement, listType);
159 | System.out.println("destinations : " + destinations.getCurrency());
160 | if (destinations.getDestination() != null)
161 | System.out.println("destinations : " + destinations.getDestination().size());
162 | return destinations;
163 | }
164 |
165 |
166 | public static Customer getCustomer(HashMap sessionParameters) throws JSONException {
167 | System.out.println("customer object >>>>> " + sessionParameters.get("customer"));
168 | JSONObject jsonObject = null;
169 | if (sessionParameters.get("customer") == null || "null".equalsIgnoreCase(sessionParameters.get("customer").toString()))
170 | return null;
171 | // String customerString = (String) sessionParameters.get("customer");
172 |
173 | Customer customer = null;
174 | try {
175 | Gson gson = new Gson();
176 | String customerString = gson.toJson(sessionParameters.get("customer"));
177 | System.out.println("sessionParameters = " + sessionParameters + "customerString" + customerString);
178 |
179 | jsonObject = new JSONObject(customerString);
180 |
181 | if (jsonObject != null && jsonObject.get("customerId").toString() != null && jsonObject.get("customerId").toString().length() > 0) {
182 | customer = new Customer.CustomerBuilder(jsonObject.get("customerId").toString()).build();
183 | } else {
184 | PhoneNumber phoneNumber = new PhoneNumber(jsonObject.get("isdNumber").toString(), jsonObject.get("number").toString());
185 | customer = new Customer.CustomerBuilder(jsonObject.get("customerId").toString()).email(jsonObject.get("email").toString()).firstName(jsonObject.get("first_name").toString())
186 | .lastName(jsonObject.get("last_name").toString()).phone(phoneNumber)
187 | .middleName(jsonObject.get("middle_name").toString()).build();
188 | }
189 |
190 |
191 | }catch(JSONException e){
192 | e.printStackTrace();
193 | }
194 |
195 |
196 | return customer;//new Customer.CustomerBuilder(jsonObject.get("customerId").toString()).build();
197 |
198 |
199 | }
200 | public static AppearanceMode getAppearanceMode(double value) {
201 | if (value == 0 ) {
202 | return AppearanceMode.WINDOWED_MODE;
203 | } else {
204 | return AppearanceMode.FULLSCREEN_MODE;
205 | }
206 | }
207 | public static TransactionMode getTransactionMode(String jsonString) {
208 | if (jsonString == null ||
209 | "null".equalsIgnoreCase(jsonString) ||
210 | "".equalsIgnoreCase(jsonString.trim())
211 | ) return TransactionMode.PURCHASE;
212 | System.out.println("trxMode >>>> " + jsonString);
213 | switch (jsonString) {
214 | case "TransactionMode.PURCHASE":
215 | return TransactionMode.PURCHASE;
216 | case "TransactionMode.AUTHORIZE_CAPTURE":
217 | return TransactionMode.AUTHORIZE_CAPTURE;
218 | case "TransactionMode.SAVE_CARD":
219 | return TransactionMode.SAVE_CARD;
220 | case "TransactionMode.TOKENIZE_CARD":
221 | return TransactionMode.TOKENIZE_CARD;
222 | }
223 | return TransactionMode.PURCHASE;
224 | }
225 |
226 |
227 | public static CardType getCardType(String jsonString) {
228 | if (jsonString == null || jsonString == CardType.ALL.toString() ||
229 | "null".equalsIgnoreCase(jsonString) ||
230 | "".equalsIgnoreCase(jsonString.trim())
231 | ) return CardType.ALL;
232 | System.out.println("card type >>>> " + jsonString);
233 | if ("CREDIT".equalsIgnoreCase(jsonString)) {
234 | return CardType.CREDIT;
235 | }
236 | else if ("DEBIT".equalsIgnoreCase(jsonString)) return CardType.DEBIT;
237 | return CardType.ALL;
238 | }
239 |
240 | public static String getPaymentType(String jsonString) {
241 | if (jsonString == null ||
242 | "null".equalsIgnoreCase(jsonString) ||
243 | "".equalsIgnoreCase(jsonString.trim())
244 | ) return "All";
245 |
246 | System.out.println("payment type >>>> " + jsonString);
247 | switch (jsonString) {
248 | case "PaymentType.CARD":
249 | return "CARD";
250 | case "PaymentType.WEB":
251 | return "WEB";
252 | case "PaymentType.APPLE_PAY":
253 | return "APPLE_PAY";
254 | }
255 | return "ALL";
256 |
257 | }
258 |
259 | public static WritableMap convertHashMapToWritableMap(HashMap hashMap) {
260 | WritableMap writableMap = new WritableNativeMap();
261 |
262 | for (Map.Entry entry : hashMap.entrySet()) {
263 | Object value = entry.getValue();
264 | if (value instanceof String) {
265 | writableMap.putString(entry.getKey(), (String) value);
266 | } else if (value instanceof Boolean) {
267 | writableMap.putBoolean(entry.getKey(), (Boolean) value);
268 | } else if (value instanceof Double) {
269 | writableMap.putDouble(entry.getKey(), (Double) value);
270 | } else if (value instanceof Integer) {
271 | writableMap.putInt(entry.getKey(), (Integer) value);
272 | } else if (entry.getValue() instanceof HashMap) {
273 | writableMap.putMap(entry.getKey(), DeserializationUtil.convertHashMapToWritableMap((HashMap) entry.getValue()));
274 | }
275 | }
276 |
277 | return writableMap;
278 | }
279 |
280 | }
--------------------------------------------------------------------------------
/README.md:
--------------------------------------------------------------------------------
1 | # gosellSDK-ReactNative
2 | React-Ntive plugin compatible version of goSellSDK library for both Android and iOS that fully covers payment/authorization/card saving/card tokenization process inside your Android application.
3 | Original SDKS
4 |
5 | - React-Native (https://github.com/Tap-Payments/gosellSDK-ReactNative)
6 | - Android (https://github.com/Tap-Payments/goSellSDK-Android)
7 | - AndroidX (https://github.com/Tap-Payments/goSellSDK-AndroidX)
8 | - iOS (https://github.com/Tap-Payments/goSellSDK-ios)
9 |
10 | ## Getting Started
11 |
12 | # Table of Contents
13 |
14 | ---
15 |
16 | 1. [Requirements](#requirements)
17 | 2. [Installation](#installation)
18 | 1. [Install goSellSDK using npm](#installation_with_npm)
19 | 3. [Usage](#usage)
20 | 1. [Configure Your App](#configure_your_app)
21 | 2. [Configure SDK Session](#configure_sdk_session)
22 | 3. [Transaction Modes](#transaction_modes)
23 | 4. [Customer](#customer)
24 | 5. [Use Tap Pay Button](#tap_pay_button)
25 | 6. [Use Charge Id callback](#charge_id_callback)
26 | 7. [Start Payment](#start_payment)
27 | 8. [Handle SDK Result](#handle_sdk_result)
28 | 9. [Apple Pay Setup](#apple_pay)
29 | 4. [Common Issues](#common_issues)
30 |
31 |
32 |
33 | # Requirements
34 |
35 | ---
36 |
37 | To use the SDK the following requirements must be met:
38 |
39 | 1. **Visual Studio - InteliJ Idea**
40 | 2. **react: 16.13.1** or newer
41 | 3. **react-native: 0.63.3** or newer
42 | 4. **iOS 11** or later
43 | 5. **XCode 12** or later
44 |
45 |
46 |
47 | # Installation
48 |
49 | ---
50 |
51 |
52 |
53 | ### Install goSellSDK using npm
54 | ###### Open Terminal
55 | **Install npm packages**
56 | ```
57 | npm install
58 | ```
59 | **Install goSellSdkReactNative package**
60 | ```
61 | npm i @tap-payments/gosell-sdk-react-native@1.0.53
62 | ```
63 |
64 | ### Install pods for iOS
65 | ```
66 | cd ios
67 | pod install
68 | pod update
69 | ```
70 |
71 | ### Install pods for iOS for M1
72 | ```
73 | sudo arch -x86_64 gem install ffi
74 | arch -x86_64 pod install
75 | ```
76 | ## M1 based Macs
77 |
78 | You may face a compilation error when compiled using M1 based Mac devices, to solve this please follow these steps:
79 |
80 | 1. Close the Xcode.
81 |
82 | 2. Go to the `application` folder.
83 |
84 | 3. Find the `Xcode` icon.
85 |
86 | 4. Right click on Xcode icon.
87 |
88 | 5. Choose `Get info`
89 |
90 | 6. Check the option `Open using Rosetta`
91 |
92 | 
93 |
94 |
95 | ### Install for Andoid
96 | 1. Make sure to set **minimum version to 21 in gradle**
97 | 2. Add **multiDexEnabled true** build gradle of app in android
98 | 3. Make sure to support **JDK 8**
99 |
100 |
101 | ### Update library for versions above 1.0.57 to remove unused assets
102 | 1. Make sure delete @tap_payments folders from node_modules
103 | 2. Make sure run npm install
104 | 3. Run gradle sync from android studio
105 | ---
106 |
107 |
108 |
109 | ## Configure your app
110 |
111 | Create `sdkConfigurations.js` file to set the configurations.
112 |
113 | `goSellSDK` should be set up. To set it up, add the following lines of code inside `sdkConfigurations.js` in your project.
114 | Import RNGoSell from `@tap-payments/gosell-sdk-react-native` package.
115 | ``` javascript
116 | import RNGoSell from '@tap-payments/gosell-sdk-react-native';
117 | const {
118 | Languages,
119 | PaymentTypes,
120 | AllowedCadTypes,
121 | TrxMode,
122 | SDKMode,
123 | Listener,
124 | }= RNGoSell.goSellSDKModels;
125 | ```
126 |
127 | Set app credentials using your **bundle / package ID** and your **sandbox** and **production** keys generated by `TAP Payments` as the below
128 | ``` javascript
129 | const appCredentials = {
130 | production_secrete_key: (Platform.OS == 'ios') ? 'iOS-Live-KEY' : 'Android-Live-KEY',
131 | language: Languages.EN,
132 | sandbox_secrete_key: (Platform.OS == 'ios') ? 'iOS-SANDBOX-KEY' : 'Android-SANDBOX-KEY',
133 | bundleID: (Platform.OS == 'ios') ? 'iOS-PACKAGE-NAME' : 'ANDROIID-PACKAGE-NAME',
134 | }
135 | ```
136 |
137 | ---
138 |
139 |
140 | **Configure SDK Session Example**
141 |
142 | ###### Transaction Currency
143 | ``` javascript
144 | const transactionCurrency = 'kwd';
145 | ```
146 | ###### Shipping
147 | ``` javascript
148 | const shipping = [
149 | {
150 | name: 'shipping 1',
151 | description: 'shiping description 1',
152 | amount: 100.0,
153 | },
154 | ];
155 | ```
156 | ###### Payment Items
157 | ``` javascript
158 | const paymentitems = [
159 | {
160 | amount_per_unit: 1,
161 | description: 'Item 1 Apple',
162 | discount: {
163 | type: 'F',
164 | value: 10,
165 | maximum_fee: 10,
166 | minimum_fee: 1,
167 | },
168 | name: 'item1',
169 | quantity: {
170 | value: 1,
171 | },
172 | taxes: [
173 | {
174 | name: 'tax1',
175 | description: 'tax describtion',
176 | amount: {
177 | type: 'F',
178 | value: 10,
179 | maximum_fee: 10,
180 | minimum_fee: 1,
181 | },
182 | },
183 | ],
184 | total_amount: 100,
185 | },
186 | ];
187 | ```
188 | ###### Taxes
189 | ``` javascript
190 | const taxes = [
191 | {
192 | name: 'tax1',
193 | description: 'tax describtion',
194 | amount: { type: 'F', value: 10.0, maximum_fee: 10.0, minimum_fee: 1.0 },
195 | },
196 | {
197 | name: 'tax1',
198 | description: 'tax describtion',
199 | amount: { type: 'F', value: 10.0, maximum_fee: 10.0, minimum_fee: 1.0 },
200 | },
201 | ];
202 | ```
203 |
204 |
205 |
206 | ###### Customer
207 |
208 | - New Customer (First time to pay using goSell SDK)
209 | ``` javascript
210 | const customer = {
211 | isdNumber: '965',
212 | number: '00000000',
213 | customerId: '',
214 | first_name: 'test',
215 | middle_name: 'test',
216 | last_name: 'test',
217 | email: 'test@test.com',
218 | };
219 | ```
220 | > After the first transaction success, you receive the customerId in the response. Save it to be used in the next transaction.
221 | - Existed Customer (paid before using goSell SDK)
222 | You need to set the customerId only and you can see the customer saved cards if the user has.
223 | ``` javascript
224 | const customer = {
225 | isdNumber: '965',
226 | number: '00000000',
227 | customerId: 'cus_smdnd3346nd3dks3jd9drd7d',
228 | first_name: '',
229 | middle_name: '',
230 | last_name: '',
231 | email: '',
232 | };
233 | ```
234 |
235 | > Please note that goSell SDK using the customerId only if it's not Empty ('').
236 |
237 | ###### Payment Reference
238 | ``` javascript
239 | const paymentReference = {
240 | track: 'track',
241 | payment: 'payment',
242 | gateway: 'gateway',
243 | acquirer: 'acquirer',
244 | transaction: 'trans_910101',
245 | order: 'order_262625',
246 | gosellID: null,
247 | };
248 | ```
249 | ###### Set the final confugurations to be set to goSellSdk
250 | ``` javascript
251 | const allConfigurations = {
252 | appCredentials: appCredentials,
253 | sessionParameters: {
254 | paymentStatementDescriptor: 'paymentStatementDescriptor',
255 | transactionCurrency: 'kwd',
256 | isUserAllowedToSaveCard: true,
257 | paymentType: PaymentTypes.ALL,
258 | amount: '100',
259 | shipping: shipping,
260 | allowedCadTypes:AllowedCadTypes.ALL,
261 | paymentitems: paymentitems,
262 | paymenMetaData: { a: 'a meta', b: 'b meta' },
263 | applePayMerchantID: 'applePayMerchantID',
264 | authorizeAction: { timeInHours: 10, time: 10, type: 'CAPTURE' },
265 | cardHolderName: 'Card Holder NAME',
266 | editCardHolderName: false,
267 | postURL: 'https://tap.company',
268 | paymentDescription: 'paymentDescription',
269 | destinations: 'null',
270 | trxMode: TrxMode.PURCHASE,
271 | taxes: taxes,
272 | merchantID: '',
273 | SDKMode: SDKMode.Sandbox,
274 | customer: customer,
275 | isRequires3DSecure: false,
276 | receiptSettings: { id: null, email: false, sms: true },
277 | allowsToSaveSameCardMoreThanOnce: false,
278 | paymentReference: paymentReference,
279 | uiDisplayMode: UiDisplayModes.DARK,
280 | appearanceMode: SDKAppearanceMode.Windowed,
281 | supportedPaymentMethods: ['Knet'],
282 | },
283 | };
284 |
285 | export default allConfigurations
286 | ```
287 |
288 | ---
289 |
290 | **Supported payments Methods**
291 | ``` javascript
292 | supportedPaymentMethods: ['Knet'],
293 | ```
294 | Optional when you pass this values it will be only enabled methods for payment
295 | if you not pass it or pass it as empty array you will have all available payment methods to your account
296 |
297 | You can pass the supported payment Methods as array of string to supportedPaymentMethods key:
298 | - **Available values**
299 | - AMERICAN_EXPRESS
300 | - APPLE_PAY
301 | - BENEFIT
302 | - BENEFITPAY
303 | - CAREEMPAY
304 | - FAWRY
305 | - GOOGLE_PAY
306 | - KNET
307 | - MADA
308 | - MASTERCARD
309 | - MEEZA
310 | - OMANNET
311 | - PAYPAL
312 | - POST_PAY
313 | - NAPS
314 | - STC_PAY
315 | - TABBY
316 | - VISA
317 |
318 |
319 | **Appearance Mode**
320 |
321 | ``` javascript
322 | appearanceMode: SDKAppearanceMode.Fullscreen
323 | ```
324 |
325 | Optional You can set the appearance mode into one of the following modes:
326 | - **Fullscreen**
327 | - ```SDKAppearanceMode.Fullscreen```
328 | > Show sheet as full screen
329 | - **Windowed**
330 | - ```SDKAppearanceMode.Windowed```
331 | > Show sheet as window.
332 |
333 |
334 | **Transaction Modes**
335 |
336 | ``` javascript
337 | trxMode: TransactionMode.PURCHASE
338 | ```
339 |
340 |
341 | You can set the transaction mode into one of the following modes:
342 | - **Purchase**
343 | - ```TransactionMode.PURCHASE```
344 | > Normal customer charge.
345 | - **Authorize**
346 | - ```TransactionMode.AUTHORIZE_CAPTURE```
347 | > Only authorization is happening. You should specify an action after successful authorization: either capture the amount or void the charge after specific period of time.
348 | - **Save Card**
349 | - ```TransactionMode.SAVE_CARD```
350 | > Use this mode to save the card of the customer with Tap and use it later.
351 | - **Tokenize Card**
352 | - ```TransactionMode.TOKENIZE_CARD```
353 | > Use this mode if you are willing to perform the charging/authorization manually. The purpose of this mode is only to collect and tokenize card information details of your customer if you don't have PCI compliance certificate but willing to process the payment manually using our services.
354 |
355 |
356 |
357 |
358 |
359 | **Use Tap Pay Button UI**
360 | ``` javascript
361 | render() {
362 | const statusbar =
363 | Platform.OS == 'ios' ? (
364 |
365 | ) : (
366 |
367 | );
368 | const { statusNow } = this.state;
369 | return (
370 |
371 |
372 | {statusbar}
373 |
374 | Status: {statusNow}
375 | {this.state.result}
376 |
377 | {Platform.OS == 'ios' ?
378 |
379 |
380 | Start Payment
381 |
382 |
383 | :
384 | }
385 |
386 |
387 |
388 | );
389 | }
390 | ```
391 |
392 | **Use Charge Id callback**
393 | ``` javascript
394 | constructor(props) {
395 | super(props);
396 | this.subscription = RNGoSell.goSellListener.addListener(RNGoSell.goSellSDKModels.Listener.paymentInit, (chargeId) => {
397 | console.log("chargeId", chargeId)
398 | })
399 | }
400 |
401 | componentWillUnmount() {
402 | this.subscription.remove() // to clear the listener
403 | }
404 | ```
405 | **Use apple pay cancel callback**
406 | ``` javascript
407 | constructor(props) {
408 | super(props);
409 | this.subscription = RNGoSell.goSellListener.addListener(RNGoSell.goSellSDKModels.Listener.applePayCancelled, (result) => {
410 | console.log("result", result)
411 | })
412 | }
413 |
414 | componentWillUnmount() {
415 | this.subscription.remove() // to clear the listener
416 | }
417 | ```
418 | ``` javascript
419 | const styles = StyleSheet.create({
420 | safeAreaView: {
421 | flex: 1,
422 | backgroundColor: '#000',
423 | },
424 | container: {
425 | flex: 1,
426 | backgroundColor: '#F5FCFF',
427 | },
428 | statusbar: {
429 | height: 20,
430 | },
431 | payButtonBg: {
432 | alignItems: 'center',
433 | color: '#25cf1f',
434 | backgroundColor: '#25cf1f',
435 | paddingVertical: 12,
436 | paddingHorizontal: 25,
437 | borderRadius: 25,
438 | position: 'absolute',
439 | bottom: 0,
440 | width: '90%',
441 | marginLeft: '6%',
442 | marginRight: '10%',
443 | },
444 | payButtonText: {
445 | color: '#FFF',
446 | fontSize: 20,
447 | },
448 | bottom: {
449 | flex: 1,
450 | justifyContent: 'flex-end',
451 | marginBottom: 36,
452 | },
453 | statusText: {
454 | textAlign: 'center',
455 | fontWeight: 'bold',
456 | fontSize: 25,
457 | },
458 | resultText: {
459 | textAlign: 'center',
460 | fontSize: 15,
461 | width: '90%',
462 | marginLeft: '6%',
463 | marginRight: '10%',
464 | },
465 | });
466 | ```
467 | ---
468 |
469 | **Start Payment**
470 |
471 | - In your `App.js` import RNGoSell from '@tap-payments/gosell-sdk-react-native'
472 | - Import `sdkConfigurations` from './sdkConfigurations'
473 | - Call start payment from
474 | #### Parameters
475 |
476 | - First parameter is the `sdkConfigurations` dictionary
477 | - Second parameter is integer value to set the `termination timeout in milliseconds`, the sdk will terminate the session after this time expire. `Set 0 if you don't want to terminate the session and keep it terminated normally clicking on cancel button by the user`
478 | - Third parameter is the `result callback`, you can handle the required action on recieving the the result through this callback.
479 | ``` javascript
480 | import RNGoSell from '@tap-payments/gosell-sdk-react-native';
481 | import sdkConfigurations from './sdkConfigurations';
482 | // startPayment(sdkConfigurations, terminationTimeoutInMilliseconds, this.handleResult)
483 | // Set terminationTimeoutInMilliseconds to 0 to prevent termination the session automatically
484 | RNGoSell.goSellSDK.startPayment(sdkConfigurations, 0, this.handleResult)
485 | ```
486 | ---
487 |
488 | **Handle SDK Result**
489 |
490 | ```javascript
491 | handleResult(error, status) {
492 | var myString = JSON.stringify(status);
493 | console.log('status is ' + status.sdk_result);
494 | console.log(myString);
495 | var resultStr = String(status.sdk_result);
496 | switch (resultStr) {
497 | case 'SUCCESS':
498 | this.handleSDKResult(status)
499 | break
500 | case 'FAILED':
501 | this.handleSDKResult(status)
502 | break
503 | case "SDK_ERROR":
504 | console.log('sdk error............');
505 | console.log(status['sdk_error_code']);
506 | console.log(status['sdk_error_message']);
507 | console.log(status['sdk_error_description']);
508 | console.log('sdk error............');
509 | break
510 | case "NOT_IMPLEMENTED":
511 | break
512 | }
513 | }
514 |
515 | handleSDKResult(result) {
516 | console.log('trx_mode::::');
517 | console.log(result['trx_mode'])
518 | switch (result['trx_mode']) {
519 | case "CHARGE":
520 | console.log('Charge');
521 | console.log(result);
522 | this.printSDKResult(result);
523 | break;
524 |
525 | case "AUTHORIZE":
526 | this.printSDKResult(result);
527 | break;
528 |
529 | case "SAVE_CARD":
530 | this.printSDKResult(result);
531 | break;
532 |
533 | case "TOKENIZE":
534 | Object.keys(result).map((key) => {
535 | console.log(`TOKENIZE \t${key}:\t\t\t${result[key]}`);
536 | })
537 |
538 | // responseID = tapSDKResult['token'];
539 | break;
540 | }
541 | }
542 |
543 | printSDKResult(result) {
544 | if (!result) return
545 | Object.keys(result).map((key) => {
546 | console.log(`${result['trx_mode']}\t${key}:\t\t\t${result[key]}`);
547 | })
548 | }
549 | ```
550 | ---
551 |
552 |
553 | **Apple pay setup**
554 |
555 | Follow the steps shared in the following link to setup apple pay:
556 | https://github.com/Tap-Payments/goSellSDK-ios#apple-pay
557 |
558 | ---
559 |
560 | ---
561 |
562 |
563 | **Google pay setup**
564 |
565 |
566 |
567 | **Requirements And SetUp**
568 |
569 | 1. Make sure, your current goSellSDK version is >= 3.16.0
570 |
571 | 2. To use Google Pay™, first ensure your device supports GooglePay and is above api version 22
572 |
573 | 3. Ask for Enabling googlePay as payment option from Tap team.
574 |
575 | 4. In Manifest file of your app enable gms wallet:
576 |
577 | ```java
578 |
582 | ```
583 |
584 |
585 | You may refer to https://github.com/Tap-Payments/goSellSDK-AndroidX/tree/FT_Google_Pay_Integration#requirements_googlepay for more info
586 |
587 | ---
588 |
589 |
590 |
591 | ## Common Issues
592 | #### iOS
593 | 1. Undefined symbol:
594 | 1. Undefined symbol: __swift_FORCE_LOAD_$_swiftWebKit
595 | 2. Undefined symbol: __swift_FORCE_LOAD_$_swiftUniformTypeIdentifiers
596 | 3. Undefined symbol: __swift_FORCE_LOAD_$_swiftCoreMIDI
597 |
598 | ###### Fix:
599 | - Add ```$(SDKROOT)/usr/lib/swift``` in **Build Settings > Library Search Paths**
600 |
601 | 2. Event Config Error: error
602 | 
603 |
604 | ###### Fix:
605 | 1. In iOS Podfile, **replace ```use_flipper!``` with** ```use_flipper!({ 'Flipper-Folly' => '2.3.0' })```
606 | 2. Use command ```pod deintegrate``` then **remove Podfile.lock**
607 | 3. Use command ```pod install``` then ```pod update```
608 |
609 |
--------------------------------------------------------------------------------
/example/ios/example.xcodeproj/project.pbxproj:
--------------------------------------------------------------------------------
1 | // !$*UTF8*$!
2 | {
3 | archiveVersion = 1;
4 | classes = {
5 | };
6 | objectVersion = 54;
7 | objects = {
8 |
9 | /* Begin PBXBuildFile section */
10 | 0C80B921A6F3F58F76C31292 /* libPods-example.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 5DCACB8F33CDC322A6C60F78 /* libPods-example.a */; };
11 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB51A68108700A75B9A /* Images.xcassets */; };
12 | 5442852CBBBF8864FE9FACBF /* PrivacyInfo.xcprivacy in Resources */ = {isa = PBXBuildFile; fileRef = 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */; };
13 | 761780ED2CA45674006654EE /* AppDelegate.swift in Sources */ = {isa = PBXBuildFile; fileRef = 761780EC2CA45674006654EE /* AppDelegate.swift */; };
14 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */ = {isa = PBXBuildFile; fileRef = 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */; };
15 | /* End PBXBuildFile section */
16 |
17 | /* Begin PBXFileReference section */
18 | 13B07F961A680F5B00A75B9A /* example.app */ = {isa = PBXFileReference; explicitFileType = wrapper.application; includeInIndex = 0; path = example.app; sourceTree = BUILT_PRODUCTS_DIR; };
19 | 13B07FB51A68108700A75B9A /* Images.xcassets */ = {isa = PBXFileReference; lastKnownFileType = folder.assetcatalog; name = Images.xcassets; path = example/Images.xcassets; sourceTree = ""; };
20 | 13B07FB61A68108700A75B9A /* Info.plist */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = Info.plist; path = example/Info.plist; sourceTree = ""; };
21 | 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = text.plist.xml; name = PrivacyInfo.xcprivacy; path = example/PrivacyInfo.xcprivacy; sourceTree = ""; };
22 | 3B4392A12AC88292D35C810B /* Pods-example.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.debug.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.debug.xcconfig"; sourceTree = ""; };
23 | 5709B34CF0A7D63546082F79 /* Pods-example.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-example.release.xcconfig"; path = "Target Support Files/Pods-example/Pods-example.release.xcconfig"; sourceTree = ""; };
24 | 5DCACB8F33CDC322A6C60F78 /* libPods-example.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-example.a"; sourceTree = BUILT_PRODUCTS_DIR; };
25 | 761780EC2CA45674006654EE /* AppDelegate.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; name = AppDelegate.swift; path = example/AppDelegate.swift; sourceTree = ""; };
26 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = file.storyboard; name = LaunchScreen.storyboard; path = example/LaunchScreen.storyboard; sourceTree = ""; };
27 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */ = {isa = PBXFileReference; lastKnownFileType = wrapper.framework; name = JavaScriptCore.framework; path = System/Library/Frameworks/JavaScriptCore.framework; sourceTree = SDKROOT; };
28 | /* End PBXFileReference section */
29 |
30 | /* Begin PBXFrameworksBuildPhase section */
31 | 13B07F8C1A680F5B00A75B9A /* Frameworks */ = {
32 | isa = PBXFrameworksBuildPhase;
33 | buildActionMask = 2147483647;
34 | files = (
35 | 0C80B921A6F3F58F76C31292 /* libPods-example.a in Frameworks */,
36 | );
37 | runOnlyForDeploymentPostprocessing = 0;
38 | };
39 | /* End PBXFrameworksBuildPhase section */
40 |
41 | /* Begin PBXGroup section */
42 | 13B07FAE1A68108700A75B9A /* example */ = {
43 | isa = PBXGroup;
44 | children = (
45 | 13B07FB51A68108700A75B9A /* Images.xcassets */,
46 | 761780EC2CA45674006654EE /* AppDelegate.swift */,
47 | 13B07FB61A68108700A75B9A /* Info.plist */,
48 | 81AB9BB72411601600AC10FF /* LaunchScreen.storyboard */,
49 | 13B07FB81A68108700A75B9A /* PrivacyInfo.xcprivacy */,
50 | );
51 | name = example;
52 | sourceTree = "";
53 | };
54 | 2D16E6871FA4F8E400B85C8A /* Frameworks */ = {
55 | isa = PBXGroup;
56 | children = (
57 | ED297162215061F000B7C4FE /* JavaScriptCore.framework */,
58 | 5DCACB8F33CDC322A6C60F78 /* libPods-example.a */,
59 | );
60 | name = Frameworks;
61 | sourceTree = "";
62 | };
63 | 832341AE1AAA6A7D00B99B32 /* Libraries */ = {
64 | isa = PBXGroup;
65 | children = (
66 | );
67 | name = Libraries;
68 | sourceTree = "";
69 | };
70 | 83CBB9F61A601CBA00E9B192 = {
71 | isa = PBXGroup;
72 | children = (
73 | 13B07FAE1A68108700A75B9A /* example */,
74 | 832341AE1AAA6A7D00B99B32 /* Libraries */,
75 | 83CBBA001A601CBA00E9B192 /* Products */,
76 | 2D16E6871FA4F8E400B85C8A /* Frameworks */,
77 | BBD78D7AC51CEA395F1C20DB /* Pods */,
78 | );
79 | indentWidth = 2;
80 | sourceTree = "";
81 | tabWidth = 2;
82 | usesTabs = 0;
83 | };
84 | 83CBBA001A601CBA00E9B192 /* Products */ = {
85 | isa = PBXGroup;
86 | children = (
87 | 13B07F961A680F5B00A75B9A /* example.app */,
88 | );
89 | name = Products;
90 | sourceTree = "";
91 | };
92 | BBD78D7AC51CEA395F1C20DB /* Pods */ = {
93 | isa = PBXGroup;
94 | children = (
95 | 3B4392A12AC88292D35C810B /* Pods-example.debug.xcconfig */,
96 | 5709B34CF0A7D63546082F79 /* Pods-example.release.xcconfig */,
97 | );
98 | path = Pods;
99 | sourceTree = "";
100 | };
101 | /* End PBXGroup section */
102 |
103 | /* Begin PBXNativeTarget section */
104 | 13B07F861A680F5B00A75B9A /* example */ = {
105 | isa = PBXNativeTarget;
106 | buildConfigurationList = 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "example" */;
107 | buildPhases = (
108 | C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */,
109 | 13B07F871A680F5B00A75B9A /* Sources */,
110 | 13B07F8C1A680F5B00A75B9A /* Frameworks */,
111 | 13B07F8E1A680F5B00A75B9A /* Resources */,
112 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */,
113 | 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */,
114 | E235C05ADACE081382539298 /* [CP] Copy Pods Resources */,
115 | );
116 | buildRules = (
117 | );
118 | dependencies = (
119 | );
120 | name = example;
121 | productName = example;
122 | productReference = 13B07F961A680F5B00A75B9A /* example.app */;
123 | productType = "com.apple.product-type.application";
124 | };
125 | /* End PBXNativeTarget section */
126 |
127 | /* Begin PBXProject section */
128 | 83CBB9F71A601CBA00E9B192 /* Project object */ = {
129 | isa = PBXProject;
130 | attributes = {
131 | LastUpgradeCheck = 1210;
132 | TargetAttributes = {
133 | 13B07F861A680F5B00A75B9A = {
134 | LastSwiftMigration = 1120;
135 | };
136 | };
137 | };
138 | buildConfigurationList = 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "example" */;
139 | compatibilityVersion = "Xcode 12.0";
140 | developmentRegion = en;
141 | hasScannedForEncodings = 0;
142 | knownRegions = (
143 | en,
144 | Base,
145 | );
146 | mainGroup = 83CBB9F61A601CBA00E9B192;
147 | productRefGroup = 83CBBA001A601CBA00E9B192 /* Products */;
148 | projectDirPath = "";
149 | projectRoot = "";
150 | targets = (
151 | 13B07F861A680F5B00A75B9A /* example */,
152 | );
153 | };
154 | /* End PBXProject section */
155 |
156 | /* Begin PBXResourcesBuildPhase section */
157 | 13B07F8E1A680F5B00A75B9A /* Resources */ = {
158 | isa = PBXResourcesBuildPhase;
159 | buildActionMask = 2147483647;
160 | files = (
161 | 81AB9BB82411601600AC10FF /* LaunchScreen.storyboard in Resources */,
162 | 13B07FBF1A68108700A75B9A /* Images.xcassets in Resources */,
163 | 5442852CBBBF8864FE9FACBF /* PrivacyInfo.xcprivacy in Resources */,
164 | );
165 | runOnlyForDeploymentPostprocessing = 0;
166 | };
167 | /* End PBXResourcesBuildPhase section */
168 |
169 | /* Begin PBXShellScriptBuildPhase section */
170 | 00DD1BFF1BD5951E006B06BC /* Bundle React Native code and images */ = {
171 | isa = PBXShellScriptBuildPhase;
172 | buildActionMask = 2147483647;
173 | files = (
174 | );
175 | inputPaths = (
176 | "$(SRCROOT)/.xcode.env.local",
177 | "$(SRCROOT)/.xcode.env",
178 | );
179 | name = "Bundle React Native code and images";
180 | outputPaths = (
181 | );
182 | runOnlyForDeploymentPostprocessing = 0;
183 | shellPath = /bin/sh;
184 | shellScript = "set -e\n\nWITH_ENVIRONMENT=\"$REACT_NATIVE_PATH/scripts/xcode/with-environment.sh\"\nREACT_NATIVE_XCODE=\"$REACT_NATIVE_PATH/scripts/react-native-xcode.sh\"\n\n/bin/sh -c \"$WITH_ENVIRONMENT $REACT_NATIVE_XCODE\"\n";
185 | };
186 | 00EEFC60759A1932668264C0 /* [CP] Embed Pods Frameworks */ = {
187 | isa = PBXShellScriptBuildPhase;
188 | buildActionMask = 2147483647;
189 | files = (
190 | );
191 | inputFileListPaths = (
192 | "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-input-files.xcfilelist",
193 | );
194 | name = "[CP] Embed Pods Frameworks";
195 | outputFileListPaths = (
196 | "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks-${CONFIGURATION}-output-files.xcfilelist",
197 | );
198 | runOnlyForDeploymentPostprocessing = 0;
199 | shellPath = /bin/sh;
200 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-frameworks.sh\"\n";
201 | showEnvVarsInLog = 0;
202 | };
203 | C38B50BA6285516D6DCD4F65 /* [CP] Check Pods Manifest.lock */ = {
204 | isa = PBXShellScriptBuildPhase;
205 | buildActionMask = 2147483647;
206 | files = (
207 | );
208 | inputFileListPaths = (
209 | );
210 | inputPaths = (
211 | "${PODS_PODFILE_DIR_PATH}/Podfile.lock",
212 | "${PODS_ROOT}/Manifest.lock",
213 | );
214 | name = "[CP] Check Pods Manifest.lock";
215 | outputFileListPaths = (
216 | );
217 | outputPaths = (
218 | "$(DERIVED_FILE_DIR)/Pods-example-checkManifestLockResult.txt",
219 | );
220 | runOnlyForDeploymentPostprocessing = 0;
221 | shellPath = /bin/sh;
222 | shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
223 | showEnvVarsInLog = 0;
224 | };
225 | E235C05ADACE081382539298 /* [CP] Copy Pods Resources */ = {
226 | isa = PBXShellScriptBuildPhase;
227 | buildActionMask = 2147483647;
228 | files = (
229 | );
230 | inputFileListPaths = (
231 | "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-input-files.xcfilelist",
232 | );
233 | name = "[CP] Copy Pods Resources";
234 | outputFileListPaths = (
235 | "${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources-${CONFIGURATION}-output-files.xcfilelist",
236 | );
237 | runOnlyForDeploymentPostprocessing = 0;
238 | shellPath = /bin/sh;
239 | shellScript = "\"${PODS_ROOT}/Target Support Files/Pods-example/Pods-example-resources.sh\"\n";
240 | showEnvVarsInLog = 0;
241 | };
242 | /* End PBXShellScriptBuildPhase section */
243 |
244 | /* Begin PBXSourcesBuildPhase section */
245 | 13B07F871A680F5B00A75B9A /* Sources */ = {
246 | isa = PBXSourcesBuildPhase;
247 | buildActionMask = 2147483647;
248 | files = (
249 | 761780ED2CA45674006654EE /* AppDelegate.swift in Sources */,
250 | );
251 | runOnlyForDeploymentPostprocessing = 0;
252 | };
253 | /* End PBXSourcesBuildPhase section */
254 |
255 | /* Begin XCBuildConfiguration section */
256 | 13B07F941A680F5B00A75B9A /* Debug */ = {
257 | isa = XCBuildConfiguration;
258 | baseConfigurationReference = 3B4392A12AC88292D35C810B /* Pods-example.debug.xcconfig */;
259 | buildSettings = {
260 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
261 | CLANG_ENABLE_MODULES = YES;
262 | CURRENT_PROJECT_VERSION = 1;
263 | ENABLE_BITCODE = NO;
264 | INFOPLIST_FILE = example/Info.plist;
265 | IPHONEOS_DEPLOYMENT_TARGET = 15.1;
266 | LD_RUNPATH_SEARCH_PATHS = (
267 | "$(inherited)",
268 | "@executable_path/Frameworks",
269 | );
270 | MARKETING_VERSION = 1.0;
271 | OTHER_LDFLAGS = (
272 | "$(inherited)",
273 | "-ObjC",
274 | "-lc++",
275 | );
276 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
277 | PRODUCT_NAME = example;
278 | SWIFT_OPTIMIZATION_LEVEL = "-Onone";
279 | SWIFT_VERSION = 5.0;
280 | VERSIONING_SYSTEM = "apple-generic";
281 | };
282 | name = Debug;
283 | };
284 | 13B07F951A680F5B00A75B9A /* Release */ = {
285 | isa = XCBuildConfiguration;
286 | baseConfigurationReference = 5709B34CF0A7D63546082F79 /* Pods-example.release.xcconfig */;
287 | buildSettings = {
288 | ASSETCATALOG_COMPILER_APPICON_NAME = AppIcon;
289 | CLANG_ENABLE_MODULES = YES;
290 | CURRENT_PROJECT_VERSION = 1;
291 | INFOPLIST_FILE = example/Info.plist;
292 | IPHONEOS_DEPLOYMENT_TARGET = 15.1;
293 | LD_RUNPATH_SEARCH_PATHS = (
294 | "$(inherited)",
295 | "@executable_path/Frameworks",
296 | );
297 | MARKETING_VERSION = 1.0;
298 | OTHER_LDFLAGS = (
299 | "$(inherited)",
300 | "-ObjC",
301 | "-lc++",
302 | );
303 | PRODUCT_BUNDLE_IDENTIFIER = "org.reactjs.native.example.$(PRODUCT_NAME:rfc1034identifier)";
304 | PRODUCT_NAME = example;
305 | SWIFT_VERSION = 5.0;
306 | VERSIONING_SYSTEM = "apple-generic";
307 | };
308 | name = Release;
309 | };
310 | 83CBBA201A601CBA00E9B192 /* Debug */ = {
311 | isa = XCBuildConfiguration;
312 | buildSettings = {
313 | ALWAYS_SEARCH_USER_PATHS = NO;
314 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
315 | CLANG_CXX_LANGUAGE_STANDARD = "c++20";
316 | CLANG_CXX_LIBRARY = "libc++";
317 | CLANG_ENABLE_MODULES = YES;
318 | CLANG_ENABLE_OBJC_ARC = YES;
319 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
320 | CLANG_WARN_BOOL_CONVERSION = YES;
321 | CLANG_WARN_COMMA = YES;
322 | CLANG_WARN_CONSTANT_CONVERSION = YES;
323 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
324 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
325 | CLANG_WARN_EMPTY_BODY = YES;
326 | CLANG_WARN_ENUM_CONVERSION = YES;
327 | CLANG_WARN_INFINITE_RECURSION = YES;
328 | CLANG_WARN_INT_CONVERSION = YES;
329 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
330 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
331 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
332 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
333 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
334 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
335 | CLANG_WARN_STRICT_PROTOTYPES = YES;
336 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
337 | CLANG_WARN_UNREACHABLE_CODE = YES;
338 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
339 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
340 | COPY_PHASE_STRIP = NO;
341 | ENABLE_STRICT_OBJC_MSGSEND = YES;
342 | ENABLE_TESTABILITY = YES;
343 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
344 | GCC_C_LANGUAGE_STANDARD = gnu99;
345 | GCC_DYNAMIC_NO_PIC = NO;
346 | GCC_NO_COMMON_BLOCKS = YES;
347 | GCC_OPTIMIZATION_LEVEL = 0;
348 | GCC_PREPROCESSOR_DEFINITIONS = (
349 | "DEBUG=1",
350 | "$(inherited)",
351 | );
352 | GCC_SYMBOLS_PRIVATE_EXTERN = NO;
353 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
354 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
355 | GCC_WARN_UNDECLARED_SELECTOR = YES;
356 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
357 | GCC_WARN_UNUSED_FUNCTION = YES;
358 | GCC_WARN_UNUSED_VARIABLE = YES;
359 | IPHONEOS_DEPLOYMENT_TARGET = 15.1;
360 | LD_RUNPATH_SEARCH_PATHS = (
361 | /usr/lib/swift,
362 | "$(inherited)",
363 | );
364 | LIBRARY_SEARCH_PATHS = (
365 | "\"$(SDKROOT)/usr/lib/swift\"",
366 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
367 | "\"$(inherited)\"",
368 | );
369 | MTL_ENABLE_DEBUG_INFO = YES;
370 | ONLY_ACTIVE_ARCH = YES;
371 | OTHER_CPLUSPLUSFLAGS = (
372 | "$(OTHER_CFLAGS)",
373 | "-DFOLLY_NO_CONFIG",
374 | "-DFOLLY_MOBILE=1",
375 | "-DFOLLY_USE_LIBCPP=1",
376 | "-DFOLLY_CFG_NO_COROUTINES=1",
377 | "-DFOLLY_HAVE_CLOCK_GETTIME=1",
378 | );
379 | OTHER_LDFLAGS = (
380 | "$(inherited)",
381 | " ",
382 | );
383 | REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
384 | SDKROOT = iphoneos;
385 | SWIFT_ACTIVE_COMPILATION_CONDITIONS = "$(inherited) DEBUG";
386 | USE_HERMES = true;
387 | };
388 | name = Debug;
389 | };
390 | 83CBBA211A601CBA00E9B192 /* Release */ = {
391 | isa = XCBuildConfiguration;
392 | buildSettings = {
393 | ALWAYS_SEARCH_USER_PATHS = NO;
394 | CLANG_ANALYZER_LOCALIZABILITY_NONLOCALIZED = YES;
395 | CLANG_CXX_LANGUAGE_STANDARD = "c++20";
396 | CLANG_CXX_LIBRARY = "libc++";
397 | CLANG_ENABLE_MODULES = YES;
398 | CLANG_ENABLE_OBJC_ARC = YES;
399 | CLANG_WARN_BLOCK_CAPTURE_AUTORELEASING = YES;
400 | CLANG_WARN_BOOL_CONVERSION = YES;
401 | CLANG_WARN_COMMA = YES;
402 | CLANG_WARN_CONSTANT_CONVERSION = YES;
403 | CLANG_WARN_DEPRECATED_OBJC_IMPLEMENTATIONS = YES;
404 | CLANG_WARN_DIRECT_OBJC_ISA_USAGE = YES_ERROR;
405 | CLANG_WARN_EMPTY_BODY = YES;
406 | CLANG_WARN_ENUM_CONVERSION = YES;
407 | CLANG_WARN_INFINITE_RECURSION = YES;
408 | CLANG_WARN_INT_CONVERSION = YES;
409 | CLANG_WARN_NON_LITERAL_NULL_CONVERSION = YES;
410 | CLANG_WARN_OBJC_IMPLICIT_RETAIN_SELF = YES;
411 | CLANG_WARN_OBJC_LITERAL_CONVERSION = YES;
412 | CLANG_WARN_OBJC_ROOT_CLASS = YES_ERROR;
413 | CLANG_WARN_QUOTED_INCLUDE_IN_FRAMEWORK_HEADER = YES;
414 | CLANG_WARN_RANGE_LOOP_ANALYSIS = YES;
415 | CLANG_WARN_STRICT_PROTOTYPES = YES;
416 | CLANG_WARN_SUSPICIOUS_MOVE = YES;
417 | CLANG_WARN_UNREACHABLE_CODE = YES;
418 | CLANG_WARN__DUPLICATE_METHOD_MATCH = YES;
419 | "CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "iPhone Developer";
420 | COPY_PHASE_STRIP = YES;
421 | ENABLE_NS_ASSERTIONS = NO;
422 | ENABLE_STRICT_OBJC_MSGSEND = YES;
423 | "EXCLUDED_ARCHS[sdk=iphonesimulator*]" = "";
424 | GCC_C_LANGUAGE_STANDARD = gnu99;
425 | GCC_NO_COMMON_BLOCKS = YES;
426 | GCC_WARN_64_TO_32_BIT_CONVERSION = YES;
427 | GCC_WARN_ABOUT_RETURN_TYPE = YES_ERROR;
428 | GCC_WARN_UNDECLARED_SELECTOR = YES;
429 | GCC_WARN_UNINITIALIZED_AUTOS = YES_AGGRESSIVE;
430 | GCC_WARN_UNUSED_FUNCTION = YES;
431 | GCC_WARN_UNUSED_VARIABLE = YES;
432 | IPHONEOS_DEPLOYMENT_TARGET = 15.1;
433 | LD_RUNPATH_SEARCH_PATHS = (
434 | /usr/lib/swift,
435 | "$(inherited)",
436 | );
437 | LIBRARY_SEARCH_PATHS = (
438 | "\"$(SDKROOT)/usr/lib/swift\"",
439 | "\"$(TOOLCHAIN_DIR)/usr/lib/swift/$(PLATFORM_NAME)\"",
440 | "\"$(inherited)\"",
441 | );
442 | MTL_ENABLE_DEBUG_INFO = NO;
443 | OTHER_CPLUSPLUSFLAGS = (
444 | "$(OTHER_CFLAGS)",
445 | "-DFOLLY_NO_CONFIG",
446 | "-DFOLLY_MOBILE=1",
447 | "-DFOLLY_USE_LIBCPP=1",
448 | "-DFOLLY_CFG_NO_COROUTINES=1",
449 | "-DFOLLY_HAVE_CLOCK_GETTIME=1",
450 | );
451 | OTHER_LDFLAGS = (
452 | "$(inherited)",
453 | " ",
454 | );
455 | REACT_NATIVE_PATH = "${PODS_ROOT}/../../node_modules/react-native";
456 | SDKROOT = iphoneos;
457 | USE_HERMES = true;
458 | VALIDATE_PRODUCT = YES;
459 | };
460 | name = Release;
461 | };
462 | /* End XCBuildConfiguration section */
463 |
464 | /* Begin XCConfigurationList section */
465 | 13B07F931A680F5B00A75B9A /* Build configuration list for PBXNativeTarget "example" */ = {
466 | isa = XCConfigurationList;
467 | buildConfigurations = (
468 | 13B07F941A680F5B00A75B9A /* Debug */,
469 | 13B07F951A680F5B00A75B9A /* Release */,
470 | );
471 | defaultConfigurationIsVisible = 0;
472 | defaultConfigurationName = Release;
473 | };
474 | 83CBB9FA1A601CBA00E9B192 /* Build configuration list for PBXProject "example" */ = {
475 | isa = XCConfigurationList;
476 | buildConfigurations = (
477 | 83CBBA201A601CBA00E9B192 /* Debug */,
478 | 83CBBA211A601CBA00E9B192 /* Release */,
479 | );
480 | defaultConfigurationIsVisible = 0;
481 | defaultConfigurationName = Release;
482 | };
483 | /* End XCConfigurationList section */
484 | };
485 | rootObject = 83CBB9F71A601CBA00E9B192 /* Project object */;
486 | }
487 |
--------------------------------------------------------------------------------
/CHANGELOG.md:
--------------------------------------------------------------------------------
1 | ## 2.3.70 - 2025-11-17
2 | • Update native android
3 | ## 2.3.69 - 2025-11-04
4 | • Remove JCenter to support new react native
5 | ## 2.3.68 - 2025-09-29
6 | • Fix android compatibility with Kotlin 2.0.0
7 | ## 2.3.67 - 2025-09-28
8 | • Fix android crash
9 | ## 2.3.66 - 2025-09-28
10 | • Fix android crash
11 | ## 2.3.66 - 2025-09-21
12 | • Support 16kb page size in android 15
13 | ## 2.3.65 - 2025-09-18
14 | • Support 16kb page size in android 15
15 | ## 2.3.64 - 2025-09-18
16 | • Support 16kb page size in android 15
17 | ## 2.3.63 - 2025-08-27
18 | • Apply localization to pay button
19 | ## 2.3.62 - 2025-08-27
20 | • Support old appCompact change local
21 | ## 2.3.61 - 2025-08-26
22 | • Change locale method to accept activity context
23 | ## 2.3.60 - 2025-08-26
24 | • Fix old dependency issue in android
25 | ## 2.3.59 - 2025-08-25
26 | • Fix arabic language issue in android
27 | ## 2.3.58 - 2025-08-20
28 | • Updating to support latest android api 35
29 | • Updating to support gradle 8.5.0
30 | ## 2.3.57 - 2025-08-20
31 | ### Enhancement Feature:
32 | • Fix Dark mode in android
33 | ## 2.3.56 - 2025-08-18
34 | ### Enhancement Feature:
35 | • Fix conflicts with okHttp
36 | ## 2.3.55 - 2025-07-24
37 | ### Enhancement Feature:
38 | • Updating to support latest android api 35
39 | • Updating support lib to support android api 35
40 | ### Impact on existing integrations:
41 | • May need to update gradles to support latest apis support sdk 35
42 | • compileSdkVersion 35
43 | • targetSdkVersion 35
44 | • Project build.gradle classpath 'com.android.tools.build:gradle:8.6.0'
45 | • Gradle wrapper.properties distributionUrl=https://services.gradle.org/distributions/gradle-8.10.2-bin.zip
46 | • May need to add proguard rules# Add project specific ProGuard rules here.
47 | You can control the set of applied configuration files using the
48 | proguardFiles setting in build.gradle.
49 | For more details, see http://developer.android.com/guide/developing/tools/proguard.html
50 | If your project uses WebView with JS, uncomment the following
51 | and specify the fully qualified class name to the JavaScript interface
52 |
53 | ```
54 | -assumenosideeffects class android.util.Log {
55 | public static boolean isLoggable(java.lang.String, int);
56 | public static int v(...);
57 | public static int i(...);
58 | public static int w(...);
59 | public static int d(...);
60 | public static int e(...);
61 | }
62 | -keep class com.facebook.react.** { *; }
63 | -keep class com.facebook.** { *; }
64 | -keep class com.crashlytics.** { *; }
65 | -keep class com.qualtrics.** {*;}
66 | -keep public class com.horcrux.svg.** {*;}
67 | -keep class com.google.android.gms.common.** {*;}
68 | -keep class **.BuildConfig { *; }
69 | -dontwarn com.crashlytics.**
70 |
71 | -keep class com.adjust.sdk.** { *; }
72 | -keep class com.google.android.gms.common.ConnectionResult {
73 | int SUCCESS;
74 | }
75 | -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
76 | com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
77 | }
78 | -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
79 | java.lang.String getId();
80 | boolean isLimitAdTrackingEnabled();
81 | }
82 | -keep public class com.android.installreferrer.** { *; }
83 | -keep class com.shopify.reactnative.skia.SkiaDomView {*;}
84 |
85 | # Added as per WhatFix Mobile SDK.
86 | -dontwarn is.leap.android.**
87 |
88 | -keep class is.leap.android.** {*;}
89 |
90 | -dontwarn okhttp3.internal.platform.**
91 | -dontwarn org.conscrypt.**
92 | -dontwarn org.bouncycastle.**
93 | -dontwarn org.openjsse.**
94 |
95 | # Please add these rules to your existing keep rules in order to suppress warnings.
96 | # This is generated automatically by the Android Gradle plugin.
97 | -dontwarn com.bun.miitmdid.core.MdidSdkHelper
98 | -dontwarn com.bun.miitmdid.interfaces.IIdentifierListener
99 | -dontwarn com.bun.miitmdid.interfaces.IdSupplier
100 | -dontwarn com.facebook.stetho.dumpapp.DumpException
101 | -dontwarn com.facebook.stetho.dumpapp.DumpUsageException
102 | -dontwarn com.facebook.stetho.dumpapp.DumperContext
103 | -dontwarn com.facebook.stetho.dumpapp.DumperPlugin
104 | -dontwarn com.huawei.hms.ads.identifier.AdvertisingIdClient$Info
105 | -dontwarn com.huawei.hms.ads.identifier.AdvertisingIdClient
106 | -dontwarn org.slf4j.impl.StaticLoggerBinder
107 | -dontwarn org.slf4j.impl.StaticMDCBinder
108 | -dontwarn org.slf4j.impl.StaticMarkerBinder
109 |
110 | # Retrofit
111 | -keepattributes Signature
112 | -keepattributes RuntimeVisibleAnnotations
113 | -keep class retrofit2.** { *; }
114 | -keep interface retrofit2.** { *; }
115 | -keepclassmembers class * {
116 | @retrofit2.http.* ;
117 | }
118 |
119 | # OkHttp
120 | -keep class okhttp3.** { *; }
121 | -keep interface okhttp3.** { *; }
122 |
123 | # Gson
124 | #-keep class com.google.gson.** { *; }
125 | -keepattributes EnclosingMethod
126 | -keepattributes InnerClasses
127 | -keepattributes Signature
128 |
129 | -keep class company.tap.gosellapi.** { *; }
130 | -keep class company.tap.goSellSDKExamplee.** { *; }
131 | -keep class com.tapgooglepayrn.** { *; }
132 | -keep public class gotap.com.tapglkitandroid.** { *; }
133 |
134 | # Gson TypeToken
135 | -keep class com.google.gson.reflect.TypeToken { *; }
136 | -keep class * extends com.google.gson.reflect.TypeToken
137 |
138 |
139 | -keep class **.CreateTokenGPayRequest { *; }
140 | -keep class **.CreateTokenGPayRequest$Builder { *; }
141 |
142 | # If the class is in a specific package, be more specific (replace with your actual package):
143 | # -keep class com.yourpackage.CreateTokenGPayRequest { *; }
144 | # -keep class com.yourpackage.CreateTokenGPayRequest$Builder { *; }
145 |
146 | # Keep all classes that use Gson annotations
147 | -keepclassmembers class * {
148 | @com.google.gson.annotations.SerializedName ;
149 | @com.google.gson.annotations.Expose ;
150 | }
151 |
152 | # Keep all model classes that implement Serializable (if this is your pattern)
153 | -keep class * implements java.io.Serializable {
154 | *;
155 | }
156 | ```
157 | ## 2.3.54 - 2025-07-24
158 | ### Enhancement Feature:
159 | • Updating to support latest android api 35
160 | • Updating support lib to support android api 35
161 | ### Impact on existing integrations:
162 | • May need to update gradles to support latest apis support sdk 35
163 | • compileSdkVersion 35
164 | • targetSdkVersion 35
165 | • Project build.gradle classpath 'com.android.tools.build:gradle:8.6.0'
166 | • Gradle wrapper.properties distributionUrl=https://services.gradle.org/distributions/gradle-8.10.2-bin.zip
167 | • May need to add proguard rules# Add project specific ProGuard rules here.
168 | You can control the set of applied configuration files using the
169 | proguardFiles setting in build.gradle.
170 | For more details, see http://developer.android.com/guide/developing/tools/proguard.html
171 | If your project uses WebView with JS, uncomment the following
172 | and specify the fully qualified class name to the JavaScript interface
173 |
174 | ```
175 | -assumenosideeffects class android.util.Log {
176 | public static boolean isLoggable(java.lang.String, int);
177 | public static int v(...);
178 | public static int i(...);
179 | public static int w(...);
180 | public static int d(...);
181 | public static int e(...);
182 | }
183 | -keep class com.facebook.react.** { *; }
184 | -keep class com.facebook.** { *; }
185 | -keep class com.crashlytics.** { *; }
186 | -keep class com.qualtrics.** {*;}
187 | -keep public class com.horcrux.svg.** {*;}
188 | -keep class com.google.android.gms.common.** {*;}
189 | -keep class **.BuildConfig { *; }
190 | -dontwarn com.crashlytics.**
191 |
192 | -keep class com.adjust.sdk.** { *; }
193 | -keep class com.google.android.gms.common.ConnectionResult {
194 | int SUCCESS;
195 | }
196 | -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
197 | com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
198 | }
199 | -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
200 | java.lang.String getId();
201 | boolean isLimitAdTrackingEnabled();
202 | }
203 | -keep public class com.android.installreferrer.** { *; }
204 | -keep class com.shopify.reactnative.skia.SkiaDomView {*;}
205 |
206 | # Added as per WhatFix Mobile SDK.
207 | -dontwarn is.leap.android.**
208 |
209 | -keep class is.leap.android.** {*;}
210 |
211 | -dontwarn okhttp3.internal.platform.**
212 | -dontwarn org.conscrypt.**
213 | -dontwarn org.bouncycastle.**
214 | -dontwarn org.openjsse.**
215 |
216 | # Please add these rules to your existing keep rules in order to suppress warnings.
217 | # This is generated automatically by the Android Gradle plugin.
218 | -dontwarn com.bun.miitmdid.core.MdidSdkHelper
219 | -dontwarn com.bun.miitmdid.interfaces.IIdentifierListener
220 | -dontwarn com.bun.miitmdid.interfaces.IdSupplier
221 | -dontwarn com.facebook.stetho.dumpapp.DumpException
222 | -dontwarn com.facebook.stetho.dumpapp.DumpUsageException
223 | -dontwarn com.facebook.stetho.dumpapp.DumperContext
224 | -dontwarn com.facebook.stetho.dumpapp.DumperPlugin
225 | -dontwarn com.huawei.hms.ads.identifier.AdvertisingIdClient$Info
226 | -dontwarn com.huawei.hms.ads.identifier.AdvertisingIdClient
227 | -dontwarn org.slf4j.impl.StaticLoggerBinder
228 | -dontwarn org.slf4j.impl.StaticMDCBinder
229 | -dontwarn org.slf4j.impl.StaticMarkerBinder
230 |
231 | # Retrofit
232 | -keepattributes Signature
233 | -keepattributes RuntimeVisibleAnnotations
234 | -keep class retrofit2.** { *; }
235 | -keep interface retrofit2.** { *; }
236 | -keepclassmembers class * {
237 | @retrofit2.http.* ;
238 | }
239 |
240 | # OkHttp
241 | -keep class okhttp3.** { *; }
242 | -keep interface okhttp3.** { *; }
243 |
244 | # Gson
245 | #-keep class com.google.gson.** { *; }
246 | -keepattributes EnclosingMethod
247 | -keepattributes InnerClasses
248 | -keepattributes Signature
249 |
250 | -keep class company.tap.gosellapi.** { *; }
251 | -keep class company.tap.goSellSDKExamplee.** { *; }
252 | -keep class com.tapgooglepayrn.** { *; }
253 | -keep public class gotap.com.tapglkitandroid.** { *; }
254 |
255 | # Gson TypeToken
256 | -keep class com.google.gson.reflect.TypeToken { *; }
257 | -keep class * extends com.google.gson.reflect.TypeToken
258 |
259 |
260 | -keep class **.CreateTokenGPayRequest { *; }
261 | -keep class **.CreateTokenGPayRequest$Builder { *; }
262 |
263 | # If the class is in a specific package, be more specific (replace with your actual package):
264 | # -keep class com.yourpackage.CreateTokenGPayRequest { *; }
265 | # -keep class com.yourpackage.CreateTokenGPayRequest$Builder { *; }
266 |
267 | # Keep all classes that use Gson annotations
268 | -keepclassmembers class * {
269 | @com.google.gson.annotations.SerializedName ;
270 | @com.google.gson.annotations.Expose ;
271 | }
272 |
273 | # Keep all model classes that implement Serializable (if this is your pattern)
274 | -keep class * implements java.io.Serializable {
275 | *;
276 | }
277 | ```
278 | ## 2.3.53 - 2025-07-24
279 |
280 | ### Enhancement Feature:
281 | • Updating to support latest android api 35
282 | ### Impact on existing integrations:
283 | • May need to update gradles to support latest apis support sdk 35
284 | • compileSdkVersion 35
285 | • targetSdkVersion 35
286 | • Project build.gradle classpath 'com.android.tools.build:gradle:8.6.0'
287 | • Gradle wrapper.properties distributionUrl=https://services.gradle.org/distributions/gradle-8.10.2-bin.zip
288 | • May need to add proguard rules# Add project specific ProGuard rules here.
289 | You can control the set of applied configuration files using the
290 | proguardFiles setting in build.gradle.
291 | For more details, see http://developer.android.com/guide/developing/tools/proguard.html
292 | If your project uses WebView with JS, uncomment the following
293 | and specify the fully qualified class name to the JavaScript interface
294 |
295 | ```
296 | -assumenosideeffects class android.util.Log {
297 | public static boolean isLoggable(java.lang.String, int);
298 | public static int v(...);
299 | public static int i(...);
300 | public static int w(...);
301 | public static int d(...);
302 | public static int e(...);
303 | }
304 | -keep class com.facebook.react.** { *; }
305 | -keep class com.facebook.** { *; }
306 | -keep class com.crashlytics.** { *; }
307 | -keep class com.qualtrics.** {*;}
308 | -keep public class com.horcrux.svg.** {*;}
309 | -keep class com.google.android.gms.common.** {*;}
310 | -keep class **.BuildConfig { *; }
311 | -dontwarn com.crashlytics.**
312 |
313 | -keep class com.adjust.sdk.** { *; }
314 | -keep class com.google.android.gms.common.ConnectionResult {
315 | int SUCCESS;
316 | }
317 | -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient {
318 | com.google.android.gms.ads.identifier.AdvertisingIdClient$Info getAdvertisingIdInfo(android.content.Context);
319 | }
320 | -keep class com.google.android.gms.ads.identifier.AdvertisingIdClient$Info {
321 | java.lang.String getId();
322 | boolean isLimitAdTrackingEnabled();
323 | }
324 | -keep public class com.android.installreferrer.** { *; }
325 | -keep class com.shopify.reactnative.skia.SkiaDomView {*;}
326 |
327 | # Added as per WhatFix Mobile SDK.
328 | -dontwarn is.leap.android.**
329 |
330 | -keep class is.leap.android.** {*;}
331 |
332 | -dontwarn okhttp3.internal.platform.**
333 | -dontwarn org.conscrypt.**
334 | -dontwarn org.bouncycastle.**
335 | -dontwarn org.openjsse.**
336 |
337 | # Please add these rules to your existing keep rules in order to suppress warnings.
338 | # This is generated automatically by the Android Gradle plugin.
339 | -dontwarn com.bun.miitmdid.core.MdidSdkHelper
340 | -dontwarn com.bun.miitmdid.interfaces.IIdentifierListener
341 | -dontwarn com.bun.miitmdid.interfaces.IdSupplier
342 | -dontwarn com.facebook.stetho.dumpapp.DumpException
343 | -dontwarn com.facebook.stetho.dumpapp.DumpUsageException
344 | -dontwarn com.facebook.stetho.dumpapp.DumperContext
345 | -dontwarn com.facebook.stetho.dumpapp.DumperPlugin
346 | -dontwarn com.huawei.hms.ads.identifier.AdvertisingIdClient$Info
347 | -dontwarn com.huawei.hms.ads.identifier.AdvertisingIdClient
348 | -dontwarn org.slf4j.impl.StaticLoggerBinder
349 | -dontwarn org.slf4j.impl.StaticMDCBinder
350 | -dontwarn org.slf4j.impl.StaticMarkerBinder
351 |
352 | # Retrofit
353 | -keepattributes Signature
354 | -keepattributes RuntimeVisibleAnnotations
355 | -keep class retrofit2.** { *; }
356 | -keep interface retrofit2.** { *; }
357 | -keepclassmembers class * {
358 | @retrofit2.http.* ;
359 | }
360 |
361 | # OkHttp
362 | -keep class okhttp3.** { *; }
363 | -keep interface okhttp3.** { *; }
364 |
365 | # Gson
366 | #-keep class com.google.gson.** { *; }
367 | -keepattributes EnclosingMethod
368 | -keepattributes InnerClasses
369 | -keepattributes Signature
370 |
371 | -keep class company.tap.gosellapi.** { *; }
372 | -keep class company.tap.goSellSDKExamplee.** { *; }
373 | -keep class com.tapgooglepayrn.** { *; }
374 | -keep public class gotap.com.tapglkitandroid.** { *; }
375 |
376 | # Gson TypeToken
377 | -keep class com.google.gson.reflect.TypeToken { *; }
378 | -keep class * extends com.google.gson.reflect.TypeToken
379 |
380 |
381 | -keep class **.CreateTokenGPayRequest { *; }
382 | -keep class **.CreateTokenGPayRequest$Builder { *; }
383 |
384 | # If the class is in a specific package, be more specific (replace with your actual package):
385 | # -keep class com.yourpackage.CreateTokenGPayRequest { *; }
386 | # -keep class com.yourpackage.CreateTokenGPayRequest$Builder { *; }
387 |
388 | # Keep all classes that use Gson annotations
389 | -keepclassmembers class * {
390 | @com.google.gson.annotations.SerializedName ;
391 | @com.google.gson.annotations.Expose ;
392 | }
393 |
394 | # Keep all model classes that implement Serializable (if this is your pattern)
395 | -keep class * implements java.io.Serializable {
396 | *;
397 | }
398 | ```
399 |
400 | ## 2.3.52 - 2025-04-20
401 |
402 | - Fix Keyboard issue in ios
403 |
404 | ## 2.3.51 - 2025-04-16
405 |
406 | - Fix tokenize mode callback in android
407 |
408 | ## 2.3.50 - 2025-04-16
409 |
410 | - Fix tokenize mode callback in android
411 |
412 | ## 2.3.49 - 2025-03-19
413 |
414 | - Update SAR symbol
415 |
416 | ## 2.3.48 - 2025-01-12
417 |
418 | - Update android dependency
419 |
420 | ## 2.3.47 - 2024-12-24
421 |
422 | - Update iOS dependency to fix ios 18 webkit issue
423 |
424 | ## 2.3.46 - 2024-12-12
425 |
426 | - Add apple pay closed listener
427 |
428 | ## 2.3.45 - 2024-11-21
429 |
430 | - Fix paymentMetaData not sent in ios.
431 | - Fix paymentMetaData typo in android
432 |
433 | ## 2.3.44 - 2024-10-30
434 |
435 | - Update Android dependency.
436 |
437 | ## 2.3.43 - 2024-10-24
438 |
439 | - Update iOS dependency.
440 |
441 | ## 2.3.42 - 2024-10-21
442 |
443 | - Update iOS dependency.
444 |
445 | ## 2.3.41 - 2024-10-17
446 |
447 | - Remove card iO.
448 |
449 | ## 2.3.40 - 2024-09-25
450 |
451 | - Update iOS dependency.
452 |
453 | ## 1.0.70 - 2024-09-23
454 |
455 | - Update Android dependency.
456 |
457 | ## 1.0.69 - 2024-08-29
458 |
459 | - Add post url in save card.
460 |
461 | ## 1.0.68 - 2024-08-26
462 |
463 | - Update Android dependency.
464 |
465 | ## 1.0.67 - 2024-08-25
466 |
467 | - Update Android dependency.
468 |
469 | ## 1.0.66 - 2024-08-12
470 |
471 | - Remove setupApplePay.
472 |
473 | ## 1.0.65 - 2024-08-08
474 |
475 | - Fix payment agreement json
476 |
477 | ## 1.0.64 - 2024-08-08
478 |
479 | - Add payment agreement in save card response
480 |
481 | ## 1.0.63 - 2024-07-22
482 |
483 | - Fix parsing receipt in android
484 |
485 | ## 1.0.61 - 2024-07-02
486 |
487 | - Upgrade readme
488 |
489 | ## 1.0.60 - 2024-07-02
490 |
491 | - Upgrade android version
492 |
493 | ## 1.0.59 - 2024-07-02
494 |
495 | - Fix ios transaction fails when there is no phone number.
496 |
497 | ## 1.0.58 - 2024-07-02
498 |
499 | - Remove fonts from android.
500 |
501 | ## 1.0.57 - 2024-04-28
502 |
503 | - Disabling opening a payment option while executing a transaction.
504 |
505 | ## 1.0.56 - 2024-04-15
506 |
507 | - Update android
508 | ### Impact on existing integrations:
509 | - May need to update gradles to support latest apis support sdk 34
510 | - compileSdkVersion 34
511 | - targetSdkVersion 34
512 | - Project build.gradle classpath 'com.android.tools.build:gradle:7.3.1'
513 | - Gradle wrapper.properties distributionUrl=https\://services.gradle.org/distributions/gradle-7.4.2-bin.zip
514 |
515 |
516 | ## 1.0.55 - 2024-04-01
517 |
518 | - Add recite
519 |
520 | ## 1.0.54 - 2024-03-12
521 |
522 | - Update Android native lib
523 |
524 | ## 1.0.53 - 2024-01-29
525 |
526 | - Add payment reference in response
527 |
528 | ## 1.0.52 - 2023-12-25
529 |
530 | - Enable scan feature for iOS
531 |
532 | ## 1.0.51 - 2023-12-21
533 |
534 | - Update iOS native lib
535 |
536 | ## 1.0.50 - 2023-12-21
537 |
538 | - Update iOS native lib
539 |
540 | ## 1.0.49 - 2023-12-14
541 |
542 | - Update Android native lib
543 |
544 | ## 1.0.48 - 2023-12-11
545 |
546 | - Update ios native lib
547 |
548 | ## 1.0.47 - 2023-12-05
549 |
550 | - Add sdk appearance param
551 |
552 | ## 1.0.46 - 2023-12-05
553 |
554 | - Add supported payments methods
555 |
556 | ## 1.0.45 - 2023-11-28
557 |
558 | - Update ios native lib
559 |
560 |
561 | ## 1.0.44 - 2023-11-26
562 |
563 | - min sdk for android 21
564 |
565 |
566 | ## 1.0.43 - 2023-11-26
567 |
568 | - min sdk for android 21
569 |
570 |
571 | ## 1.0.42 - 2023-11-06
572 |
573 | - Add allowed payment types
574 |
575 |
576 | ## 1.0.41 - 2023-10-24
577 |
578 | - Add apple pay tokenized failed callback
579 | - Add apple pay tokenized success callback
580 |
581 | ## 1.0.40 - 2023-08-23
582 |
583 | - Update Android GoSellSdk
584 | ## 1.0.39 - 2023-08-23
585 |
586 | - Update Android GoSellSdk
587 | ## 1.0.38 - 2023-08-23
588 |
589 | - Update Android GoSellSdk
590 | ## 1.0.37 - 2023-08-23
591 |
592 | - Update iOS GoSellSdk
593 | ## 1.0.36 - 2023-02-17
594 |
595 | - Add issuer response
596 |
597 | ## 1.0.35- 2023-02-17
598 |
599 | - Update iOS/Android GoSellSdk
600 | ## 1.0.34 - 2023-02-17
601 |
602 | ## 1.0.34 - 2023-02-17
603 |
604 | - Fix static framrworks option in iOS
605 | ## 1.0.33 - 2023-01-24
606 |
607 | - add charge id callback
608 |
609 | ## 1.0.32 - 2023-01-12
610 |
611 | - iOS> update iOS sdk version
612 |
613 | ## 1.0.31 - 2022-12-01
614 |
615 | - Android> googlePay issue fixing
616 | - Android> googlePay issue fixing
617 | - Android> googlePay issue fixing
618 | - Android> googlePay issue fixing
619 | - Android> googlePay issue fixing
620 | - Android> googlePay issue fixing
621 | - Android> googlePay issue fixing
622 | - Android> googlePay issue fixing
623 | - Android> googlePay issue fixing
624 | - Android> googlePay issue fixing
625 | - Android> googlePay issue fixing
626 | - Android> googlePay issue fixing
627 | - Android> googlePay issue fixing
628 | - Android> googlePay issue fixing
629 | - Android> googlePay issue fixing
630 |
631 | ## 1.0.30 - 2022-11-02
632 |
633 | - iOS> goSellSDK pods issue fixed
634 | - iOS> goSellSDK pods issue fixing
635 | - iOS> goSellSDK pods issue fixing
636 | - iOS> goSellSDK pods issue fixing
637 | - iOS> goSellSDK pods issue fixing
638 | - iOS> goSellSDK pods issue fixing
639 | - iOS> goSellSDK pods issue fixing
640 | - iOS> goSellSDK pods issue fixing
641 | - iOS> goSellSDK pods issue fixing
642 |
643 |
644 | ## 1.0.29 - 2022-09-27
645 |
646 | - Android> asyncPaymentStarted methods prints bug fixed
647 | - Android> asyncPaymentStarted methods prints bug fixed retrofit version tested
648 | - Android> asyncPaymentStarted methods prints bug fixed and Retrofit version updated
649 |
650 | ## 1.0.28 - 2022-09-20
651 |
652 | - Android> Inside GoSellSDKDelegate asyncPaymentStarted method added
653 |
654 | ## 1.0.27 - 2022-09-19
655 |
656 | - Android> Retrofit library and androix version updated
657 |
658 | ## 1.0.26
659 |
660 | - iOS> Transaction mode default value updated and will thorw exception on Invalid Trx mode
661 | - iOS> Transaction mode default value updated and will thorw exception on Invalid Trx mode
662 |
663 |
664 |
665 | ## 1.0.25
666 | - Updated configuration file and set back to original
667 |
668 | ## 1.0.24
669 |
670 | - iOS> Transaction mode work updated
671 |
672 | ## 1.0.23
673 |
674 | - iOS> Transaction mode added
675 |
676 |
677 | ## 1.0.22
678 |
679 | ## 1.0.21
680 |
681 | - Android > align saved card text in arabic view from right to left same as iOS
682 | - iOS > MM/YY update text in arabic to be same as android
683 | - iOS > in case of dark mode activated > slider shows in dark color
684 |
685 | ## 1.0.20
686 |
687 | - Typing name on the card and clicking “Space” from keyboard > user can’t see space while typing
688 |
689 | ## 1.0.19
690 |
691 | - “Customer first name is required” error in Android while performing a transaction with non-3ds card
692 | - “next” is taking the cursor to “expiry date” instead of CVV
693 |
694 | ## 1.0.18
695 |
696 | ## 1.0.17
697 |
698 | - Save Card Mode: The return key should hide the keyboard
699 | - Card name should not allow type Arabic characters
700 | - Toggle button blinking issue fixed
701 | - iOS in Save Card mode -Text difference between IOS & Android. This is fixed
702 | - Android Tokenize Mode: Text on tokenize button updated with the amount
703 | - Save Card Mode, Tokenize Mode: Enabled Windowed mode by default
704 | - While entering a card number in iOS, Tokenize mode, while typing on space, the cursor is not moving. But while entering the next letter, the space is visible.
705 | - Arabic placeholder for the expiry date mm/yy synced with Android.
706 | - Save Card Mode: The return key should hide the keyboard
707 | - Save Card Mode: Greyed button action stopped.
--------------------------------------------------------------------------------
/android/src/main/java/company/tap/goSellSDKExamplee/GoSellSdKDelegate.java:
--------------------------------------------------------------------------------
1 | package company.tap.goSellSDKExamplee;
2 |
3 | import android.app.Activity;
4 | import android.os.Build;
5 | import android.os.CountDownTimer;
6 | import android.util.Log;
7 | import android.widget.Toast;
8 |
9 | import androidx.annotation.NonNull;
10 | import androidx.annotation.Nullable;
11 | import androidx.annotation.RequiresApi;
12 |
13 | import com.facebook.react.bridge.WritableMap;
14 | import com.facebook.react.bridge.WritableNativeMap;
15 |
16 | import org.json.JSONException;
17 |
18 | import java.math.BigDecimal;
19 | import java.util.ArrayList;
20 | import java.util.HashMap;
21 | import java.util.Map;
22 | import java.util.Objects;
23 |
24 | import company.tap.gosellapi.GoSellSDK;
25 | import company.tap.gosellapi.internal.api.callbacks.GoSellError;
26 | import company.tap.gosellapi.internal.api.models.Authorize;
27 | import company.tap.gosellapi.internal.api.models.Charge;
28 | import company.tap.gosellapi.internal.api.models.Contract;
29 | import company.tap.gosellapi.internal.api.models.PaymentAgreement;
30 | import company.tap.gosellapi.internal.api.models.SaveCard;
31 | import company.tap.gosellapi.internal.api.models.Token;
32 | import company.tap.gosellapi.open.controllers.SDKSession;
33 | import company.tap.gosellapi.open.controllers.ThemeObject;
34 | import company.tap.gosellapi.open.delegate.SessionDelegate;
35 | import company.tap.gosellapi.open.enums.AppearanceMode;
36 | import company.tap.gosellapi.open.exception.CurrencyException;
37 | import company.tap.gosellapi.open.models.CardsList;
38 | import company.tap.gosellapi.open.models.Reference;
39 | import company.tap.gosellapi.open.models.TapCurrency;
40 |
41 |
42 | public class GoSellSdKDelegate implements SessionDelegate {
43 |
44 | private SDKSession sdkSession;
45 | private Activity activity;
46 | private RNGosellSdkReactNativeModule callback;
47 |
48 | private Reference reference;
49 | public GoSellSdKDelegate(Activity _activity) {
50 | this.activity = _activity;
51 | }
52 |
53 |
54 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
55 | public void startSDK(
56 | HashMap sdkConfigurations, RNGosellSdkReactNativeModule result, Activity activity1, int timeout) {
57 | activity = activity1;
58 | //Commented to testing
59 | /* if (!setPendingMethodCallAndResult(methodCall, result)) {
60 | finishWithAlreadyActiveError(result);
61 | return;
62 | }*/
63 |
64 | if (timeout > 0) {
65 | new CountDownTimer(timeout, 1) {
66 | public void onTick(long millisUntilFinished) {}
67 | public void onFinish() {
68 | terminatePayment();
69 | }
70 | }.start();
71 | }
72 |
73 | // start SDK
74 | showSDK(sdkConfigurations, result);
75 | }
76 |
77 | public void terminatePayment() {
78 | System.out.println("terminate session!");
79 | Log.d("MainActivity", "Session Terminated.........");
80 | if (activity != null) {
81 | sdkSession.cancelSession(activity);
82 | }
83 | }
84 |
85 |
86 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
87 | private void showSDK(HashMap sdkConfigurations, RNGosellSdkReactNativeModule result) {
88 | HashMap sessionParameters = (HashMap) sdkConfigurations
89 | .get("sessionParameters");
90 | /**
91 | * Required step. Configure SDK with your Secret API key and App Bundle name
92 | * registered with tap company.
93 | */
94 | HashMap appConfigurations = (HashMap) sdkConfigurations.get("appCredentials");
95 | String sandboxKey = appConfigurations.get("sandbox_secrete_key");
96 | String productionKey = appConfigurations.get("production_secrete_key");
97 | String activeKey = sandboxKey;
98 | if ("SDKMode.Production".equalsIgnoreCase(sessionParameters.get("SDKMode").toString()))
99 | activeKey = productionKey;
100 | // System.out.println("activeKey : " + activeKey);
101 | configureApp(activeKey, appConfigurations.get("bundleID"), appConfigurations.get("language"), activity);
102 |
103 | // configureSDKThemeObject();
104 |
105 | /**
106 | * Required step. Configure SDK Session with all required data.
107 | */
108 | configureSDKSession(sessionParameters, result);
109 | if(sessionParameters.get("trxMode").toString().equals("TransactionMode.SAVE_CARD")){
110 | // ThemeObject.getInstance().setPayButtonText(activity.getResources().getString(company.tap.gosellapi.R.string.save_card));
111 | } else {
112 | // ThemeObject.getInstance().setPayButtonText(activity.getResources().getString(company.tap.gosellapi.R.string.pay));
113 | }
114 | if (sessionParameters.get("appearanceMode") != null) {
115 | ThemeObject.getInstance()
116 | .setAppearanceMode(DeserializationUtil.getAppearanceMode((double) sessionParameters.get("appearanceMode")));
117 | }
118 |
119 | sdkSession.start(activity);
120 | }
121 |
122 |
123 | @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
124 | private void configureApp(String secrete_key, String bundleID, String language, Activity activity1) {
125 | System.out.println("act val :" + this.activity);
126 | this.activity = activity1;
127 | GoSellSDK.init(this.activity, secrete_key, bundleID); // to be replaced by merchant
128 | ThemeObject.getInstance().setSdkLanguage(language);
129 | }
130 |
131 | /**
132 | * Configure SDK Session
133 | *
134 | * @param sessionParameters
135 | * @param result
136 | */
137 | @RequiresApi(api = Build.VERSION_CODES.KITKAT)
138 | private void configureSDKSession(HashMap sessionParameters, RNGosellSdkReactNativeModule result) {
139 | callback = result;
140 | reference = null;
141 | // Instantiate SDK Session
142 | if (sdkSession == null)
143 | sdkSession = new SDKSession(); // ** Required **
144 |
145 | // pass your activity as a session delegate to listen to SDK internal payment
146 | // process follow
147 | sdkSession.addSessionDelegate(this); // ** Required **
148 |
149 | // initiate PaymentDataSource
150 | sdkSession.instantiatePaymentDataSource(); // ** Required **
151 |
152 | // sdk mode
153 | sdkSession.setTransactionMode(
154 | DeserializationUtil.getTransactionMode(sessionParameters.get("trxMode").toString()));
155 |
156 | // set transaction currency associated to your account
157 | TapCurrency transactionCurrency;
158 | try {
159 | transactionCurrency = new TapCurrency(
160 | (String) Objects.requireNonNull(sessionParameters.get("transactionCurrency")));
161 | } catch (CurrencyException c) {
162 | Log.d("GoSellSDKDelegate : ", "Unknown currency exception thrown : "
163 | + (String) Objects.requireNonNull(sessionParameters.get("transactionCurrency")));
164 | transactionCurrency = new TapCurrency("KWD");
165 | } catch (Exception e) {
166 | Log.d("GoSellSDKDelegate : ", "Unknown currency: "
167 | + (String) Objects.requireNonNull(sessionParameters.get("transactionCurrency")));
168 | transactionCurrency = new TapCurrency("KWD");
169 | }
170 |
171 | sdkSession.setTransactionCurrency(transactionCurrency); // ** Required **
172 |
173 | // Using static CustomerBuilder method available inside TAP Customer Class you
174 | // can populate TAP Customer object and pass it to SDK
175 | try {
176 | sdkSession.setCustomer(DeserializationUtil.getCustomer(sessionParameters)); // ** Required **
177 |
178 | }catch (JSONException e){
179 | e.printStackTrace();
180 | }
181 |
182 | // Set Total Amount. The Total amount will be recalculated according to provided
183 | // Taxes and Shipping
184 | BigDecimal amount;
185 | try {
186 | amount = new BigDecimal(
187 | Double.parseDouble((String) Objects.requireNonNull(sessionParameters.get("amount"))));
188 | } catch (Exception e) {
189 | Log.d("GoSellSDKDelegate : ", "Invalid amount can't be parsed to double : "
190 | + (String) Objects.requireNonNull(sessionParameters.get("amount")));
191 | amount = BigDecimal.ZERO;
192 | }
193 | sdkSession.setAmount(amount); // ** Required **
194 |
195 | sdkSession.setPaymentItems(DeserializationUtil.getPaymentItems(sessionParameters.get("paymentitems")));//**Optional you can pass empty array list**//
196 |
197 | // Set Taxes array list
198 | sdkSession.setTaxes(DeserializationUtil.getTaxes(sessionParameters.get("taxes")));// ** Optional ** you can pass empty array list
199 |
200 | // Set Shipping array list
201 | sdkSession.setShipping(DeserializationUtil.getShipping(sessionParameters.get("shipping")));// ** Optional ** you can pass empty array list
202 |
203 | // Post URL
204 | if (sessionParameters.get("postURL") != null) {
205 | sdkSession.setPostURL(sessionParameters.get("postURL").toString());// ** Optional **
206 | }
207 |
208 | // Payment Description
209 | sdkSession.setPaymentDescription(sessionParameters.get("paymentDescription").toString()); // ** Optional **
210 |
211 | // Payment Extra Info
212 | sdkSession.setPaymentMetadata(DeserializationUtil.getMetaData(sessionParameters.get("paymentMetaData")));// **Optional** you can pass empty array hashmap//
213 |
214 | // Payment Reference
215 | sdkSession.setPaymentReference(DeserializationUtil.getReference(sessionParameters.get("paymentReference"))); // **Optional**you can pass null
216 | reference = DeserializationUtil.getReference(sessionParameters.get("paymentReference"));
217 | // Payment Statement Descriptor
218 | sdkSession.setPaymentStatementDescriptor(sessionParameters.get("paymentStatementDescriptor").toString()); // **Optional**//
219 |
220 | // Enable or Disable Saving Card
221 | sdkSession.isUserAllowedToSaveCard((boolean) sessionParameters.get("isUserAllowedToSaveCard"));
222 | // ** Required you can pass boolean //
223 | sdkSession.setSupportedPaymentMethods((ArrayList) sessionParameters.get("supportedPaymentMethods"));
224 |
225 | // Enable or Disable 3DSecure
226 | sdkSession.isRequires3DSecure((boolean) sessionParameters.get("isRequires3DSecure"));
227 |
228 | // Set Receipt Settings [SMS - Email ]
229 | sdkSession.setReceiptSettings(DeserializationUtil.getReceipt(sessionParameters.get("receiptSettings"))); // **Optional** you can pass Receipt object or null
230 |
231 | // Set Authorize Action
232 | sdkSession.setAuthorizeAction(DeserializationUtil.getAuthorizeAction(sessionParameters.get("authorizeAction"))); // **Optional**you can pass AuthorizeAction object or null
233 |
234 | sdkSession.setDestination(DeserializationUtil.getDestinations(sessionParameters.get("destinations"))); //**Optional you can pass Destinations object or null //
235 |
236 | sdkSession.setMerchantID(sessionParameters.get("merchantID").toString()); // ** Optional ** you can pass merchant id or null
237 |
238 |
239 | sdkSession.setCardType(DeserializationUtil.getCardType(sessionParameters.get("allowedCadTypes").toString())); //**Optional ** You can pass [CREDIT/DEBIT] id.
240 |
241 | sdkSession.setPaymentType(DeserializationUtil.getPaymentType(sessionParameters.get("paymentType").toString()));
242 |
243 | // sdkSession.setGooglePayWalletMode(DeserializationUtil.getGPayWalletMode(sessionParameters.get("GPayWalletMode").toString())); //** Required ** For setting GooglePAY Environment
244 |
245 | sdkSession.setDefaultCardHolderName(sessionParameters.get("cardHolderName").toString()); // ** Optional ** you can pass default CardHolderName of the user .So you don't need to type it.
246 |
247 | sdkSession.isUserAllowedToEnableCardHolderName((boolean) sessionParameters.get("editCardHolderName")); // **Optional** you can enable/ disable default CardHolderName .
248 |
249 | }
250 | ////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
251 |
252 | private void sendChargeResult(Charge charge, String paymentStatus, String trx_mode) {
253 | HashMap resultMap = new HashMap<>();
254 | if (charge.getStatus() != null)
255 | resultMap.put("status", charge.getStatus().name());
256 | resultMap.put("description", charge.getDescription());
257 | resultMap.put("message", charge.getResponse().getMessage());
258 | resultMap.put("charge_id", charge.getId());
259 | if (charge.getReceipt() != null) {
260 | HashMap receiptSettingsMap = new HashMap<>();
261 | receiptSettingsMap.put("id", charge.getReceipt().getId());
262 | receiptSettingsMap.put("email", charge.getReceipt().isEmail());
263 | receiptSettingsMap.put("sms", charge.getReceipt().isSms());
264 | resultMap.put("receipt_settings", receiptSettingsMap);
265 | }
266 | if (charge.getCard() != null) {
267 | resultMap.put("card_first_six", charge.getCard().getFirstSix());
268 | resultMap.put("card_last_four", charge.getCard().getLast4());
269 | resultMap.put("card_object", charge.getCard().getObject());
270 | resultMap.put("card_brand", charge.getCard().getBrand());
271 | if (charge.getCard().getExpiry() != null) {
272 | resultMap.put("card_exp_month", charge.getCard().getExpiry().getMonth());
273 | resultMap.put("card_exp_year", charge.getCard().getExpiry().getYear());
274 | } else {
275 | resultMap.put("card_exp_month", charge.getCard().getExp_month());
276 | resultMap.put("card_exp_year", charge.getCard().getExp_year());
277 | }
278 | }
279 | if (charge.getAcquirer() != null) {
280 | resultMap.put("acquirer_id", charge.getAcquirer().getId());
281 | resultMap.put("acquirer_response_code", charge.getAcquirer().getResponse().getCode());
282 | resultMap.put("acquirer_response_message", charge.getAcquirer().getResponse().getMessage());
283 | }
284 | if (charge.getSource() != null) {
285 | resultMap.put("source_id", charge.getSource().getId());
286 | if (charge.getSource().getChannel() != null)
287 | resultMap.put("source_channel", charge.getSource().getChannel().name());
288 | resultMap.put("source_object", charge.getSource().getObject());
289 | resultMap.put("source_payment_type", charge.getSource().getPaymentType());
290 | }
291 |
292 | if (charge.getCustomer() != null) {
293 | resultMap.put("customer_id", charge.getCustomer().getIdentifier());
294 | resultMap.put("customer_first_name", charge.getCustomer().getFirstName());
295 | resultMap.put("customer_middle_name", charge.getCustomer().getMiddleName());
296 | resultMap.put("customer_last_name", charge.getCustomer().getLastName());
297 | resultMap.put("customer_email", charge.getCustomer().getEmail());
298 | }
299 | if (reference != null) {
300 | if (reference.getOrder() != null) {
301 | resultMap.put("order_number", reference.getOrder());
302 | }
303 | if (reference.getTransaction() != null) {
304 | resultMap.put("transaction_number", reference.getTransaction());
305 | }
306 | }
307 |
308 | resultMap.put("sdk_result", paymentStatus);
309 | resultMap.put("trx_mode", trx_mode);
310 | resultMap.put("id", charge.getId());
311 | System.out.println("resultMap on success = " + resultMap);
312 | System.out.println("callback on success = " + callback);
313 | callback.onSuccess(resultMap);
314 | callback = null;
315 | }
316 |
317 | private void sendTokenResult(Token token, String paymentStatus, boolean saveCard) {
318 | HashMap resultMap = new HashMap<>();
319 |
320 | resultMap.put("token", token.getId());
321 | resultMap.put("token_currency", token.getCurrency());
322 | if (token.getCard() != null) {
323 | resultMap.put("card_first_six", token.getCard().getFirstSix());
324 | resultMap.put("card_last_four", token.getCard().getLastFour());
325 | resultMap.put("card_object", token.getCard().getObject());
326 | resultMap.put("card_exp_month", "" + token.getCard().getExpirationYear());
327 | resultMap.put("card_exp_year", "" + token.getCard().getExpirationMonth());
328 | HashMap issuerMap = new HashMap<>();
329 |
330 | if (token.getCard().getIssuer() != null ){
331 | issuerMap.put("id", token.getCard().getIssuer().getId());
332 | issuerMap.put("bank", token.getCard().getIssuer().getBank());
333 | issuerMap.put("country", token.getCard().getIssuer().getCountry());
334 | resultMap.put("issuer", issuerMap);
335 | }
336 | }
337 | resultMap.put("save_card", String.valueOf(saveCard));
338 | resultMap.put("sdk_result", paymentStatus);
339 | resultMap.put("trx_mode", "TOKENIZE");
340 | if (reference != null) {
341 | if (reference.getOrder() != null) {
342 | resultMap.put("order_number", reference.getOrder());
343 | }
344 | if (reference.getTransaction() != null) {
345 | resultMap.put("transaction_number", reference.getTransaction());
346 | }
347 | }
348 | callback.onSuccess(resultMap);
349 | callback = null;
350 | }
351 |
352 | // @Override
353 | // public void asyncPaymentStarted(@NonNull Charge charge) {
354 | // System.out.println("asyncPaymentStarted: ");
355 | // System.out.println("Charge id:"+charge.getId());
356 | // System.out.println("Fawry reference:"+charge.getTransaction().getOrder().getReference());
357 | // }
358 |
359 |
360 | private void sendSDKError(int errorCode, String errorMessage, String errorBody) {
361 | HashMap resultMap = new HashMap<>();
362 | resultMap.put("sdk_result", "SDK_ERROR");
363 | resultMap.put("sdk_error_code", String.valueOf(errorCode));
364 | resultMap.put("sdk_error_message", errorMessage);
365 | resultMap.put("sdk_error_description", errorBody);
366 | if (reference != null) {
367 | if (reference.getOrder() != null) {
368 | resultMap.put("order_number", reference.getOrder());
369 | }
370 | if (reference.getTransaction() != null) {
371 | resultMap.put("transaction_number", reference.getTransaction());
372 | }
373 | }
374 | callback.onFailure(resultMap);
375 | callback = null;
376 | }
377 |
378 | //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////
379 | @Override
380 | public void paymentSucceed(@NonNull Charge charge) {
381 | System.out.println("paymentSucceed = " + charge.getCard() + " charge information" + charge.getId()+"getTransactionMode");
382 | sendChargeResult(charge, "SUCCESS", "CHARGE");
383 |
384 | Toast.makeText(activity, charge.getId(), Toast.LENGTH_SHORT).show();
385 | }
386 |
387 | @Override
388 | public void paymentFailed(@Nullable Charge charge) {
389 | sendChargeResult(charge, "FAILED", "CHARGE");
390 | }
391 |
392 | @Override
393 | public void authorizationSucceed(@NonNull Authorize authorize) {
394 | sendChargeResult(authorize, "SUCCESS", "AUTHORIZE");
395 | }
396 |
397 | @Override
398 | public void authorizationFailed(Authorize authorize) {
399 | sendChargeResult(authorize, "FAILED", "AUTHORIZE");
400 | }
401 |
402 | @Override
403 | public void cardSaved(@NonNull Charge charge) {
404 | System.out.println("charge in save card"+charge);
405 | sendSavedCardResult(charge, "SUCCESS", "SAVE_CARD");
406 | }
407 |
408 | @Override
409 | public void cardSavingFailed(@NonNull Charge charge) {
410 | sendSavedCardFailure(charge, "FAILED", "SAVE_CARD");
411 | }
412 |
413 | @Override
414 | public void cardTokenizedSuccessfully(@NonNull Token token) {
415 | // sendTokenResult(token, "SUCCESS");
416 | }
417 |
418 | @Override
419 | public void savedCardsList(@NonNull CardsList cardsList) {
420 | }
421 |
422 | @Override
423 | public void sdkError(@Nullable GoSellError goSellError) {
424 | if (goSellError != null) {
425 | System.out.println("SDK Process Error : " + goSellError.getErrorBody());
426 | System.out.println("SDK Process Error : " + goSellError.getErrorMessage());
427 | System.out.println("SDK Process Error : " + goSellError.getErrorCode());
428 | }
429 |
430 | sendSDKError(goSellError.getErrorCode(), goSellError.getErrorMessage(), goSellError.getErrorBody());
431 | Toast.makeText(activity.getBaseContext(), goSellError.getErrorMessage(), Toast.LENGTH_LONG).show();
432 | }
433 |
434 | @Override
435 | public void sessionIsStarting() {
436 | System.out.println(" Session Is Starting.....");
437 | }
438 |
439 | @Override
440 | public void sessionHasStarted() {
441 | System.out.println(" Session Has Started .......");
442 | }
443 |
444 | // public void googlePayFailed(String error) {
445 | // System.out.println("googlePayFailed : " + error);
446 | // sendSDKError(303, error, error);
447 |
448 | // Toast.makeText(activity.getBaseContext(), error, Toast.LENGTH_LONG).show();
449 |
450 | // // System.out.println("googlePayFailed : " + error);
451 | // // showDialog(error, "googlePayFailed", company.tap.gosellapi.R.drawable.icon_failed);
452 |
453 | // }
454 |
455 | @Override
456 | public void sessionCancelled() {
457 | Log.d("MainActivity", "Session Cancelled.........");
458 | HashMap resultMap = new HashMap<>();
459 | resultMap.put("sdk_result", "CANCELLED");
460 | if (reference != null) {
461 | if (reference.getOrder() != null) {
462 | resultMap.put("order_number", reference.getOrder());
463 | }
464 | if (reference.getTransaction() != null) {
465 | resultMap.put("transaction_number", reference.getTransaction());
466 | }
467 | }
468 | callback.onFailure(resultMap);
469 | callback = null;
470 | }
471 |
472 | @Override
473 | public void sessionFailedToStart() {
474 | Log.d("MainActivity", "Session Failed to start.........");
475 | }
476 |
477 | @Override
478 | public void invalidCardDetails() {
479 | System.out.println(" Card details are invalid....");
480 | }
481 |
482 | @Override
483 | public void backendUnknownError(String message) {
484 | System.out.println("Backend Un-Known error.... : " + message);
485 | sendSDKError(Constants.ERROR_CODE_BACKEND_UNKNOWN_ERROR, message, message);
486 | }
487 |
488 | @Override
489 | public void invalidTransactionMode() {
490 | System.out.println(" invalidTransactionMode ......");
491 | sendSDKError(Constants.ERROR_CODE_INVALID_TRX_MODE, "invalidTransactionMode", "invalidTransactionMode");
492 |
493 | }
494 |
495 | @Override
496 | public void invalidCustomerID() {
497 | System.out.println("Invalid Customer ID .......");
498 | sendSDKError(Constants.ERROR_CODE_INVALID_CUSTOMER_ID, "Invalid Customer ID ", "Invalid Customer ID ");
499 | }
500 |
501 | @Override
502 | public void userEnabledSaveCardOption(boolean saveCardEnabled) {
503 | System.out.println("userEnabledSaveCardOption : " + saveCardEnabled);
504 | }
505 |
506 | @Override
507 | public void cardTokenizedSuccessfully(@NonNull Token token, boolean saveCardEnabled) {
508 | sendTokenResult(token, "SUCCESS", saveCardEnabled);
509 | }
510 |
511 | @Override
512 | public void asyncPaymentStarted(@NonNull Charge charge) {
513 |
514 | }
515 |
516 | @Override
517 | public void paymentInitiated(@Nullable Charge charge) {
518 | if (charge != null) {
519 | HashMap resultMap = new HashMap<>();
520 | if (charge.getStatus() != null)
521 | resultMap.put("status", charge.getStatus().name());
522 | resultMap.put("description", charge.getDescription());
523 | resultMap.put("message", charge.getResponse().getMessage());
524 | resultMap.put("charge_id", charge.getId());
525 | if (charge.getCard() != null) {
526 | resultMap.put("card_first_six", charge.getCard().getFirstSix());
527 | resultMap.put("card_last_four", charge.getCard().getLast4());
528 | resultMap.put("card_object", charge.getCard().getObject());
529 | resultMap.put("card_brand", charge.getCard().getBrand());
530 | if (charge.getCard().getExpiry() != null) {
531 | resultMap.put("card_exp_month", charge.getCard().getExpiry().getMonth());
532 | resultMap.put("card_exp_year", charge.getCard().getExpiry().getYear());
533 | } else {
534 | resultMap.put("card_exp_month", charge.getCard().getExp_month());
535 | resultMap.put("card_exp_year", charge.getCard().getExp_year());
536 | }
537 | }
538 | if (charge.getAcquirer() != null) {
539 | resultMap.put("acquirer_id", charge.getAcquirer().getId());
540 | resultMap.put("acquirer_response_code", charge.getAcquirer().getResponse().getCode());
541 | resultMap.put("acquirer_response_message", charge.getAcquirer().getResponse().getMessage());
542 | }
543 | if (charge.getSource() != null) {
544 | resultMap.put("source_id", charge.getSource().getId());
545 | if (charge.getSource().getChannel() != null)
546 | resultMap.put("source_channel", charge.getSource().getChannel().name());
547 | resultMap.put("source_object", charge.getSource().getObject());
548 | resultMap.put("source_payment_type", charge.getSource().getPaymentType());
549 | }
550 |
551 | if (charge.getCustomer() != null) {
552 | resultMap.put("customer_id", charge.getCustomer().getIdentifier());
553 | resultMap.put("customer_first_name", charge.getCustomer().getFirstName());
554 | resultMap.put("customer_middle_name", charge.getCustomer().getMiddleName());
555 | resultMap.put("customer_last_name", charge.getCustomer().getLastName());
556 | resultMap.put("customer_email", charge.getCustomer().getEmail());
557 | }
558 |
559 | resultMap.put("sdk_result", "SUCCESS");
560 | resultMap.put("trx_mode", "CHARGE");
561 | resultMap.put("charge_id", charge.getId());
562 | if (reference != null) {
563 | if (reference.getOrder() != null) {
564 | resultMap.put("order_number", reference.getOrder());
565 | }
566 | if (reference.getTransaction() != null) {
567 | resultMap.put("transaction_number", reference.getTransaction());
568 | }
569 | }
570 | System.out.println("resultMap on success = " + resultMap);
571 | System.out.println("callback on success = " + callback);
572 | callback.onPaymentInit(resultMap);
573 | }
574 | }
575 |
576 | @Override
577 | public void googlePayFailed(String error) {
578 |
579 | }
580 |
581 | private void sendSavedCardResult(Charge charge, String paymentStatus, String trx_mode){
582 | HashMap resultMap = new HashMap<>();
583 | if (charge instanceof SaveCard) {
584 | System.out.println("Card are Saved Succeeded : first six digits : " + ((SaveCard) charge).getCard().getFirstSix() + " last four :" + ((SaveCard) charge).getCard().getLast4());
585 | }
586 |
587 |
588 | if(((SaveCard) charge).getPaymentAgreement() != null) {
589 | PaymentAgreement paymentAgreement = ((SaveCard) charge).getPaymentAgreement();
590 | HashMap paymentAgreementMap = new HashMap<>();
591 | paymentAgreementMap.put("id", paymentAgreement.getId());
592 | paymentAgreementMap.put("type", paymentAgreement.getType());
593 | paymentAgreementMap.put("total_payments_count", paymentAgreement.getTotalPaymentCount());
594 | paymentAgreementMap.put("trace_id", paymentAgreement.getTraceId());
595 | if(paymentAgreement.getContract() != null) {
596 | Contract contract= paymentAgreement.getContract();
597 | HashMap contractMap = new HashMap<>();
598 | contractMap.put("id", contract.getId());
599 | contractMap.put("customer_id", contract.getCustomerId());
600 | contractMap.put("type", contract.getType());
601 | paymentAgreementMap.put("contract",contractMap);
602 | }
603 | resultMap.put("payment_agreement", paymentAgreementMap);
604 | }
605 |
606 |
607 | resultMap.put("card_first_six", ((SaveCard) charge).getCard().getFirstSix());
608 | resultMap.put("card_last_four",((SaveCard) charge).getCard().getLast4());
609 | resultMap.put("card_status",charge.getStatus().toString());
610 | resultMap.put("card_brand",charge.getCard().getBrand());
611 | resultMap.put("customer_id",charge.getCustomer().getIdentifier());
612 | resultMap.put("card_message", charge.getResponse().getMessage());
613 | resultMap.put("sdk_result", paymentStatus);
614 | resultMap.put("trx_mode", trx_mode);
615 | resultMap.put("charge_id", charge.getId());
616 | if (charge.getPost() != null) {
617 | resultMap.put("postURl", charge.getPost().getUrl());
618 | }
619 | if (reference != null) {
620 | if (reference.getOrder() != null) {
621 | resultMap.put("order_number", reference.getOrder());
622 | }
623 | if (reference.getTransaction() != null) {
624 | resultMap.put("transaction_number", reference.getTransaction());
625 | }
626 | }
627 | callback.onSuccess(resultMap);
628 | callback = null;
629 | System.out.println("Card Saved is Succeeded : first six digits : " + ((SaveCard) charge).getCard().getFirstSix() + " last four :" + ((SaveCard) charge).getCard().getLast4());
630 | }
631 |
632 | private void sendSavedCardFailure(Charge charge, String paymentStatus, String trx_mode){
633 | HashMap resultMap = new HashMap<>();
634 | if (charge instanceof SaveCard) {
635 | resultMap.put("card_status", charge.getStatus().toString());
636 | resultMap.put("card_description", charge.getDescription());
637 | resultMap.put("card_message", charge.getResponse().getMessage());
638 | resultMap.put("sdk_result", paymentStatus);
639 | resultMap.put("trx_mode", trx_mode);
640 | if (reference != null) {
641 | if (reference.getOrder() != null) {
642 | resultMap.put("order_number", reference.getOrder());
643 | }
644 | if (reference.getTransaction() != null) {
645 | resultMap.put("transaction_number", reference.getTransaction());
646 | }
647 | }
648 | callback.onFailure(resultMap);
649 | callback = null;
650 | System.out.println("Card Saved is failed " + charge.getResponse().getMessage());
651 | }
652 | }
653 |
654 | }
--------------------------------------------------------------------------------