@haroldtran/react-native-pax 0.1.7

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,4 @@
1
+ <?xml version="1.0" encoding="UTF-8"?>
2
+ <Workspace
3
+ version = "1.0">
4
+ </Workspace>
@@ -0,0 +1,48 @@
1
+ "use strict";
2
+
3
+ Object.defineProperty(exports, "__esModule", {
4
+ value: true
5
+ });
6
+ exports.closeBatch = closeBatch;
7
+ exports.initPOSLink = initPOSLink;
8
+ exports.makeAdjustment = makeAdjustment;
9
+ exports.makeAuth = makeAuth;
10
+ exports.makePayment = makePayment;
11
+ exports.makePostAuth = makePostAuth;
12
+ exports.makeReturn = makeReturn;
13
+ exports.voidTransaction = voidTransaction;
14
+ var _reactNative = require("react-native");
15
+ const LINKING_ERROR = `The package '@haroldtran/react-native-pax' doesn't seem to be linked. Make sure: \n\n` + _reactNative.Platform.select({
16
+ ios: "- You have run 'pod install'\n",
17
+ default: ''
18
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
19
+ const PaxPoslink = _reactNative.NativeModules.PaxPoslink ? _reactNative.NativeModules.PaxPoslink : new Proxy({}, {
20
+ get() {
21
+ throw new Error(LINKING_ERROR);
22
+ }
23
+ });
24
+ function initPOSLink(type, timeout, proxy, ip, port) {
25
+ return PaxPoslink.initPOSLink(type, timeout, proxy, ip, port);
26
+ }
27
+ function makePayment(amount, _tip = '0') {
28
+ return PaxPoslink.runPayment(amount, _tip);
29
+ }
30
+ function makeReturn(amount) {
31
+ return PaxPoslink.runReturn(amount);
32
+ }
33
+ function makeAdjustment(amount, refNum) {
34
+ return PaxPoslink.runAdjustment(amount, refNum);
35
+ }
36
+ function makeAuth(amount) {
37
+ return PaxPoslink.runAuth(amount);
38
+ }
39
+ function makePostAuth(amount, refNum, autCode) {
40
+ return PaxPoslink.runPostAuth(amount, refNum, autCode);
41
+ }
42
+ function voidTransaction(refNum, autCode) {
43
+ return PaxPoslink.runVoid(refNum, autCode);
44
+ }
45
+ function closeBatch() {
46
+ return PaxPoslink.closeBatch();
47
+ }
48
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["_reactNative","require","LINKING_ERROR","Platform","select","ios","default","PaxPoslink","NativeModules","Proxy","get","Error","initPOSLink","type","timeout","proxy","ip","port","makePayment","amount","_tip","runPayment","makeReturn","runReturn","makeAdjustment","refNum","runAdjustment","makeAuth","runAuth","makePostAuth","autCode","runPostAuth","voidTransaction","runVoid","closeBatch"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;;;;;;;;;;;;AAAA,IAAAA,YAAA,GAAAC,OAAA;AAEA,MAAMC,aAAa,GACjB,uFAAuF,GACvFC,qBAAQ,CAACC,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,UAAU,GAAGC,0BAAa,CAACD,UAAU,GACvCC,0BAAa,CAACD,UAAU,GACxB,IAAIE,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACT,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEE,SAASU,WAAWA,CACzBC,IAQU,EACVC,OAAe,EACfC,KAAc,EACdC,EAAQ,EACRC,IAAU,EACQ;EAClB,OAAOV,UAAU,CAACK,WAAW,CAACC,IAAI,EAAEC,OAAO,EAAEC,KAAK,EAAEC,EAAE,EAAEC,IAAI,CAAC;AAC/D;AAEO,SAASC,WAAWA,CACzBC,MAAc,EACdC,IAAY,GAAG,GAAG,EACD;EACjB,OAAOb,UAAU,CAACc,UAAU,CAACF,MAAM,EAAEC,IAAI,CAAC;AAC5C;AAEO,SAASE,UAAUA,CAACH,MAAc,EAAmB;EAC1D,OAAOZ,UAAU,CAACgB,SAAS,CAACJ,MAAM,CAAC;AACrC;AAEO,SAASK,cAAcA,CAC5BL,MAAc,EACdM,MAAc,EACG;EACjB,OAAOlB,UAAU,CAACmB,aAAa,CAACP,MAAM,EAAEM,MAAM,CAAC;AACjD;AAEO,SAASE,QAAQA,CAACR,MAAc,EAAmB;EACxD,OAAOZ,UAAU,CAACqB,OAAO,CAACT,MAAM,CAAC;AACnC;AAEO,SAASU,YAAYA,CAC1BV,MAAc,EACdM,MAAc,EACdK,OAAe,EACE;EACjB,OAAOvB,UAAU,CAACwB,WAAW,CAACZ,MAAM,EAAEM,MAAM,EAAEK,OAAO,CAAC;AACxD;AAEO,SAASE,eAAeA,CAC7BP,MAAc,EACdK,OAAe,EACE;EACjB,OAAOvB,UAAU,CAAC0B,OAAO,CAACR,MAAM,EAAEK,OAAO,CAAC;AAC5C;AAEO,SAASI,UAAUA,CAAA,EAAoB;EAC5C,OAAO3B,UAAU,CAAC2B,UAAU,CAAC,CAAC;AAChC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,37 @@
1
+ "use strict";
2
+
3
+ import { NativeModules, Platform } from 'react-native';
4
+ const LINKING_ERROR = `The package '@haroldtran/react-native-pax' doesn't seem to be linked. Make sure: \n\n` + Platform.select({
5
+ ios: "- You have run 'pod install'\n",
6
+ default: ''
7
+ }) + '- You rebuilt the app after installing the package\n' + '- You are not using Expo Go\n';
8
+ const PaxPoslink = NativeModules.PaxPoslink ? NativeModules.PaxPoslink : new Proxy({}, {
9
+ get() {
10
+ throw new Error(LINKING_ERROR);
11
+ }
12
+ });
13
+ export function initPOSLink(type, timeout, proxy, ip, port) {
14
+ return PaxPoslink.initPOSLink(type, timeout, proxy, ip, port);
15
+ }
16
+ export function makePayment(amount, _tip = '0') {
17
+ return PaxPoslink.runPayment(amount, _tip);
18
+ }
19
+ export function makeReturn(amount) {
20
+ return PaxPoslink.runReturn(amount);
21
+ }
22
+ export function makeAdjustment(amount, refNum) {
23
+ return PaxPoslink.runAdjustment(amount, refNum);
24
+ }
25
+ export function makeAuth(amount) {
26
+ return PaxPoslink.runAuth(amount);
27
+ }
28
+ export function makePostAuth(amount, refNum, autCode) {
29
+ return PaxPoslink.runPostAuth(amount, refNum, autCode);
30
+ }
31
+ export function voidTransaction(refNum, autCode) {
32
+ return PaxPoslink.runVoid(refNum, autCode);
33
+ }
34
+ export function closeBatch() {
35
+ return PaxPoslink.closeBatch();
36
+ }
37
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"names":["NativeModules","Platform","LINKING_ERROR","select","ios","default","PaxPoslink","Proxy","get","Error","initPOSLink","type","timeout","proxy","ip","port","makePayment","amount","_tip","runPayment","makeReturn","runReturn","makeAdjustment","refNum","runAdjustment","makeAuth","runAuth","makePostAuth","autCode","runPostAuth","voidTransaction","runVoid","closeBatch"],"sourceRoot":"../../src","sources":["index.tsx"],"mappings":";;AAAA,SAASA,aAAa,EAAEC,QAAQ,QAAQ,cAAc;AAEtD,MAAMC,aAAa,GACjB,uFAAuF,GACvFD,QAAQ,CAACE,MAAM,CAAC;EAAEC,GAAG,EAAE,gCAAgC;EAAEC,OAAO,EAAE;AAAG,CAAC,CAAC,GACvE,sDAAsD,GACtD,+BAA+B;AAEjC,MAAMC,UAAU,GAAGN,aAAa,CAACM,UAAU,GACvCN,aAAa,CAACM,UAAU,GACxB,IAAIC,KAAK,CACP,CAAC,CAAC,EACF;EACEC,GAAGA,CAAA,EAAG;IACJ,MAAM,IAAIC,KAAK,CAACP,aAAa,CAAC;EAChC;AACF,CACF,CAAC;AAEL,OAAO,SAASQ,WAAWA,CACzBC,IAQU,EACVC,OAAe,EACfC,KAAc,EACdC,EAAQ,EACRC,IAAU,EACQ;EAClB,OAAOT,UAAU,CAACI,WAAW,CAACC,IAAI,EAAEC,OAAO,EAAEC,KAAK,EAAEC,EAAE,EAAEC,IAAI,CAAC;AAC/D;AAEA,OAAO,SAASC,WAAWA,CACzBC,MAAc,EACdC,IAAY,GAAG,GAAG,EACD;EACjB,OAAOZ,UAAU,CAACa,UAAU,CAACF,MAAM,EAAEC,IAAI,CAAC;AAC5C;AAEA,OAAO,SAASE,UAAUA,CAACH,MAAc,EAAmB;EAC1D,OAAOX,UAAU,CAACe,SAAS,CAACJ,MAAM,CAAC;AACrC;AAEA,OAAO,SAASK,cAAcA,CAC5BL,MAAc,EACdM,MAAc,EACG;EACjB,OAAOjB,UAAU,CAACkB,aAAa,CAACP,MAAM,EAAEM,MAAM,CAAC;AACjD;AAEA,OAAO,SAASE,QAAQA,CAACR,MAAc,EAAmB;EACxD,OAAOX,UAAU,CAACoB,OAAO,CAACT,MAAM,CAAC;AACnC;AAEA,OAAO,SAASU,YAAYA,CAC1BV,MAAc,EACdM,MAAc,EACdK,OAAe,EACE;EACjB,OAAOtB,UAAU,CAACuB,WAAW,CAACZ,MAAM,EAAEM,MAAM,EAAEK,OAAO,CAAC;AACxD;AAEA,OAAO,SAASE,eAAeA,CAC7BP,MAAc,EACdK,OAAe,EACE;EACjB,OAAOtB,UAAU,CAACyB,OAAO,CAACR,MAAM,EAAEK,OAAO,CAAC;AAC5C;AAEA,OAAO,SAASI,UAAUA,CAAA,EAAoB;EAC5C,OAAO1B,UAAU,CAAC0B,UAAU,CAAC,CAAC;AAChC","ignoreList":[]}
@@ -0,0 +1 @@
1
+ {"type":"module"}
@@ -0,0 +1,9 @@
1
+ export declare function initPOSLink(type: 'UART' | 'TCP' | 'SSL' | 'HTTP' | 'HTTPS' | 'BLUETOOTH' | 'USB' | 'AIDL', timeout: string, proxy: boolean, ip?: any, port?: any): Promise<boolean>;
2
+ export declare function makePayment(amount: string, _tip?: string): Promise<string>;
3
+ export declare function makeReturn(amount: string): Promise<string>;
4
+ export declare function makeAdjustment(amount: string, refNum: string): Promise<string>;
5
+ export declare function makeAuth(amount: string): Promise<string>;
6
+ export declare function makePostAuth(amount: string, refNum: string, autCode: string): Promise<string>;
7
+ export declare function voidTransaction(refNum: string, autCode: string): Promise<string>;
8
+ export declare function closeBatch(): Promise<string>;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,WAAW,CACzB,IAAI,EACA,MAAM,GACN,KAAK,GACL,KAAK,GACL,MAAM,GACN,OAAO,GACP,WAAW,GACX,KAAK,GACL,MAAM,EACV,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,EACd,EAAE,CAAC,EAAE,GAAG,EACR,IAAI,CAAC,EAAE,GAAG,GACT,OAAO,CAAC,OAAO,CAAC,CAElB;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,MAAY,GACjB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1D;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAExD;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAE5C"}
@@ -0,0 +1 @@
1
+ {"type":"commonjs"}
@@ -0,0 +1,9 @@
1
+ export declare function initPOSLink(type: 'UART' | 'TCP' | 'SSL' | 'HTTP' | 'HTTPS' | 'BLUETOOTH' | 'USB' | 'AIDL', timeout: string, proxy: boolean, ip?: any, port?: any): Promise<boolean>;
2
+ export declare function makePayment(amount: string, _tip?: string): Promise<string>;
3
+ export declare function makeReturn(amount: string): Promise<string>;
4
+ export declare function makeAdjustment(amount: string, refNum: string): Promise<string>;
5
+ export declare function makeAuth(amount: string): Promise<string>;
6
+ export declare function makePostAuth(amount: string, refNum: string, autCode: string): Promise<string>;
7
+ export declare function voidTransaction(refNum: string, autCode: string): Promise<string>;
8
+ export declare function closeBatch(): Promise<string>;
9
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../../src/index.tsx"],"names":[],"mappings":"AAmBA,wBAAgB,WAAW,CACzB,IAAI,EACA,MAAM,GACN,KAAK,GACL,KAAK,GACL,MAAM,GACN,OAAO,GACP,WAAW,GACX,KAAK,GACL,MAAM,EACV,OAAO,EAAE,MAAM,EACf,KAAK,EAAE,OAAO,EACd,EAAE,CAAC,EAAE,GAAG,EACR,IAAI,CAAC,EAAE,GAAG,GACT,OAAO,CAAC,OAAO,CAAC,CAElB;AAED,wBAAgB,WAAW,CACzB,MAAM,EAAE,MAAM,EACd,IAAI,GAAE,MAAY,GACjB,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,UAAU,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAE1D;AAED,wBAAgB,cAAc,CAC5B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,GACb,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAC,MAAM,CAAC,CAExD;AAED,wBAAgB,YAAY,CAC1B,MAAM,EAAE,MAAM,EACd,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,eAAe,CAC7B,MAAM,EAAE,MAAM,EACd,OAAO,EAAE,MAAM,GACd,OAAO,CAAC,MAAM,CAAC,CAEjB;AAED,wBAAgB,UAAU,IAAI,OAAO,CAAC,MAAM,CAAC,CAE5C"}
@@ -0,0 +1 @@
1
+ {"type":"module"}
package/package.json ADDED
@@ -0,0 +1,185 @@
1
+ {
2
+ "name": "@haroldtran/react-native-pax",
3
+ "version": "0.1.7",
4
+ "description": "React Native native module for PAX devices",
5
+ "main": "./lib/commonjs/index.js",
6
+ "module": "./lib/module/index.js",
7
+ "types": "./lib/typescript/commonjs/index.d.ts",
8
+ "source": "src/index",
9
+ "files": [
10
+ "src",
11
+ "lib",
12
+ "android",
13
+ "ios",
14
+ "cpp",
15
+ "*.podspec",
16
+ "!lib/typescript/example",
17
+ "!ios/build",
18
+ "!android/build",
19
+ "!android/gradle",
20
+ "!android/gradlew",
21
+ "!android/gradlew.bat",
22
+ "!android/local.properties",
23
+ "!**/__tests__",
24
+ "!**/__fixtures__",
25
+ "!**/__mocks__",
26
+ "!**/.*"
27
+ ],
28
+ "scripts": {
29
+ "test": "jest",
30
+ "typecheck": "tsc --noEmit",
31
+ "lint": "eslint \"**/*.{js,ts,tsx}\"",
32
+ "prepack": "bob build",
33
+ "release": "release-it",
34
+ "example": "yarn --cwd example",
35
+ "prepare": "bob build"
36
+ },
37
+ "keywords": [
38
+ "react-native",
39
+ "pax",
40
+ "pos",
41
+ "poslink",
42
+ "payment",
43
+ "ios",
44
+ "android"
45
+ ],
46
+ "repository": {
47
+ "type": "git",
48
+ "url": "git+https://github.com/phattran1201/react-native-pax.git"
49
+ },
50
+ "author": "Harold Tran <phattran1201@gmail.com>",
51
+ "license": "MIT",
52
+ "bugs": {
53
+ "url": "https://github.com/phattran1201/react-native-pax/issues"
54
+ },
55
+ "homepage": "https://github.com/phattran1201/react-native-pax#readme",
56
+ "publishConfig": {
57
+ "access": "public",
58
+ "registry": "https://registry.npmjs.org/"
59
+ },
60
+ "devDependencies": {
61
+ "@commitlint/config-conventional": "^17.0.2",
62
+ "@evilmartians/lefthook": "^1.2.2",
63
+ "@react-native-community/eslint-config": "^3.0.2",
64
+ "@release-it/conventional-changelog": "^5.0.0",
65
+ "@types/jest": "^28.1.2",
66
+ "@types/react": "~17.0.21",
67
+ "@types/react-native": "0.70.0",
68
+ "commitlint": "^17.0.2",
69
+ "del-cli": "^5.0.0",
70
+ "eslint": "^8.4.1",
71
+ "eslint-config-prettier": "^8.5.0",
72
+ "eslint-plugin-prettier": "^4.0.0",
73
+ "jest": "^28.1.1",
74
+ "pod-install": "^0.1.0",
75
+ "prettier": "^2.0.5",
76
+ "react": "18.2.0",
77
+ "react-native": "0.72.0",
78
+ "react-native-builder-bob": "^0.40.12",
79
+ "release-it": "^15.0.0",
80
+ "typescript": "^4.5.2"
81
+ },
82
+ "resolutions": {
83
+ "@types/react": "17.0.21"
84
+ },
85
+ "peerDependencies": {
86
+ "react": "*",
87
+ "react-native": "*"
88
+ },
89
+ "engines": {
90
+ "node": ">= 16.0.0"
91
+ },
92
+ "jest": {
93
+ "preset": "react-native",
94
+ "modulePathIgnorePatterns": [
95
+ "<rootDir>/example/node_modules",
96
+ "<rootDir>/lib/"
97
+ ]
98
+ },
99
+ "commitlint": {
100
+ "extends": [
101
+ "@commitlint/config-conventional"
102
+ ]
103
+ },
104
+ "release-it": {
105
+ "git": {
106
+ "commitMessage": "chore: release ${version}",
107
+ "tagName": "v${version}"
108
+ },
109
+ "npm": {
110
+ "publish": true
111
+ },
112
+ "github": {
113
+ "release": true
114
+ },
115
+ "plugins": {
116
+ "@release-it/conventional-changelog": {
117
+ "preset": "angular"
118
+ }
119
+ }
120
+ },
121
+ "eslintConfig": {
122
+ "root": true,
123
+ "extends": [
124
+ "@react-native-community",
125
+ "prettier"
126
+ ],
127
+ "rules": {
128
+ "prettier/prettier": [
129
+ "error",
130
+ {
131
+ "quoteProps": "consistent",
132
+ "singleQuote": true,
133
+ "tabWidth": 2,
134
+ "trailingComma": "es5",
135
+ "useTabs": false
136
+ }
137
+ ]
138
+ }
139
+ },
140
+ "eslintIgnore": [
141
+ "node_modules/",
142
+ "lib/"
143
+ ],
144
+ "prettier": {
145
+ "quoteProps": "consistent",
146
+ "singleQuote": true,
147
+ "tabWidth": 2,
148
+ "trailingComma": "es5",
149
+ "useTabs": false
150
+ },
151
+ "react-native-builder-bob": {
152
+ "source": "src",
153
+ "output": "lib",
154
+ "targets": [
155
+ [
156
+ "module",
157
+ {
158
+ "esm": true
159
+ }
160
+ ],
161
+ [
162
+ "commonjs",
163
+ {
164
+ "esm": true
165
+ }
166
+ ],
167
+ "typescript"
168
+ ]
169
+ },
170
+ "packageManager": "yarn@4.9.2",
171
+ "exports": {
172
+ ".": {
173
+ "source": "./src/index.tsx",
174
+ "import": {
175
+ "types": "./lib/typescript/module/index.d.ts",
176
+ "default": "./lib/module/index.js"
177
+ },
178
+ "require": {
179
+ "types": "./lib/typescript/commonjs/index.d.ts",
180
+ "default": "./lib/commonjs/index.js"
181
+ }
182
+ },
183
+ "./package.json": "./package.json"
184
+ }
185
+ }
@@ -0,0 +1,35 @@
1
+ require "json"
2
+
3
+ package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
+ folly_compiler_flags = '-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1 -Wno-comma -Wno-shorten-64-to-32'
5
+
6
+ Pod::Spec.new do |s|
7
+ s.name = "@haroldtran/react-native-pax"
8
+ s.version = package["version"]
9
+ s.summary = package["description"]
10
+ s.homepage = package["homepage"]
11
+ s.license = package["license"]
12
+ s.authors = package["author"]
13
+
14
+ s.platforms = { :ios => "11.0" }
15
+ s.source = { :git => "https://github.com/phattran1201/react-native-pax.git", :tag => "#{s.version}" }
16
+
17
+ s.source_files = "ios/**/*.{h,m,mm}"
18
+
19
+ s.dependency "React-Core"
20
+
21
+ # Don't install the dependencies when we run `pod install` in the old architecture.
22
+ if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
23
+ s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
24
+ s.pod_target_xcconfig = {
25
+ "HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
26
+ "OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
27
+ "CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
28
+ }
29
+ s.dependency "React-Codegen"
30
+ s.dependency "RCT-Folly"
31
+ s.dependency "RCTRequired"
32
+ s.dependency "RCTTypeSafety"
33
+ s.dependency "ReactCommon/turbomodule/core"
34
+ end
35
+ end
package/src/index.tsx ADDED
@@ -0,0 +1,77 @@
1
+ import { NativeModules, Platform } from 'react-native';
2
+
3
+ const LINKING_ERROR =
4
+ `The package '@haroldtran/react-native-pax' doesn't seem to be linked. Make sure: \n\n` +
5
+ Platform.select({ ios: "- You have run 'pod install'\n", default: '' }) +
6
+ '- You rebuilt the app after installing the package\n' +
7
+ '- You are not using Expo Go\n';
8
+
9
+ const PaxPoslink = NativeModules.PaxPoslink
10
+ ? NativeModules.PaxPoslink
11
+ : new Proxy(
12
+ {},
13
+ {
14
+ get() {
15
+ throw new Error(LINKING_ERROR);
16
+ },
17
+ }
18
+ );
19
+
20
+ export function initPOSLink(
21
+ type:
22
+ | 'UART'
23
+ | 'TCP'
24
+ | 'SSL'
25
+ | 'HTTP'
26
+ | 'HTTPS'
27
+ | 'BLUETOOTH'
28
+ | 'USB'
29
+ | 'AIDL',
30
+ timeout: string,
31
+ proxy: boolean,
32
+ ip?: any,
33
+ port?: any
34
+ ): Promise<boolean> {
35
+ return PaxPoslink.initPOSLink(type, timeout, proxy, ip, port);
36
+ }
37
+
38
+ export function makePayment(
39
+ amount: string,
40
+ _tip: string = '0'
41
+ ): Promise<string> {
42
+ return PaxPoslink.runPayment(amount, _tip);
43
+ }
44
+
45
+ export function makeReturn(amount: string): Promise<string> {
46
+ return PaxPoslink.runReturn(amount);
47
+ }
48
+
49
+ export function makeAdjustment(
50
+ amount: string,
51
+ refNum: string
52
+ ): Promise<string> {
53
+ return PaxPoslink.runAdjustment(amount, refNum);
54
+ }
55
+
56
+ export function makeAuth(amount: string): Promise<string> {
57
+ return PaxPoslink.runAuth(amount);
58
+ }
59
+
60
+ export function makePostAuth(
61
+ amount: string,
62
+ refNum: string,
63
+ autCode: string
64
+ ): Promise<string> {
65
+ return PaxPoslink.runPostAuth(amount, refNum, autCode);
66
+ }
67
+
68
+ export function voidTransaction(
69
+ refNum: string,
70
+ autCode: string
71
+ ): Promise<string> {
72
+ return PaxPoslink.runVoid(refNum, autCode);
73
+ }
74
+
75
+ export function closeBatch(): Promise<string> {
76
+ return PaxPoslink.closeBatch();
77
+ }