@rnw-community/react-native-payments 0.83.1 → 1.2.0
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.
- package/LICENSE.md +1 -1
- package/dist/cjs/app.plugin.d.ts +3 -0
- package/dist/cjs/app.plugin.d.ts.map +1 -0
- package/dist/cjs/app.plugin.js +5 -0
- package/dist/cjs/app.plugin.js.map +1 -0
- package/dist/cjs/class/payment-request/payment-request.d.ts.map +1 -1
- package/dist/cjs/class/payment-request/payment-request.js +4 -3
- package/dist/cjs/class/payment-request/payment-request.js.map +1 -1
- package/dist/cjs/class/payment-request/payment-request.web.d.ts +5 -0
- package/dist/cjs/class/payment-request/payment-request.web.d.ts.map +1 -0
- package/dist/cjs/class/payment-request/payment-request.web.js +5 -0
- package/dist/cjs/class/payment-request/payment-request.web.js.map +1 -0
- package/dist/cjs/class/payment-response/payment-response.d.ts.map +1 -1
- package/dist/cjs/class/payment-response/payment-response.js +4 -3
- package/dist/cjs/class/payment-response/payment-response.js.map +1 -1
- package/dist/cjs/class/payment-response/payment-response.web.d.ts +5 -0
- package/dist/cjs/class/payment-response/payment-response.web.d.ts.map +1 -0
- package/dist/cjs/class/payment-response/payment-response.web.js +5 -0
- package/dist/cjs/class/payment-response/payment-response.web.js.map +1 -0
- package/dist/cjs/expo-plugins/plugin.props.d.ts +4 -0
- package/dist/cjs/expo-plugins/plugin.props.d.ts.map +1 -0
- package/dist/cjs/expo-plugins/plugin.props.js +3 -0
- package/dist/cjs/expo-plugins/plugin.props.js.map +1 -0
- package/dist/cjs/expo-plugins/with-apple-pay.d.ts +4 -0
- package/dist/cjs/expo-plugins/with-apple-pay.d.ts.map +1 -0
- package/dist/cjs/expo-plugins/with-apple-pay.js +24 -0
- package/dist/cjs/expo-plugins/with-apple-pay.js.map +1 -0
- package/dist/cjs/expo-plugins/with-google-pay.d.ts +4 -0
- package/dist/cjs/expo-plugins/with-google-pay.d.ts.map +1 -0
- package/dist/cjs/expo-plugins/with-google-pay.js +26 -0
- package/dist/cjs/expo-plugins/with-google-pay.js.map +1 -0
- package/dist/cjs/expo-plugins/with-payments.d.ts +4 -0
- package/dist/cjs/expo-plugins/with-payments.d.ts.map +1 -0
- package/dist/cjs/expo-plugins/with-payments.js +12 -0
- package/dist/cjs/expo-plugins/with-payments.js.map +1 -0
- package/dist/cjs/util/is-valid-decimal-monetary-value.util.js +2 -2
- package/dist/cjs/util/is-valid-decimal-monetary-value.util.js.map +1 -1
- package/dist/cjs/util/validate-payment-methods.util.js +1 -1
- package/dist/cjs/util/validate-payment-methods.util.js.map +1 -1
- package/dist/esm/app.plugin.d.ts +3 -0
- package/dist/esm/app.plugin.d.ts.map +1 -0
- package/dist/esm/app.plugin.js +3 -0
- package/dist/esm/app.plugin.js.map +1 -0
- package/dist/esm/class/payment-request/payment-request.d.ts.map +1 -1
- package/dist/esm/class/payment-request/payment-request.js +5 -4
- package/dist/esm/class/payment-request/payment-request.js.map +1 -1
- package/dist/esm/class/payment-request/payment-request.web.d.ts +5 -0
- package/dist/esm/class/payment-request/payment-request.web.d.ts.map +1 -0
- package/dist/esm/class/payment-request/payment-request.web.js +2 -0
- package/dist/esm/class/payment-request/payment-request.web.js.map +1 -0
- package/dist/esm/class/payment-response/payment-response.d.ts.map +1 -1
- package/dist/esm/class/payment-response/payment-response.js +4 -3
- package/dist/esm/class/payment-response/payment-response.js.map +1 -1
- package/dist/esm/class/payment-response/payment-response.web.d.ts +5 -0
- package/dist/esm/class/payment-response/payment-response.web.d.ts.map +1 -0
- package/dist/esm/class/payment-response/payment-response.web.js +2 -0
- package/dist/esm/class/payment-response/payment-response.web.js.map +1 -0
- package/dist/esm/expo-plugins/plugin.props.d.ts +4 -0
- package/dist/esm/expo-plugins/plugin.props.d.ts.map +1 -0
- package/dist/esm/expo-plugins/plugin.props.js +2 -0
- package/dist/esm/expo-plugins/plugin.props.js.map +1 -0
- package/dist/esm/expo-plugins/with-apple-pay.d.ts +4 -0
- package/dist/esm/expo-plugins/with-apple-pay.d.ts.map +1 -0
- package/dist/esm/expo-plugins/with-apple-pay.js +20 -0
- package/dist/esm/expo-plugins/with-apple-pay.js.map +1 -0
- package/dist/esm/expo-plugins/with-google-pay.d.ts +4 -0
- package/dist/esm/expo-plugins/with-google-pay.d.ts.map +1 -0
- package/dist/esm/expo-plugins/with-google-pay.js +22 -0
- package/dist/esm/expo-plugins/with-google-pay.js.map +1 -0
- package/dist/esm/expo-plugins/with-payments.d.ts +4 -0
- package/dist/esm/expo-plugins/with-payments.d.ts.map +1 -0
- package/dist/esm/expo-plugins/with-payments.js +8 -0
- package/dist/esm/expo-plugins/with-payments.js.map +1 -0
- package/dist/esm/util/is-valid-decimal-monetary-value.util.js +2 -2
- package/dist/esm/util/is-valid-decimal-monetary-value.util.js.map +1 -1
- package/dist/esm/util/validate-payment-methods.util.js +2 -2
- package/dist/esm/util/validate-payment-methods.util.js.map +1 -1
- package/ios/Payments.mm +9 -1
- package/package.json +11 -13
- package/react-native-payments.podspec +21 -18
- package/readme.md +33 -27
- package/src/app.plugin.ts +3 -0
- package/src/class/payment-request/payment-request.spec.ts +691 -0
- package/src/class/payment-request/payment-request.ts +5 -4
- package/src/class/payment-request/payment-request.web.ts +1 -0
- package/src/class/payment-response/payment-response.spec.ts +142 -0
- package/src/class/payment-response/payment-response.ts +4 -3
- package/src/class/payment-response/payment-response.web.ts +1 -0
- package/src/expo-plugins/plugin.props.ts +3 -0
- package/src/expo-plugins/with-apple-pay.ts +27 -0
- package/src/expo-plugins/with-google-pay.ts +31 -0
- package/src/expo-plugins/with-payments.ts +13 -0
- package/src/util/is-valid-decimal-monetary-value.util.ts +2 -2
- package/src/util/validate-payment-methods.util.ts +2 -2
- package/app.plugin.js +0 -1
- package/plugins/with-apple-pay.js +0 -24
- package/plugins/with-google-pay.js +0 -49
- package/plugins/with-payments.js +0 -12
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-google-pay.d.ts","sourceRoot":"","sources":["../../../src/expo-plugins/with-google-pay.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,eAAO,MAAM,aAAa,EAAE,YAAY,CAAC,8BAA8B,CAyBjE,CAAC"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { withAndroidManifest } from '@expo/config-plugins';
|
|
2
|
+
export const withGooglePay = initialConfig => withAndroidManifest(initialConfig, config => {
|
|
3
|
+
const androidManifest = config.modResults;
|
|
4
|
+
const mainApplication = androidManifest.manifest.application?.[0];
|
|
5
|
+
if (mainApplication) {
|
|
6
|
+
const existingMetaData = mainApplication['meta-data']?.find(metadata => metadata.$['android:name'] === 'com.google.android.gms.wallet.api.enabled');
|
|
7
|
+
if (!existingMetaData) {
|
|
8
|
+
if (!mainApplication['meta-data']) {
|
|
9
|
+
mainApplication['meta-data'] = [];
|
|
10
|
+
}
|
|
11
|
+
mainApplication['meta-data'].push({
|
|
12
|
+
// eslint-disable-next-line id-length
|
|
13
|
+
$: {
|
|
14
|
+
'android:name': 'com.google.android.gms.wallet.api.enabled',
|
|
15
|
+
'android:value': 'true',
|
|
16
|
+
},
|
|
17
|
+
});
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return config;
|
|
21
|
+
});
|
|
22
|
+
//# sourceMappingURL=with-google-pay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-google-pay.js","sourceRoot":"","sources":["../../../src/expo-plugins/with-google-pay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,mBAAmB,EAAE,MAAM,sBAAsB,CAAC;AAK3D,MAAM,CAAC,MAAM,aAAa,GAAiD,aAAa,CAAC,EAAE,CACvF,mBAAmB,CAAC,aAAa,EAAE,MAAM,CAAC,EAAE;IACxC,MAAM,eAAe,GAAG,MAAM,CAAC,UAAU,CAAC;IAC1C,MAAM,eAAe,GAAG,eAAe,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,CAAC,CAAC,CAAC;IAElE,IAAI,eAAe,EAAE,CAAC;QAClB,MAAM,gBAAgB,GAAG,eAAe,CAAC,WAAW,CAAC,EAAE,IAAI,CACvD,QAAQ,CAAC,EAAE,CAAC,QAAQ,CAAC,CAAC,CAAC,cAAc,CAAC,KAAK,2CAA2C,CACzF,CAAC;QAEF,IAAI,CAAC,gBAAgB,EAAE,CAAC;YACpB,IAAI,CAAC,eAAe,CAAC,WAAW,CAAC,EAAE,CAAC;gBAChC,eAAe,CAAC,WAAW,CAAC,GAAG,EAAE,CAAC;YACtC,CAAC;YACD,eAAe,CAAC,WAAW,CAAC,CAAC,IAAI,CAAC;gBAC9B,qCAAqC;gBACrC,CAAC,EAAE;oBACC,cAAc,EAAE,2CAA2C;oBAC3D,eAAe,EAAE,MAAM;iBAC1B;aACJ,CAAC,CAAC;QACP,CAAC;IACL,CAAC;IAED,OAAO,MAAM,CAAC;AAClB,CAAC,CAAC,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-payments.d.ts","sourceRoot":"","sources":["../../../src/expo-plugins/with-payments.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,sBAAsB,CAAC;AAEzD,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,8BAA8B,CAIhE,CAAC"}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
import { withPlugins } from '@expo/config-plugins';
|
|
2
|
+
import { withApplePay } from './with-apple-pay';
|
|
3
|
+
import { withGooglePay } from './with-google-pay';
|
|
4
|
+
export const withPayments = (config, props) => withPlugins(config, [
|
|
5
|
+
[withApplePay, props],
|
|
6
|
+
[withGooglePay, props],
|
|
7
|
+
]);
|
|
8
|
+
//# sourceMappingURL=with-payments.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-payments.js","sourceRoot":"","sources":["../../../src/expo-plugins/with-payments.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,WAAW,EAAE,MAAM,sBAAsB,CAAC;AAEnD,OAAO,EAAE,YAAY,EAAE,MAAM,kBAAkB,CAAC;AAChD,OAAO,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC;AAKlD,MAAM,CAAC,MAAM,YAAY,GAAiD,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CACxF,WAAW,CAAC,MAAM,EAAE;IAChB,CAAC,YAAY,EAAE,KAAK,CAAC;IACrB,CAAC,aAAa,EAAE,KAAK,CAAC;CACzB,CAAC,CAAC"}
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import
|
|
1
|
+
import validator from 'validator';
|
|
2
2
|
import { isNumber, isString } from '@rnw-community/shared';
|
|
3
3
|
const isValidStringAmount = (stringAmount) => {
|
|
4
4
|
if (stringAmount.endsWith('.')) {
|
|
5
5
|
return false;
|
|
6
6
|
}
|
|
7
|
-
return isDecimal(stringAmount);
|
|
7
|
+
return validator.isDecimal(stringAmount);
|
|
8
8
|
};
|
|
9
9
|
export const isValidDecimalMonetaryValue = (amountValue) => {
|
|
10
10
|
if (!isNumber(amountValue) && !isString(amountValue)) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"is-valid-decimal-monetary-value.util.js","sourceRoot":"","sources":["../../../src/util/is-valid-decimal-monetary-value.util.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,
|
|
1
|
+
{"version":3,"file":"is-valid-decimal-monetary-value.util.js","sourceRoot":"","sources":["../../../src/util/is-valid-decimal-monetary-value.util.ts"],"names":[],"mappings":"AAAA,OAAO,SAAS,MAAM,WAAW,CAAC;AAElC,OAAO,EAAE,QAAQ,EAAE,QAAQ,EAAE,MAAM,uBAAuB,CAAC;AAI3D,MAAM,mBAAmB,GAAG,CAAC,YAAoB,EAAW,EAAE;IAC1D,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,EAAE,CAAC;QAC7B,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,SAAS,CAAC,SAAS,CAAC,YAAY,CAAC,CAAC;AAC7C,CAAC,CAAC;AAEF,MAAM,CAAC,MAAM,2BAA2B,GAAG,CAAC,WAAwB,EAAW,EAAE;IAC7E,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,IAAI,CAAC,QAAQ,CAAC,WAAW,CAAC,EAAE,CAAC;QACnD,OAAO,KAAK,CAAC;IACjB,CAAC;IAED,OAAO,QAAQ,CAAC,WAAW,CAAC,IAAI,mBAAmB,CAAC,WAAW,CAAC,CAAC;AACrE,CAAC,CAAC"}
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { isDefined } from '@rnw-community/shared';
|
|
1
|
+
import { isDefined, isNotEmptyArray } from '@rnw-community/shared';
|
|
2
2
|
import { ConstructorError } from '../error/constructor.error';
|
|
3
3
|
/** @deprecated Move to PaymentRequest */
|
|
4
4
|
export const validatePaymentMethods = (methodData) => {
|
|
5
5
|
// Check that at least one payment method is passed in
|
|
6
|
-
if (methodData
|
|
6
|
+
if (!isNotEmptyArray(methodData)) {
|
|
7
7
|
throw new ConstructorError(`At least one payment method is required`);
|
|
8
8
|
}
|
|
9
9
|
// Check that each payment method has at least one payment method identifier
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-payment-methods.util.js","sourceRoot":"","sources":["../../../src/util/validate-payment-methods.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;
|
|
1
|
+
{"version":3,"file":"validate-payment-methods.util.js","sourceRoot":"","sources":["../../../src/util/validate-payment-methods.util.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,SAAS,EAAE,eAAe,EAAE,MAAM,uBAAuB,CAAC;AAEnE,OAAO,EAAE,gBAAgB,EAAE,MAAM,4BAA4B,CAAC;AAI9D,yCAAyC;AACzC,MAAM,CAAC,MAAM,sBAAsB,GAAG,CAAC,UAA+B,EAAQ,EAAE;IAC5E,sDAAsD;IACtD,IAAI,CAAC,eAAe,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,gBAAgB,CAAC,yCAAyC,CAAC,CAAC;IAC1E,CAAC;IAED,4EAA4E;IAC5E,UAAU,CAAC,OAAO,CAAC,aAAa,CAAC,EAAE;QAC/B,IAAI,CAAC,SAAS,CAAC,aAAa,CAAC,gBAAgB,CAAC,EAAE,CAAC;YAC7C,MAAM,IAAI,gBAAgB,CAAC,gDAAgD,CAAC,CAAC;QACjF,CAAC;IACL,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
package/ios/Payments.mm
CHANGED
|
@@ -170,7 +170,15 @@ RCT_EXPORT_METHOD(complete: (NSString *)paymentStatus
|
|
|
170
170
|
|
|
171
171
|
self.completion([[PKPaymentAuthorizationResult alloc] initWithStatus:status errors:nil]);
|
|
172
172
|
|
|
173
|
-
|
|
173
|
+
dispatch_async(dispatch_get_main_queue(), ^{
|
|
174
|
+
if (self.viewController.presentingViewController) {
|
|
175
|
+
[self.viewController dismissViewControllerAnimated:YES completion:^{
|
|
176
|
+
resolve(nil);
|
|
177
|
+
}];
|
|
178
|
+
} else {
|
|
179
|
+
resolve(nil);
|
|
180
|
+
}
|
|
181
|
+
});
|
|
174
182
|
}
|
|
175
183
|
|
|
176
184
|
RCT_EXPORT_METHOD(canMakePayments: (NSString *)methodDataString
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnw-community/react-native-payments",
|
|
3
|
-
"version": "
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "1.2.0",
|
|
4
|
+
"description": "Accept Payments with Apple Pay and Android Pay using the Payment Request API.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
7
7
|
"react-native",
|
|
@@ -31,7 +31,10 @@
|
|
|
31
31
|
"import": "./dist/esm/index.js",
|
|
32
32
|
"require": "./dist/cjs/index.js"
|
|
33
33
|
},
|
|
34
|
-
"./app.plugin":
|
|
34
|
+
"./app.plugin": {
|
|
35
|
+
"import": "./dist/esm/app.plugin.js",
|
|
36
|
+
"require": "./dist/cjs/app.plugin.js"
|
|
37
|
+
},
|
|
35
38
|
"./package.json": "./package.json"
|
|
36
39
|
},
|
|
37
40
|
"react-native": "src/index.ts",
|
|
@@ -45,8 +48,6 @@
|
|
|
45
48
|
"ios",
|
|
46
49
|
"cpp",
|
|
47
50
|
"*.podspec",
|
|
48
|
-
"plugins",
|
|
49
|
-
"app.plugin.js",
|
|
50
51
|
"!ios/build",
|
|
51
52
|
"!android/build",
|
|
52
53
|
"!android/gradle",
|
|
@@ -72,17 +73,14 @@
|
|
|
72
73
|
"test": "run -T jest --passWithNoTests",
|
|
73
74
|
"test:coverage": "run -T jest --coverage --passWithNoTests",
|
|
74
75
|
"format": "run -T prettier --write \"./src/**/*.{ts,tsx}\"",
|
|
75
|
-
"clear": "rm -rf coverage && rm -rf dist && rm -f *.tsbuildinfo
|
|
76
|
+
"clear": "rm -rf coverage && rm -rf dist && rm -f *.tsbuildinfo",
|
|
76
77
|
"clear:deps": "rm -rf ./node_modules && rm -rf ./dist",
|
|
77
|
-
"
|
|
78
|
-
"example": "yarn --cwd example",
|
|
79
|
-
"build:android": "cd example/android && ./gradlew assembleDebug --no-daemon --console=plain -PreactNativeArchitectures=arm64-v8a",
|
|
80
|
-
"build:ios": "cd example/ios && xcodebuild -workspace PaymentsExample.xcworkspace -scheme PaymentsExample -configuration Debug -sdk iphonesimulator CC=clang CPLUSPLUS=clang++ LD=clang LDPLUSPLUS=clang++ GCC_OPTIMIZATION_LEVEL=0 GCC_PRECOMPILE_PREFIX_HEADER=YES ASSETCATALOG_COMPILER_OPTIMIZATION=time DEBUG_INFORMATION_FORMAT=dwarf COMPILER_INDEX_STORE_ENABLE=NO"
|
|
78
|
+
"example": "yarn --cwd example"
|
|
81
79
|
},
|
|
82
|
-
"gitHead": "
|
|
80
|
+
"gitHead": "028837fd8d39e79797438f41eeff1128a9ad5652",
|
|
83
81
|
"dependencies": {
|
|
84
|
-
"@expo/config-plugins": "
|
|
85
|
-
"@rnw-community/shared": "
|
|
82
|
+
"@expo/config-plugins": "^9.0.14",
|
|
83
|
+
"@rnw-community/shared": "1.1.0",
|
|
86
84
|
"react-native-uuid": "^2.0.1",
|
|
87
85
|
"validator": "^13.9.0"
|
|
88
86
|
},
|
|
@@ -11,31 +11,34 @@ Pod::Spec.new do |s|
|
|
|
11
11
|
s.license = package["license"]
|
|
12
12
|
s.authors = package["author"]
|
|
13
13
|
|
|
14
|
-
s.platforms = { :ios =>
|
|
14
|
+
s.platforms = { :ios => min_ios_version_supported }
|
|
15
15
|
s.source = { :git => "https://github.com/vitalyiegorov/react-native-payments.git", :tag => "#{s.version}" }
|
|
16
16
|
|
|
17
|
-
s.source_files = "ios/**/*.{h,m,mm}"
|
|
17
|
+
s.source_files = "ios/**/*.{h,m,mm,cpp}"
|
|
18
|
+
s.private_header_files = "ios/generated/**/*.h"
|
|
19
|
+
|
|
20
|
+
s.frameworks = "PassKit"
|
|
18
21
|
|
|
19
22
|
# Use install_modules_dependencies helper to install the dependencies if React Native version >=0.71.0.
|
|
20
23
|
# See https://github.com/facebook/react-native/blob/febf6b7f33fdb4904669f99d795eba4c0f95d7bf/scripts/cocoapods/new_architecture.rb#L79.
|
|
21
24
|
if respond_to?(:install_modules_dependencies, true)
|
|
22
25
|
install_modules_dependencies(s)
|
|
23
26
|
else
|
|
24
|
-
|
|
27
|
+
s.dependency "React-Core"
|
|
25
28
|
|
|
26
|
-
|
|
27
|
-
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
40
|
-
end
|
|
29
|
+
# Don't install the dependencies when we run `pod install` in the old architecture.
|
|
30
|
+
if ENV['RCT_NEW_ARCH_ENABLED'] == '1' then
|
|
31
|
+
s.compiler_flags = folly_compiler_flags + " -DRCT_NEW_ARCH_ENABLED=1"
|
|
32
|
+
s.pod_target_xcconfig = {
|
|
33
|
+
"HEADER_SEARCH_PATHS" => "\"$(PODS_ROOT)/boost\"",
|
|
34
|
+
"OTHER_CPLUSPLUSFLAGS" => "-DFOLLY_NO_CONFIG -DFOLLY_MOBILE=1 -DFOLLY_USE_LIBCPP=1",
|
|
35
|
+
"CLANG_CXX_LANGUAGE_STANDARD" => "c++17"
|
|
36
|
+
}
|
|
37
|
+
s.dependency "React-Codegen"
|
|
38
|
+
s.dependency "RCT-Folly"
|
|
39
|
+
s.dependency "RCTRequired"
|
|
40
|
+
s.dependency "RCTTypeSafety"
|
|
41
|
+
s.dependency "ReactCommon/turbomodule/core"
|
|
42
|
+
end
|
|
43
|
+
end
|
|
41
44
|
end
|
package/readme.md
CHANGED
|
@@ -52,6 +52,7 @@ integration experience for your applications.
|
|
|
52
52
|
- Follow [this guide](https://developer.apple.com/library/archive/ApplePay_Guide/Configuration.html) to setup ApplePay in
|
|
53
53
|
your application.
|
|
54
54
|
- [Payment token reference](https://developer.apple.com/documentation/passkit/apple_pay/payment_token_format_reference?language=objc)
|
|
55
|
+
#### Objective-C setup
|
|
55
56
|
- Add following code to your `AppDelegate.h`:
|
|
56
57
|
```objc
|
|
57
58
|
#import <RCTAppDelegate.h>
|
|
@@ -59,7 +60,15 @@ integration experience for your applications.
|
|
|
59
60
|
#import <PassKit/PassKit.h> // Add this import
|
|
60
61
|
|
|
61
62
|
@interface AppDelegate : RCTAppDelegate
|
|
62
|
-
|
|
63
|
+
```
|
|
64
|
+
#### Swift setup
|
|
65
|
+
- Add following code to your `AppDelegate.swift`:
|
|
66
|
+
```swift
|
|
67
|
+
import UIKit
|
|
68
|
+
import React
|
|
69
|
+
import React_RCTAppDelegate
|
|
70
|
+
import ReactAppDependencyProvider
|
|
71
|
+
import PassKit // Add this import
|
|
63
72
|
```
|
|
64
73
|
|
|
65
74
|
### AndroidPay setup
|
|
@@ -83,30 +92,27 @@ dependencies {
|
|
|
83
92
|
|
|
84
93
|
### Expo setup
|
|
85
94
|
|
|
86
|
-
To integrate with Expo custom builds, you need to add the
|
|
95
|
+
To integrate with Expo [custom builds](https://docs.expo.dev/custom-builds/get-started/), you need to add the `@rnw-community/react-native-payments` plugin into your `app.config.js`:
|
|
87
96
|
|
|
88
97
|
1. Update your `app.config.js` configuration:
|
|
89
98
|
```js
|
|
90
99
|
export default {
|
|
91
|
-
expo: {
|
|
92
|
-
...
|
|
93
|
-
ios: {
|
|
94
|
-
...
|
|
95
|
-
infoPlist: {
|
|
96
|
-
merchant_id: [your_merchant_id],
|
|
97
|
-
},
|
|
98
|
-
entitlements: {
|
|
99
|
-
"com.apple.developer.in-app-payments": [your_merchant_id],
|
|
100
|
-
},
|
|
101
|
-
...
|
|
102
|
-
},
|
|
103
100
|
plugins: [
|
|
104
101
|
...
|
|
105
|
-
|
|
102
|
+
[
|
|
103
|
+
"@rnw-community/react-native-payments/app.plugin",
|
|
104
|
+
{
|
|
105
|
+
"merchantIdentifier": "merchant.react-native-payments"
|
|
106
|
+
}
|
|
107
|
+
],
|
|
106
108
|
],
|
|
107
109
|
},
|
|
108
110
|
};
|
|
109
111
|
```
|
|
112
|
+
2. Prebuild your project:
|
|
113
|
+
```bash
|
|
114
|
+
npx expo prebuild --clean
|
|
115
|
+
```
|
|
110
116
|
|
|
111
117
|
## Usage
|
|
112
118
|
|
|
@@ -181,7 +187,7 @@ Depending on the platform and payment method, you can provide additional data to
|
|
|
181
187
|
|
|
182
188
|
- `environment`: This property represents the Android environment for the payment.
|
|
183
189
|
- `requestPayerName`: "An optional boolean field that, when present and set to true, indicates that the `PaymentResponse` will include the name of the payer.
|
|
184
|
-
- `requestPayerPhone`: "An optional boolean field that, when present and set to true, indicates that the `PaymentResponse` will include the phone of the payer.
|
|
190
|
+
- `requestPayerPhone`: "An optional boolean field that, when present and set to true, indicates that the `PaymentResponse` will include the phone of the payer.
|
|
185
191
|
- `requestBillingAddress`: An optional boolean field that, when present and set to true, indicates that the `PaymentResponse` will
|
|
186
192
|
include the billing address of the payer.
|
|
187
193
|
- `requestPayerEmail`: An optional boolean field that, when present and set to true, indicates that the `PaymentResponse` will
|
|
@@ -305,8 +311,16 @@ export function setupJestTurboModuleMock(): void {
|
|
|
305
311
|
|
|
306
312
|
## Example
|
|
307
313
|
|
|
308
|
-
|
|
309
|
-
the [react-native-payments-example](../react-native-payments-example/README.md) package.
|
|
314
|
+
### Expo
|
|
315
|
+
You can find working example in the `App` component of the [react-native-payments-expo-example](../react-native-payments-expo-example/README.md) package.
|
|
316
|
+
|
|
317
|
+
#### Web(react-native-web)
|
|
318
|
+
On web the library will fallback to [W3C implementation](https://developer.mozilla.org/en-US/docs/Web/API/Payment_Request_API)
|
|
319
|
+
|
|
320
|
+
### Bare React Native CLI
|
|
321
|
+
You can find working example in the `App` component of the [react-native-payments-example](../react-native-payments-example/README.md) package.
|
|
322
|
+
|
|
323
|
+
|
|
310
324
|
|
|
311
325
|
## TODO
|
|
312
326
|
|
|
@@ -335,16 +349,8 @@ the [react-native-payments-example](../react-native-payments-example/README.md)
|
|
|
335
349
|
|
|
336
350
|
### Other
|
|
337
351
|
|
|
338
|
-
- [ ] Add [EXPO support](https://docs.expo.dev/modules/existing-library/)
|
|
339
|
-
- [ ] Add unit tests
|
|
340
352
|
- [ ] Refactor `utils`
|
|
341
|
-
- [ ]
|
|
342
|
-
- [ ] Merge react-native-payments-example into this package, and setup it properly
|
|
343
|
-
- [ ] CI/CD:
|
|
344
|
-
- [ ] check/setup pull request
|
|
345
|
-
- [ ] check/setup push to master and release to NPM
|
|
346
|
-
- [ ] add e2e via maestro for IOS
|
|
347
|
-
- [ ] add e2e via maestro for Android
|
|
353
|
+
- [ ] Find alternative/suctom implementation for the `validator` library
|
|
348
354
|
|
|
349
355
|
## License
|
|
350
356
|
|