├── example ├── .watchmanconfig ├── app.json ├── .bundle │ └── config ├── tsconfig.json ├── .eslintrc.js ├── babel.config.js ├── android │ ├── app │ │ ├── src │ │ │ ├── main │ │ │ │ ├── res │ │ │ │ │ ├── values │ │ │ │ │ │ ├── strings.xml │ │ │ │ │ │ └── styles.xml │ │ │ │ │ ├── mipmap-hdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-mdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ ├── mipmap-xxxhdpi │ │ │ │ │ │ ├── ic_launcher.png │ │ │ │ │ │ └── ic_launcher_round.png │ │ │ │ │ └── drawable │ │ │ │ │ │ └── rn_edit_text_material.xml │ │ │ │ ├── java │ │ │ │ │ └── com │ │ │ │ │ │ └── example │ │ │ │ │ │ ├── MainActivity.kt │ │ │ │ │ │ └── MainApplication.kt │ │ │ │ └── AndroidManifest.xml │ │ │ └── debug │ │ │ │ └── AndroidManifest.xml │ │ ├── debug.keystore │ │ ├── proguard-rules.pro │ │ └── build.gradle │ ├── gradle │ │ └── wrapper │ │ │ ├── gradle-wrapper.jar │ │ │ └── gradle-wrapper.properties │ ├── settings.gradle │ ├── build.gradle │ ├── gradle.properties │ ├── gradlew.bat │ └── gradlew ├── ios │ ├── example │ │ ├── Images.xcassets │ │ │ ├── Contents.json │ │ │ └── AppIcon.appiconset │ │ │ │ └── Contents.json │ │ ├── AppDelegate.swift │ │ ├── PrivacyInfo.xcprivacy │ │ ├── Info.plist │ │ └── LaunchScreen.storyboard │ ├── example.xcworkspace │ │ └── contents.xcworkspacedata │ ├── .xcode.env │ ├── Podfile │ └── example.xcodeproj │ │ ├── xcshareddata │ │ └── xcschemes │ │ │ └── example.xcscheme │ │ └── project.pbxproj ├── .prettierrc.js ├── index.js ├── jest.config.js ├── metro.config.js ├── Gemfile ├── components │ └── Header.tsx ├── package.json ├── .gitignore ├── README.md ├── sdkConfigurations.js ├── types │ └── gosell-sdk-react-native.d.ts └── App.tsx ├── .gitattributes ├── .eslintrc.js ├── yarn.lock ├── android ├── gradle │ └── wrapper │ │ ├── gradle-wrapper.jar │ │ └── gradle-wrapper.properties ├── src │ └── main │ │ ├── AndroidManifest.xml │ │ └── java │ │ └── company │ │ └── tap │ │ └── goSellSDKExamplee │ │ ├── Constants.java │ │ ├── SDKCallBack.java │ │ ├── RNGosellSdkReactNativePackage.java │ │ ├── RNGosellSdkReactNativeModule.java │ │ ├── DeserializationUtil.java │ │ └── GoSellSdKDelegate.java ├── build.gradle ├── gradlew.bat └── gradlew ├── .prettierrc.js ├── .npmignore ├── ios ├── Classes │ ├── RNGosellSdkReactNative.h │ └── RNGosellSdkReactNative.m ├── RNGosellSdkReactNative.xcworkspace │ └── contents.xcworkspacedata └── RNGosellSdkReactNative.xcodeproj │ └── project.pbxproj ├── index.js ├── package.json ├── .gitignore ├── RNGosellSdkReactNative.podspec ├── models.js ├── README.md └── CHANGELOG.md /example/.watchmanconfig: -------------------------------------------------------------------------------- 1 | {} 2 | -------------------------------------------------------------------------------- /.gitattributes: -------------------------------------------------------------------------------- 1 | *.pbxproj -text 2 | -------------------------------------------------------------------------------- /example/app.json: -------------------------------------------------------------------------------- 1 | { 2 | "name": "example", 3 | "displayName": "example" 4 | } 5 | -------------------------------------------------------------------------------- /example/.bundle/config: -------------------------------------------------------------------------------- 1 | BUNDLE_PATH: "vendor/bundle" 2 | BUNDLE_FORCE_RUBY_PLATFORM: 1 3 | -------------------------------------------------------------------------------- /example/tsconfig.json: -------------------------------------------------------------------------------- 1 | { 2 | "extends": "@react-native/typescript-config/tsconfig.json" 3 | } 4 | -------------------------------------------------------------------------------- /.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native-community', 4 | }; 5 | -------------------------------------------------------------------------------- /example/.eslintrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | root: true, 3 | extends: '@react-native', 4 | }; 5 | -------------------------------------------------------------------------------- /example/babel.config.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | presets: ['module:@react-native/babel-preset'], 3 | }; 4 | -------------------------------------------------------------------------------- /yarn.lock: -------------------------------------------------------------------------------- 1 | # THIS IS AN AUTOGENERATED FILE. DO NOT EDIT THIS FILE DIRECTLY. 2 | # yarn lockfile v1 3 | 4 | 5 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/values/strings.xml: -------------------------------------------------------------------------------- 1 | 2 | example 3 | 4 | -------------------------------------------------------------------------------- /example/android/app/debug.keystore: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tap-Payments/gosellSDK-ReactNative/HEAD/example/android/app/debug.keystore -------------------------------------------------------------------------------- /example/ios/example/Images.xcassets/Contents.json: -------------------------------------------------------------------------------- 1 | { 2 | "info" : { 3 | "version" : 1, 4 | "author" : "xcode" 5 | } 6 | } 7 | -------------------------------------------------------------------------------- /android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tap-Payments/gosellSDK-ReactNative/HEAD/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | bracketSpacing: false, 3 | jsxBracketSameLine: true, 4 | singleQuote: true, 5 | trailingComma: 'all', 6 | }; 7 | -------------------------------------------------------------------------------- /example/android/gradle/wrapper/gradle-wrapper.jar: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tap-Payments/gosellSDK-ReactNative/HEAD/example/android/gradle/wrapper/gradle-wrapper.jar -------------------------------------------------------------------------------- /android/src/main/AndroidManifest.xml: -------------------------------------------------------------------------------- 1 | 2 | 4 | 5 | 6 | -------------------------------------------------------------------------------- /example/.prettierrc.js: -------------------------------------------------------------------------------- 1 | module.exports = { 2 | arrowParens: 'avoid', 3 | bracketSameLine: true, 4 | bracketSpacing: false, 5 | singleQuote: true, 6 | trailingComma: 'all', 7 | }; 8 | -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tap-Payments/gosellSDK-ReactNative/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tap-Payments/gosellSDK-ReactNative/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tap-Payments/gosellSDK-ReactNative/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tap-Payments/gosellSDK-ReactNative/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tap-Payments/gosellSDK-ReactNative/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tap-Payments/gosellSDK-ReactNative/HEAD/example/android/app/src/main/res/mipmap-hdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tap-Payments/gosellSDK-ReactNative/HEAD/example/android/app/src/main/res/mipmap-mdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tap-Payments/gosellSDK-ReactNative/HEAD/example/android/app/src/main/res/mipmap-xhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tap-Payments/gosellSDK-ReactNative/HEAD/example/android/app/src/main/res/mipmap-xxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png: -------------------------------------------------------------------------------- https://raw.githubusercontent.com/Tap-Payments/gosellSDK-ReactNative/HEAD/example/android/app/src/main/res/mipmap-xxxhdpi/ic_launcher_round.png -------------------------------------------------------------------------------- /.npmignore: -------------------------------------------------------------------------------- 1 | .github 2 | .travis 3 | docs 4 | example 5 | example_tmp 6 | example_podspec 7 | tmp 8 | website 9 | .editorconfig 10 | .eslintrc 11 | .travis.yml 12 | Makefile 13 | *~ 14 | *.tgz 15 | .envrc -------------------------------------------------------------------------------- /ios/Classes/RNGosellSdkReactNative.h: -------------------------------------------------------------------------------- 1 | #import 2 | #import 3 | #import 4 | @interface RNGosellSdkReactNative : RCTEventEmitter 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 |