@stripe/stripe-react-native 0.2.4 → 0.3.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 +8 -0
- package/README.md +5 -18
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherFragment.kt +44 -0
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkCardView.kt +30 -23
- package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +33 -20
- package/ios/StripeSdk.swift +1 -0
- package/lib/commonjs/NativeStripeSdk.js.map +1 -1
- package/lib/commonjs/functions.js +1 -1
- package/lib/commonjs/functions.js.map +1 -1
- package/lib/commonjs/hooks/useGooglePay.js +1 -1
- package/lib/commonjs/hooks/useGooglePay.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/Errors.js +1 -1
- package/lib/commonjs/types/Errors.js.map +1 -1
- package/lib/commonjs/types/GooglePay.js.map +1 -1
- package/lib/module/NativeStripeSdk.js.map +1 -1
- package/lib/module/functions.js +1 -1
- package/lib/module/functions.js.map +1 -1
- package/lib/module/hooks/useGooglePay.js +1 -1
- package/lib/module/hooks/useGooglePay.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/Errors.js +1 -1
- package/lib/module/types/Errors.js.map +1 -1
- package/lib/module/types/GooglePay.js.map +1 -1
- package/lib/typescript/e2e/screenObject/HomeScreen.d.ts +1 -1
- package/lib/typescript/example/src/App.d.ts +1 -0
- package/lib/typescript/example/src/screens/CreateTokenScreen.d.ts +1 -0
- package/lib/typescript/src/NativeStripeSdk.d.ts +1 -0
- package/lib/typescript/src/functions.d.ts +1 -0
- package/lib/typescript/src/hooks/useGooglePay.d.ts +1 -0
- package/lib/typescript/src/hooks/useStripe.d.ts +1 -0
- package/lib/typescript/src/types/Errors.d.ts +4 -0
- package/lib/typescript/src/types/GooglePay.d.ts +6 -6
- package/package.json +2 -9
- package/src/NativeStripeSdk.tsx +3 -0
- package/src/functions.ts +20 -1
- package/src/hooks/useGooglePay.tsx +19 -2
- package/src/hooks/useStripe.tsx +9 -0
- package/src/types/Errors.ts +6 -0
- package/src/types/GooglePay.ts +7 -6
- package/stripe-react-native.podspec +1 -1
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,13 @@
|
|
|
1
1
|
# CHANGELOG
|
|
2
2
|
|
|
3
|
+
## 0.3.0 - 2022-02-17
|
|
4
|
+
|
|
5
|
+
- [#810](https://github.com/stripe/stripe-react-native/pull/810) Feat: add `isGooglePaySupported` method
|
|
6
|
+
- [#809](https://github.com/stripe/stripe-react-native/pull/809) Fix: do not crash if no routing number provided when creating a bank account token on Android
|
|
7
|
+
- [#814](https://github.com/stripe/stripe-react-native/pull/814) Fix: cleanup `paymentSheetFlowController` ref before initializing new payment sheet
|
|
8
|
+
- [#806](https://github.com/stripe/stripe-react-native/pull/806) Fix: properly assign `cursorColor` style on Android `CardField` (requires Android 10 or higher).
|
|
9
|
+
- [#817](https://github.com/stripe/stripe-react-native/pull/817) Chore: Upgrade `stripe-ios` to v21.12.0 and `stripe-android` to v19.2.+
|
|
10
|
+
|
|
3
11
|
## 0.2.4 - 2022-02-10
|
|
4
12
|
|
|
5
13
|
- [#788](https://github.com/stripe/stripe-react-native/pull/788) fix: assign `paymentSheetFragment` directly, instead of through intents which would sometimes result in a `NullPointerException`.
|
package/README.md
CHANGED
|
@@ -24,6 +24,7 @@ Get started with our [📚 integration guides](https://stripe.com/docs/payments/
|
|
|
24
24
|
**Native UI**: We provide native screens and elements to securely collect payment details on Android and iOS.
|
|
25
25
|
|
|
26
26
|
**PaymentSheet**: [Learn how to integrate](https://stripe.com/docs/payments/accept-a-payment) PaymentSheet, our new pre-built payments UI for mobile apps. PaymentSheet lets you accept cards, Apple Pay, Google Pay, and much more out of the box and also supports saving & reusing payment methods. PaymentSheet currently accepts the following payment methods: Card, Apple Pay, Google Pay, SEPA Debit, Bancontact, iDEAL, and Sofort.
|
|
27
|
+
|
|
27
28
|
#### Recommended usage
|
|
28
29
|
|
|
29
30
|
If you're selling digital products or services within your app, (e.g. subscriptions, in-game currencies, game levels, access to premium content, or unlocking a full version), you must use the app store's in-app purchase APIs. See [Apple's](https://developer.apple.com/app-store/review/guidelines/#payments) and [Google's](https://support.google.com/googleplay/android-developer/answer/9858738?hl=en&ref_topic=9857752) guidelines for more information. For all other scenarios you can use this SDK to process payments via Stripe.
|
|
@@ -201,20 +202,6 @@ function App() {
|
|
|
201
202
|
|
|
202
203
|
You can find more details about the `StripeProvider` component in the [API reference](https://stripe.dev/stripe-react-native/api-reference/modules.html#stripeprovider).
|
|
203
204
|
|
|
204
|
-
## Run the example app
|
|
205
|
-
|
|
206
|
-
- Install the dependencies
|
|
207
|
-
- `yarn bootstrap`
|
|
208
|
-
- Set up env vars
|
|
209
|
-
- `cp example/.env.example example/.env` and set the variable values in your newly created `.env` file.
|
|
210
|
-
- Start the example
|
|
211
|
-
- Terminal 1: `yarn example start:server`
|
|
212
|
-
- Terminal 2: `yarn example start`
|
|
213
|
-
- Terminal 3: depending on what platform you want to build for run either
|
|
214
|
-
- `yarn example ios`
|
|
215
|
-
- or
|
|
216
|
-
- `yarn example android`
|
|
217
|
-
|
|
218
205
|
##### Additional steps for webhook forwarding
|
|
219
206
|
|
|
220
207
|
Certain payment methods require a [webhook listener](https://stripe.com/docs/payments/payment-intents/verifying-status#webhooks) to notify you of changes in the status. When developing locally, you can use the [Stripe CLI](https://stripe.com/docs/stripe-cli) to forward webhook events to your local dev server.
|
|
@@ -245,6 +232,10 @@ jest.mock('@stripe/stripe-react-native', () => ({
|
|
|
245
232
|
}));
|
|
246
233
|
```
|
|
247
234
|
|
|
235
|
+
## Contributing
|
|
236
|
+
|
|
237
|
+
See the [contributor guidelines](CONTRIBUTING.md) to learn how to contribute to the repository or to learn how to run the example app.
|
|
238
|
+
|
|
248
239
|
## Troubleshooting
|
|
249
240
|
|
|
250
241
|
### `Undefined symbols for architecture x86_64` on iOS
|
|
@@ -270,7 +261,3 @@ Follow these steps to resolve this:
|
|
|
270
261
|
You might see error this whilst initializing the `StripeProvider` component with Expo. This is caused by using an older version of Expo before stripe-react-native was [officially supported](https://github.com/stripe/stripe-react-native/issues/3#issuecomment-846225534). Updating Expo Go from the stores (or locally on simulators installed with `expo install:client:[ios|android]`) should fix the problem.
|
|
271
262
|
|
|
272
263
|
If you're still having troubles, please [open an issue](https://github.com/stripe/stripe-react-native/issues/new/choose) or jump in our [developer chat](https://stripe.com/go/developer-chat).
|
|
273
|
-
|
|
274
|
-
## Contributing
|
|
275
|
-
|
|
276
|
-
See the [contributor guidelines](CONTRIBUTING.md) to learn how to contribute to the repository.
|
package/android/build.gradle
CHANGED
|
@@ -132,7 +132,7 @@ dependencies {
|
|
|
132
132
|
api 'com.facebook.react:react-native:+'
|
|
133
133
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
134
134
|
implementation "androidx.lifecycle:lifecycle-runtime-ktx:2.3.1"
|
|
135
|
-
implementation 'com.stripe:stripe-android:19.
|
|
135
|
+
implementation 'com.stripe:stripe-android:19.2.+'
|
|
136
136
|
implementation 'com.google.android.material:material:1.3.0'
|
|
137
137
|
implementation 'androidx.appcompat:appcompat:1.2.0'
|
|
138
138
|
implementation 'androidx.legacy:legacy-support-v4:1.0.0'
|
package/android/src/main/java/com/reactnativestripesdk/GooglePayPaymentMethodLauncherFragment.kt
ADDED
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
package com.reactnativestripesdk
|
|
2
|
+
|
|
3
|
+
import android.os.Bundle
|
|
4
|
+
import android.view.LayoutInflater
|
|
5
|
+
import android.view.View
|
|
6
|
+
import android.view.ViewGroup
|
|
7
|
+
import android.widget.FrameLayout
|
|
8
|
+
import androidx.appcompat.app.AppCompatActivity
|
|
9
|
+
import androidx.fragment.app.Fragment
|
|
10
|
+
import com.facebook.react.bridge.Promise
|
|
11
|
+
import com.stripe.android.googlepaylauncher.GooglePayEnvironment
|
|
12
|
+
import com.stripe.android.googlepaylauncher.GooglePayPaymentMethodLauncher
|
|
13
|
+
|
|
14
|
+
class GooglePayPaymentMethodLauncherFragment(
|
|
15
|
+
private val activity: AppCompatActivity,
|
|
16
|
+
private val isTestEnv: Boolean,
|
|
17
|
+
private val paymentMethodRequired: Boolean,
|
|
18
|
+
private val promise: Promise
|
|
19
|
+
) : Fragment() {
|
|
20
|
+
override fun onCreateView(inflater: LayoutInflater, container: ViewGroup?,
|
|
21
|
+
savedInstanceState: Bundle?): View? {
|
|
22
|
+
return FrameLayout(requireActivity()).also {
|
|
23
|
+
it.visibility = View.GONE
|
|
24
|
+
}
|
|
25
|
+
}
|
|
26
|
+
|
|
27
|
+
override fun onViewCreated(view: View, savedInstanceState: Bundle?) {
|
|
28
|
+
super.onViewCreated(view, savedInstanceState)
|
|
29
|
+
GooglePayPaymentMethodLauncher(
|
|
30
|
+
this,
|
|
31
|
+
config = GooglePayPaymentMethodLauncher.Config(
|
|
32
|
+
environment = if (isTestEnv) GooglePayEnvironment.Test else GooglePayEnvironment.Production,
|
|
33
|
+
existingPaymentMethodRequired = paymentMethodRequired,
|
|
34
|
+
merchantCountryCode = "", // Unnecessary since all we are checking for is Google Pay availability
|
|
35
|
+
merchantName = "", // Same as above
|
|
36
|
+
),
|
|
37
|
+
readyCallback = {
|
|
38
|
+
promise.resolve(it)
|
|
39
|
+
activity.supportFragmentManager.beginTransaction().remove(this).commit()
|
|
40
|
+
},
|
|
41
|
+
resultCallback = {}
|
|
42
|
+
)
|
|
43
|
+
}
|
|
44
|
+
}
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
package com.reactnativestripesdk
|
|
2
2
|
|
|
3
|
-
import android.content.Context
|
|
4
3
|
import android.content.res.ColorStateList
|
|
5
4
|
import android.graphics.Color
|
|
6
5
|
import android.graphics.Typeface
|
|
6
|
+
import android.os.Build
|
|
7
7
|
import android.text.Editable
|
|
8
8
|
import android.text.TextWatcher
|
|
9
|
-
import android.view.View
|
|
10
|
-
import android.view.inputmethod.InputMethodManager
|
|
11
9
|
import android.widget.FrameLayout
|
|
12
10
|
import com.facebook.react.bridge.ReadableMap
|
|
13
11
|
import com.facebook.react.uimanager.ThemedReactContext
|
|
@@ -89,36 +87,45 @@ class StripeSdkCardView(private val context: ThemedReactContext) : FrameLayout(c
|
|
|
89
87
|
val fontFamily = getValOr(value, "fontFamily")
|
|
90
88
|
val placeholderColor = getValOr(value, "placeholderColor", null)
|
|
91
89
|
val textErrorColor = getValOr(value, "textErrorColor", null)
|
|
90
|
+
val cursorColor = getValOr(value, "cursorColor", null)
|
|
91
|
+
val bindings = setOf(binding.cardNumberEditText, binding.cvcEditText, binding.expiryDateEditText, binding.postalCodeEditText)
|
|
92
92
|
|
|
93
93
|
textColor?.let {
|
|
94
|
-
|
|
95
|
-
|
|
96
|
-
|
|
97
|
-
binding.postalCodeEditText.setTextColor(Color.parseColor(it))
|
|
94
|
+
for (editTextBinding in bindings) {
|
|
95
|
+
editTextBinding.setTextColor(Color.parseColor(it))
|
|
96
|
+
}
|
|
98
97
|
}
|
|
99
98
|
textErrorColor?.let {
|
|
100
|
-
|
|
101
|
-
|
|
102
|
-
|
|
103
|
-
binding.postalCodeEditText.setErrorColor(Color.parseColor(it))
|
|
99
|
+
for (editTextBinding in bindings) {
|
|
100
|
+
editTextBinding.setErrorColor(Color.parseColor(it))
|
|
101
|
+
}
|
|
104
102
|
}
|
|
105
103
|
placeholderColor?.let {
|
|
106
|
-
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
binding.postalCodeEditText.setHintTextColor(Color.parseColor(it))
|
|
104
|
+
for (editTextBinding in bindings) {
|
|
105
|
+
editTextBinding.setHintTextColor(Color.parseColor(it))
|
|
106
|
+
}
|
|
110
107
|
}
|
|
111
108
|
fontSize?.let {
|
|
112
|
-
|
|
113
|
-
|
|
114
|
-
|
|
115
|
-
binding.postalCodeEditText.textSize = it.toFloat()
|
|
109
|
+
for (editTextBinding in bindings) {
|
|
110
|
+
editTextBinding.textSize = it.toFloat()
|
|
111
|
+
}
|
|
116
112
|
}
|
|
117
113
|
fontFamily?.let {
|
|
118
|
-
|
|
119
|
-
|
|
120
|
-
|
|
121
|
-
|
|
114
|
+
for (editTextBinding in bindings) {
|
|
115
|
+
editTextBinding.typeface = Typeface.create(it, Typeface.NORMAL)
|
|
116
|
+
}
|
|
117
|
+
}
|
|
118
|
+
cursorColor?.let {
|
|
119
|
+
if (Build.VERSION.SDK_INT >= Build.VERSION_CODES.Q) {
|
|
120
|
+
val color = Color.parseColor(it)
|
|
121
|
+
for (editTextBinding in bindings) {
|
|
122
|
+
editTextBinding.textCursorDrawable?.setTint(color)
|
|
123
|
+
editTextBinding.textSelectHandle?.setTint(color)
|
|
124
|
+
editTextBinding.textSelectHandleLeft?.setTint(color)
|
|
125
|
+
editTextBinding.textSelectHandleRight?.setTint(color)
|
|
126
|
+
editTextBinding.highlightColor = color
|
|
127
|
+
}
|
|
128
|
+
}
|
|
122
129
|
}
|
|
123
130
|
|
|
124
131
|
mCardWidget.setPadding(40, 0, 40, 0)
|
|
@@ -1,14 +1,11 @@
|
|
|
1
1
|
package com.reactnativestripesdk
|
|
2
2
|
|
|
3
3
|
import android.app.Activity
|
|
4
|
-
import android.app.Application
|
|
5
4
|
import android.content.BroadcastReceiver
|
|
6
5
|
import android.content.Context
|
|
7
6
|
import android.content.Intent
|
|
8
7
|
import android.content.IntentFilter
|
|
9
8
|
import android.os.AsyncTask
|
|
10
|
-
import android.os.Build
|
|
11
|
-
import android.os.Bundle
|
|
12
9
|
import android.os.Parcelable
|
|
13
10
|
import android.util.Log
|
|
14
11
|
import androidx.activity.ComponentActivity
|
|
@@ -25,8 +22,9 @@ import com.stripe.android.paymentsheet.PaymentSheetResult
|
|
|
25
22
|
import com.stripe.android.view.AddPaymentMethodActivityStarter
|
|
26
23
|
import kotlinx.coroutines.*
|
|
27
24
|
|
|
25
|
+
|
|
28
26
|
@ReactModule(name = StripeSdkModule.NAME)
|
|
29
|
-
class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
27
|
+
class StripeSdkModule(private val reactContext: ReactApplicationContext) : ReactContextBaseJavaModule(reactContext) {
|
|
30
28
|
var cardFieldView: StripeSdkCardView? = null
|
|
31
29
|
var cardFormView: CardFormView? = null
|
|
32
30
|
private lateinit var localBroadcastManager: LocalBroadcastManager
|
|
@@ -419,29 +417,30 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
|
419
417
|
}
|
|
420
418
|
|
|
421
419
|
private fun createTokenFromBankAccount(params: ReadableMap, promise: Promise) {
|
|
422
|
-
val accountHolderName = getValOr(params, "accountHolderName")
|
|
423
|
-
val accountHolderType = getValOr(params, "accountHolderType")
|
|
420
|
+
val accountHolderName = getValOr(params, "accountHolderName", null)
|
|
421
|
+
val accountHolderType = getValOr(params, "accountHolderType", null)
|
|
424
422
|
val accountNumber = getValOr(params, "accountNumber", null)
|
|
425
423
|
val country = getValOr(params, "country", null)
|
|
426
424
|
val currency = getValOr(params, "currency", null)
|
|
427
|
-
val routingNumber = getValOr(params, "routingNumber")
|
|
428
|
-
|
|
429
|
-
|
|
430
|
-
|
|
431
|
-
|
|
432
|
-
|
|
433
|
-
|
|
434
|
-
|
|
435
|
-
|
|
436
|
-
|
|
437
|
-
|
|
438
|
-
|
|
425
|
+
val routingNumber = getValOr(params, "routingNumber", null)
|
|
426
|
+
|
|
427
|
+
val bankAccountParams = BankAccountTokenParams(
|
|
428
|
+
country = country!!,
|
|
429
|
+
currency = currency!!,
|
|
430
|
+
accountNumber = accountNumber!!,
|
|
431
|
+
accountHolderName = accountHolderName,
|
|
432
|
+
routingNumber = routingNumber,
|
|
433
|
+
accountHolderType = mapToBankAccountType(accountHolderType)
|
|
434
|
+
)
|
|
435
|
+
CoroutineScope(Dispatchers.IO).launch {
|
|
436
|
+
runCatching {
|
|
439
437
|
val token = stripe.createBankAccountToken(bankAccountParams, null, stripeAccountId)
|
|
440
438
|
promise.resolve(createResult("token", mapFromToken(token)))
|
|
439
|
+
}.onFailure {
|
|
440
|
+
promise.resolve(createError(CreateTokenErrorType.Failed.toString(), it.message))
|
|
441
441
|
}
|
|
442
|
-
}.onFailure {
|
|
443
|
-
promise.resolve(createError(CreateTokenErrorType.Failed.toString(), it.message))
|
|
444
442
|
}
|
|
443
|
+
|
|
445
444
|
}
|
|
446
445
|
|
|
447
446
|
private fun createTokenFromCard(params: ReadableMap, promise: Promise) {
|
|
@@ -604,6 +603,20 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
|
|
|
604
603
|
}
|
|
605
604
|
}
|
|
606
605
|
|
|
606
|
+
@ReactMethod
|
|
607
|
+
fun isGooglePaySupported(params: ReadableMap?, promise: Promise) {
|
|
608
|
+
val fragment = GooglePayPaymentMethodLauncherFragment(
|
|
609
|
+
currentActivity as AppCompatActivity,
|
|
610
|
+
getBooleanOrFalse(params, "testEnv"),
|
|
611
|
+
getBooleanOrFalse(params, "existingPaymentMethodRequired"),
|
|
612
|
+
promise
|
|
613
|
+
)
|
|
614
|
+
|
|
615
|
+
(currentActivity as AppCompatActivity).supportFragmentManager.beginTransaction()
|
|
616
|
+
.add(fragment, "google_pay_support_fragment")
|
|
617
|
+
.commit()
|
|
618
|
+
}
|
|
619
|
+
|
|
607
620
|
@ReactMethod
|
|
608
621
|
fun initGooglePay(params: ReadableMap, promise: Promise) {
|
|
609
622
|
val activity = currentActivity as AppCompatActivity
|
package/ios/StripeSdk.swift
CHANGED
|
@@ -65,6 +65,7 @@ class StripeSdk: RCTEventEmitter, STPApplePayContextDelegate, STPBankSelectionVi
|
|
|
65
65
|
func initPaymentSheet(params: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock,
|
|
66
66
|
rejecter reject: @escaping RCTPromiseRejectBlock) -> Void {
|
|
67
67
|
var configuration = PaymentSheet.Configuration()
|
|
68
|
+
self.paymentSheetFlowController = nil
|
|
68
69
|
|
|
69
70
|
if params["applePay"] as? Bool == true {
|
|
70
71
|
if let merchantIdentifier = self.merchantIdentifier, let merchantCountryCode = params["merchantCountryCode"] as? String {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["NativeStripeSdk.tsx"],"names":["StripeSdk","NativeModules"],"mappings":"gFAAA,
|
|
1
|
+
{"version":3,"sources":["NativeStripeSdk.tsx"],"names":["StripeSdk","NativeModules"],"mappings":"gFAAA,yCAiFA,GAAQA,CAAAA,SAAR,CAAsBC,0BAAtB,CAAQD,SAAR,C,aAEeA,S","sourcesContent":["import { NativeModules } from 'react-native';\nimport type {\n PaymentMethodCreateParams,\n ApplePay,\n PaymentSheet,\n ConfirmSetupIntent,\n InitialiseParams,\n CreatePaymentMethodResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n ConfirmPaymentResult,\n HandleCardActionResult,\n ConfirmSetupIntentResult,\n CreateTokenForCVCUpdateResult,\n InitPaymentSheetResult,\n PresentPaymentSheetResult,\n ConfirmPaymentSheetPaymentResult,\n ApplePayResult,\n CreateTokenResult,\n GooglePayInitResult,\n PayWithGooglePayResult,\n CreateGooglePayPaymentMethodResult,\n GooglePay,\n OpenApplePaySetupResult,\n CreateTokenParams,\n} from './types';\n\ntype NativeStripeSdkType = {\n initialise(params: InitialiseParams): Promise<void>;\n createPaymentMethod(\n data: PaymentMethodCreateParams.Params,\n options: PaymentMethodCreateParams.Options\n ): Promise<CreatePaymentMethodResult>;\n handleCardAction(\n paymentIntentClientSecret: string\n ): Promise<HandleCardActionResult>;\n confirmPayment(\n paymentIntentClientSecret: string,\n data: PaymentMethodCreateParams.Params,\n options: PaymentMethodCreateParams.Options\n ): Promise<ConfirmPaymentResult>;\n isApplePaySupported(): Promise<boolean>;\n presentApplePay(params: ApplePay.PresentParams): Promise<ApplePayResult>;\n confirmApplePayPayment(clientSecret: string): Promise<void>;\n updateApplePaySummaryItems(\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }>\n ): Promise<void>;\n confirmSetupIntent(\n paymentIntentClientSecret: string,\n data: ConfirmSetupIntent.Params,\n options: ConfirmSetupIntent.Options\n ): Promise<ConfirmSetupIntentResult>;\n retrievePaymentIntent(\n clientSecret: string\n ): Promise<RetrievePaymentIntentResult>;\n retrieveSetupIntent(clientSecret: string): Promise<RetrieveSetupIntentResult>;\n initPaymentSheet(\n params: PaymentSheet.SetupParams\n ): Promise<InitPaymentSheetResult>;\n presentPaymentSheet(): Promise<PresentPaymentSheetResult>;\n confirmPaymentSheetPayment(): Promise<ConfirmPaymentSheetPaymentResult>;\n createTokenForCVCUpdate(cvc: string): Promise<CreateTokenForCVCUpdateResult>;\n handleURLCallback(url: string): Promise<boolean>;\n createToken(params: CreateTokenParams): Promise<CreateTokenResult>;\n isGooglePaySupported(\n params: GooglePay.IsGooglePaySupportedParams\n ): Promise<boolean>;\n initGooglePay(params: GooglePay.InitParams): Promise<GooglePayInitResult>;\n presentGooglePay(\n params: GooglePay.PresentGooglePayParams\n ): Promise<PayWithGooglePayResult>;\n createGooglePayPaymentMethod(\n params: GooglePay.CreatePaymentMethodParams\n ): Promise<CreateGooglePayPaymentMethodResult>;\n openApplePaySetup(): Promise<OpenApplePaySetupResult>;\n};\n\nconst { StripeSdk } = NativeModules;\n\nexport default StripeSdk as NativeStripeSdkType;\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.openApplePaySetup=exports.createGooglePayPaymentMethod=exports.presentGooglePay=exports.initGooglePay=exports.confirmPaymentSheetPayment=exports.presentPaymentSheet=exports.initPaymentSheet=exports.handleURLCallback=exports.createTokenForCVCUpdate=exports.confirmSetupIntent=exports.handleCardAction=exports.confirmApplePayPayment=exports.updateApplePaySummaryItems=exports.presentApplePay=exports.isApplePaySupported=exports.confirmPayment=exports.retrieveSetupIntent=exports.retrievePaymentIntent=exports.createToken=exports.createPaymentMethod=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _helpers=require("./helpers");var _NativeStripeSdk=_interopRequireDefault(require("./NativeStripeSdk"));var _types=require("./types");var APPLE_PAY_NOT_SUPPORTED_MESSAGE='Apple pay is not supported on this device';var createPaymentMethod=function _callee(data){var options,_await$NativeStripeSd,paymentMethod,error,_args=arguments;return _regenerator.default.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:options=_args.length>1&&_args[1]!==undefined?_args[1]:{};_context.prev=1;_context.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.createPaymentMethod(data,options));case 4:_await$NativeStripeSd=_context.sent;paymentMethod=_await$NativeStripeSd.paymentMethod;error=_await$NativeStripeSd.error;if(!error){_context.next=9;break;}return _context.abrupt("return",{error:error});case 9:return _context.abrupt("return",{paymentMethod:paymentMethod});case 12:_context.prev=12;_context.t0=_context["catch"](1);return _context.abrupt("return",{error:_context.t0});case 15:case"end":return _context.stop();}}},null,null,[[1,12]],Promise);};exports.createPaymentMethod=createPaymentMethod;var createToken=function _callee2(params){var _await$NativeStripeSd2,token,error;return _regenerator.default.async(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:_context2.prev=0;_context2.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.createToken(params));case 3:_await$NativeStripeSd2=_context2.sent;token=_await$NativeStripeSd2.token;error=_await$NativeStripeSd2.error;if(!error){_context2.next=8;break;}return _context2.abrupt("return",{error:error});case 8:return _context2.abrupt("return",{token:token});case 11:_context2.prev=11;_context2.t0=_context2["catch"](0);return _context2.abrupt("return",{error:(0,_helpers.createError)(_context2.t0)});case 14:case"end":return _context2.stop();}}},null,null,[[0,11]],Promise);};exports.createToken=createToken;var retrievePaymentIntent=function _callee3(clientSecret){var _await$NativeStripeSd3,paymentIntent,error;return _regenerator.default.async(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.prev=0;_context3.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.retrievePaymentIntent(clientSecret));case 3:_await$NativeStripeSd3=_context3.sent;paymentIntent=_await$NativeStripeSd3.paymentIntent;error=_await$NativeStripeSd3.error;if(!error){_context3.next=8;break;}return _context3.abrupt("return",{error:error});case 8:return _context3.abrupt("return",{paymentIntent:paymentIntent});case 11:_context3.prev=11;_context3.t0=_context3["catch"](0);return _context3.abrupt("return",{error:_context3.t0});case 14:case"end":return _context3.stop();}}},null,null,[[0,11]],Promise);};exports.retrievePaymentIntent=retrievePaymentIntent;var retrieveSetupIntent=function _callee4(clientSecret){var _await$NativeStripeSd4,setupIntent,error;return _regenerator.default.async(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.prev=0;_context4.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.retrieveSetupIntent(clientSecret));case 3:_await$NativeStripeSd4=_context4.sent;setupIntent=_await$NativeStripeSd4.setupIntent;error=_await$NativeStripeSd4.error;if(!error){_context4.next=8;break;}return _context4.abrupt("return",{error:error});case 8:return _context4.abrupt("return",{setupIntent:setupIntent});case 11:_context4.prev=11;_context4.t0=_context4["catch"](0);return _context4.abrupt("return",{error:_context4.t0});case 14:case"end":return _context4.stop();}}},null,null,[[0,11]],Promise);};exports.retrieveSetupIntent=retrieveSetupIntent;var confirmPayment=function _callee5(paymentIntentClientSecret,data){var options,_await$NativeStripeSd5,paymentIntent,error,_args5=arguments;return _regenerator.default.async(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:options=_args5.length>2&&_args5[2]!==undefined?_args5[2]:{};_context5.prev=1;_context5.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.confirmPayment(paymentIntentClientSecret,data,options));case 4:_await$NativeStripeSd5=_context5.sent;paymentIntent=_await$NativeStripeSd5.paymentIntent;error=_await$NativeStripeSd5.error;if(!error){_context5.next=9;break;}return _context5.abrupt("return",{error:error});case 9:return _context5.abrupt("return",{paymentIntent:paymentIntent});case 12:_context5.prev=12;_context5.t0=_context5["catch"](1);return _context5.abrupt("return",{error:_context5.t0});case 15:case"end":return _context5.stop();}}},null,null,[[1,12]],Promise);};exports.confirmPayment=confirmPayment;var isApplePaySupported=function _callee6(){return _regenerator.default.async(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:_context6.t0=_helpers.isiOS;if(!_context6.t0){_context6.next=5;break;}_context6.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 4:_context6.t0=_context6.sent;case 5:return _context6.abrupt("return",_context6.t0);case 6:case"end":return _context6.stop();}}},null,null,null,Promise);};exports.isApplePaySupported=isApplePaySupported;var presentApplePay=function _callee7(params){var _await$NativeStripeSd6,paymentMethod,error;return _regenerator.default.async(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:_context7.next=2;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 2:if(_context7.sent){_context7.next=4;break;}return _context7.abrupt("return",{error:(0,_helpers.createError)({code:_types.ApplePayError.Canceled,message:APPLE_PAY_NOT_SUPPORTED_MESSAGE})});case 4:_context7.prev=4;_context7.next=7;return _regenerator.default.awrap(_NativeStripeSdk.default.presentApplePay(params));case 7:_await$NativeStripeSd6=_context7.sent;paymentMethod=_await$NativeStripeSd6.paymentMethod;error=_await$NativeStripeSd6.error;if(!error){_context7.next=12;break;}return _context7.abrupt("return",{error:error});case 12:return _context7.abrupt("return",{paymentMethod:paymentMethod});case 15:_context7.prev=15;_context7.t0=_context7["catch"](4);return _context7.abrupt("return",{error:_context7.t0});case 18:case"end":return _context7.stop();}}},null,null,[[4,15]],Promise);};exports.presentApplePay=presentApplePay;var updateApplePaySummaryItems=function _callee8(summaryItems){var errorAddressFields,_args8=arguments;return _regenerator.default.async(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:errorAddressFields=_args8.length>1&&_args8[1]!==undefined?_args8[1]:[];_context8.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 3:if(_context8.sent){_context8.next=5;break;}return _context8.abrupt("return",{error:(0,_helpers.createError)({code:_types.ApplePayError.Canceled,message:APPLE_PAY_NOT_SUPPORTED_MESSAGE})});case 5:_context8.prev=5;_context8.next=8;return _regenerator.default.awrap(_NativeStripeSdk.default.updateApplePaySummaryItems(summaryItems,errorAddressFields));case 8:return _context8.abrupt("return",{});case 11:_context8.prev=11;_context8.t0=_context8["catch"](5);return _context8.abrupt("return",{error:(0,_helpers.createError)(_context8.t0)});case 14:case"end":return _context8.stop();}}},null,null,[[5,11]],Promise);};exports.updateApplePaySummaryItems=updateApplePaySummaryItems;var confirmApplePayPayment=function _callee9(clientSecret){return _regenerator.default.async(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:_context9.next=2;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 2:if(_context9.sent){_context9.next=4;break;}return _context9.abrupt("return",{error:(0,_helpers.createError)({code:_types.ApplePayError.Canceled,message:APPLE_PAY_NOT_SUPPORTED_MESSAGE})});case 4:_context9.prev=4;_context9.next=7;return _regenerator.default.awrap(_NativeStripeSdk.default.confirmApplePayPayment(clientSecret));case 7:return _context9.abrupt("return",{});case 10:_context9.prev=10;_context9.t0=_context9["catch"](4);return _context9.abrupt("return",{error:(0,_helpers.createError)(_context9.t0)});case 13:case"end":return _context9.stop();}}},null,null,[[4,10]],Promise);};exports.confirmApplePayPayment=confirmApplePayPayment;var handleCardAction=function _callee10(paymentIntentClientSecret){var _await$NativeStripeSd7,paymentIntent,error;return _regenerator.default.async(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_context10.prev=0;_context10.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.handleCardAction(paymentIntentClientSecret));case 3:_await$NativeStripeSd7=_context10.sent;paymentIntent=_await$NativeStripeSd7.paymentIntent;error=_await$NativeStripeSd7.error;if(!error){_context10.next=8;break;}return _context10.abrupt("return",{error:error});case 8:return _context10.abrupt("return",{paymentIntent:paymentIntent});case 11:_context10.prev=11;_context10.t0=_context10["catch"](0);return _context10.abrupt("return",{error:(0,_helpers.createError)(_context10.t0)});case 14:case"end":return _context10.stop();}}},null,null,[[0,11]],Promise);};exports.handleCardAction=handleCardAction;var confirmSetupIntent=function _callee11(paymentIntentClientSecret,data){var options,_await$NativeStripeSd8,setupIntent,error,_args11=arguments;return _regenerator.default.async(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:options=_args11.length>2&&_args11[2]!==undefined?_args11[2]:{};_context11.prev=1;_context11.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.confirmSetupIntent(paymentIntentClientSecret,data,options));case 4:_await$NativeStripeSd8=_context11.sent;setupIntent=_await$NativeStripeSd8.setupIntent;error=_await$NativeStripeSd8.error;if(!error){_context11.next=9;break;}return _context11.abrupt("return",{error:error});case 9:return _context11.abrupt("return",{setupIntent:setupIntent});case 12:_context11.prev=12;_context11.t0=_context11["catch"](1);return _context11.abrupt("return",{error:(0,_helpers.createError)(_context11.t0)});case 15:case"end":return _context11.stop();}}},null,null,[[1,12]],Promise);};exports.confirmSetupIntent=confirmSetupIntent;var createTokenForCVCUpdate=function _callee12(cvc){var _await$NativeStripeSd9,tokenId,error;return _regenerator.default.async(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:_context12.prev=0;_context12.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.createTokenForCVCUpdate(cvc));case 3:_await$NativeStripeSd9=_context12.sent;tokenId=_await$NativeStripeSd9.tokenId;error=_await$NativeStripeSd9.error;if(!error){_context12.next=8;break;}return _context12.abrupt("return",{error:error});case 8:return _context12.abrupt("return",{tokenId:tokenId});case 11:_context12.prev=11;_context12.t0=_context12["catch"](0);return _context12.abrupt("return",{error:(0,_helpers.createError)(_context12.t0)});case 14:case"end":return _context12.stop();}}},null,null,[[0,11]],Promise);};exports.createTokenForCVCUpdate=createTokenForCVCUpdate;var handleURLCallback=function _callee13(url){var stripeHandled;return _regenerator.default.async(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:_context13.next=2;return _regenerator.default.awrap(_NativeStripeSdk.default.handleURLCallback(url));case 2:stripeHandled=_context13.sent;return _context13.abrupt("return",stripeHandled);case 4:case"end":return _context13.stop();}}},null,null,null,Promise);};exports.handleURLCallback=handleURLCallback;var initPaymentSheet=function _callee14(params){var _await$NativeStripeSd10,paymentOption,error;return _regenerator.default.async(function _callee14$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:_context14.prev=0;_context14.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.initPaymentSheet(params));case 3:_await$NativeStripeSd10=_context14.sent;paymentOption=_await$NativeStripeSd10.paymentOption;error=_await$NativeStripeSd10.error;if(!error){_context14.next=8;break;}return _context14.abrupt("return",{error:error});case 8:return _context14.abrupt("return",{paymentOption:paymentOption});case 11:_context14.prev=11;_context14.t0=_context14["catch"](0);return _context14.abrupt("return",{error:(0,_helpers.createError)(_context14.t0)});case 14:case"end":return _context14.stop();}}},null,null,[[0,11]],Promise);};exports.initPaymentSheet=initPaymentSheet;var presentPaymentSheet=function _callee15(){var _await$NativeStripeSd11,paymentOption,error;return _regenerator.default.async(function _callee15$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:_context15.prev=0;_context15.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.presentPaymentSheet());case 3:_await$NativeStripeSd11=_context15.sent;paymentOption=_await$NativeStripeSd11.paymentOption;error=_await$NativeStripeSd11.error;if(!error){_context15.next=8;break;}return _context15.abrupt("return",{error:error});case 8:return _context15.abrupt("return",{paymentOption:paymentOption});case 11:_context15.prev=11;_context15.t0=_context15["catch"](0);return _context15.abrupt("return",{error:(0,_helpers.createError)(_context15.t0)});case 14:case"end":return _context15.stop();}}},null,null,[[0,11]],Promise);};exports.presentPaymentSheet=presentPaymentSheet;var confirmPaymentSheetPayment=function _callee16(){var _await$NativeStripeSd12,error;return _regenerator.default.async(function _callee16$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:_context16.prev=0;_context16.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.confirmPaymentSheetPayment());case 3:_await$NativeStripeSd12=_context16.sent;error=_await$NativeStripeSd12.error;if(!error){_context16.next=7;break;}return _context16.abrupt("return",{error:error});case 7:return _context16.abrupt("return",{});case 10:_context16.prev=10;_context16.t0=_context16["catch"](0);return _context16.abrupt("return",{error:(0,_helpers.createError)(_context16.t0)});case 13:case"end":return _context16.stop();}}},null,null,[[0,10]],Promise);};exports.confirmPaymentSheetPayment=confirmPaymentSheetPayment;var initGooglePay=function _callee17(params){var _await$NativeStripeSd13,error;return _regenerator.default.async(function _callee17$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:_context17.prev=0;_context17.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.initGooglePay(params));case 3:_await$NativeStripeSd13=_context17.sent;error=_await$NativeStripeSd13.error;if(!error){_context17.next=7;break;}return _context17.abrupt("return",{error:error});case 7:return _context17.abrupt("return",{});case 10:_context17.prev=10;_context17.t0=_context17["catch"](0);return _context17.abrupt("return",{error:(0,_helpers.createError)(_context17.t0)});case 13:case"end":return _context17.stop();}}},null,null,[[0,10]],Promise);};exports.initGooglePay=initGooglePay;var presentGooglePay=function _callee18(params){var _await$NativeStripeSd14,error;return _regenerator.default.async(function _callee18$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:_context18.prev=0;_context18.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.presentGooglePay(params));case 3:_await$NativeStripeSd14=_context18.sent;error=_await$NativeStripeSd14.error;if(!error){_context18.next=7;break;}return _context18.abrupt("return",{error:error});case 7:return _context18.abrupt("return",{});case 10:_context18.prev=10;_context18.t0=_context18["catch"](0);return _context18.abrupt("return",{error:(0,_helpers.createError)(_context18.t0)});case 13:case"end":return _context18.stop();}}},null,null,[[0,10]],Promise);};exports.presentGooglePay=presentGooglePay;var createGooglePayPaymentMethod=function _callee19(params){var _await$NativeStripeSd15,error,paymentMethod;return _regenerator.default.async(function _callee19$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:_context19.prev=0;_context19.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.createGooglePayPaymentMethod(params));case 3:_await$NativeStripeSd15=_context19.sent;error=_await$NativeStripeSd15.error;paymentMethod=_await$NativeStripeSd15.paymentMethod;if(!error){_context19.next=8;break;}return _context19.abrupt("return",{error:error});case 8:return _context19.abrupt("return",{paymentMethod:paymentMethod});case 11:_context19.prev=11;_context19.t0=_context19["catch"](0);return _context19.abrupt("return",{error:(0,_helpers.createError)(_context19.t0)});case 14:case"end":return _context19.stop();}}},null,null,[[0,11]],Promise);};exports.createGooglePayPaymentMethod=createGooglePayPaymentMethod;var openApplePaySetup=function _callee20(){var _await$NativeStripeSd16,error;return _regenerator.default.async(function _callee20$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:_context20.prev=0;_context20.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.openApplePaySetup());case 3:_await$NativeStripeSd16=_context20.sent;error=_await$NativeStripeSd16.error;if(!error){_context20.next=7;break;}return _context20.abrupt("return",{error:error});case 7:return _context20.abrupt("return",{});case 10:_context20.prev=10;_context20.t0=_context20["catch"](0);return _context20.abrupt("return",{error:(0,_helpers.createError)(_context20.t0)});case 13:case"end":return _context20.stop();}}},null,null,[[0,10]],Promise);};exports.openApplePaySetup=openApplePaySetup;
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.openApplePaySetup=exports.createGooglePayPaymentMethod=exports.presentGooglePay=exports.initGooglePay=exports.isGooglePaySupported=exports.confirmPaymentSheetPayment=exports.presentPaymentSheet=exports.initPaymentSheet=exports.handleURLCallback=exports.createTokenForCVCUpdate=exports.confirmSetupIntent=exports.handleCardAction=exports.confirmApplePayPayment=exports.updateApplePaySummaryItems=exports.presentApplePay=exports.isApplePaySupported=exports.confirmPayment=exports.retrieveSetupIntent=exports.retrievePaymentIntent=exports.createToken=exports.createPaymentMethod=void 0;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _helpers=require("./helpers");var _Errors=require("./types/Errors");var _NativeStripeSdk=_interopRequireDefault(require("./NativeStripeSdk"));var _types=require("./types");var APPLE_PAY_NOT_SUPPORTED_MESSAGE='Apple pay is not supported on this device';var createPaymentMethod=function _callee(data){var options,_await$NativeStripeSd,paymentMethod,error,_args=arguments;return _regenerator.default.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:options=_args.length>1&&_args[1]!==undefined?_args[1]:{};_context.prev=1;_context.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.createPaymentMethod(data,options));case 4:_await$NativeStripeSd=_context.sent;paymentMethod=_await$NativeStripeSd.paymentMethod;error=_await$NativeStripeSd.error;if(!error){_context.next=9;break;}return _context.abrupt("return",{error:error});case 9:return _context.abrupt("return",{paymentMethod:paymentMethod});case 12:_context.prev=12;_context.t0=_context["catch"](1);return _context.abrupt("return",{error:_context.t0});case 15:case"end":return _context.stop();}}},null,null,[[1,12]],Promise);};exports.createPaymentMethod=createPaymentMethod;var createToken=function _callee2(params){var _params$country;var _await$NativeStripeSd2,token,error;return _regenerator.default.async(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:if(!(params.type==='BankAccount'&&((_params$country=params.country)==null?void 0:_params$country.toLowerCase())==='us'&&!params.routingNumber)){_context2.next=2;break;}return _context2.abrupt("return",{error:_Errors.MissingRoutingNumber});case 2:_context2.prev=2;_context2.next=5;return _regenerator.default.awrap(_NativeStripeSdk.default.createToken(params));case 5:_await$NativeStripeSd2=_context2.sent;token=_await$NativeStripeSd2.token;error=_await$NativeStripeSd2.error;if(!error){_context2.next=10;break;}return _context2.abrupt("return",{error:error});case 10:return _context2.abrupt("return",{token:token});case 13:_context2.prev=13;_context2.t0=_context2["catch"](2);return _context2.abrupt("return",{error:(0,_helpers.createError)(_context2.t0)});case 16:case"end":return _context2.stop();}}},null,null,[[2,13]],Promise);};exports.createToken=createToken;var retrievePaymentIntent=function _callee3(clientSecret){var _await$NativeStripeSd3,paymentIntent,error;return _regenerator.default.async(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:_context3.prev=0;_context3.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.retrievePaymentIntent(clientSecret));case 3:_await$NativeStripeSd3=_context3.sent;paymentIntent=_await$NativeStripeSd3.paymentIntent;error=_await$NativeStripeSd3.error;if(!error){_context3.next=8;break;}return _context3.abrupt("return",{error:error});case 8:return _context3.abrupt("return",{paymentIntent:paymentIntent});case 11:_context3.prev=11;_context3.t0=_context3["catch"](0);return _context3.abrupt("return",{error:_context3.t0});case 14:case"end":return _context3.stop();}}},null,null,[[0,11]],Promise);};exports.retrievePaymentIntent=retrievePaymentIntent;var retrieveSetupIntent=function _callee4(clientSecret){var _await$NativeStripeSd4,setupIntent,error;return _regenerator.default.async(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:_context4.prev=0;_context4.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.retrieveSetupIntent(clientSecret));case 3:_await$NativeStripeSd4=_context4.sent;setupIntent=_await$NativeStripeSd4.setupIntent;error=_await$NativeStripeSd4.error;if(!error){_context4.next=8;break;}return _context4.abrupt("return",{error:error});case 8:return _context4.abrupt("return",{setupIntent:setupIntent});case 11:_context4.prev=11;_context4.t0=_context4["catch"](0);return _context4.abrupt("return",{error:_context4.t0});case 14:case"end":return _context4.stop();}}},null,null,[[0,11]],Promise);};exports.retrieveSetupIntent=retrieveSetupIntent;var confirmPayment=function _callee5(paymentIntentClientSecret,data){var options,_await$NativeStripeSd5,paymentIntent,error,_args5=arguments;return _regenerator.default.async(function _callee5$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:options=_args5.length>2&&_args5[2]!==undefined?_args5[2]:{};_context5.prev=1;_context5.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.confirmPayment(paymentIntentClientSecret,data,options));case 4:_await$NativeStripeSd5=_context5.sent;paymentIntent=_await$NativeStripeSd5.paymentIntent;error=_await$NativeStripeSd5.error;if(!error){_context5.next=9;break;}return _context5.abrupt("return",{error:error});case 9:return _context5.abrupt("return",{paymentIntent:paymentIntent});case 12:_context5.prev=12;_context5.t0=_context5["catch"](1);return _context5.abrupt("return",{error:_context5.t0});case 15:case"end":return _context5.stop();}}},null,null,[[1,12]],Promise);};exports.confirmPayment=confirmPayment;var isApplePaySupported=function _callee6(){return _regenerator.default.async(function _callee6$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:_context6.t0=_helpers.isiOS;if(!_context6.t0){_context6.next=5;break;}_context6.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 4:_context6.t0=_context6.sent;case 5:return _context6.abrupt("return",_context6.t0);case 6:case"end":return _context6.stop();}}},null,null,null,Promise);};exports.isApplePaySupported=isApplePaySupported;var presentApplePay=function _callee7(params){var _await$NativeStripeSd6,paymentMethod,error;return _regenerator.default.async(function _callee7$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:_context7.next=2;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 2:if(_context7.sent){_context7.next=4;break;}return _context7.abrupt("return",{error:(0,_helpers.createError)({code:_types.ApplePayError.Canceled,message:APPLE_PAY_NOT_SUPPORTED_MESSAGE})});case 4:_context7.prev=4;_context7.next=7;return _regenerator.default.awrap(_NativeStripeSdk.default.presentApplePay(params));case 7:_await$NativeStripeSd6=_context7.sent;paymentMethod=_await$NativeStripeSd6.paymentMethod;error=_await$NativeStripeSd6.error;if(!error){_context7.next=12;break;}return _context7.abrupt("return",{error:error});case 12:return _context7.abrupt("return",{paymentMethod:paymentMethod});case 15:_context7.prev=15;_context7.t0=_context7["catch"](4);return _context7.abrupt("return",{error:_context7.t0});case 18:case"end":return _context7.stop();}}},null,null,[[4,15]],Promise);};exports.presentApplePay=presentApplePay;var updateApplePaySummaryItems=function _callee8(summaryItems){var errorAddressFields,_args8=arguments;return _regenerator.default.async(function _callee8$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:errorAddressFields=_args8.length>1&&_args8[1]!==undefined?_args8[1]:[];_context8.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 3:if(_context8.sent){_context8.next=5;break;}return _context8.abrupt("return",{error:(0,_helpers.createError)({code:_types.ApplePayError.Canceled,message:APPLE_PAY_NOT_SUPPORTED_MESSAGE})});case 5:_context8.prev=5;_context8.next=8;return _regenerator.default.awrap(_NativeStripeSdk.default.updateApplePaySummaryItems(summaryItems,errorAddressFields));case 8:return _context8.abrupt("return",{});case 11:_context8.prev=11;_context8.t0=_context8["catch"](5);return _context8.abrupt("return",{error:(0,_helpers.createError)(_context8.t0)});case 14:case"end":return _context8.stop();}}},null,null,[[5,11]],Promise);};exports.updateApplePaySummaryItems=updateApplePaySummaryItems;var confirmApplePayPayment=function _callee9(clientSecret){return _regenerator.default.async(function _callee9$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:_context9.next=2;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 2:if(_context9.sent){_context9.next=4;break;}return _context9.abrupt("return",{error:(0,_helpers.createError)({code:_types.ApplePayError.Canceled,message:APPLE_PAY_NOT_SUPPORTED_MESSAGE})});case 4:_context9.prev=4;_context9.next=7;return _regenerator.default.awrap(_NativeStripeSdk.default.confirmApplePayPayment(clientSecret));case 7:return _context9.abrupt("return",{});case 10:_context9.prev=10;_context9.t0=_context9["catch"](4);return _context9.abrupt("return",{error:(0,_helpers.createError)(_context9.t0)});case 13:case"end":return _context9.stop();}}},null,null,[[4,10]],Promise);};exports.confirmApplePayPayment=confirmApplePayPayment;var handleCardAction=function _callee10(paymentIntentClientSecret){var _await$NativeStripeSd7,paymentIntent,error;return _regenerator.default.async(function _callee10$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:_context10.prev=0;_context10.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.handleCardAction(paymentIntentClientSecret));case 3:_await$NativeStripeSd7=_context10.sent;paymentIntent=_await$NativeStripeSd7.paymentIntent;error=_await$NativeStripeSd7.error;if(!error){_context10.next=8;break;}return _context10.abrupt("return",{error:error});case 8:return _context10.abrupt("return",{paymentIntent:paymentIntent});case 11:_context10.prev=11;_context10.t0=_context10["catch"](0);return _context10.abrupt("return",{error:(0,_helpers.createError)(_context10.t0)});case 14:case"end":return _context10.stop();}}},null,null,[[0,11]],Promise);};exports.handleCardAction=handleCardAction;var confirmSetupIntent=function _callee11(paymentIntentClientSecret,data){var options,_await$NativeStripeSd8,setupIntent,error,_args11=arguments;return _regenerator.default.async(function _callee11$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:options=_args11.length>2&&_args11[2]!==undefined?_args11[2]:{};_context11.prev=1;_context11.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.confirmSetupIntent(paymentIntentClientSecret,data,options));case 4:_await$NativeStripeSd8=_context11.sent;setupIntent=_await$NativeStripeSd8.setupIntent;error=_await$NativeStripeSd8.error;if(!error){_context11.next=9;break;}return _context11.abrupt("return",{error:error});case 9:return _context11.abrupt("return",{setupIntent:setupIntent});case 12:_context11.prev=12;_context11.t0=_context11["catch"](1);return _context11.abrupt("return",{error:(0,_helpers.createError)(_context11.t0)});case 15:case"end":return _context11.stop();}}},null,null,[[1,12]],Promise);};exports.confirmSetupIntent=confirmSetupIntent;var createTokenForCVCUpdate=function _callee12(cvc){var _await$NativeStripeSd9,tokenId,error;return _regenerator.default.async(function _callee12$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:_context12.prev=0;_context12.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.createTokenForCVCUpdate(cvc));case 3:_await$NativeStripeSd9=_context12.sent;tokenId=_await$NativeStripeSd9.tokenId;error=_await$NativeStripeSd9.error;if(!error){_context12.next=8;break;}return _context12.abrupt("return",{error:error});case 8:return _context12.abrupt("return",{tokenId:tokenId});case 11:_context12.prev=11;_context12.t0=_context12["catch"](0);return _context12.abrupt("return",{error:(0,_helpers.createError)(_context12.t0)});case 14:case"end":return _context12.stop();}}},null,null,[[0,11]],Promise);};exports.createTokenForCVCUpdate=createTokenForCVCUpdate;var handleURLCallback=function _callee13(url){var stripeHandled;return _regenerator.default.async(function _callee13$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:_context13.next=2;return _regenerator.default.awrap(_NativeStripeSdk.default.handleURLCallback(url));case 2:stripeHandled=_context13.sent;return _context13.abrupt("return",stripeHandled);case 4:case"end":return _context13.stop();}}},null,null,null,Promise);};exports.handleURLCallback=handleURLCallback;var initPaymentSheet=function _callee14(params){var _await$NativeStripeSd10,paymentOption,error;return _regenerator.default.async(function _callee14$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:_context14.prev=0;_context14.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.initPaymentSheet(params));case 3:_await$NativeStripeSd10=_context14.sent;paymentOption=_await$NativeStripeSd10.paymentOption;error=_await$NativeStripeSd10.error;if(!error){_context14.next=8;break;}return _context14.abrupt("return",{error:error});case 8:return _context14.abrupt("return",{paymentOption:paymentOption});case 11:_context14.prev=11;_context14.t0=_context14["catch"](0);return _context14.abrupt("return",{error:(0,_helpers.createError)(_context14.t0)});case 14:case"end":return _context14.stop();}}},null,null,[[0,11]],Promise);};exports.initPaymentSheet=initPaymentSheet;var presentPaymentSheet=function _callee15(){var _await$NativeStripeSd11,paymentOption,error;return _regenerator.default.async(function _callee15$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:_context15.prev=0;_context15.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.presentPaymentSheet());case 3:_await$NativeStripeSd11=_context15.sent;paymentOption=_await$NativeStripeSd11.paymentOption;error=_await$NativeStripeSd11.error;if(!error){_context15.next=8;break;}return _context15.abrupt("return",{error:error});case 8:return _context15.abrupt("return",{paymentOption:paymentOption});case 11:_context15.prev=11;_context15.t0=_context15["catch"](0);return _context15.abrupt("return",{error:(0,_helpers.createError)(_context15.t0)});case 14:case"end":return _context15.stop();}}},null,null,[[0,11]],Promise);};exports.presentPaymentSheet=presentPaymentSheet;var confirmPaymentSheetPayment=function _callee16(){var _await$NativeStripeSd12,error;return _regenerator.default.async(function _callee16$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:_context16.prev=0;_context16.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.confirmPaymentSheetPayment());case 3:_await$NativeStripeSd12=_context16.sent;error=_await$NativeStripeSd12.error;if(!error){_context16.next=7;break;}return _context16.abrupt("return",{error:error});case 7:return _context16.abrupt("return",{});case 10:_context16.prev=10;_context16.t0=_context16["catch"](0);return _context16.abrupt("return",{error:(0,_helpers.createError)(_context16.t0)});case 13:case"end":return _context16.stop();}}},null,null,[[0,10]],Promise);};exports.confirmPaymentSheetPayment=confirmPaymentSheetPayment;var isGooglePaySupported=function _callee17(params){return _regenerator.default.async(function _callee17$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:_context17.t0=_helpers.isAndroid;if(!_context17.t0){_context17.next=5;break;}_context17.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.isGooglePaySupported(params!=null?params:{}));case 4:_context17.t0=_context17.sent;case 5:return _context17.abrupt("return",_context17.t0);case 6:case"end":return _context17.stop();}}},null,null,null,Promise);};exports.isGooglePaySupported=isGooglePaySupported;var initGooglePay=function _callee18(params){var _await$NativeStripeSd13,error;return _regenerator.default.async(function _callee18$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:_context18.prev=0;_context18.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.initGooglePay(params));case 3:_await$NativeStripeSd13=_context18.sent;error=_await$NativeStripeSd13.error;if(!error){_context18.next=7;break;}return _context18.abrupt("return",{error:error});case 7:return _context18.abrupt("return",{});case 10:_context18.prev=10;_context18.t0=_context18["catch"](0);return _context18.abrupt("return",{error:(0,_helpers.createError)(_context18.t0)});case 13:case"end":return _context18.stop();}}},null,null,[[0,10]],Promise);};exports.initGooglePay=initGooglePay;var presentGooglePay=function _callee19(params){var _await$NativeStripeSd14,error;return _regenerator.default.async(function _callee19$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:_context19.prev=0;_context19.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.presentGooglePay(params));case 3:_await$NativeStripeSd14=_context19.sent;error=_await$NativeStripeSd14.error;if(!error){_context19.next=7;break;}return _context19.abrupt("return",{error:error});case 7:return _context19.abrupt("return",{});case 10:_context19.prev=10;_context19.t0=_context19["catch"](0);return _context19.abrupt("return",{error:(0,_helpers.createError)(_context19.t0)});case 13:case"end":return _context19.stop();}}},null,null,[[0,10]],Promise);};exports.presentGooglePay=presentGooglePay;var createGooglePayPaymentMethod=function _callee20(params){var _await$NativeStripeSd15,error,paymentMethod;return _regenerator.default.async(function _callee20$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:_context20.prev=0;_context20.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.createGooglePayPaymentMethod(params));case 3:_await$NativeStripeSd15=_context20.sent;error=_await$NativeStripeSd15.error;paymentMethod=_await$NativeStripeSd15.paymentMethod;if(!error){_context20.next=8;break;}return _context20.abrupt("return",{error:error});case 8:return _context20.abrupt("return",{paymentMethod:paymentMethod});case 11:_context20.prev=11;_context20.t0=_context20["catch"](0);return _context20.abrupt("return",{error:(0,_helpers.createError)(_context20.t0)});case 14:case"end":return _context20.stop();}}},null,null,[[0,11]],Promise);};exports.createGooglePayPaymentMethod=createGooglePayPaymentMethod;var openApplePaySetup=function _callee21(){var _await$NativeStripeSd16,error;return _regenerator.default.async(function _callee21$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:_context21.prev=0;_context21.next=3;return _regenerator.default.awrap(_NativeStripeSdk.default.openApplePaySetup());case 3:_await$NativeStripeSd16=_context21.sent;error=_await$NativeStripeSd16.error;if(!error){_context21.next=7;break;}return _context21.abrupt("return",{error:error});case 7:return _context21.abrupt("return",{});case 10:_context21.prev=10;_context21.t0=_context21["catch"](0);return _context21.abrupt("return",{error:(0,_helpers.createError)(_context21.t0)});case 13:case"end":return _context21.stop();}}},null,null,[[0,10]],Promise);};exports.openApplePaySetup=openApplePaySetup;
|
|
2
2
|
//# sourceMappingURL=functions.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["functions.ts"],"names":["APPLE_PAY_NOT_SUPPORTED_MESSAGE","createPaymentMethod","data","options","NativeStripeSdk","paymentMethod","error","createToken","params","token","retrievePaymentIntent","clientSecret","paymentIntent","retrieveSetupIntent","setupIntent","confirmPayment","paymentIntentClientSecret","isApplePaySupported","isiOS","presentApplePay","code","ApplePayError","Canceled","message","updateApplePaySummaryItems","summaryItems","errorAddressFields","confirmApplePayPayment","handleCardAction","confirmSetupIntent","createTokenForCVCUpdate","cvc","tokenId","handleURLCallback","url","stripeHandled","initPaymentSheet","paymentOption","presentPaymentSheet","confirmPaymentSheetPayment","initGooglePay","presentGooglePay","createGooglePayPaymentMethod","openApplePaySetup"],"mappings":"6wBAAA,kCACA,0EACA,8BA2BA,GAAMA,CAAAA,+BAA+B,CACnC,2CADF,CAGO,GAAMC,CAAAA,mBAAmB,CAAG,iBACjCC,IADiC,0LAEjCC,OAFiC,+CAEY,EAFZ,mEAKQC,yBAAgBH,mBAAhB,CACrCC,IADqC,CAErCC,OAFqC,CALR,6CAKvBE,aALuB,uBAKvBA,aALuB,CAKRC,KALQ,uBAKRA,KALQ,KAS3BA,KAT2B,yDAUtB,CACLA,KAAK,CAALA,KADK,CAVsB,yCAcxB,CACLD,aAAa,CAAEA,aADV,CAdwB,4FAkBxB,CACLC,KAAK,YADA,CAlBwB,4EAA5B,C,gDAwBA,GAAMC,CAAAA,WAAW,CAAG,kBACzBC,MADyB,mOAIQJ,yBAAgBG,WAAhB,CAA4BC,MAA5B,CAJR,+CAIfC,KAJe,wBAIfA,KAJe,CAIRH,KAJQ,wBAIRA,KAJQ,KAMnBA,KANmB,2DAOd,CACLA,KAAK,CAALA,KADK,CAPc,0CAWhB,C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AIzBD,aAJyB,yBAIzBA,aAJyB,KAMpCC,KANoC,6DAO/B,CACLA,KAAK,CAALA,KADK,CAP+B,2CAWjC,CACLD,aAAa,CAAEA,aADV,CAXiC,oGAejC,CACLC,KAAK,CAAE,uCADF,CAfiC,8EAArC,C,kEAqBA,GAAMqC,CAAAA,iBAAiB,CAAG,uPAELvC,yBAAgBuC,iBAAhB,EAFK,iDAErBrC,KAFqB,yBAErBA,KAFqB,KAGzBA,KAHyB,6DAIpB,CACLA,KAAK,CAALA,KADK,CAJoB,2CAQtB,EARsB,oGAUtB,CACLA,KAAK,CAAE,uCADF,CAVsB,8EAA1B,C","sourcesContent":["import { createError, isiOS } from './helpers';\nimport NativeStripeSdk from './NativeStripeSdk';\nimport {\n ApplePay,\n ApplePayError,\n ApplePayResult,\n ConfirmPaymentResult,\n ConfirmPaymentSheetPaymentResult,\n ConfirmSetupIntent,\n ConfirmSetupIntentResult,\n CreatePaymentMethodResult,\n CreateTokenForCVCUpdateResult,\n CreateTokenResult,\n GooglePayInitResult,\n HandleCardActionResult,\n InitPaymentSheetResult,\n PaymentMethodCreateParams,\n PaymentSheet,\n PayWithGooglePayResult,\n PresentPaymentSheetResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n StripeError,\n GooglePay,\n CreateGooglePayPaymentMethodResult,\n OpenApplePaySetupResult,\n CreateTokenParams,\n} from './types';\n\nconst APPLE_PAY_NOT_SUPPORTED_MESSAGE =\n 'Apple pay is not supported on this device';\n\nexport const createPaymentMethod = async (\n data: PaymentMethodCreateParams.Params,\n options: PaymentMethodCreateParams.Options = {}\n): Promise<CreatePaymentMethodResult> => {\n try {\n const { paymentMethod, error } = await NativeStripeSdk.createPaymentMethod(\n data,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentMethod: paymentMethod!,\n };\n } catch (error) {\n return {\n error,\n };\n }\n};\n\nexport const createToken = async (\n params: CreateTokenParams\n): Promise<CreateTokenResult> => {\n try {\n const { token, error } = await NativeStripeSdk.createToken(params);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n token: token!,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const retrievePaymentIntent = async (\n clientSecret: string\n): Promise<RetrievePaymentIntentResult> => {\n try {\n const { paymentIntent, error } =\n await NativeStripeSdk.retrievePaymentIntent(clientSecret);\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error) {\n return {\n error,\n };\n }\n};\n\nexport const retrieveSetupIntent = async (\n clientSecret: string\n): Promise<RetrieveSetupIntentResult> => {\n try {\n const { setupIntent, error } = await NativeStripeSdk.retrieveSetupIntent(\n clientSecret\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error) {\n return {\n error,\n };\n }\n};\n\nexport const confirmPayment = async (\n paymentIntentClientSecret: string,\n data: PaymentMethodCreateParams.Params,\n options: PaymentMethodCreateParams.Options = {}\n): Promise<ConfirmPaymentResult> => {\n try {\n const { paymentIntent, error } = await NativeStripeSdk.confirmPayment(\n paymentIntentClientSecret,\n data,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error) {\n return {\n error,\n };\n }\n};\n\nexport const isApplePaySupported = async (): Promise<boolean> => {\n return isiOS && (await NativeStripeSdk.isApplePaySupported());\n};\n\nexport const presentApplePay = async (\n params: ApplePay.PresentParams\n): Promise<ApplePayResult> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: createError({\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n }),\n };\n }\n\n try {\n const { paymentMethod, error } = await NativeStripeSdk.presentApplePay(\n params\n );\n if (error) {\n return {\n error,\n };\n }\n return { paymentMethod: paymentMethod! };\n } catch (error) {\n return {\n error,\n };\n }\n};\n\nexport const updateApplePaySummaryItems = async (\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }> = []\n): Promise<{ error?: StripeError<ApplePayError> }> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: createError({\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n }),\n };\n }\n\n try {\n await NativeStripeSdk.updateApplePaySummaryItems(\n summaryItems,\n errorAddressFields\n );\n\n return {};\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const confirmApplePayPayment = async (\n clientSecret: string\n): Promise<{ error?: StripeError<ApplePayError> }> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: createError({\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n }),\n };\n }\n try {\n await NativeStripeSdk.confirmApplePayPayment(clientSecret);\n return {};\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const handleCardAction = async (\n paymentIntentClientSecret: string\n): Promise<HandleCardActionResult> => {\n try {\n const { paymentIntent, error } = await NativeStripeSdk.handleCardAction(\n paymentIntentClientSecret\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const confirmSetupIntent = async (\n paymentIntentClientSecret: string,\n data: ConfirmSetupIntent.Params,\n options: ConfirmSetupIntent.Options = {}\n): Promise<ConfirmSetupIntentResult> => {\n try {\n const { setupIntent, error } = await NativeStripeSdk.confirmSetupIntent(\n paymentIntentClientSecret,\n data,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const createTokenForCVCUpdate = async (\n cvc: string\n): Promise<CreateTokenForCVCUpdateResult> => {\n try {\n const { tokenId, error } = await NativeStripeSdk.createTokenForCVCUpdate(\n cvc\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n tokenId: tokenId!,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const handleURLCallback = async (url: string): Promise<boolean> => {\n const stripeHandled = await NativeStripeSdk.handleURLCallback(url);\n return stripeHandled;\n};\n\nexport const initPaymentSheet = async (\n params: PaymentSheet.SetupParams\n): Promise<InitPaymentSheetResult> => {\n try {\n const { paymentOption, error } = await NativeStripeSdk.initPaymentSheet(\n params\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentOption,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const presentPaymentSheet =\n async (): Promise<PresentPaymentSheetResult> => {\n try {\n const { paymentOption, error } =\n await NativeStripeSdk.presentPaymentSheet();\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentOption: paymentOption,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n };\n\nexport const confirmPaymentSheetPayment =\n async (): Promise<ConfirmPaymentSheetPaymentResult> => {\n try {\n const { error } = await NativeStripeSdk.confirmPaymentSheetPayment();\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n };\n\nexport const initGooglePay = async (\n params: GooglePay.InitParams\n): Promise<GooglePayInitResult> => {\n try {\n const { error } = await NativeStripeSdk.initGooglePay(params);\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const presentGooglePay = async (\n params: GooglePay.SetupIntentParams\n): Promise<PayWithGooglePayResult> => {\n try {\n const { error } = await NativeStripeSdk.presentGooglePay(params);\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const createGooglePayPaymentMethod = async (\n params: GooglePay.CreatePaymentMethodParams\n): Promise<CreateGooglePayPaymentMethodResult> => {\n try {\n const { error, paymentMethod } =\n await NativeStripeSdk.createGooglePayPaymentMethod(params);\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentMethod: paymentMethod!,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const openApplePaySetup = async (): Promise<OpenApplePaySetupResult> => {\n try {\n const { error } = await NativeStripeSdk.openApplePaySetup();\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n"]}
|
|
1
|
+
{"version":3,"sources":["functions.ts"],"names":["APPLE_PAY_NOT_SUPPORTED_MESSAGE","createPaymentMethod","data","options","NativeStripeSdk","paymentMethod","error","createToken","params","type","country","toLowerCase","routingNumber","MissingRoutingNumber","token","retrievePaymentIntent","clientSecret","paymentIntent","retrieveSetupIntent","setupIntent","confirmPayment","paymentIntentClientSecret","isApplePaySupported","isiOS","presentApplePay","code","ApplePayError","Canceled","message","updateApplePaySummaryItems","summaryItems","errorAddressFields","confirmApplePayPayment","handleCardAction","confirmSetupIntent","createTokenForCVCUpdate","cvc","tokenId","handleURLCallback","url","stripeHandled","initPaymentSheet","paymentOption","presentPaymentSheet","confirmPaymentSheetPayment","isGooglePaySupported","isAndroid","initGooglePay","presentGooglePay","createGooglePayPaymentMethod","openApplePaySetup"],"mappings":"0yBAAA,kCACA,sCACA,0EACA,8BA2BA,GAAMA,CAAAA,+BAA+B,CACnC,2CADF,CAGO,GAAMC,CAAAA,mBAAmB,CAAG,iBACjCC,IADiC,0LAEjCC,OAFiC,+CAEY,EAFZ,mEAKQC,yBAAgBH,mBAAhB,CACrCC,IADqC,CAErCC,OAFqC,CALR,6CAKvBE,aALuB,uBAKvBA,aALuB,CAKRC,KALQ,uBAKRA,KALQ,KAS3BA,KAT2B,yDAUtB,CACLA,KAAK,CAALA,KADK,CAVsB,yCAcxB,CACLD,aAAa,CAAEA,aADV,CAdwB,4FAkBxB,CACLC,KAAK,YADA,CAlBwB,4EAA5B,C,gDAwBA,GAAMC,CAAAA,WAAW,CAAG,kBACzBC,MADyB,wLAIvBA,MAAM,CAACC,IAAP,GAAgB,aAAhB,EACA,kBAAAD,MAAM,CAACE,OAAP,+BAAgBC,W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B,CACLA,KAAK,CAAE,uCADF,CAZkB,8EAAtB,C,oCAkBA,GAAM0C,CAAAA,gBAAgB,CAAG,mBAC9BxC,MAD8B,oOAIJJ,yBAAgB4C,gBAAhB,CAAiCxC,MAAjC,CAJI,iDAIpBF,KAJoB,yBAIpBA,KAJoB,KAKxBA,KALwB,6DAMnB,CACLA,KAAK,CAALA,KADK,CANmB,2CAUrB,EAVqB,oGAYrB,CACLA,KAAK,CAAE,uCADF,CAZqB,8EAAzB,C,0CAkBA,GAAM2C,CAAAA,4BAA4B,CAAG,mBAC1CzC,MAD0C,kPAKhCJ,yBAAgB6C,4BAAhB,CAA6CzC,MAA7C,CALgC,iDAIhCF,KAJgC,yBAIhCA,KAJgC,CAIzBD,aAJyB,yBAIzBA,aAJyB,KAMpCC,KANoC,6DAO/B,CACLA,KAAK,CAALA,KADK,CAP+B,2CAWjC,CACLD,aAAa,CAAEA,aADV,CAXiC,oGAejC,CACLC,KAAK,CAAE,uCADF,CAfiC,8EAArC,C,kEAqBA,GAAM4C,CAAAA,iBAAiB,CAAG,uPAEL9C,yBAAgB8C,iBAAhB,EAFK,iDAErB5C,KAFqB,yBAErBA,KAFqB,KAGzBA,KAHyB,6DAIpB,CACLA,KAAK,CAALA,KADK,CAJoB,2CAQtB,EARsB,oGAUtB,CACLA,KAAK,CAAE,uCADF,CAVsB,8EAA1B,C","sourcesContent":["import { createError, isAndroid, isiOS } from './helpers';\nimport { MissingRoutingNumber } from './types/Errors';\nimport NativeStripeSdk from './NativeStripeSdk';\nimport {\n ApplePay,\n ApplePayError,\n ApplePayResult,\n ConfirmPaymentResult,\n ConfirmPaymentSheetPaymentResult,\n ConfirmSetupIntent,\n ConfirmSetupIntentResult,\n CreatePaymentMethodResult,\n CreateTokenForCVCUpdateResult,\n CreateTokenResult,\n GooglePayInitResult,\n HandleCardActionResult,\n InitPaymentSheetResult,\n PaymentMethodCreateParams,\n PaymentSheet,\n PayWithGooglePayResult,\n PresentPaymentSheetResult,\n RetrievePaymentIntentResult,\n RetrieveSetupIntentResult,\n StripeError,\n GooglePay,\n CreateGooglePayPaymentMethodResult,\n OpenApplePaySetupResult,\n CreateTokenParams,\n} from './types';\n\nconst APPLE_PAY_NOT_SUPPORTED_MESSAGE =\n 'Apple pay is not supported on this device';\n\nexport const createPaymentMethod = async (\n data: PaymentMethodCreateParams.Params,\n options: PaymentMethodCreateParams.Options = {}\n): Promise<CreatePaymentMethodResult> => {\n try {\n const { paymentMethod, error } = await NativeStripeSdk.createPaymentMethod(\n data,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentMethod: paymentMethod!,\n };\n } catch (error) {\n return {\n error,\n };\n }\n};\n\nexport const createToken = async (\n params: CreateTokenParams\n): Promise<CreateTokenResult> => {\n if (\n params.type === 'BankAccount' &&\n params.country?.toLowerCase() === 'us' &&\n !params.routingNumber\n ) {\n return {\n error: MissingRoutingNumber,\n };\n }\n\n try {\n const { token, error } = await NativeStripeSdk.createToken(params);\n\n if (error) {\n return {\n error,\n };\n }\n return {\n token: token!,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const retrievePaymentIntent = async (\n clientSecret: string\n): Promise<RetrievePaymentIntentResult> => {\n try {\n const { paymentIntent, error } =\n await NativeStripeSdk.retrievePaymentIntent(clientSecret);\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error) {\n return {\n error,\n };\n }\n};\n\nexport const retrieveSetupIntent = async (\n clientSecret: string\n): Promise<RetrieveSetupIntentResult> => {\n try {\n const { setupIntent, error } = await NativeStripeSdk.retrieveSetupIntent(\n clientSecret\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error) {\n return {\n error,\n };\n }\n};\n\nexport const confirmPayment = async (\n paymentIntentClientSecret: string,\n data: PaymentMethodCreateParams.Params,\n options: PaymentMethodCreateParams.Options = {}\n): Promise<ConfirmPaymentResult> => {\n try {\n const { paymentIntent, error } = await NativeStripeSdk.confirmPayment(\n paymentIntentClientSecret,\n data,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error) {\n return {\n error,\n };\n }\n};\n\nexport const isApplePaySupported = async (): Promise<boolean> => {\n return isiOS && (await NativeStripeSdk.isApplePaySupported());\n};\n\nexport const presentApplePay = async (\n params: ApplePay.PresentParams\n): Promise<ApplePayResult> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: createError({\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n }),\n };\n }\n\n try {\n const { paymentMethod, error } = await NativeStripeSdk.presentApplePay(\n params\n );\n if (error) {\n return {\n error,\n };\n }\n return { paymentMethod: paymentMethod! };\n } catch (error) {\n return {\n error,\n };\n }\n};\n\nexport const updateApplePaySummaryItems = async (\n summaryItems: ApplePay.CartSummaryItem[],\n errorAddressFields: Array<{\n field: ApplePay.AddressFields;\n message?: string;\n }> = []\n): Promise<{ error?: StripeError<ApplePayError> }> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: createError({\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n }),\n };\n }\n\n try {\n await NativeStripeSdk.updateApplePaySummaryItems(\n summaryItems,\n errorAddressFields\n );\n\n return {};\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const confirmApplePayPayment = async (\n clientSecret: string\n): Promise<{ error?: StripeError<ApplePayError> }> => {\n if (!(await NativeStripeSdk.isApplePaySupported())) {\n return {\n error: createError({\n code: ApplePayError.Canceled,\n message: APPLE_PAY_NOT_SUPPORTED_MESSAGE,\n }),\n };\n }\n try {\n await NativeStripeSdk.confirmApplePayPayment(clientSecret);\n return {};\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const handleCardAction = async (\n paymentIntentClientSecret: string\n): Promise<HandleCardActionResult> => {\n try {\n const { paymentIntent, error } = await NativeStripeSdk.handleCardAction(\n paymentIntentClientSecret\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentIntent: paymentIntent!,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const confirmSetupIntent = async (\n paymentIntentClientSecret: string,\n data: ConfirmSetupIntent.Params,\n options: ConfirmSetupIntent.Options = {}\n): Promise<ConfirmSetupIntentResult> => {\n try {\n const { setupIntent, error } = await NativeStripeSdk.confirmSetupIntent(\n paymentIntentClientSecret,\n data,\n options\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n setupIntent: setupIntent!,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const createTokenForCVCUpdate = async (\n cvc: string\n): Promise<CreateTokenForCVCUpdateResult> => {\n try {\n const { tokenId, error } = await NativeStripeSdk.createTokenForCVCUpdate(\n cvc\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n tokenId: tokenId!,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const handleURLCallback = async (url: string): Promise<boolean> => {\n const stripeHandled = await NativeStripeSdk.handleURLCallback(url);\n return stripeHandled;\n};\n\nexport const initPaymentSheet = async (\n params: PaymentSheet.SetupParams\n): Promise<InitPaymentSheetResult> => {\n try {\n const { paymentOption, error } = await NativeStripeSdk.initPaymentSheet(\n params\n );\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentOption,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const presentPaymentSheet =\n async (): Promise<PresentPaymentSheetResult> => {\n try {\n const { paymentOption, error } =\n await NativeStripeSdk.presentPaymentSheet();\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentOption: paymentOption,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n };\n\nexport const confirmPaymentSheetPayment =\n async (): Promise<ConfirmPaymentSheetPaymentResult> => {\n try {\n const { error } = await NativeStripeSdk.confirmPaymentSheetPayment();\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n };\n\nexport const isGooglePaySupported = async (\n params?: GooglePay.IsGooglePaySupportedParams\n): Promise<boolean> => {\n return (\n isAndroid && (await NativeStripeSdk.isGooglePaySupported(params ?? {}))\n );\n};\n\nexport const initGooglePay = async (\n params: GooglePay.InitParams\n): Promise<GooglePayInitResult> => {\n try {\n const { error } = await NativeStripeSdk.initGooglePay(params);\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const presentGooglePay = async (\n params: GooglePay.SetupIntentParams\n): Promise<PayWithGooglePayResult> => {\n try {\n const { error } = await NativeStripeSdk.presentGooglePay(params);\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const createGooglePayPaymentMethod = async (\n params: GooglePay.CreatePaymentMethodParams\n): Promise<CreateGooglePayPaymentMethodResult> => {\n try {\n const { error, paymentMethod } =\n await NativeStripeSdk.createGooglePayPaymentMethod(params);\n if (error) {\n return {\n error,\n };\n }\n return {\n paymentMethod: paymentMethod!,\n };\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n\nexport const openApplePaySetup = async (): Promise<OpenApplePaySetupResult> => {\n try {\n const { error } = await NativeStripeSdk.openApplePaySetup();\n if (error) {\n return {\n error,\n };\n }\n return {};\n } catch (error) {\n return {\n error: createError(error),\n };\n }\n};\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useGooglePay=useGooglePay;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _useStripe2=require("./useStripe");function useGooglePay(){var _useStripe=(0,_useStripe2.useStripe)(),initGooglePay=_useStripe.initGooglePay,presentGooglePay=_useStripe.presentGooglePay,createGooglePayPaymentMethod=_useStripe.createGooglePayPaymentMethod;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useGooglePay=useGooglePay;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _useStripe2=require("./useStripe");function useGooglePay(){var _useStripe=(0,_useStripe2.useStripe)(),isGooglePaySupported=_useStripe.isGooglePaySupported,initGooglePay=_useStripe.initGooglePay,presentGooglePay=_useStripe.presentGooglePay,createGooglePayPaymentMethod=_useStripe.createGooglePayPaymentMethod;var _useState=(0,_react.useState)(false),_useState2=(0,_slicedToArray2.default)(_useState,2),loading=_useState2[0],setLoading=_useState2[1];var _isGooglePaySupported=(0,_react.useCallback)(function _callee(params){var result;return _regenerator.default.async(function _callee$(_context){while(1){switch(_context.prev=_context.next){case 0:setLoading(true);_context.next=3;return _regenerator.default.awrap(isGooglePaySupported(params));case 3:result=_context.sent;setLoading(false);return _context.abrupt("return",result);case 6:case"end":return _context.stop();}}},null,null,null,Promise);},[isGooglePaySupported]);var _initGooglePay=(0,_react.useCallback)(function _callee2(params){var result;return _regenerator.default.async(function _callee2$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:setLoading(true);_context2.next=3;return _regenerator.default.awrap(initGooglePay(params));case 3:result=_context2.sent;setLoading(false);return _context2.abrupt("return",result);case 6:case"end":return _context2.stop();}}},null,null,null,Promise);},[initGooglePay]);var _presentGooglePay=(0,_react.useCallback)(function _callee3(params){var result;return _regenerator.default.async(function _callee3$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:setLoading(true);_context3.next=3;return _regenerator.default.awrap(presentGooglePay(params));case 3:result=_context3.sent;setLoading(false);return _context3.abrupt("return",result);case 6:case"end":return _context3.stop();}}},null,null,null,Promise);},[presentGooglePay]);var _createGooglePayPaymentMethod=(0,_react.useCallback)(function _callee4(params){var result;return _regenerator.default.async(function _callee4$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:setLoading(true);_context4.next=3;return _regenerator.default.awrap(createGooglePayPaymentMethod(params));case 3:result=_context4.sent;setLoading(false);return _context4.abrupt("return",result);case 6:case"end":return _context4.stop();}}},null,null,null,Promise);},[createGooglePayPaymentMethod]);return{loading:loading,isGooglePaySupported:_isGooglePaySupported,initGooglePay:_initGooglePay,presentGooglePay:_presentGooglePay,createGooglePayPaymentMethod:_createGooglePayPaymentMethod};}
|
|
2
2
|
//# sourceMappingURL=useGooglePay.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["useGooglePay.tsx"],"names":["useGooglePay","initGooglePay","presentGooglePay","createGooglePayPaymentMethod","loading","setLoading","
|
|
1
|
+
{"version":3,"sources":["useGooglePay.tsx"],"names":["useGooglePay","isGooglePaySupported","initGooglePay","presentGooglePay","createGooglePayPaymentMethod","loading","setLoading","_isGooglePaySupported","params","result","_initGooglePay","_presentGooglePay","_createGooglePayPaymentMethod"],"mappings":"yVAAA,4BAEA,uCAKO,QAASA,CAAAA,YAAT,EAAwB,CAC7B,eAKI,2BALJ,CACEC,oBADF,YACEA,oBADF,CAEEC,aAFF,YAEEA,aAFF,CAGEC,gBAHF,YAGEA,gBAHF,CAIEC,4BAJF,YAIEA,4BAJF,CAMA,cAA8B,oBAAS,KAAT,CAA9B,qDAAOC,OAAP,eAAgBC,UAAhB,eAEA,GAAMC,CAAAA,qBAAqB,CAAG,uBAC5B,iBAAOC,MAAP,+HACEF,UAAU,CAAC,IAAD,CAAV,CADF,kDAGuBL,oBAAoB,CAACO,MAAD,CAH3C,SAGQC,MAHR,eAIEH,UAAU,CAAC,KAAD,CAAV,CAJF,gCAMSG,MANT,uEAD4B,CAS5B,CAACR,oBAAD,CAT4B,CAA9B,CAYA,GAAMS,CAAAA,cAAc,CAAG,uBACrB,kBAAOF,MAAP,mIACEF,UAAU,CAAC,IAAD,CAAV,CADF,mDAGuBJ,aAAa,CAACM,MAAD,CAHpC,SAGQC,MAHR,gBAIEH,UAAU,CAAC,KAAD,CAAV,CAJF,iCAMSG,MANT,wEADqB,CASrB,CAACP,aAAD,CATqB,CAAvB,CAYA,GAAMS,CAAAA,iBAAiB,CAAG,uBACxB,kBAAOH,MAAP,mIACEF,UAAU,CAAC,IAAD,CAAV,CADF,mDAGuBH,gBAAgB,CAACK,MAAD,CAHvC,SAGQC,MAHR,gBAIEH,UAAU,CAAC,KAAD,CAAV,CAJF,iCAMSG,MANT,wEADwB,CASxB,CAACN,gBAAD,CATwB,CAA1B,CAYA,GAAMS,CAAAA,6BAA6B,CAAG,uBACpC,kBAAOJ,MAAP,mIACEF,UAAU,CAAC,IAAD,CAAV,CADF,mDAGuBF,4BAA4B,CAACI,MAAD,CAHnD,SAGQC,MAHR,gBAIEH,UAAU,CAAC,KAAD,CAAV,CAJF,iCAMSG,MANT,wEADoC,CASpC,CAACL,4BAAD,CAToC,CAAtC,CAYA,MAAO,CACLC,OAAO,CAAPA,OADK,CAELJ,oBAAoB,CAAEM,qBAFjB,CAGLL,aAAa,CAAEQ,cAHV,CAILP,gBAAgB,CAAEQ,iBAJb,CAKLP,4BAA4B,CAAEQ,6BALzB,CAAP,CAOD","sourcesContent":["import { useCallback, useState } from 'react';\nimport type { GooglePay } from '../types';\nimport { useStripe } from './useStripe';\n\n/**\n * useGooglePay hook\n */\nexport function useGooglePay() {\n const {\n isGooglePaySupported,\n initGooglePay,\n presentGooglePay,\n createGooglePayPaymentMethod,\n } = useStripe();\n const [loading, setLoading] = useState(false);\n\n const _isGooglePaySupported = useCallback(\n async (params?: GooglePay.IsGooglePaySupportedParams) => {\n setLoading(true);\n\n const result = await isGooglePaySupported(params);\n setLoading(false);\n\n return result;\n },\n [isGooglePaySupported]\n );\n\n const _initGooglePay = useCallback(\n async (params: GooglePay.InitParams) => {\n setLoading(true);\n\n const result = await initGooglePay(params);\n setLoading(false);\n\n return result;\n },\n [initGooglePay]\n );\n\n const _presentGooglePay = useCallback(\n async (params: GooglePay.PresentGooglePayParams) => {\n setLoading(true);\n\n const result = await presentGooglePay(params);\n setLoading(false);\n\n return result;\n },\n [presentGooglePay]\n );\n\n const _createGooglePayPaymentMethod = useCallback(\n async (params: GooglePay.CreatePaymentMethodParams) => {\n setLoading(true);\n\n const result = await createGooglePayPaymentMethod(params);\n setLoading(false);\n\n return result;\n },\n [createGooglePayPaymentMethod]\n );\n\n return {\n loading,\n isGooglePaySupported: _isGooglePaySupported,\n initGooglePay: _initGooglePay,\n presentGooglePay: _presentGooglePay,\n createGooglePayPaymentMethod: _createGooglePayPaymentMethod,\n };\n}\n"]}
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useStripe=useStripe;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _helpers=require("../helpers");var _NativeStripeSdk=_interopRequireDefault(require("../NativeStripeSdk"));var _functions=require("../functions");function useStripe(){var _useState=(0,_react.useState)(null),_useState2=(0,_slicedToArray2.default)(_useState,2),isApplePaySupported=_useState2[0],setApplePaySupported=_useState2[1];(0,_react.useEffect)(function(){function checkApplePaySupport(){var isSupported;return _regenerator.default.async(function checkApplePaySupport$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.t0=_helpers.isiOS;if(!_context.t0){_context.next=5;break;}_context.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 4:_context.t0=_context.sent;case 5:isSupported=_context.t0;setApplePaySupported(isSupported);case 7:case"end":return _context.stop();}}},null,null,null,Promise);}checkApplePaySupport();},[]);var _createPaymentMethod=(0,_react.useCallback)(function _callee(data){var options,_args2=arguments;return _regenerator.default.async(function _callee$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:options=_args2.length>1&&_args2[1]!==undefined?_args2[1]:{};return _context2.abrupt("return",(0,_functions.createPaymentMethod)(data,options));case 2:case"end":return _context2.stop();}}},null,null,null,Promise);},[]);var _createToken=(0,_react.useCallback)(function _callee2(params){return _regenerator.default.async(function _callee2$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:return _context3.abrupt("return",(0,_functions.createToken)(params));case 1:case"end":return _context3.stop();}}},null,null,null,Promise);},[]);var _retrievePaymentIntent=(0,_react.useCallback)(function _callee3(clientSecret){return _regenerator.default.async(function _callee3$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:return _context4.abrupt("return",(0,_functions.retrievePaymentIntent)(clientSecret));case 1:case"end":return _context4.stop();}}},null,null,null,Promise);},[]);var _retrieveSetupIntent=(0,_react.useCallback)(function _callee4(clientSecret){return _regenerator.default.async(function _callee4$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:return _context5.abrupt("return",(0,_functions.retrieveSetupIntent)(clientSecret));case 1:case"end":return _context5.stop();}}},null,null,null,Promise);},[]);var _confirmPayment=(0,_react.useCallback)(function _callee5(paymentIntentClientSecret,data){var options,_args6=arguments;return _regenerator.default.async(function _callee5$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:options=_args6.length>2&&_args6[2]!==undefined?_args6[2]:{};return _context6.abrupt("return",(0,_functions.confirmPayment)(paymentIntentClientSecret,data,options));case 2:case"end":return _context6.stop();}}},null,null,null,Promise);},[]);var _presentApplePay=(0,_react.useCallback)(function _callee6(params){return _regenerator.default.async(function _callee6$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:return _context7.abrupt("return",(0,_functions.presentApplePay)(params));case 1:case"end":return _context7.stop();}}},null,null,null,Promise);},[]);var _updateApplePaySummaryItems=(0,_react.useCallback)(function _callee7(summaryItems){var errorAddressFields,_args8=arguments;return _regenerator.default.async(function _callee7$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:errorAddressFields=_args8.length>1&&_args8[1]!==undefined?_args8[1]:[];return _context8.abrupt("return",(0,_functions.updateApplePaySummaryItems)(summaryItems,errorAddressFields));case 2:case"end":return _context8.stop();}}},null,null,null,Promise);},[]);var _confirmApplePayPayment=(0,_react.useCallback)(function _callee8(clientSecret){return _regenerator.default.async(function _callee8$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:return _context9.abrupt("return",(0,_functions.confirmApplePayPayment)(clientSecret));case 1:case"end":return _context9.stop();}}},null,null,null,Promise);},[]);var _handleCardAction=(0,_react.useCallback)(function _callee9(paymentIntentClientSecret){return _regenerator.default.async(function _callee9$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:return _context10.abrupt("return",(0,_functions.handleCardAction)(paymentIntentClientSecret));case 1:case"end":return _context10.stop();}}},null,null,null,Promise);},[]);var _confirmSetupIntent=(0,_react.useCallback)(function _callee10(paymentIntentClientSecret,data){var options,_args11=arguments;return _regenerator.default.async(function _callee10$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:options=_args11.length>2&&_args11[2]!==undefined?_args11[2]:{};return _context11.abrupt("return",(0,_functions.confirmSetupIntent)(paymentIntentClientSecret,data,options));case 2:case"end":return _context11.stop();}}},null,null,null,Promise);},[]);var _createTokenForCVCUpdate=(0,_react.useCallback)(function _callee11(cvc){return _regenerator.default.async(function _callee11$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:return _context12.abrupt("return",(0,_functions.createTokenForCVCUpdate)(cvc));case 1:case"end":return _context12.stop();}}},null,null,null,Promise);},[]);var _initPaymentSheet=(0,_react.useCallback)(function _callee12(params){return _regenerator.default.async(function _callee12$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:return _context13.abrupt("return",(0,_functions.initPaymentSheet)(params));case 1:case"end":return _context13.stop();}}},null,null,null,Promise);},[]);var _presentPaymentSheet=(0,_react.useCallback)(function _callee13(){return _regenerator.default.async(function _callee13$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:return _context14.abrupt("return",(0,_functions.presentPaymentSheet)());case 1:case"end":return _context14.stop();}}},null,null,null,Promise);},[]);var _confirmPaymentSheetPayment=(0,_react.useCallback)(function _callee14(){return _regenerator.default.async(function _callee14$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:return _context15.abrupt("return",(0,_functions.confirmPaymentSheetPayment)());case 1:case"end":return _context15.stop();}}},null,null,null,Promise);},[]);var _handleURLCallback=(0,_react.useCallback)(function _callee15(url){return _regenerator.default.async(function _callee15$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:return _context16.abrupt("return",(0,_functions.handleURLCallback)(url));case 1:case"end":return _context16.stop();}}},null,null,null,Promise);},[]);var
|
|
1
|
+
var _interopRequireDefault=require("@babel/runtime/helpers/interopRequireDefault");Object.defineProperty(exports,"__esModule",{value:true});exports.useStripe=useStripe;var _regenerator=_interopRequireDefault(require("@babel/runtime/regenerator"));var _slicedToArray2=_interopRequireDefault(require("@babel/runtime/helpers/slicedToArray"));var _react=require("react");var _helpers=require("../helpers");var _NativeStripeSdk=_interopRequireDefault(require("../NativeStripeSdk"));var _functions=require("../functions");function useStripe(){var _useState=(0,_react.useState)(null),_useState2=(0,_slicedToArray2.default)(_useState,2),isApplePaySupported=_useState2[0],setApplePaySupported=_useState2[1];(0,_react.useEffect)(function(){function checkApplePaySupport(){var isSupported;return _regenerator.default.async(function checkApplePaySupport$(_context){while(1){switch(_context.prev=_context.next){case 0:_context.t0=_helpers.isiOS;if(!_context.t0){_context.next=5;break;}_context.next=4;return _regenerator.default.awrap(_NativeStripeSdk.default.isApplePaySupported());case 4:_context.t0=_context.sent;case 5:isSupported=_context.t0;setApplePaySupported(isSupported);case 7:case"end":return _context.stop();}}},null,null,null,Promise);}checkApplePaySupport();},[]);var _createPaymentMethod=(0,_react.useCallback)(function _callee(data){var options,_args2=arguments;return _regenerator.default.async(function _callee$(_context2){while(1){switch(_context2.prev=_context2.next){case 0:options=_args2.length>1&&_args2[1]!==undefined?_args2[1]:{};return _context2.abrupt("return",(0,_functions.createPaymentMethod)(data,options));case 2:case"end":return _context2.stop();}}},null,null,null,Promise);},[]);var _createToken=(0,_react.useCallback)(function _callee2(params){return _regenerator.default.async(function _callee2$(_context3){while(1){switch(_context3.prev=_context3.next){case 0:return _context3.abrupt("return",(0,_functions.createToken)(params));case 1:case"end":return _context3.stop();}}},null,null,null,Promise);},[]);var _retrievePaymentIntent=(0,_react.useCallback)(function _callee3(clientSecret){return _regenerator.default.async(function _callee3$(_context4){while(1){switch(_context4.prev=_context4.next){case 0:return _context4.abrupt("return",(0,_functions.retrievePaymentIntent)(clientSecret));case 1:case"end":return _context4.stop();}}},null,null,null,Promise);},[]);var _retrieveSetupIntent=(0,_react.useCallback)(function _callee4(clientSecret){return _regenerator.default.async(function _callee4$(_context5){while(1){switch(_context5.prev=_context5.next){case 0:return _context5.abrupt("return",(0,_functions.retrieveSetupIntent)(clientSecret));case 1:case"end":return _context5.stop();}}},null,null,null,Promise);},[]);var _confirmPayment=(0,_react.useCallback)(function _callee5(paymentIntentClientSecret,data){var options,_args6=arguments;return _regenerator.default.async(function _callee5$(_context6){while(1){switch(_context6.prev=_context6.next){case 0:options=_args6.length>2&&_args6[2]!==undefined?_args6[2]:{};return _context6.abrupt("return",(0,_functions.confirmPayment)(paymentIntentClientSecret,data,options));case 2:case"end":return _context6.stop();}}},null,null,null,Promise);},[]);var _presentApplePay=(0,_react.useCallback)(function _callee6(params){return _regenerator.default.async(function _callee6$(_context7){while(1){switch(_context7.prev=_context7.next){case 0:return _context7.abrupt("return",(0,_functions.presentApplePay)(params));case 1:case"end":return _context7.stop();}}},null,null,null,Promise);},[]);var _updateApplePaySummaryItems=(0,_react.useCallback)(function _callee7(summaryItems){var errorAddressFields,_args8=arguments;return _regenerator.default.async(function _callee7$(_context8){while(1){switch(_context8.prev=_context8.next){case 0:errorAddressFields=_args8.length>1&&_args8[1]!==undefined?_args8[1]:[];return _context8.abrupt("return",(0,_functions.updateApplePaySummaryItems)(summaryItems,errorAddressFields));case 2:case"end":return _context8.stop();}}},null,null,null,Promise);},[]);var _confirmApplePayPayment=(0,_react.useCallback)(function _callee8(clientSecret){return _regenerator.default.async(function _callee8$(_context9){while(1){switch(_context9.prev=_context9.next){case 0:return _context9.abrupt("return",(0,_functions.confirmApplePayPayment)(clientSecret));case 1:case"end":return _context9.stop();}}},null,null,null,Promise);},[]);var _handleCardAction=(0,_react.useCallback)(function _callee9(paymentIntentClientSecret){return _regenerator.default.async(function _callee9$(_context10){while(1){switch(_context10.prev=_context10.next){case 0:return _context10.abrupt("return",(0,_functions.handleCardAction)(paymentIntentClientSecret));case 1:case"end":return _context10.stop();}}},null,null,null,Promise);},[]);var _confirmSetupIntent=(0,_react.useCallback)(function _callee10(paymentIntentClientSecret,data){var options,_args11=arguments;return _regenerator.default.async(function _callee10$(_context11){while(1){switch(_context11.prev=_context11.next){case 0:options=_args11.length>2&&_args11[2]!==undefined?_args11[2]:{};return _context11.abrupt("return",(0,_functions.confirmSetupIntent)(paymentIntentClientSecret,data,options));case 2:case"end":return _context11.stop();}}},null,null,null,Promise);},[]);var _createTokenForCVCUpdate=(0,_react.useCallback)(function _callee11(cvc){return _regenerator.default.async(function _callee11$(_context12){while(1){switch(_context12.prev=_context12.next){case 0:return _context12.abrupt("return",(0,_functions.createTokenForCVCUpdate)(cvc));case 1:case"end":return _context12.stop();}}},null,null,null,Promise);},[]);var _initPaymentSheet=(0,_react.useCallback)(function _callee12(params){return _regenerator.default.async(function _callee12$(_context13){while(1){switch(_context13.prev=_context13.next){case 0:return _context13.abrupt("return",(0,_functions.initPaymentSheet)(params));case 1:case"end":return _context13.stop();}}},null,null,null,Promise);},[]);var _presentPaymentSheet=(0,_react.useCallback)(function _callee13(){return _regenerator.default.async(function _callee13$(_context14){while(1){switch(_context14.prev=_context14.next){case 0:return _context14.abrupt("return",(0,_functions.presentPaymentSheet)());case 1:case"end":return _context14.stop();}}},null,null,null,Promise);},[]);var _confirmPaymentSheetPayment=(0,_react.useCallback)(function _callee14(){return _regenerator.default.async(function _callee14$(_context15){while(1){switch(_context15.prev=_context15.next){case 0:return _context15.abrupt("return",(0,_functions.confirmPaymentSheetPayment)());case 1:case"end":return _context15.stop();}}},null,null,null,Promise);},[]);var _handleURLCallback=(0,_react.useCallback)(function _callee15(url){return _regenerator.default.async(function _callee15$(_context16){while(1){switch(_context16.prev=_context16.next){case 0:return _context16.abrupt("return",(0,_functions.handleURLCallback)(url));case 1:case"end":return _context16.stop();}}},null,null,null,Promise);},[]);var _isGooglePaySupported=(0,_react.useCallback)(function _callee16(params){return _regenerator.default.async(function _callee16$(_context17){while(1){switch(_context17.prev=_context17.next){case 0:return _context17.abrupt("return",(0,_functions.isGooglePaySupported)(params));case 1:case"end":return _context17.stop();}}},null,null,null,Promise);},[]);var _initGooglePay=(0,_react.useCallback)(function _callee17(params){return _regenerator.default.async(function _callee17$(_context18){while(1){switch(_context18.prev=_context18.next){case 0:return _context18.abrupt("return",(0,_functions.initGooglePay)(params));case 1:case"end":return _context18.stop();}}},null,null,null,Promise);},[]);var _presentGooglePay=(0,_react.useCallback)(function _callee18(params){return _regenerator.default.async(function _callee18$(_context19){while(1){switch(_context19.prev=_context19.next){case 0:return _context19.abrupt("return",(0,_functions.presentGooglePay)(params));case 1:case"end":return _context19.stop();}}},null,null,null,Promise);},[]);var _createGooglePayPaymentMethod=(0,_react.useCallback)(function _callee19(params){return _regenerator.default.async(function _callee19$(_context20){while(1){switch(_context20.prev=_context20.next){case 0:return _context20.abrupt("return",(0,_functions.createGooglePayPaymentMethod)(params));case 1:case"end":return _context20.stop();}}},null,null,null,Promise);},[]);var _openApplePaySetup=(0,_react.useCallback)(function _callee20(){return _regenerator.default.async(function _callee20$(_context21){while(1){switch(_context21.prev=_context21.next){case 0:return _context21.abrupt("return",(0,_functions.openApplePaySetup)());case 1:case"end":return _context21.stop();}}},null,null,null,Promise);},[]);return{retrievePaymentIntent:_retrievePaymentIntent,retrieveSetupIntent:_retrieveSetupIntent,confirmPayment:_confirmPayment,createPaymentMethod:_createPaymentMethod,handleCardAction:_handleCardAction,isApplePaySupported:isApplePaySupported,presentApplePay:_presentApplePay,confirmApplePayPayment:_confirmApplePayPayment,confirmSetupIntent:_confirmSetupIntent,createTokenForCVCUpdate:_createTokenForCVCUpdate,updateApplePaySummaryItems:_updateApplePaySummaryItems,handleURLCallback:_handleURLCallback,confirmPaymentSheetPayment:_confirmPaymentSheetPayment,presentPaymentSheet:_presentPaymentSheet,initPaymentSheet:_initPaymentSheet,createToken:_createToken,isGooglePaySupported:_isGooglePaySupported,initGooglePay:_initGooglePay,presentGooglePay:_presentGooglePay,createGooglePayPaymentMethod:_createGooglePayPaymentMethod,openApplePaySetup:_openApplePaySetup};}
|
|
2
2
|
//# sourceMappingURL=useStripe.js.map
|