Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix/shippingContactOnPM #1

Closed
wants to merge 35 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
35 commits
Select commit Hold shift + click to select a range
5ed60e5
feat(iOS): Recurring Transactions and order tracking APIs (#1248)
charliecruzan-stripe Feb 15, 2023
dd6990d
Fix changelog formatting [skip actions]
charliecruzan-stripe Feb 15, 2023
7ee1dcb
feat: add `timeout` option to programmatically close payment sheet (#…
charliecruzan-stripe Feb 17, 2023
a987187
[skip actions] release 0.24.0 (#1304)
ianjabour-stripe Feb 17, 2023
42d64fe
v0.24.0
charliecruzan-stripe Feb 17, 2023
32e07e5
fix: Push Provisioning issues on iOS due to Apple bugs (#1305)
charliecruzan-stripe Feb 21, 2023
2d481ac
feat: make nfc check optional on android (#1308)
charliecruzan-stripe Feb 22, 2023
4cce506
fix: allow apple pay shipping events to emit (#1298)
p-sebastian Feb 22, 2023
60d2966
[skip actions] changelog
charliecruzan-stripe Feb 22, 2023
fb4a341
[skip actions] run yarn bootstrap
charliecruzan-stripe Feb 24, 2023
67495a9
Release 0.25.0 [skip actions] (#1316)
ianjabour-stripe Feb 27, 2023
dafa335
v0.25.0
charliecruzan-stripe Feb 27, 2023
ee97691
[skip actions] update changelog for 0.23.1
charliecruzan-stripe Mar 1, 2023
8fa8a7a
chore: upgrade stripe-ios to 23.4.x
charliecruzan-stripe Mar 9, 2023
dbb0263
chore(deps): bump minimist from 1.2.5 to 1.2.8 (#1317)
dependabot[bot] Mar 9, 2023
543c313
[skip actions] expo sdk 48
charliecruzan-stripe Mar 10, 2023
3d5170e
[skip actions] changelog
charliecruzan-stripe Mar 10, 2023
c188a55
[skip actions] format changelog
charliecruzan-stripe Mar 10, 2023
bb7b3fc
feat: add cashapp and paypal payment methods, and option to pass Mand…
charliecruzan-stripe Mar 16, 2023
e03075c
[skip actions] changelog
charliecruzan-stripe Mar 16, 2023
caeb5f6
[skip actions] release 0.26.0 (#1332)
joyluu-stripe Mar 16, 2023
bf15906
v0.26.0
charliecruzan-stripe Mar 16, 2023
1ca5e56
tests: downgrade version of maestro
charliecruzan-stripe Mar 17, 2023
c8bc061
fix: update button to have less rounded corners (#1343)
charliecruzan-stripe Mar 31, 2023
6335dad
[skip actions] changelog
charliecruzan-stripe Mar 31, 2023
5ead69e
fix: phone number on ShippingContact is a string (#1349)
huextrat Apr 6, 2023
a0891da
[skip actions] update changelog
charliecruzan-stripe Apr 6, 2023
d5c4ce2
[skip actions] update podfile
charliecruzan-stripe Apr 7, 2023
4c4e3d0
feat: add isThreeDSecureSupported on CardResult type (#1347)
huextrat Apr 10, 2023
b8127b0
[skip actions] update changelog
charliecruzan-stripe Apr 14, 2023
f903858
feat: add billingDetailsCollectionConfiguration to payment sheet (#1361)
charliecruzan-stripe Apr 18, 2023
5850fbf
[skip actions] Update CHANGELOG.md (#1364)
ianjabour-stripe Apr 21, 2023
8204a77
v0.27.0
charliecruzan-stripe Apr 21, 2023
0ad598b
[skip actions] update changelog
charliecruzan-stripe Apr 21, 2023
0f4ee6c
fix: send shippingContact with createPaymentMethod
p-sebastian Apr 24, 2023
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/e2e-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ jobs:
key: gradle-${{ runner.os }}-${{ hashFiles('**/*.gradle*') }}-${{ hashFiles('**/gradle/wrapper/gradle-wrapper.properties') }}-${{ hashFiles('**/buildSrc/**/*.kt') }}

- name: Install Maestro CLI
run: curl -Ls "https://get.maestro.mobile.dev" | bash
run: export MAESTRO_VERSION=1.21.3; curl -Ls "https://get.maestro.mobile.dev" | bash

- name: Add Maestro to path
run: echo "${HOME}/.maestro/bin" >> $GITHUB_PATH
Expand Down
84 changes: 73 additions & 11 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,21 +2,83 @@

## Unreleased

## 0.23.3 - 2023-02-07

## Fixes
## 0.27.0 - 2023-04-21

### Features

- Added `billingDetailsCollectionConfiguration` to `initPaymentSheet` parameters. Use this to configure the collection of email, phone, name, or address in the Payment Sheet. [See the docs here](https://stripe.com/docs/payments/accept-a-payment?platform=react-native&ui=payment-sheet#collect-billing-details) [#1361](https://github.com/stripe/stripe-react-native/pull/1361)

### Fixes

- Updated Google Pay button asset to match Google's most recent branding guidelines. [#1343](https://github.com/stripe/stripe-react-native/pull/1343)
- Fixed type for `ApplePay.ShippingContact.phoneNumber`. [#1349](https://github.com/stripe/stripe-react-native/pull/1349)
- Fixed `CardResult` type to include `threeDSecureUsage`. [#1347](https://github.com/stripe/stripe-react-native/pull/1347)

## 0.26.0 - 2023-03-16

### New Features

- Added support for PayPal and CashApp to PaymentSheet, `confirmPayment`, and `confirmSetupIntent`. [#1331](https://github.com/stripe/stripe-react-native/pull/1331)

### Fixes

- Compatible with v0.1.4 of `@stripe/stripe-identity-react-native`. [8fa8a7a](https://github.com/stripe/stripe-react-native/commit/8fa8a7a0595a31d7422af6bbe26d696ba5e211f7)

## 0.25.0 - 2023-02-27

### New Features

- Added the `supportsTapToPay` option to `canAddCardToWallet`. [#1308](https://github.com/stripe/stripe-react-native/pull/1308)

### Fixes

- Fixed an issue on iOS where `canAddCardToWallet` would always return a `details.status` of `UNSUPPORTED_DEVICE` on iPads. [#1305](https://github.com/stripe/stripe-react-native/pull/1305)
- Fixed an issue on iOS where `canAddCardToWallet` would always return a `{canAddCard: false}` if the card in question had been provsioned on the current device, but **had not yet been provisioned** on a paired Watch. [#1305](https://github.com/stripe/stripe-react-native/pull/1305)
- Fixed an issue on iOS where the **deprecated** `onDidSetShippingMethod` & `onDidSetShippingContact` events wouldn't be triggered if you were using the `useApplePay` hook _without_ using the `ApplePayButton` component. [#1298](https://github.com/stripe/stripe-react-native/pull/1298)
- Fixed an issue on Android where `canAddCardToWallet` could result in a null pointer exception on devices without NFC compatibility. [#1308](https://github.com/stripe/stripe-react-native/pull/1308)

## 0.24.0 - 2023-02-17

### Breaking changes

- [#1248](https://github.com/stripe/stripe-react-native/pull/1248) Renamed the `paymentSummaryItems` field in `initPaymentSheet()`'s `applePay` params to `cartItems`. So your change will look like this:

```diff
initPaymentSheet({
...
applePay: {
- paymentSummaryItems: [
+ cartItems: [
}
...
})
```

### New Features

- Added the `setOrderTracking` property to the `PlatformPayButton` component and the `initPaymentSheet` method. Use this callback for setting the order details to give users the ability to track and manage their purchases in Wallet. To learn more about order tracking, see [Apple’s Wallet Orders documentation](https://developer.apple.com/documentation/walletorders). [#1248](https://github.com/stripe/stripe-react-native/pull/1248)
- Added the `buttonType` field to `initPaymentSheet()`'s `applePay` params. Use this to set the text displayed by the call to action button in the Apple Pay sheet.[#1248](https://github.com/stripe/stripe-react-native/pull/1248)
- Added the `request` field to `initPaymentSheet()`'s, `confirmPlatformPayPayment()`'s, and `confirmPlatformPaySetupIntent`'s `applePay` params. Use this to support different types of payment requests, like `RecurringPaymentRequest`, `AutomaticReloadPaymentRequest`, and `MultiMerchantRequest`.[#1248](https://github.com/stripe/stripe-react-native/pull/1248)
- Added an `options` argument to `presentPaymentSheet` which includes a `timeout` property. [#1287](https://github.com/stripe/stripe-react-native/pull/1287)

## 0.23.3 - 2023-02-07 (📌 Expo SDK 48)

### Fixes

- Fixes a build failure on Android when using `stripe-android` v20.19.2. [#1289](https://github.com/stripe/stripe-react-native/pull/1289)

## 0.23.2 - 2023-02-06

## Fixes
### Fixes

- Fixed a bug on Android where `canAddCardToWallet` wouldn't correctly return the `details.token` object. [#1282](https://github.com/stripe/stripe-react-native/pull/1282)

## 0.23.1 - 2023-01-25

## Fixes
> **Note**: This version pulls in a new version of `stripe-android` that now requires v1.8.0 of the Kotlin Gradle plugin. [Refer to this issue for a limited workaround](https://github.com/stripe/stripe-react-native/issues/1294#issuecomment-1426150258).

### Fixes

- Fixed an issue with `confirmPlatformPaySetupIntent` on iOS. [#1266](https://github.com/stripe/stripe-react-native/pull/1266)
- Fixed types so that Klarna accepts the `shippingDetails` property. [#1272](https://github.com/stripe/stripe-react-native/pull/1272)
Expand All @@ -29,7 +91,7 @@
- `createPlatformPayPaymentMethod` no longer returns a `token` object. [#1236](https://github.com/stripe/stripe-react-native/issues/1236)
- If your integration depends on Stripe's Tokens API, please use `createPlatformPayToken`, which accepts identical arguments.

## Fixes
### Fixes

- Fixed an issue with `createPlatformPayPaymentMethod` on iOS where a "Canceled" error could be returned in production. [#1236](https://github.com/stripe/stripe-react-native/issues/1236)
- Fixed an issue where the `PlatformPayButton` with `type={PlatformPay.ButtonType.GooglePayMark}` would be unclickable. [#1236](https://github.com/stripe/stripe-react-native/issues/1236)
Expand All @@ -38,7 +100,7 @@

## 0.22.1 - 2022-12-07

## Fixes
### Fixes

- Fixed the `ShippingMethod` type to contain the `isPending` field instead of a `type` field (which previously was never correct). This reflects the inputs accepted. [#1227](https://github.com/stripe/stripe-react-native/pull/1227)
- Fixed the `ShippingMethod` type to contain the `startDate` and `endDate` keys, if applicable. [#1227](https://github.com/stripe/stripe-react-native/pull/1227)
Expand All @@ -54,7 +116,7 @@
- Added the `hasPairedAppleWatch` option to `canAddCardToWallet`. [#1219](https://github.com/stripe/stripe-react-native/pull/1219)
- Added new functions and a new component to streamline integrating with Apple and Google Pay and add more feature support. See the [Migrating to Platform Pay guide](https://github.com/stripe/stripe-react-native/blob/master/docs/Platform-Pay-Migration.md) for more details. The old Apple and Google Pay APIs are marked as `deprecated` and will be removed in a future release, but are still supported in this version.

## Fixes
### Fixes

- Fixed an issue where builds would error with the message `'const' enums are not supported.` [see commit](https://github.com/stripe/stripe-react-native/commit/f882bfa588aa6d23a980b4b43d2cca660ca1dd2a)
- Fixed an issue where the `canAddCardToWallet` method would sometimes wrongly return `false` with a `details.status` of `MISSING_CONFIGURATION` in production builds. [#1215](https://github.com/stripe/stripe-react-native/pull/1215)
Expand All @@ -71,7 +133,7 @@
- [Find the docs here](https://stripe.com/docs/elements/address-element?platform=react-native)
- Added the `defaultShippingDetails` field to the `params` argument in `initPaymentSheet(params)`. This will allow you to collect shipping details (either in your own UI or using the new `<AddressSheet />` component) for payments in the Payment Sheet. [#1169](https://github.com/stripe/stripe-react-native/pull/1169)

## Fixes
### Fixes

- Fixed a build error on Android when using Kotlin version 1.7.10. [#1195](https://github.com/stripe/stripe-react-native/pull/1195)

Expand All @@ -89,7 +151,7 @@
- Added support for custom fonts to `CardForm` and `CardView` on Android. [#1150](https://github.com/stripe/stripe-react-native/pull/1150)
- Added support for customizing the call to action button label in Payment Sheet by providing the `primaryButtonLabel` property to `initPaymentSheet()`. [#1190](https://github.com/stripe/stripe-react-native/pull/1190)

## Fixes
### Fixes

- Fixed an issue on iOS where `confirmSetupIntent` would throw an error if the `Card` payment method was provided with the `paymentMethodId` parameter. [#1151](https://github.com/stripe/stripe-react-native/pull/1151)
- Upgraded `stripe-android` to 20.15.+. [#1176](https://github.com/stripe/stripe-react-native/pull/1176)
Expand All @@ -109,7 +171,7 @@

- Add `returnURL` as an optional parameter to `handleNextAction`. Use this so the Stripe SDK can redirect back to your app after authentication. [#1104](https://github.com/stripe/stripe-react-native/pull/1104)

## Fixes
### Fixes

- Fixed an issue where the error resolved on iOS wasn't the root error. [#1105](https://github.com/stripe/stripe-react-native/pull/1105)
- Fix Expo Config Plugin support on SDK 46. [#1111](https://github.com/stripe/stripe-react-native/pull/1111)
Expand All @@ -121,7 +183,7 @@

### New features

## Fixes
### Fixes

- Fixed an issue where some promises on Android would never resolve when using React Native 0.65.x or under. [#1089](https://github.com/stripe/stripe-react-native/pull/1089).

Expand Down
2 changes: 1 addition & 1 deletion android/gradle.properties
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
StripeSdk_kotlinVersion=1.8.0
StripeSdk_stripeVersion=[20.19.2, 20.20.0[
StripeSdk_stripeVersion=20.23.+
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ class PaymentMethodCreateParamsFactory(
PaymentMethod.Type.USBankAccount -> createUSBankAccountParams(paymentMethodData)
PaymentMethod.Type.PayPal -> createPayPalParams()
PaymentMethod.Type.Affirm -> createAffirmParams()
PaymentMethod.Type.CashAppPay -> createCashAppParams()
else -> {
throw Exception("This paymentMethodType is not supported yet")
}
Expand Down Expand Up @@ -202,13 +203,17 @@ class PaymentMethodCreateParamsFactory(
return PaymentMethodCreateParams.createAffirm(billingDetailsParams)
}

@Throws(PaymentMethodCreateParamsException::class)
private fun createCashAppParams(): PaymentMethodCreateParams {
return PaymentMethodCreateParams.createCashAppPay(billingDetailsParams)
}

@Throws(PaymentMethodCreateParamsException::class)
fun createParams(clientSecret: String, paymentMethodType: PaymentMethod.Type?, isPaymentIntent: Boolean): ConfirmStripeIntentParams {
try {
return when (paymentMethodType) {
PaymentMethod.Type.Card -> createCardStripeIntentParams(clientSecret, isPaymentIntent)
PaymentMethod.Type.USBankAccount -> createUSBankAccountStripeIntentParams(clientSecret, isPaymentIntent)
PaymentMethod.Type.PayPal -> createPayPalStripeIntentParams(clientSecret, isPaymentIntent)
PaymentMethod.Type.Affirm -> createAffirmStripeIntentParams(clientSecret, isPaymentIntent)
PaymentMethod.Type.Ideal,
PaymentMethod.Type.Alipay,
Expand All @@ -223,7 +228,9 @@ class PaymentMethodCreateParamsFactory(
PaymentMethod.Type.Fpx,
PaymentMethod.Type.AfterpayClearpay,
PaymentMethod.Type.AuBecsDebit,
PaymentMethod.Type.Klarna -> {
PaymentMethod.Type.Klarna,
PaymentMethod.Type.PayPal,
PaymentMethod.Type.CashAppPay -> {
val params = createPaymentMethodParams(paymentMethodType)

return if (isPaymentIntent) {
Expand All @@ -232,11 +239,13 @@ class PaymentMethodCreateParamsFactory(
paymentMethodCreateParams = params,
clientSecret = clientSecret,
setupFutureUsage = mapToPaymentIntentFutureUsage(getValOr(options, "setupFutureUsage")),
mandateData = buildMandateDataParams()
)
} else {
ConfirmSetupIntentParams.create(
paymentMethodCreateParams = params,
clientSecret = clientSecret,
mandateData = buildMandateDataParams()
)
}
}
Expand Down Expand Up @@ -339,20 +348,6 @@ class PaymentMethodCreateParamsFactory(
}
}

@Throws(PaymentMethodCreateParamsException::class)
private fun createPayPalStripeIntentParams(clientSecret: String, isPaymentIntent: Boolean): ConfirmStripeIntentParams {
if (!isPaymentIntent) {
throw PaymentMethodCreateParamsException("PayPal is not yet supported through SetupIntents.")
}

val params = createPayPalParams()

return ConfirmPaymentIntentParams.createWithPaymentMethodCreateParams(
paymentMethodCreateParams = params,
clientSecret = clientSecret,
)
}

@Throws(PaymentMethodCreateParamsException::class)
private fun createAffirmStripeIntentParams(clientSecret: String, isPaymentIntent: Boolean): ConfirmStripeIntentParams {
if (!isPaymentIntent) {
Expand All @@ -366,6 +361,7 @@ class PaymentMethodCreateParamsFactory(
paymentMethodCreateParams = params,
clientSecret = clientSecret,
setupFutureUsage = mapToPaymentIntentFutureUsage(getValOr(options, "setupFutureUsage")),
mandateData = buildMandateDataParams()
)
}

Expand Down Expand Up @@ -401,6 +397,20 @@ class PaymentMethodCreateParamsFactory(
null
)
}

private fun buildMandateDataParams(): MandateDataParams? {
getMapOrNull(paymentMethodData, "mandateData")?.let { mandateData ->
getMapOrNull(mandateData, "customerAcceptance")?.let { customerAcceptance ->
getMapOrNull(customerAcceptance, "online")?.let { onlineParams ->
return MandateDataParams(MandateDataParams.Type.Online(
ipAddress = getValOr(onlineParams, "ipAddress", "") ?: "",
userAgent = getValOr(onlineParams, "userAgent", "") ?: "",
))
}
}
}
return null
}
}

class PaymentMethodCreateParamsException(message: String) : Exception(message)
Loading