diff --git a/CHANGELOG.md b/CHANGELOG.md index 111a1acfd..b0ffa12ba 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -2,6 +2,10 @@ ## Unreleased +**Features** + +- Added support for RevolutPay bindings + ## 0.34.0 - 2023-10-25 **Features** diff --git a/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt b/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt index 2f8208bb0..1c9b27b04 100644 --- a/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt +++ b/android/src/main/java/com/reactnativestripesdk/PaymentMethodCreateParamsFactory.kt @@ -38,6 +38,7 @@ class PaymentMethodCreateParamsFactory( PaymentMethod.Type.PayPal -> createPayPalParams() PaymentMethod.Type.Affirm -> createAffirmParams() PaymentMethod.Type.CashAppPay -> createCashAppParams() + PaymentMethod.Type.RevolutPay -> createRevolutPayParams() else -> { throw Exception("This paymentMethodType is not supported yet") } @@ -208,6 +209,11 @@ class PaymentMethodCreateParamsFactory( return PaymentMethodCreateParams.createCashAppPay(billingDetailsParams) } + @Throws(PaymentMethodCreateParamsException::class) + private fun createRevolutPayParams(): PaymentMethodCreateParams { + return PaymentMethodCreateParams.createRevolutPay(billingDetailsParams) + } + @Throws(PaymentMethodCreateParamsException::class) fun createParams(clientSecret: String, paymentMethodType: PaymentMethod.Type?, isPaymentIntent: Boolean): ConfirmStripeIntentParams { try { @@ -230,7 +236,8 @@ class PaymentMethodCreateParamsFactory( PaymentMethod.Type.AuBecsDebit, PaymentMethod.Type.Klarna, PaymentMethod.Type.PayPal, - PaymentMethod.Type.CashAppPay -> { + PaymentMethod.Type.CashAppPay, + PaymentMethod.Type.RevolutPay -> { val params = createPaymentMethodParams(paymentMethodType) return if (isPaymentIntent) { diff --git a/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt b/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt index 5e763a487..f06fb4038 100644 --- a/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +++ b/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt @@ -124,6 +124,7 @@ internal fun mapPaymentMethodType(type: PaymentMethod.Type?): String { PaymentMethod.Type.PayPal -> "PayPal" PaymentMethod.Type.Affirm -> "Affirm" PaymentMethod.Type.CashAppPay -> "CashApp" + PaymentMethod.Type.RevolutPay -> "RevolutPay" else -> "Unknown" } } @@ -154,6 +155,7 @@ internal fun mapToPaymentMethodType(type: String?): PaymentMethod.Type? { "PayPal" -> PaymentMethod.Type.PayPal "Affirm" -> PaymentMethod.Type.Affirm "CashApp" -> PaymentMethod.Type.CashAppPay + "RevolutPay" -> PaymentMethod.Type.RevolutPay else -> null } } diff --git a/example/ios/Podfile.lock b/example/ios/Podfile.lock index d684103bb..d675cb020 100644 --- a/example/ios/Podfile.lock +++ b/example/ios/Podfile.lock @@ -374,7 +374,7 @@ PODS: - StripePayments (= 23.18.0) - StripePaymentsUI (= 23.18.0) - StripeUICore (= 23.18.0) - - stripe-react-native (0.33.0): + - stripe-react-native (0.34.0): - React-Core - Stripe (~> 23.18.0) - StripeApplePay (~> 23.18.0) @@ -382,7 +382,7 @@ PODS: - StripePayments (~> 23.18.0) - StripePaymentSheet (~> 23.18.0) - StripePaymentsUI (~> 23.18.0) - - stripe-react-native/Tests (0.33.0): + - stripe-react-native/Tests (0.34.0): - React-Core - Stripe (~> 23.18.0) - StripeApplePay (~> 23.18.0) @@ -637,7 +637,7 @@ SPEC CHECKSUMS: RNScreens: 34cc502acf1b916c582c60003dc3089fa01dc66d SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608 Stripe: 4092bc51f41ca1758166aef921aa0dd2f0fbc639 - stripe-react-native: 782bcf073871e678dd51a0a1bdb7b0eafae25efe + stripe-react-native: 8607258ea7b0e77534840f5c898ccb70cd8900be StripeApplePay: aedbcb53f5324d527a52a5888bd0eeee25b3ca36 StripeCore: f86db23fb3f984808e6f5d3876397b953bf58a52 StripeFinancialConnections: 0aaddb3593a7cc76b5f01eab185f16ef60798b15 diff --git a/example/server/index.ts b/example/server/index.ts index 244537f96..33c06e01b 100644 --- a/example/server/index.ts +++ b/example/server/index.ts @@ -71,6 +71,7 @@ function getKeys(payment_method?: string) { secret_key = process.env.STRIPE_SECRET_KEY_WECHAT; break; case 'paypal': + case 'revolut_pay': publishable_key = process.env.STRIPE_PUBLISHABLE_KEY_UK; secret_key = process.env.STRIPE_SECRET_KEY_UK; break; @@ -363,11 +364,20 @@ app.post('/create-setup-intent', async (req, res) => { }, confirm: true, }; + const revolutPayIntentPayload = { + payment_method_data: { + type: 'revolut_pay', + }, + usage: 'off_session', + }; //@ts-ignore const setupIntent = await stripe.setupIntents.create({ ...{ customer: customer.id, payment_method_types }, ...(payment_method_types?.includes('paypal') ? payPalIntentPayload : {}), + ...(payment_method_types?.includes('revolut_pay') + ? revolutPayIntentPayload + : {}), }); // Send publishable key and SetupIntent details to client diff --git a/example/src/App.tsx b/example/src/App.tsx index 51d658783..ecfb20733 100644 --- a/example/src/App.tsx +++ b/example/src/App.tsx @@ -44,6 +44,7 @@ import CashAppScreen from './screens/CashAppScreen'; import PaymentSheetDeferredIntentScreen from './screens/PaymentSheetDeferredIntentScreen'; import PaymentSheetDeferredIntentMultiStepScreen from './screens/PaymentSheetDeferredIntentMultiStepScreen'; import CustomerSheetScreen from './screens/CustomerSheetScreen'; +import RevolutPayScreen from './screens/RevolutPayScreen'; const Stack = createNativeStackNavigator(); @@ -89,6 +90,7 @@ export type RootStackParamList = { PaymentSheetDeferredIntentScreen: undefined; PaymentSheetDeferredIntentMultiStepScreen: undefined; CustomerSheetScreen: undefined; + RevolutPayScreen: undefined; }; declare global { @@ -248,6 +250,7 @@ export default function App() { name="CustomerSheetScreen" component={CustomerSheetScreen} /> + diff --git a/example/src/screens/HomeScreen.tsx b/example/src/screens/HomeScreen.tsx index 98bccecdc..af9d36a57 100644 --- a/example/src/screens/HomeScreen.tsx +++ b/example/src/screens/HomeScreen.tsx @@ -401,6 +401,14 @@ export default function HomeScreen() { }} /> + +