@rnw-community/react-native-payments 0.83.1 → 1.1.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/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/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/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/package.json +10 -12
- package/react-native-payments.podspec +21 -18
- package/readme.md +22 -18
- package/src/app.plugin.ts +3 -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/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
package/LICENSE.md
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
MIT License
|
|
2
2
|
|
|
3
|
-
Copyright (c) 2018-
|
|
3
|
+
Copyright (c) 2018-2025 Vitalii Yehorov and others
|
|
4
4
|
|
|
5
5
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
6
|
of this software and associated documentation files (the "Software"), to deal
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.plugin.d.ts","sourceRoot":"","sources":["../../src/app.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.plugin.js","sourceRoot":"","sources":["../../src/app.plugin.ts"],"names":[],"mappings":";;AAAA,gEAA4D;AAE5D,kBAAe,4BAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.props.d.ts","sourceRoot":"","sources":["../../../src/expo-plugins/plugin.props.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,8BAA8B;IAC3C,kBAAkB,EAAE,MAAM,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.props.js","sourceRoot":"","sources":["../../../src/expo-plugins/plugin.props.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-apple-pay.d.ts","sourceRoot":"","sources":["../../../src/expo-plugins/with-apple-pay.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,8BAA8B,CAmBrE,CAAC"}
|
|
@@ -0,0 +1,24 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withApplePay = void 0;
|
|
4
|
+
const config_plugins_1 = require("expo/config-plugins");
|
|
5
|
+
const shared_1 = require("@rnw-community/shared");
|
|
6
|
+
const withApplePay = (initialConfig, { merchantIdentifier }) => {
|
|
7
|
+
if (!(0, shared_1.isDefined)(merchantIdentifier)) {
|
|
8
|
+
throw new Error(`Pleas provide "@rnw-community/react-native-payments" plugin option "merchantIdentifier"`);
|
|
9
|
+
}
|
|
10
|
+
return (0, config_plugins_1.withEntitlementsPlist)(initialConfig, configWithEntitlements => {
|
|
11
|
+
if (merchantIdentifier) {
|
|
12
|
+
if (!(0, shared_1.isDefined)(configWithEntitlements.modResults['com.apple.developer.in-app-payments'])) {
|
|
13
|
+
configWithEntitlements.modResults['com.apple.developer.in-app-payments'] = [];
|
|
14
|
+
}
|
|
15
|
+
const applePayArray = configWithEntitlements.modResults['com.apple.developer.in-app-payments'];
|
|
16
|
+
if (!applePayArray.includes(merchantIdentifier)) {
|
|
17
|
+
applePayArray.push(merchantIdentifier);
|
|
18
|
+
}
|
|
19
|
+
}
|
|
20
|
+
return configWithEntitlements;
|
|
21
|
+
});
|
|
22
|
+
};
|
|
23
|
+
exports.withApplePay = withApplePay;
|
|
24
|
+
//# sourceMappingURL=with-apple-pay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-apple-pay.js","sourceRoot":"","sources":["../../../src/expo-plugins/with-apple-pay.ts"],"names":[],"mappings":";;;AAAA,wDAA4D;AAE5D,kDAAkD;AAK3C,MAAM,YAAY,GAAiD,CAAC,aAAa,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE;IAChH,IAAI,CAAC,IAAA,kBAAS,EAAC,kBAAkB,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,yFAAyF,CAAC,CAAC;IAC/G,CAAC;IAED,OAAO,IAAA,sCAAqB,EAAC,aAAa,EAAE,sBAAsB,CAAC,EAAE;QACjE,IAAI,kBAAkB,EAAE,CAAC;YACrB,IAAI,CAAC,IAAA,kBAAS,EAAC,sBAAsB,CAAC,UAAU,CAAC,qCAAqC,CAAC,CAAC,EAAE,CAAC;gBACvF,sBAAsB,CAAC,UAAU,CAAC,qCAAqC,CAAC,GAAG,EAAE,CAAC;YAClF,CAAC;YAED,MAAM,aAAa,GAAG,sBAAsB,CAAC,UAAU,CAAC,qCAAqC,CAAa,CAAC;YAC3G,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;gBAC9C,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC3C,CAAC;QACL,CAAC;QAED,OAAO,sBAAsB,CAAC;IAClC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC;AAnBW,QAAA,YAAY,gBAmBvB"}
|
|
@@ -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,26 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withGooglePay = void 0;
|
|
4
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
5
|
+
const withGooglePay = initialConfig => (0, config_plugins_1.withAndroidManifest)(initialConfig, config => {
|
|
6
|
+
const androidManifest = config.modResults;
|
|
7
|
+
const mainApplication = androidManifest.manifest.application?.[0];
|
|
8
|
+
if (mainApplication) {
|
|
9
|
+
const existingMetaData = mainApplication['meta-data']?.find(metadata => metadata.$['android:name'] === 'com.google.android.gms.wallet.api.enabled');
|
|
10
|
+
if (!existingMetaData) {
|
|
11
|
+
if (!mainApplication['meta-data']) {
|
|
12
|
+
mainApplication['meta-data'] = [];
|
|
13
|
+
}
|
|
14
|
+
mainApplication['meta-data'].push({
|
|
15
|
+
// eslint-disable-next-line id-length
|
|
16
|
+
$: {
|
|
17
|
+
'android:name': 'com.google.android.gms.wallet.api.enabled',
|
|
18
|
+
'android:value': 'true',
|
|
19
|
+
},
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
return config;
|
|
24
|
+
});
|
|
25
|
+
exports.withGooglePay = withGooglePay;
|
|
26
|
+
//# 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,yDAA2D;AAKpD,MAAM,aAAa,GAAiD,aAAa,CAAC,EAAE,CACvF,IAAA,oCAAmB,EAAC,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;AAzBM,QAAA,aAAa,iBAyBnB"}
|
|
@@ -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,12 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.withPayments = void 0;
|
|
4
|
+
const config_plugins_1 = require("@expo/config-plugins");
|
|
5
|
+
const with_apple_pay_1 = require("./with-apple-pay");
|
|
6
|
+
const with_google_pay_1 = require("./with-google-pay");
|
|
7
|
+
const withPayments = (config, props) => (0, config_plugins_1.withPlugins)(config, [
|
|
8
|
+
[with_apple_pay_1.withApplePay, props],
|
|
9
|
+
[with_google_pay_1.withGooglePay, props],
|
|
10
|
+
]);
|
|
11
|
+
exports.withPayments = withPayments;
|
|
12
|
+
//# 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,yDAAmD;AAEnD,qDAAgD;AAChD,uDAAkD;AAK3C,MAAM,YAAY,GAAiD,CAAC,MAAM,EAAE,KAAK,EAAE,EAAE,CACxF,IAAA,4BAAW,EAAC,MAAM,EAAE;IAChB,CAAC,6BAAY,EAAE,KAAK,CAAC;IACrB,CAAC,+BAAa,EAAE,KAAK,CAAC;CACzB,CAAC,CAAC;AAJM,QAAA,YAAY,gBAIlB"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.plugin.d.ts","sourceRoot":"","sources":["../../src/app.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"app.plugin.js","sourceRoot":"","sources":["../../src/app.plugin.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAAE,MAAM,8BAA8B,CAAC;AAE5D,eAAe,YAAY,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.props.d.ts","sourceRoot":"","sources":["../../../src/expo-plugins/plugin.props.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,8BAA8B;IAC3C,kBAAkB,EAAE,MAAM,CAAC;CAC9B"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"plugin.props.js","sourceRoot":"","sources":["../../../src/expo-plugins/plugin.props.ts"],"names":[],"mappings":""}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-apple-pay.d.ts","sourceRoot":"","sources":["../../../src/expo-plugins/with-apple-pay.ts"],"names":[],"mappings":"AAIA,OAAO,KAAK,EAAE,8BAA8B,EAAE,MAAM,gBAAgB,CAAC;AACrE,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,qBAAqB,CAAC;AAExD,eAAO,MAAM,YAAY,EAAE,YAAY,CAAC,8BAA8B,CAmBrE,CAAC"}
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
import { withEntitlementsPlist } from 'expo/config-plugins';
|
|
2
|
+
import { isDefined } from '@rnw-community/shared';
|
|
3
|
+
export const withApplePay = (initialConfig, { merchantIdentifier }) => {
|
|
4
|
+
if (!isDefined(merchantIdentifier)) {
|
|
5
|
+
throw new Error(`Pleas provide "@rnw-community/react-native-payments" plugin option "merchantIdentifier"`);
|
|
6
|
+
}
|
|
7
|
+
return withEntitlementsPlist(initialConfig, configWithEntitlements => {
|
|
8
|
+
if (merchantIdentifier) {
|
|
9
|
+
if (!isDefined(configWithEntitlements.modResults['com.apple.developer.in-app-payments'])) {
|
|
10
|
+
configWithEntitlements.modResults['com.apple.developer.in-app-payments'] = [];
|
|
11
|
+
}
|
|
12
|
+
const applePayArray = configWithEntitlements.modResults['com.apple.developer.in-app-payments'];
|
|
13
|
+
if (!applePayArray.includes(merchantIdentifier)) {
|
|
14
|
+
applePayArray.push(merchantIdentifier);
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
return configWithEntitlements;
|
|
18
|
+
});
|
|
19
|
+
};
|
|
20
|
+
//# sourceMappingURL=with-apple-pay.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"with-apple-pay.js","sourceRoot":"","sources":["../../../src/expo-plugins/with-apple-pay.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,qBAAqB,EAAE,MAAM,qBAAqB,CAAC;AAE5D,OAAO,EAAE,SAAS,EAAE,MAAM,uBAAuB,CAAC;AAKlD,MAAM,CAAC,MAAM,YAAY,GAAiD,CAAC,aAAa,EAAE,EAAE,kBAAkB,EAAE,EAAE,EAAE;IAChH,IAAI,CAAC,SAAS,CAAC,kBAAkB,CAAC,EAAE,CAAC;QACjC,MAAM,IAAI,KAAK,CAAC,yFAAyF,CAAC,CAAC;IAC/G,CAAC;IAED,OAAO,qBAAqB,CAAC,aAAa,EAAE,sBAAsB,CAAC,EAAE;QACjE,IAAI,kBAAkB,EAAE,CAAC;YACrB,IAAI,CAAC,SAAS,CAAC,sBAAsB,CAAC,UAAU,CAAC,qCAAqC,CAAC,CAAC,EAAE,CAAC;gBACvF,sBAAsB,CAAC,UAAU,CAAC,qCAAqC,CAAC,GAAG,EAAE,CAAC;YAClF,CAAC;YAED,MAAM,aAAa,GAAG,sBAAsB,CAAC,UAAU,CAAC,qCAAqC,CAAa,CAAC;YAC3G,IAAI,CAAC,aAAa,CAAC,QAAQ,CAAC,kBAAkB,CAAC,EAAE,CAAC;gBAC9C,aAAa,CAAC,IAAI,CAAC,kBAAkB,CAAC,CAAC;YAC3C,CAAC;QACL,CAAC;QAED,OAAO,sBAAsB,CAAC;IAClC,CAAC,CAAC,CAAC;AACP,CAAC,CAAC"}
|
|
@@ -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"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@rnw-community/react-native-payments",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "1.1.0",
|
|
4
4
|
"description": "React Native Payments",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"react",
|
|
@@ -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": "fdf81233f870fb05fb06c952f091d7d35df77c68",
|
|
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
|
|
@@ -335,11 +341,9 @@ the [react-native-payments-example](../react-native-payments-example/README.md)
|
|
|
335
341
|
|
|
336
342
|
### Other
|
|
337
343
|
|
|
338
|
-
- [ ] Add [EXPO support](https://docs.expo.dev/modules/existing-library/)
|
|
339
344
|
- [ ] Add unit tests
|
|
340
345
|
- [ ] Refactor `utils`
|
|
341
346
|
- [ ] Add web support
|
|
342
|
-
- [ ] Merge react-native-payments-example into this package, and setup it properly
|
|
343
347
|
- [ ] CI/CD:
|
|
344
348
|
- [ ] check/setup pull request
|
|
345
349
|
- [ ] check/setup push to master and release to NPM
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { withEntitlementsPlist } from 'expo/config-plugins';
|
|
2
|
+
|
|
3
|
+
import { isDefined } from '@rnw-community/shared';
|
|
4
|
+
|
|
5
|
+
import type { ReactNativePaymentsPluginProps } from './plugin.props';
|
|
6
|
+
import type { ConfigPlugin } from 'expo/config-plugins';
|
|
7
|
+
|
|
8
|
+
export const withApplePay: ConfigPlugin<ReactNativePaymentsPluginProps> = (initialConfig, { merchantIdentifier }) => {
|
|
9
|
+
if (!isDefined(merchantIdentifier)) {
|
|
10
|
+
throw new Error(`Pleas provide "@rnw-community/react-native-payments" plugin option "merchantIdentifier"`);
|
|
11
|
+
}
|
|
12
|
+
|
|
13
|
+
return withEntitlementsPlist(initialConfig, configWithEntitlements => {
|
|
14
|
+
if (merchantIdentifier) {
|
|
15
|
+
if (!isDefined(configWithEntitlements.modResults['com.apple.developer.in-app-payments'])) {
|
|
16
|
+
configWithEntitlements.modResults['com.apple.developer.in-app-payments'] = [];
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
const applePayArray = configWithEntitlements.modResults['com.apple.developer.in-app-payments'] as string[];
|
|
20
|
+
if (!applePayArray.includes(merchantIdentifier)) {
|
|
21
|
+
applePayArray.push(merchantIdentifier);
|
|
22
|
+
}
|
|
23
|
+
}
|
|
24
|
+
|
|
25
|
+
return configWithEntitlements;
|
|
26
|
+
});
|
|
27
|
+
};
|
|
@@ -0,0 +1,31 @@
|
|
|
1
|
+
import { withAndroidManifest } from '@expo/config-plugins';
|
|
2
|
+
|
|
3
|
+
import type { ReactNativePaymentsPluginProps } from './plugin.props';
|
|
4
|
+
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
5
|
+
|
|
6
|
+
export const withGooglePay: ConfigPlugin<ReactNativePaymentsPluginProps> = initialConfig =>
|
|
7
|
+
withAndroidManifest(initialConfig, config => {
|
|
8
|
+
const androidManifest = config.modResults;
|
|
9
|
+
const mainApplication = androidManifest.manifest.application?.[0];
|
|
10
|
+
|
|
11
|
+
if (mainApplication) {
|
|
12
|
+
const existingMetaData = mainApplication['meta-data']?.find(
|
|
13
|
+
metadata => metadata.$['android:name'] === 'com.google.android.gms.wallet.api.enabled'
|
|
14
|
+
);
|
|
15
|
+
|
|
16
|
+
if (!existingMetaData) {
|
|
17
|
+
if (!mainApplication['meta-data']) {
|
|
18
|
+
mainApplication['meta-data'] = [];
|
|
19
|
+
}
|
|
20
|
+
mainApplication['meta-data'].push({
|
|
21
|
+
// eslint-disable-next-line id-length
|
|
22
|
+
$: {
|
|
23
|
+
'android:name': 'com.google.android.gms.wallet.api.enabled',
|
|
24
|
+
'android:value': 'true',
|
|
25
|
+
},
|
|
26
|
+
});
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
|
|
30
|
+
return config;
|
|
31
|
+
});
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
import { withPlugins } from '@expo/config-plugins';
|
|
2
|
+
|
|
3
|
+
import { withApplePay } from './with-apple-pay';
|
|
4
|
+
import { withGooglePay } from './with-google-pay';
|
|
5
|
+
|
|
6
|
+
import type { ReactNativePaymentsPluginProps } from './plugin.props';
|
|
7
|
+
import type { ConfigPlugin } from '@expo/config-plugins';
|
|
8
|
+
|
|
9
|
+
export const withPayments: ConfigPlugin<ReactNativePaymentsPluginProps> = (config, props) =>
|
|
10
|
+
withPlugins(config, [
|
|
11
|
+
[withApplePay, props],
|
|
12
|
+
[withGooglePay, props],
|
|
13
|
+
]);
|
package/app.plugin.js
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./plugins/with-payments');
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
const { withDangerousMod } = require("@expo/config-plugins");
|
|
2
|
-
const fs = require("fs");
|
|
3
|
-
const path = require("path");
|
|
4
|
-
|
|
5
|
-
const withApplePay = (config) =>
|
|
6
|
-
withDangerousMod(config, [
|
|
7
|
-
"ios",
|
|
8
|
-
async (config) => {
|
|
9
|
-
const filePath = path.join(
|
|
10
|
-
config.modRequest.platformProjectRoot,
|
|
11
|
-
config.modRequest.projectName,
|
|
12
|
-
"AppDelegate.h"
|
|
13
|
-
);
|
|
14
|
-
|
|
15
|
-
const content = fs.readFileSync(filePath, "utf-8");
|
|
16
|
-
if (!content.includes("#import <PassKit/PassKit.h>")) {
|
|
17
|
-
fs.writeFileSync(filePath, `#import <PassKit/PassKit.h>\n${content}`);
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
return config;
|
|
21
|
-
},
|
|
22
|
-
]);
|
|
23
|
-
|
|
24
|
-
module.exports = { withApplePay };
|
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
const { withAppBuildGradle, withAndroidManifest } = require("@expo/config-plugins");
|
|
2
|
-
|
|
3
|
-
const withGooglePay = (config) => {
|
|
4
|
-
// Add Google Pay dependency to app/build.gradle
|
|
5
|
-
config = withAppBuildGradle(config, (config) => {
|
|
6
|
-
if (config.modResults.language === "groovy") {
|
|
7
|
-
config.modResults.contents = config.modResults.contents.replace(
|
|
8
|
-
/dependencies\s?{/,
|
|
9
|
-
`dependencies {
|
|
10
|
-
implementation 'com.google.android.gms:play-services-wallet:19.2.0'`,
|
|
11
|
-
);
|
|
12
|
-
} else {
|
|
13
|
-
throw new Error(
|
|
14
|
-
"Unable to add Google Pay dependency to build.gradle: Kotlin build files are not supported."
|
|
15
|
-
);
|
|
16
|
-
}
|
|
17
|
-
return config;
|
|
18
|
-
});
|
|
19
|
-
|
|
20
|
-
// Add meta-data to AndroidManifest.xml
|
|
21
|
-
config = withAndroidManifest(config, async (config) => {
|
|
22
|
-
const androidManifest = config.modResults;
|
|
23
|
-
const mainApplication = androidManifest.manifest.application[0];
|
|
24
|
-
|
|
25
|
-
// Check if the meta-data already exists
|
|
26
|
-
const existingMetaData = mainApplication["meta-data"]?.find(
|
|
27
|
-
(metadata) => metadata.$["android:name"] === "com.google.android.gms.wallet.api.enabled"
|
|
28
|
-
);
|
|
29
|
-
|
|
30
|
-
if (!existingMetaData) {
|
|
31
|
-
// Add the new meta-data
|
|
32
|
-
if (!mainApplication["meta-data"]) {
|
|
33
|
-
mainApplication["meta-data"] = [];
|
|
34
|
-
}
|
|
35
|
-
mainApplication["meta-data"].push({
|
|
36
|
-
$: {
|
|
37
|
-
"android:name": "com.google.android.gms.wallet.api.enabled",
|
|
38
|
-
"android:value": "true",
|
|
39
|
-
},
|
|
40
|
-
});
|
|
41
|
-
}
|
|
42
|
-
|
|
43
|
-
return config;
|
|
44
|
-
});
|
|
45
|
-
|
|
46
|
-
return config;
|
|
47
|
-
};
|
|
48
|
-
|
|
49
|
-
module.exports = { withGooglePay };
|
package/plugins/with-payments.js
DELETED
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
const { withPlugins } = require('@expo/config-plugins');
|
|
2
|
-
const { withApplePay } = require('./with-apple-pay');
|
|
3
|
-
const { withGooglePay } = require('./with-google-pay');
|
|
4
|
-
|
|
5
|
-
const withPayments = (config) => {
|
|
6
|
-
return withPlugins(config, [
|
|
7
|
-
withApplePay,
|
|
8
|
-
withGooglePay
|
|
9
|
-
]);
|
|
10
|
-
};
|
|
11
|
-
|
|
12
|
-
module.exports = withPayments;
|