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

Remove Basic Integration references #1765

Merged
merged 12 commits into from
Oct 30, 2024
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,10 @@

## Unreleased

**Breaking changes**

- Removed support for FPX payments via the bank picker UI. If you'd like to accept FPX payments, we recommend using [Mobile Payment Element](https://docs.stripe.com/payments/accept-a-payment?platform=react-native). Also see the [FPX Payment guide](https://docs.stripe.com/payments/fpx/accept-a-payment?web-or-mobile=mobile) for more info on how to integrate FPX specifically.

**Features**

- `CustomerSheet` is now generally available!
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,6 @@ import com.stripe.android.googlepaylauncher.GooglePayLauncher
import com.stripe.android.model.*
import com.stripe.android.payments.bankaccount.CollectBankAccountConfiguration
import com.stripe.android.paymentsheet.PaymentSheet
import com.stripe.android.view.AddPaymentMethodActivityStarter
import kotlinx.coroutines.CoroutineScope
import kotlinx.coroutines.Dispatchers
import kotlinx.coroutines.launch
Expand Down Expand Up @@ -77,14 +76,6 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
}
else -> {
dispatchActivityResultsToFragments(requestCode, resultCode, data)
try {
val result = AddPaymentMethodActivityStarter.Result.fromIntent(data)
if (data?.getParcelableExtra<Parcelable>("extra_activity_result") != null) {
onFpxPaymentMethodResult(result)
}
} catch (e: java.lang.Exception) {
Log.d("StripeReactNative", e.localizedMessage ?: e.toString())
}
}
}
}
Expand Down Expand Up @@ -219,48 +210,6 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
paymentSheetFragment?.paymentSheetIntentCreationCallback?.complete(params)
}

private fun payWithFpx() {
getCurrentActivityOrResolveWithError(confirmPromise)?.let {
AddPaymentMethodActivityStarter(it)
.startForResult(AddPaymentMethodActivityStarter.Args.Builder()
.setPaymentMethodType(PaymentMethod.Type.Fpx)
.build()
)
}
}

private fun onFpxPaymentMethodResult(result: AddPaymentMethodActivityStarter.Result) {
when (result) {
is AddPaymentMethodActivityStarter.Result.Success -> {
if (confirmPaymentClientSecret != null && confirmPromise != null) {
paymentLauncherFragment = PaymentLauncherFragment.forPayment(
context = reactApplicationContext,
stripe,
publishableKey,
stripeAccountId,
confirmPromise!!,
confirmPaymentClientSecret!!,
ConfirmPaymentIntentParams.createWithPaymentMethodId(
result.paymentMethod.id!!,
confirmPaymentClientSecret!!
)
)
} else {
Log.e("StripeReactNative", "FPX payment failed. Promise and/or client secret is not set.")
confirmPromise?.resolve(createError(ConfirmPaymentErrorType.Failed.toString(), "FPX payment failed. Client secret is not set."))
}
}
is AddPaymentMethodActivityStarter.Result.Failure -> {
confirmPromise?.resolve(createError(ConfirmPaymentErrorType.Failed.toString(), result.exception))
}
is AddPaymentMethodActivityStarter.Result.Canceled -> {
confirmPromise?.resolve(createError(ConfirmPaymentErrorType.Canceled.toString(), "The payment has been canceled"))
}
}
this.confirmPaymentClientSecret = null
this.confirmPromise = null
}

@ReactMethod
fun createPaymentMethod(data: ReadableMap, options: ReadableMap, promise: Promise) {
val paymentMethodType = getValOr(data, "paymentMethodType")?.let { mapToPaymentMethodType(it) } ?: run {
Expand Down Expand Up @@ -460,15 +409,6 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
else
null // Expect that payment method was attached on the server

val testOfflineBank = getBooleanOrFalse(params, "testOfflineBank")

if (paymentMethodType == PaymentMethod.Type.Fpx && !testOfflineBank) {
confirmPaymentClientSecret = paymentIntentClientSecret
confirmPromise = promise
payWithFpx()
return
}

// if (paymentMethodType == PaymentMethod.Type.WeChatPay) {
// val appId = getValOr(params, "appId") ?: run {
// promise.resolve(createError("Failed", "You must provide appId"))
Expand Down
21 changes: 0 additions & 21 deletions e2e-tests/android-only/local-only/fpx.yml

This file was deleted.

21 changes: 0 additions & 21 deletions e2e-tests/ios-only/local-only/fpx.yml

This file was deleted.

3 changes: 0 additions & 3 deletions example/src/App.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,6 @@ import AlipayPaymentScreen from './screens/AlipayPaymentScreen';
import PaymentResultScreen from './screens/PaymentResultScreen';
import SofortPaymentScreen from './screens/SofortPaymentScreen';
import SofortSetupFuturePaymentScreen from './screens/SofortSetupFuturePaymentScreen';
import FPXPaymentScreen from './screens/FPXPaymentScreen';
import BancontactPaymentScreen from './screens/BancontactPaymentScreen';
import BancontactSetupFuturePaymentScreen from './screens/BancontactSetupFuturePaymentScreen';
import SepaPaymentScreen from './screens/SepaPaymentScreen';
Expand Down Expand Up @@ -65,7 +64,6 @@ export type RootStackParamList = {
PaymentResultScreen: { url: string };
SofortPaymentScreen: undefined;
SofortSetupFuturePaymentScreen: undefined;
FPXPaymentScreen: undefined;
BancontactPaymentScreen: undefined;
BancontactSetupFuturePaymentScreen: undefined;
SepaPaymentScreen: undefined;
Expand Down Expand Up @@ -190,7 +188,6 @@ export default function App() {
name="PaymentResultScreen"
component={PaymentResultScreen}
/>
<Stack.Screen name="FPXPaymentScreen" component={FPXPaymentScreen} />
<Stack.Screen
name="SofortPaymentScreen"
component={SofortPaymentScreen}
Expand Down
97 changes: 0 additions & 97 deletions example/src/screens/FPXPaymentScreen.tsx

This file was deleted.

8 changes: 0 additions & 8 deletions example/src/screens/HomeScreen.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -239,14 +239,6 @@ export default function HomeScreen() {
/>
</View>

<View style={styles.buttonContainer}>
<Button
title="FPX"
onPress={() => {
navigation.navigate('FPXPaymentScreen');
}}
/>
</View>
<View style={styles.buttonContainer}>
<Button
title="giropay"
Expand Down
17 changes: 0 additions & 17 deletions ios/CardFieldView.swift
Original file line number Diff line number Diff line change
Expand Up @@ -194,21 +194,4 @@ class CardFieldView: UIView, STPPaymentCardTextFieldDelegate {
required init?(coder: NSCoder) {
fatalError("init(coder:) has not been implemented")
}

func paymentContext(_ paymentContext: STPPaymentContext, didFailToLoadWithError error: Error) {
//
}

func paymentContextDidChange(_ paymentContext: STPPaymentContext) {
//
}

func paymentContext(_ paymentContext: STPPaymentContext, didCreatePaymentResult paymentResult: STPPaymentResult, completion: @escaping STPPaymentStatusBlock) {
//
}

func paymentContext(_ paymentContext: STPPaymentContext, didFinishWith status: STPPaymentStatus, error: Error?) {
//
}

}
Loading
Loading