@stripe/stripe-react-native 0.12.0 → 0.14.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/CHANGELOG.md +51 -9
- package/README.md +2 -2
- package/android/.DS_Store +0 -0
- package/android/.gradle/7.1/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.1/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.1/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.1/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.1/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/.idea/.gitignore +3 -0
- package/android/.idea/gradle.xml +13 -0
- package/android/.idea/misc.xml +9 -0
- package/android/.idea/modules/android.iml +18 -0
- package/android/.idea/modules.xml +8 -0
- package/android/.idea/vcs.xml +6 -0
- package/android/.idea/workspace.xml +52 -0
- package/android/build.gradle +11 -0
- package/android/local.properties +8 -0
- package/android/src/.DS_Store +0 -0
- package/android/src/androidTest/.DS_Store +0 -0
- package/android/src/androidTest/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxyTest.kt +35 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFieldView.kt +21 -6
- package/android/src/main/java/com/reactnativestripesdk/CardFieldViewManager.kt +5 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFormView.kt +8 -0
- package/android/src/main/java/com/reactnativestripesdk/CardFormViewManager.kt +5 -0
- package/android/src/main/java/com/reactnativestripesdk/Mappers.kt +21 -7
- package/android/src/main/java/com/reactnativestripesdk/PaymentSheetFragment.kt +9 -3
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +59 -2
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonView.kt +0 -1
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxy.kt +19 -7
- package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +45 -38
- package/ios/.DS_Store +0 -0
- package/ios/CardFieldManager.m +1 -0
- package/ios/CardFieldView.swift +17 -8
- package/ios/Mappers.swift +8 -9
- package/ios/StripeSdk.m +5 -0
- package/ios/StripeSdk.swift +151 -119
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/contents.xcworkspacedata +7 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcshareddata/IDEWorkspaceChecks.plist +8 -0
- package/ios/StripeSdk.xcodeproj/project.xcworkspace/xcuserdata/charliecruzan.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
- package/ios/StripeSdk.xcodeproj/xcshareddata/xcschemes/Tests.xcscheme +52 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcdebugger/Breakpoints_v2.xcbkptlist +22 -0
- package/ios/StripeSdk.xcodeproj/xcuserdata/charliecruzan.xcuserdatad/xcschemes/xcschememanagement.plist +27 -0
- package/ios/Tests/PushProvisioningTests.swift +49 -0
- package/ios/pushprovisioning/AddToWalletButtonView.swift +1 -5
- package/ios/pushprovisioning/PushProvisioningUtils.swift +64 -0
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/components/AddToWalletButton.js +1 -1
- package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
- package/lib/commonjs/components/ApplePayButton.js +1 -1
- package/lib/commonjs/components/ApplePayButton.js.map +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js +1 -1
- package/lib/commonjs/components/AuBECSDebitForm.js.map +1 -1
- package/lib/commonjs/components/CardField.js +1 -1
- package/lib/commonjs/components/CardField.js.map +1 -1
- package/lib/commonjs/components/CardForm.js +1 -1
- package/lib/commonjs/components/CardForm.js.map +1 -1
- package/lib/commonjs/components/GooglePayButton.js +1 -1
- package/lib/commonjs/components/GooglePayButton.js.map +1 -1
- package/lib/commonjs/components/StripeContainer.js +1 -1
- package/lib/commonjs/components/StripeContainer.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/useStripe.js +1 -1
- package/lib/commonjs/hooks/useStripe.js.map +1 -1
- package/lib/commonjs/types/components/CardFieldInput.js.map +1 -1
- package/lib/commonjs/types/index.js.map +1 -1
- package/lib/module/NativeStripeSdk.js.map +1 -1
- package/lib/module/components/AddToWalletButton.js +1 -1
- package/lib/module/components/AddToWalletButton.js.map +1 -1
- package/lib/module/components/ApplePayButton.js +1 -1
- package/lib/module/components/ApplePayButton.js.map +1 -1
- package/lib/module/components/AuBECSDebitForm.js +1 -1
- package/lib/module/components/AuBECSDebitForm.js.map +1 -1
- package/lib/module/components/CardField.js +1 -1
- package/lib/module/components/CardField.js.map +1 -1
- package/lib/module/components/CardForm.js +1 -1
- package/lib/module/components/CardForm.js.map +1 -1
- package/lib/module/components/GooglePayButton.js +1 -1
- package/lib/module/components/GooglePayButton.js.map +1 -1
- package/lib/module/components/StripeContainer.js +1 -1
- package/lib/module/components/StripeContainer.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/useStripe.js +1 -1
- package/lib/module/hooks/useStripe.js.map +1 -1
- package/lib/module/types/components/CardFieldInput.js.map +1 -1
- package/lib/module/types/index.js.map +1 -1
- package/lib/typescript/e2e/screenObject/BasicPaymentScreen.d.ts +1 -2
- package/lib/typescript/src/NativeStripeSdk.d.ts +2 -1
- package/lib/typescript/src/components/AddToWalletButton.d.ts +1 -1
- package/lib/typescript/src/components/CardField.d.ts +3 -0
- package/lib/typescript/src/components/CardForm.d.ts +2 -0
- package/lib/typescript/src/functions.d.ts +2 -1
- package/lib/typescript/src/hooks/useStripe.d.ts +2 -1
- package/lib/typescript/src/types/PaymentSheet.d.ts +2 -1
- package/lib/typescript/src/types/Token.d.ts +9 -1
- package/lib/typescript/src/types/components/CardFieldInput.d.ts +1 -0
- package/lib/typescript/src/types/components/CardFormView.d.ts +6 -0
- package/lib/typescript/src/types/index.d.ts +21 -4
- package/package.json +6 -4
- package/src/NativeStripeSdk.tsx +5 -0
- package/src/components/AddToWalletButton.tsx +1 -1
- package/src/components/CardField.tsx +5 -0
- package/src/components/CardForm.tsx +6 -0
- package/src/functions.ts +26 -1
- package/src/hooks/useStripe.tsx +13 -0
- package/src/types/PaymentSheet.ts +2 -1
- package/src/types/Token.ts +13 -1
- package/src/types/components/CardFieldInput.ts +1 -0
- package/src/types/components/CardFormView.ts +7 -0
- package/src/types/index.ts +28 -5
- package/stripe-react-native.podspec +6 -1
package/CHANGELOG.md
CHANGED
|
@@ -2,7 +2,49 @@
|
|
|
2
2
|
|
|
3
3
|
## Unreleased
|
|
4
4
|
|
|
5
|
-
## 0.
|
|
5
|
+
## 0.14.0 - 2022-06-30
|
|
6
|
+
|
|
7
|
+
### Breaking changes
|
|
8
|
+
|
|
9
|
+
### New features
|
|
10
|
+
|
|
11
|
+
- Added the `canAddCardToWallet` method. [#986](https://github.com/stripe/stripe-react-native/pull/986).
|
|
12
|
+
|
|
13
|
+
### Fixes
|
|
14
|
+
|
|
15
|
+
- Fix build errors on Xcode 14 beta 1 by upgrading `stripe-ios` to `~>22.5.1`. [#1011](https://github.com/stripe/stripe-react-native/pull/1011)
|
|
16
|
+
- Fixed an issue on Android where the `brand` field in `CardField`'s `onCardChange` callback wouldn't be set unless the card details were fully complete. [#1012](https://github.com/stripe/stripe-react-native/pull/1012)
|
|
17
|
+
- Fixed an issue where Payment Sheet would cause crashes on Android if `merchantDisplayName` wasn't provided. [#1015](https://github.com/stripe/stripe-react-native/pull/1015)
|
|
18
|
+
- Fixed a bug on Android where a crash could occur if the PaymentSheet was canceled and opened again. [#1014](https://github.com/stripe/stripe-react-native/pull/1014)
|
|
19
|
+
- Fixed an instance on iOS where `CardField`'s expiry date would remain marked as valid, even when it's invalid. [#1018](https://github.com/stripe/stripe-react-native/issues/1018)
|
|
20
|
+
|
|
21
|
+
## 0.13.1 - 2022-06-16
|
|
22
|
+
|
|
23
|
+
### Breaking changes
|
|
24
|
+
|
|
25
|
+
### New features
|
|
26
|
+
|
|
27
|
+
### Fixes
|
|
28
|
+
|
|
29
|
+
- Never show postal code input in `CardField` if `postalCodeEnabled=false` (regardless of `countryCode`). [#996](https://github.com/stripe/stripe-react-native/pull/996)
|
|
30
|
+
|
|
31
|
+
## 0.13.0 - 2022-06-15
|
|
32
|
+
|
|
33
|
+
### Breaking changes
|
|
34
|
+
|
|
35
|
+
### New features
|
|
36
|
+
|
|
37
|
+
- Added a `defaultValues` prop to the `CardForm` component. Currently only accepts `countryCode`, and is Android-only. [#974](https://github.com/stripe/stripe-react-native/pull/974)
|
|
38
|
+
- Added the `countryCode` prop to the `CardField` component. [#989](https://github.com/stripe/stripe-react-native/pull/989)
|
|
39
|
+
- Added option to create a PII token (represents the details of personally identifiable information) to the `createToken` method. [#976](https://github.com/stripe/stripe-react-native/pull/976)
|
|
40
|
+
|
|
41
|
+
### Fixes
|
|
42
|
+
|
|
43
|
+
- Resolve with an Error (of type `Canceled`) if no payment option is selected in the Payment Sheet custom flow (i.e., the `x` button is clicked to close the Payment Sheet). [#975](https://github.com/stripe/stripe-react-native/pull/975)
|
|
44
|
+
- Fixed an issue on Android where the `complete` field in the `onCardChange` callback would incorrectly be set to `true` even if the postal code wasn't filled out. [#989](https://github.com/stripe/stripe-react-native/pull/989)
|
|
45
|
+
- Make `SetupIntent.lastSetupError` and `PaymentIntent.lastPaymentError` object shape consistent on iOS and Android.[#990](https://github.com/stripe/stripe-react-native/pull/990)
|
|
46
|
+
|
|
47
|
+
## 0.12.0 - 2022-06-02
|
|
6
48
|
|
|
7
49
|
### Breaking changes
|
|
8
50
|
|
|
@@ -18,7 +60,7 @@
|
|
|
18
60
|
- Fixed a bug where the wrong CVC icon was show in the `CardForm` component on Android. [#966](https://github.com/stripe/stripe-react-native/pull/966)
|
|
19
61
|
- The card brand tint color is now correctly set in the `CardField` component on Android via the `cardStyle.textColor` prop. [#851](https://github.com/stripe/stripe-react-native/pull/851)
|
|
20
62
|
|
|
21
|
-
## 0.11.0
|
|
63
|
+
## 0.11.0 - 2022-05-24
|
|
22
64
|
|
|
23
65
|
### Breaking changes
|
|
24
66
|
|
|
@@ -34,7 +76,7 @@
|
|
|
34
76
|
- Improved error messages on Android for failed `confirmPayment` and `confirmSetupIntent` calls, and any Google Pay related methods. [#957](https://github.com/stripe/stripe-react-native/pull/957)
|
|
35
77
|
- Made Android card validation state consistent with iOS in the `CardField` `onCardChange` callback. [#958](https://github.com/stripe/stripe-react-native/pull/958)
|
|
36
78
|
|
|
37
|
-
## 0.10.0
|
|
79
|
+
## 0.10.0 - 2022-05-19
|
|
38
80
|
|
|
39
81
|
### Breaking changes
|
|
40
82
|
|
|
@@ -46,7 +88,7 @@
|
|
|
46
88
|
|
|
47
89
|
### Fixes
|
|
48
90
|
|
|
49
|
-
## 0.9.0
|
|
91
|
+
## 0.9.0 - 2022-05-10
|
|
50
92
|
|
|
51
93
|
- [#913](https://github.com/stripe/stripe-react-native/pull/913) BREAKING CHANGE: Changed props for the `<AddToWalletButton />` component. Instead of passing `cardHolderName`, `cardLastFour`, `cardDescription`, and `cardBrand` directly as props, you will instead pass a `cardDetails` prop, which is an object containing the following fields:
|
|
52
94
|
- `primaryAccountIdentifier`: The `wallet.primary_account_identifier` value from the issued card.
|
|
@@ -63,7 +105,7 @@
|
|
|
63
105
|
- [#914](https://github.com/stripe/stripe-react-native/pull/914) fix: add `fingerprint` to Card result object on Android (already present on iOS)
|
|
64
106
|
- [#912](https://github.com/stripe/stripe-react-native/pull/912) fix: allow for providing zip code straight from `CardField` component on Android
|
|
65
107
|
|
|
66
|
-
## 0.8.0
|
|
108
|
+
## 0.8.0 - 2022-04-27
|
|
67
109
|
|
|
68
110
|
- **Breaking: This version requires you use `react-native@0.64.0` or above**
|
|
69
111
|
- [#902](https://github.com/stripe/stripe-react-native/pull/902) fix: create custom babel plugin for package.json imports in src/
|
|
@@ -73,7 +115,7 @@
|
|
|
73
115
|
- [#849](https://github.com/stripe/stripe-react-native/pull/849) BREAKING CHANGE: Renamed `placeholder` prop on `<CardField />` and `<CardForm />` to `placeholders`.
|
|
74
116
|
- [#849](https://github.com/stripe/stripe-react-native/pull/849) Feat: Added customized styling options to `<CardForm />` on Android.
|
|
75
117
|
|
|
76
|
-
## 0.7.0
|
|
118
|
+
## 0.7.0 - 2022-04-19
|
|
77
119
|
|
|
78
120
|
- [#894](https://github.com/stripe/stripe-react-native/pull/894) Fix: `<CardField />` `onBlur` callback will now be called appropriately on Android
|
|
79
121
|
- [#846](https://github.com/stripe/stripe-react-native/pull/846) Fix: Avoid crashes when `currentActivity` is null
|
|
@@ -117,21 +159,21 @@
|
|
|
117
159
|
- (Typescript) `GooglePay.IsGooglePaySupportedParams` is now `GooglePay.IsSupportedParams`
|
|
118
160
|
- (Typescript) Removed `GooglePay.SetupIntentParams`
|
|
119
161
|
|
|
120
|
-
## 0.6.0
|
|
162
|
+
## 0.6.0 - 2022-04-01
|
|
121
163
|
|
|
122
164
|
- [#861](https://github.com/stripe/stripe-react-native/pull/861) BREAKING: This library now supports iOS 12 and up, due to `stripe-ios` increasing the deployment target. If you would like to build for iOS 11, please continue to use `@stripe/stripe-react-native@0.5.0`.
|
|
123
165
|
- To upgrade your iOS deployment target to 12.0, you can either do so in Xcode under your `Build Settings`, or by modifying `IPHONEOS_DEPLOYMENT_TARGET` in your `project.pbxproj` directly. You will also need to update your Podfile to target `:ios, '12.0'`.
|
|
124
166
|
- [#861](https://github.com/stripe/stripe-react-native/pull/861) Feat: Add support for ACHv2 payments **on iOS only**.
|
|
125
167
|
- [#861](https://github.com/stripe/stripe-react-native/pull/861) Chore: Upgrade `stripe-ios` to 22.0.0.
|
|
126
168
|
|
|
127
|
-
## 0.5.0
|
|
169
|
+
## 0.5.0 - 2022-03-29
|
|
128
170
|
|
|
129
171
|
- [#863](https://github.com/stripe/stripe-react-native/pull/863) Feat: add card ID and bankAccount ID to token response
|
|
130
172
|
- [#862](https://github.com/stripe/stripe-react-native/pull/862) Feat: Add support for setting a card's `currency` when creating a Token
|
|
131
173
|
- [#854](https://github.com/stripe/stripe-react-native/pull/854) Chore: Upgrade `stripe-ios` to 21.13.0. Upgrade `stripe-android` to 19.3.0.
|
|
132
174
|
- [#845](https://github.com/stripe/stripe-react-native/pull/845) Feat: Added support for `placeholderColor`, `textErrorColor `, `borderColor`, `borderRadius`, and `borderWidth` for `AuBECSDebitForm` on iOS
|
|
133
175
|
|
|
134
|
-
## 0.4.0
|
|
176
|
+
## 0.4.0 - 2022-03-10
|
|
135
177
|
|
|
136
178
|
- [#821](https://github.com/stripe/stripe-react-native/pull/821) Feat: Add support for Klarna
|
|
137
179
|
- [#630](https://github.com/stripe/stripe-react-native/pull/630) Fix: card field focus jumps back to the card number field on Android
|
package/README.md
CHANGED
|
@@ -78,7 +78,7 @@ to your `app.json` file, where `merchantIdentifier` is the Apple merchant ID obt
|
|
|
78
78
|
|
|
79
79
|
_Components_
|
|
80
80
|
|
|
81
|
-
In order to use [CardForm](https://stripe.dev/stripe-react-native/api-reference/
|
|
81
|
+
In order to use [CardForm](https://stripe.dev/stripe-react-native/api-reference/index.html#CardForm) component, you need to install and configure [Material Components theme](https://github.com/material-components/material-components-android/blob/master/docs/getting-started.md#4-change-your-app-theme-to-inherit-from-a-material-components-theme) in your app.
|
|
82
82
|
|
|
83
83
|
1. Add below dependency to your `app/build.gradle` file with specified version
|
|
84
84
|
|
|
@@ -201,7 +201,7 @@ function App() {
|
|
|
201
201
|
}
|
|
202
202
|
```
|
|
203
203
|
|
|
204
|
-
You can find more details about the `StripeProvider` component in the [API reference](https://stripe.dev/stripe-react-native/api-reference/
|
|
204
|
+
You can find more details about the `StripeProvider` component in the [API reference](https://stripe.dev/stripe-react-native/api-reference/index.html#StripeProvider).
|
|
205
205
|
|
|
206
206
|
##### Additional steps for webhook forwarding
|
|
207
207
|
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="GradleMigrationSettings" migrationVersion="1" />
|
|
4
|
+
<component name="GradleSettings">
|
|
5
|
+
<option name="linkedExternalProjectsSettings">
|
|
6
|
+
<GradleProjectSettings>
|
|
7
|
+
<option name="testRunner" value="GRADLE" />
|
|
8
|
+
<option name="distributionType" value="DEFAULT_WRAPPED" />
|
|
9
|
+
<option name="externalProjectPath" value="$PROJECT_DIR$" />
|
|
10
|
+
</GradleProjectSettings>
|
|
11
|
+
</option>
|
|
12
|
+
</component>
|
|
13
|
+
</project>
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectRootManager" version="2" project-jdk-name="Android Studio default JDK" project-jdk-type="JavaSDK">
|
|
4
|
+
<output url="file://$PROJECT_DIR$/build/classes" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ProjectType">
|
|
7
|
+
<option name="id" value="Android" />
|
|
8
|
+
</component>
|
|
9
|
+
</project>
|
|
@@ -0,0 +1,18 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<module external.linked.project.id=":" external.linked.project.path="$MODULE_DIR$/../.." external.root.project.path="$MODULE_DIR$/../.." external.system.id="GRADLE" type="JAVA_MODULE" version="4">
|
|
3
|
+
<component name="FacetManager">
|
|
4
|
+
<facet type="android-gradle" name="Android-Gradle">
|
|
5
|
+
<configuration>
|
|
6
|
+
<option name="GRADLE_PROJECT_PATH" value=":" />
|
|
7
|
+
<option name="LAST_SUCCESSFUL_SYNC_AGP_VERSION" />
|
|
8
|
+
<option name="LAST_KNOWN_AGP_VERSION" />
|
|
9
|
+
</configuration>
|
|
10
|
+
</facet>
|
|
11
|
+
</component>
|
|
12
|
+
<component name="NewModuleRootManager" inherit-compiler-output="true">
|
|
13
|
+
<exclude-output />
|
|
14
|
+
<content url="file://$MODULE_DIR$/../.." />
|
|
15
|
+
<orderEntry type="inheritedJdk" />
|
|
16
|
+
<orderEntry type="sourceFolder" forTests="false" />
|
|
17
|
+
</component>
|
|
18
|
+
</module>
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="ProjectModuleManager">
|
|
4
|
+
<modules>
|
|
5
|
+
<module fileurl="file://$PROJECT_DIR$/.idea/modules/android.iml" filepath="$PROJECT_DIR$/.idea/modules/android.iml" />
|
|
6
|
+
</modules>
|
|
7
|
+
</component>
|
|
8
|
+
</project>
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
<?xml version="1.0" encoding="UTF-8"?>
|
|
2
|
+
<project version="4">
|
|
3
|
+
<component name="AutoImportSettings">
|
|
4
|
+
<option name="autoReloadType" value="NONE" />
|
|
5
|
+
</component>
|
|
6
|
+
<component name="ChangeListManager">
|
|
7
|
+
<list default="true" id="6bd19f01-32d7-4d37-8b5e-6bd0f29ff270" name="Changes" comment="">
|
|
8
|
+
<change afterPath="$PROJECT_DIR$/src/androidTest/java/com/reactnativestripesdk/pushprovisioning/PushProvisioningProxyTest.kt" afterDir="false" />
|
|
9
|
+
<change beforePath="$PROJECT_DIR$/build.gradle" beforeDir="false" afterPath="$PROJECT_DIR$/build.gradle" afterDir="false" />
|
|
10
|
+
<change beforePath="$PROJECT_DIR$/../ios/StripeSdk.xcodeproj/project.pbxproj" beforeDir="false" afterPath="$PROJECT_DIR$/../ios/StripeSdk.xcodeproj/project.pbxproj" afterDir="false" />
|
|
11
|
+
</list>
|
|
12
|
+
<option name="SHOW_DIALOG" value="false" />
|
|
13
|
+
<option name="HIGHLIGHT_CONFLICTS" value="true" />
|
|
14
|
+
<option name="HIGHLIGHT_NON_ACTIVE_CHANGELIST" value="false" />
|
|
15
|
+
<option name="LAST_RESOLUTION" value="IGNORE" />
|
|
16
|
+
</component>
|
|
17
|
+
<component name="Git.Settings">
|
|
18
|
+
<option name="RECENT_GIT_ROOT_PATH" value="$PROJECT_DIR$/.." />
|
|
19
|
+
</component>
|
|
20
|
+
<component name="ProjectId" id="2AtuQTRuDgWJsBWelsxPwKKLnTE" />
|
|
21
|
+
<component name="ProjectLevelVcsManager" settingsEditedManually="true" />
|
|
22
|
+
<component name="ProjectViewState">
|
|
23
|
+
<option name="hideEmptyMiddlePackages" value="true" />
|
|
24
|
+
<option name="showLibraryContents" value="true" />
|
|
25
|
+
</component>
|
|
26
|
+
<component name="PropertiesComponent">
|
|
27
|
+
<property name="RunOnceActivity.OpenProjectViewOnStart" value="true" />
|
|
28
|
+
<property name="RunOnceActivity.ShowReadmeOnStart" value="true" />
|
|
29
|
+
<property name="RunOnceActivity.cidr.known.project.marker" value="true" />
|
|
30
|
+
<property name="cidr.known.project.marker" value="true" />
|
|
31
|
+
<property name="last_opened_file_path" value="$PROJECT_DIR$" />
|
|
32
|
+
</component>
|
|
33
|
+
<component name="RecentsManager">
|
|
34
|
+
<key name="CreateTestDialog.Recents.Supers">
|
|
35
|
+
<recent name="" />
|
|
36
|
+
</key>
|
|
37
|
+
<key name="CreateTestDialog.RecentsKey">
|
|
38
|
+
<recent name="" />
|
|
39
|
+
</key>
|
|
40
|
+
</component>
|
|
41
|
+
<component name="SpellCheckerSettings" RuntimeDictionaries="0" Folders="0" CustomDictionaries="0" DefaultDictionary="application-level" UseSingleDictionary="true" transferred="true" />
|
|
42
|
+
<component name="TaskManager">
|
|
43
|
+
<task active="true" id="Default" summary="Default task">
|
|
44
|
+
<changelist id="6bd19f01-32d7-4d37-8b5e-6bd0f29ff270" name="Changes" comment="" />
|
|
45
|
+
<created>1655841188103</created>
|
|
46
|
+
<option name="number" value="Default" />
|
|
47
|
+
<option name="presentableId" value="Default" />
|
|
48
|
+
<updated>1655841188103</updated>
|
|
49
|
+
</task>
|
|
50
|
+
<servers />
|
|
51
|
+
</component>
|
|
52
|
+
</project>
|
package/android/build.gradle
CHANGED
|
@@ -34,6 +34,7 @@ android {
|
|
|
34
34
|
versionCode 1
|
|
35
35
|
versionName "1.0"
|
|
36
36
|
vectorDrawables.useSupportLibrary = true
|
|
37
|
+
testInstrumentationRunner "androidx.test.runner.AndroidJUnitRunner"
|
|
37
38
|
}
|
|
38
39
|
|
|
39
40
|
buildTypes {
|
|
@@ -146,4 +147,14 @@ dependencies {
|
|
|
146
147
|
|
|
147
148
|
// Users need to declare this dependency on their own, otherwise all methods are a no-op
|
|
148
149
|
compileOnly 'com.stripe:stripe-android-issuing-push-provisioning:1.1.0'
|
|
150
|
+
|
|
151
|
+
androidTestImplementation "junit:junit:4.13"
|
|
152
|
+
androidTestImplementation "androidx.test:core:1.4.0"
|
|
153
|
+
androidTestImplementation 'androidx.test:runner:1.1.0'
|
|
154
|
+
androidTestImplementation "org.mockito:mockito-core:3.+"
|
|
155
|
+
}
|
|
156
|
+
|
|
157
|
+
configurations {
|
|
158
|
+
// We want to include all of our compileOnly libraries in our tests
|
|
159
|
+
androidTestImplementation.extendsFrom compileOnly
|
|
149
160
|
}
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
## This file must *NOT* be checked into Version Control Systems,
|
|
2
|
+
# as it contains information specific to your local configuration.
|
|
3
|
+
#
|
|
4
|
+
# Location of the SDK. This is only used by Gradle.
|
|
5
|
+
# For customization when using a Version Control System, please read the
|
|
6
|
+
# header note.
|
|
7
|
+
#Tue Jun 21 15:53:06 EDT 2022
|
|
8
|
+
sdk.dir=/Users/charliecruzan/Library/Android/sdk
|
|
Binary file
|
|
Binary file
|
|
@@ -0,0 +1,35 @@
|
|
|
1
|
+
package com.reactnativestripesdk.pushprovisioning
|
|
2
|
+
|
|
3
|
+
import android.content.Context
|
|
4
|
+
import androidx.test.core.app.ApplicationProvider
|
|
5
|
+
import com.facebook.react.bridge.ReactApplicationContext
|
|
6
|
+
import org.junit.Assert.*
|
|
7
|
+
import org.junit.Test
|
|
8
|
+
|
|
9
|
+
class PushProvisioningProxyTest {
|
|
10
|
+
private val reactApplicationContext = ReactApplicationContext(
|
|
11
|
+
ApplicationProvider.getApplicationContext<Context>()
|
|
12
|
+
)
|
|
13
|
+
|
|
14
|
+
@Test
|
|
15
|
+
fun getApiVersion() {
|
|
16
|
+
// This value very rarely changes, so the test is hard coded
|
|
17
|
+
assertEquals(
|
|
18
|
+
"2019-09-09",
|
|
19
|
+
PushProvisioningProxy.getApiVersion()
|
|
20
|
+
)
|
|
21
|
+
}
|
|
22
|
+
|
|
23
|
+
@Test
|
|
24
|
+
fun isNFCEnabled() {
|
|
25
|
+
assertEquals(
|
|
26
|
+
false,
|
|
27
|
+
PushProvisioningProxy.isNFCEnabled(reactApplicationContext)
|
|
28
|
+
)
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
@Test
|
|
32
|
+
fun isTokenInWallet() {
|
|
33
|
+
assertEquals(TapAndPayProxy.isTokenInWallet({}, "4242"), false)
|
|
34
|
+
}
|
|
35
|
+
}
|
|
@@ -8,6 +8,7 @@ import android.text.Editable
|
|
|
8
8
|
import android.text.TextWatcher
|
|
9
9
|
import android.util.Log
|
|
10
10
|
import android.widget.FrameLayout
|
|
11
|
+
import androidx.core.os.LocaleListCompat
|
|
11
12
|
import com.facebook.react.bridge.ReadableMap
|
|
12
13
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
13
14
|
import com.facebook.react.uimanager.UIManagerModule
|
|
@@ -15,6 +16,8 @@ import com.facebook.react.uimanager.events.EventDispatcher
|
|
|
15
16
|
import com.google.android.material.shape.CornerFamily
|
|
16
17
|
import com.google.android.material.shape.MaterialShapeDrawable
|
|
17
18
|
import com.google.android.material.shape.ShapeAppearanceModel
|
|
19
|
+
import com.stripe.android.core.model.CountryCode
|
|
20
|
+
import com.stripe.android.core.model.CountryUtils
|
|
18
21
|
import com.stripe.android.databinding.CardInputWidgetBinding
|
|
19
22
|
import com.stripe.android.model.Address
|
|
20
23
|
import com.stripe.android.model.PaymentMethodCreateParams
|
|
@@ -33,6 +36,7 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
33
36
|
private var mEventDispatcher: EventDispatcher? = context.getNativeModule(UIManagerModule::class.java)?.eventDispatcher
|
|
34
37
|
private var dangerouslyGetFullCardDetails: Boolean = false
|
|
35
38
|
private var currentFocusedField: String? = null
|
|
39
|
+
private var isCardValid = false
|
|
36
40
|
|
|
37
41
|
init {
|
|
38
42
|
cardInputWidgetBinding.container.isFocusable = true
|
|
@@ -197,6 +201,19 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
197
201
|
mCardWidget.postalCodeEnabled = isEnabled
|
|
198
202
|
}
|
|
199
203
|
|
|
204
|
+
/**
|
|
205
|
+
* We can reliable assume that setPostalCodeEnabled is called before
|
|
206
|
+
* setCountryCode because of the order of the props in CardField.tsx
|
|
207
|
+
*/
|
|
208
|
+
fun setCountryCode(countryCode: String?) {
|
|
209
|
+
if (mCardWidget.postalCodeEnabled) {
|
|
210
|
+
val doesCountryUsePostalCode = CountryUtils.doesCountryUsePostalCode(
|
|
211
|
+
CountryCode.create(value = countryCode ?: LocaleListCompat.getAdjustedDefault()[0].country)
|
|
212
|
+
)
|
|
213
|
+
mCardWidget.postalCodeRequired = doesCountryUsePostalCode
|
|
214
|
+
}
|
|
215
|
+
}
|
|
216
|
+
|
|
200
217
|
fun getValue(): MutableMap<String, Any?> {
|
|
201
218
|
return cardDetails
|
|
202
219
|
}
|
|
@@ -224,7 +241,7 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
224
241
|
|
|
225
242
|
private fun sendCardDetailsEvent() {
|
|
226
243
|
mEventDispatcher?.dispatchEvent(
|
|
227
|
-
CardChangedEvent(id, cardDetails, mCardWidget.postalCodeEnabled,
|
|
244
|
+
CardChangedEvent(id, cardDetails, mCardWidget.postalCodeEnabled, isCardValid, dangerouslyGetFullCardDetails))
|
|
228
245
|
}
|
|
229
246
|
|
|
230
247
|
private fun setListeners() {
|
|
@@ -246,6 +263,7 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
246
263
|
}
|
|
247
264
|
|
|
248
265
|
mCardWidget.setCardValidCallback { isValid, invalidFields ->
|
|
266
|
+
isCardValid = isValid
|
|
249
267
|
fun getCardValidationState(field: CardValidCallback.Fields, editTextField: StripeEditText): String {
|
|
250
268
|
if (invalidFields.contains(field)) {
|
|
251
269
|
return if (editTextField.shouldShowError) "Invalid"
|
|
@@ -257,12 +275,14 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
257
275
|
cardDetails["validNumber"] = getCardValidationState(CardValidCallback.Fields.Number, cardInputWidgetBinding.cardNumberEditText)
|
|
258
276
|
cardDetails["validCVC"] = getCardValidationState(CardValidCallback.Fields.Cvc, cardInputWidgetBinding.cvcEditText)
|
|
259
277
|
cardDetails["validExpiryDate"] = getCardValidationState(CardValidCallback.Fields.Expiry, cardInputWidgetBinding.expiryDateEditText)
|
|
278
|
+
cardDetails["brand"] = mapCardBrand(cardInputWidgetBinding.cardNumberEditText.cardBrand)
|
|
260
279
|
|
|
261
280
|
if (isValid) {
|
|
262
281
|
onValidCardChange()
|
|
263
282
|
} else {
|
|
264
283
|
cardParams = null
|
|
265
284
|
cardAddress = null
|
|
285
|
+
sendCardDetailsEvent()
|
|
266
286
|
}
|
|
267
287
|
}
|
|
268
288
|
|
|
@@ -284,8 +304,6 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
284
304
|
if (splitText.size == 2) {
|
|
285
305
|
cardDetails["expiryYear"] = var1.toString().split("/")[1].toIntOrNull()
|
|
286
306
|
}
|
|
287
|
-
|
|
288
|
-
sendCardDetailsEvent()
|
|
289
307
|
}
|
|
290
308
|
})
|
|
291
309
|
|
|
@@ -294,7 +312,6 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
294
312
|
override fun afterTextChanged(p0: Editable?) {}
|
|
295
313
|
override fun onTextChanged(var1: CharSequence?, var2: Int, var3: Int, var4: Int) {
|
|
296
314
|
cardDetails["postalCode"] = var1.toString()
|
|
297
|
-
sendCardDetailsEvent()
|
|
298
315
|
}
|
|
299
316
|
})
|
|
300
317
|
|
|
@@ -305,7 +322,6 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
305
322
|
if (dangerouslyGetFullCardDetails) {
|
|
306
323
|
cardDetails["number"] = var1.toString().replace(" ", "")
|
|
307
324
|
}
|
|
308
|
-
sendCardDetailsEvent()
|
|
309
325
|
}
|
|
310
326
|
})
|
|
311
327
|
|
|
@@ -316,7 +332,6 @@ class CardFieldView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
316
332
|
if (dangerouslyGetFullCardDetails) {
|
|
317
333
|
cardDetails["cvc"] = var1.toString()
|
|
318
334
|
}
|
|
319
|
-
sendCardDetailsEvent()
|
|
320
335
|
}
|
|
321
336
|
})
|
|
322
337
|
}
|
|
@@ -46,6 +46,11 @@ class CardFieldViewManager : SimpleViewManager<CardFieldView>() {
|
|
|
46
46
|
view.setCardStyle(cardStyle)
|
|
47
47
|
}
|
|
48
48
|
|
|
49
|
+
@ReactProp(name = "countryCode")
|
|
50
|
+
fun setCountryCode(view: CardFieldView, countryCode: String?) {
|
|
51
|
+
view.setCountryCode(countryCode)
|
|
52
|
+
}
|
|
53
|
+
|
|
49
54
|
@ReactProp(name = "placeholders")
|
|
50
55
|
fun setPlaceHolders(view: CardFieldView, placeholders: ReadableMap) {
|
|
51
56
|
view.setPlaceHolders(placeholders)
|
|
@@ -14,6 +14,7 @@ import com.facebook.react.uimanager.events.EventDispatcher
|
|
|
14
14
|
import com.google.android.material.shape.CornerFamily
|
|
15
15
|
import com.google.android.material.shape.MaterialShapeDrawable
|
|
16
16
|
import com.google.android.material.shape.ShapeAppearanceModel
|
|
17
|
+
import com.stripe.android.core.model.CountryCode
|
|
17
18
|
import com.stripe.android.databinding.CardMultilineWidgetBinding
|
|
18
19
|
import com.stripe.android.databinding.StripeCardFormViewBinding
|
|
19
20
|
import com.stripe.android.model.Address
|
|
@@ -48,6 +49,13 @@ class CardFormView(context: ThemedReactContext) : FrameLayout(context) {
|
|
|
48
49
|
cardFormViewBinding.postalCodeContainer.visibility = visibility
|
|
49
50
|
}
|
|
50
51
|
|
|
52
|
+
fun setDefaultValues(defaults: ReadableMap) {
|
|
53
|
+
defaults.getString("countryCode")?.let {
|
|
54
|
+
cardFormViewBinding.countryLayout.setSelectedCountryCode(CountryCode(it))
|
|
55
|
+
cardFormViewBinding.countryLayout.updateUiForCountryEntered(CountryCode(it))
|
|
56
|
+
}
|
|
57
|
+
}
|
|
58
|
+
|
|
51
59
|
fun setPlaceHolders(value: ReadableMap) {
|
|
52
60
|
val numberPlaceholder = getValOr(value, "number", null)
|
|
53
61
|
val expirationPlaceholder = getValOr(value, "expiration", null)
|
|
@@ -51,6 +51,11 @@ class CardFormViewManager : SimpleViewManager<CardFormView>() {
|
|
|
51
51
|
view.setCardStyle(cardStyle)
|
|
52
52
|
}
|
|
53
53
|
|
|
54
|
+
@ReactProp(name = "defaultValues")
|
|
55
|
+
fun setDefaultValues(view: CardFormView, defaults: ReadableMap) {
|
|
56
|
+
view.setDefaultValues(defaults)
|
|
57
|
+
}
|
|
58
|
+
|
|
54
59
|
override fun createViewInstance(reactContext: ThemedReactContext): CardFormView {
|
|
55
60
|
val stripeSdkModule: StripeSdkModule? = reactContext.getNativeModule(StripeSdkModule::class.java)
|
|
56
61
|
val view = CardFormView(reactContext)
|
|
@@ -14,6 +14,22 @@ internal fun createResult(key: String, value: WritableMap): WritableMap {
|
|
|
14
14
|
return map
|
|
15
15
|
}
|
|
16
16
|
|
|
17
|
+
internal fun createCanAddCardResult(canAddCard: Boolean, status: String? = null, token: WritableMap? = null): WritableNativeMap {
|
|
18
|
+
val result = WritableNativeMap()
|
|
19
|
+
val details = WritableNativeMap()
|
|
20
|
+
if (status != null) {
|
|
21
|
+
result.putBoolean("canAddCard", false)
|
|
22
|
+
details.putString("status", status)
|
|
23
|
+
} else {
|
|
24
|
+
result.putBoolean("canAddCard", canAddCard)
|
|
25
|
+
if (token != null) {
|
|
26
|
+
details.putMap("token", token)
|
|
27
|
+
}
|
|
28
|
+
}
|
|
29
|
+
result.putMap("details", details)
|
|
30
|
+
return result
|
|
31
|
+
}
|
|
32
|
+
|
|
17
33
|
internal fun mapIntentStatus(status: StripeIntent.Status?): String {
|
|
18
34
|
return when (status) {
|
|
19
35
|
StripeIntent.Status.Succeeded -> "Succeeded"
|
|
@@ -402,14 +418,13 @@ internal fun mapFromPaymentIntentResult(paymentIntent: PaymentIntent): WritableM
|
|
|
402
418
|
|
|
403
419
|
paymentIntent.lastPaymentError?.let {
|
|
404
420
|
val paymentError: WritableMap = WritableNativeMap()
|
|
405
|
-
|
|
406
|
-
paymentIntent.lastPaymentError?.paymentMethod?.let { paymentMethod ->
|
|
407
|
-
paymentError.putMap("paymentMethod", mapFromPaymentMethod(paymentMethod))
|
|
408
|
-
}
|
|
409
|
-
|
|
410
421
|
paymentError.putString("code", it.code)
|
|
411
422
|
paymentError.putString("message", it.message)
|
|
412
423
|
paymentError.putString("type", mapFromPaymentIntentLastErrorType(it.type))
|
|
424
|
+
paymentError.putString("declineCode", it.declineCode)
|
|
425
|
+
paymentIntent.lastPaymentError?.paymentMethod?.let { paymentMethod ->
|
|
426
|
+
paymentError.putMap("paymentMethod", mapFromPaymentMethod(paymentMethod))
|
|
427
|
+
}
|
|
413
428
|
|
|
414
429
|
map.putMap("lastPaymentError", paymentError)
|
|
415
430
|
}
|
|
@@ -775,11 +790,10 @@ internal fun mapFromSetupIntentResult(setupIntent: SetupIntent): WritableMap {
|
|
|
775
790
|
setupError.putString("code", it.code)
|
|
776
791
|
setupError.putString("message", it.message)
|
|
777
792
|
setupError.putString("type", mapFromSetupIntentLastErrorType(it.type))
|
|
778
|
-
|
|
793
|
+
setupError.putString("declineCode", it.declineCode)
|
|
779
794
|
setupIntent.lastSetupError?.paymentMethod?.let { paymentMethod ->
|
|
780
795
|
setupError.putMap("paymentMethod", mapFromPaymentMethod(paymentMethod))
|
|
781
796
|
}
|
|
782
|
-
|
|
783
797
|
map.putMap("lastSetupError", setupError)
|
|
784
798
|
}
|
|
785
799
|
|
|
@@ -49,6 +49,10 @@ class PaymentSheetFragment(
|
|
|
49
49
|
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
50
50
|
super.onViewCreated(view, savedInstanceState)
|
|
51
51
|
val merchantDisplayName = arguments?.getString("merchantDisplayName").orEmpty()
|
|
52
|
+
if (merchantDisplayName.isEmpty()) {
|
|
53
|
+
initPromise.resolve(createError(ErrorType.Failed.toString(), "merchantDisplayName cannot be empty or null."))
|
|
54
|
+
return
|
|
55
|
+
}
|
|
52
56
|
val customerId = arguments?.getString("customerId").orEmpty()
|
|
53
57
|
val customerEphemeralKeySecret = arguments?.getString("customerEphemeralKeySecret").orEmpty()
|
|
54
58
|
val countryCode = arguments?.getString("merchantCountryCode").orEmpty()
|
|
@@ -74,14 +78,15 @@ class PaymentSheetFragment(
|
|
|
74
78
|
option.putString("label", paymentOption.label)
|
|
75
79
|
option.putString("image", imageString)
|
|
76
80
|
presentPromise?.resolve(createResult("paymentOption", option))
|
|
81
|
+
} else {
|
|
82
|
+
presentPromise?.resolve(createError(PaymentSheetErrorType.Canceled.toString(), "The payment option selection flow has been canceled"))
|
|
77
83
|
}
|
|
78
|
-
presentPromise?.resolve(WritableNativeMap())
|
|
79
84
|
}
|
|
80
85
|
|
|
81
86
|
val paymentResultCallback = PaymentSheetResultCallback { paymentResult ->
|
|
82
87
|
when (paymentResult) {
|
|
83
88
|
is PaymentSheetResult.Canceled -> {
|
|
84
|
-
val message = "The payment has been canceled"
|
|
89
|
+
val message = "The payment flow has been canceled"
|
|
85
90
|
confirmPromise?.resolve(createError(PaymentSheetErrorType.Canceled.toString(), message))
|
|
86
91
|
?: run {
|
|
87
92
|
presentPromise?.resolve(createError(PaymentSheetErrorType.Canceled.toString(), message))
|
|
@@ -97,9 +102,10 @@ class PaymentSheetFragment(
|
|
|
97
102
|
confirmPromise?.resolve(WritableNativeMap()) ?: run {
|
|
98
103
|
presentPromise?.resolve(WritableNativeMap())
|
|
99
104
|
}
|
|
105
|
+
// Remove the fragment now, we can be sure it won't be needed again if an intent is successful
|
|
106
|
+
(context.currentActivity as? AppCompatActivity)?.supportFragmentManager?.beginTransaction()?.remove(this)?.commitAllowingStateLoss()
|
|
100
107
|
}
|
|
101
108
|
}
|
|
102
|
-
(context.currentActivity as? AppCompatActivity)?.supportFragmentManager?.beginTransaction()?.remove(this)?.commitAllowingStateLoss()
|
|
103
109
|
}
|
|
104
110
|
|
|
105
111
|
var defaultBillingDetails: PaymentSheet.BillingDetails? = null
|