@stripe/stripe-react-native 0.23.0 → 0.23.2

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.
Files changed (35) hide show
  1. package/CHANGELOG.md +14 -0
  2. package/android/gradle.properties +1 -1
  3. package/android/src/main/java/com/reactnativestripesdk/FinancialConnectionsSheetFragment.kt +6 -6
  4. package/android/src/main/java/com/reactnativestripesdk/GooglePayLauncherFragment.kt +4 -4
  5. package/android/src/main/java/com/reactnativestripesdk/GooglePayRequestHelper.kt +3 -3
  6. package/android/src/main/java/com/reactnativestripesdk/PaymentLauncherFragment.kt +4 -4
  7. package/android/src/main/java/com/reactnativestripesdk/PaymentSheetAppearance.kt +5 -4
  8. package/android/src/main/java/com/reactnativestripesdk/StripeSdkModule.kt +5 -5
  9. package/android/src/main/java/com/reactnativestripesdk/addresssheet/AddressLauncherFragment.kt +4 -4
  10. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/AddToWalletButtonManager.kt +2 -2
  11. package/android/src/main/java/com/reactnativestripesdk/pushprovisioning/TapAndPayProxy.kt +26 -27
  12. package/android/src/main/java/com/reactnativestripesdk/utils/Extensions.kt +2 -2
  13. package/android/src/main/java/com/reactnativestripesdk/utils/Mappers.kt +71 -71
  14. package/ios/ApplePayViewController.swift +2 -0
  15. package/ios/Mappers.swift +2 -0
  16. package/lib/commonjs/components/AddToWalletButton.js.map +1 -1
  17. package/lib/commonjs/types/PaymentIntent.js.map +1 -1
  18. package/lib/commonjs/types/PaymentMethod.js.map +1 -1
  19. package/lib/commonjs/types/SetupIntent.js.map +1 -1
  20. package/lib/module/components/AddToWalletButton.js.map +1 -1
  21. package/lib/module/types/PaymentIntent.js.map +1 -1
  22. package/lib/module/types/PaymentMethod.js.map +1 -1
  23. package/lib/module/types/SetupIntent.js.map +1 -1
  24. package/lib/typescript/src/components/AddToWalletButton.d.ts +1 -1
  25. package/lib/typescript/src/types/PaymentIntent.d.ts +2 -0
  26. package/lib/typescript/src/types/PaymentMethod.d.ts +1 -0
  27. package/lib/typescript/src/types/SetupIntent.d.ts +2 -0
  28. package/package.json +7 -17
  29. package/src/components/AddToWalletButton.tsx +1 -1
  30. package/src/types/PaymentIntent.ts +2 -0
  31. package/src/types/PaymentMethod.ts +1 -0
  32. package/src/types/SetupIntent.ts +2 -0
  33. package/ios/Tests/AddressSheetUtilsTests.swift +0 -273
  34. package/ios/Tests/ApplePayUtilsTests.swift +0 -213
  35. package/ios/Tests/PushProvisioningTests.swift +0 -52
package/CHANGELOG.md CHANGED
@@ -2,6 +2,20 @@
2
2
 
3
3
  ## Unreleased
4
4
 
5
+ ## 0.23.2 - 2023-02-06
6
+
7
+ ## Fixes
8
+
9
+ - Fixed a bug on Android where `canAddCardToWallet` wouldn't correctly return the `details.token` object. [#1282](https://github.com/stripe/stripe-react-native/pull/1282)
10
+
11
+ ## 0.23.1 - 2023-01-25
12
+
13
+ ## Fixes
14
+
15
+ - Fixed an issue with `confirmPlatformPaySetupIntent` on iOS. [#1266](https://github.com/stripe/stripe-react-native/pull/1266)
16
+ - Fixed types so that Klarna accepts the `shippingDetails` property. [#1272](https://github.com/stripe/stripe-react-native/pull/1272)
17
+ - Both [`PaymentIntent.Result`](https://stripe.dev/stripe-react-native/api-reference/interfaces/PaymentIntent.Result.html) and [`SetupIntent.Result`](https://stripe.dev/stripe-react-native/api-reference/interfaces/SetupIntent.Result.html) types now include a `paymentMethod` field. This replaces the `paymentMethodId` field, which will be removed in a later release. [#1272](https://github.com/stripe/stripe-react-native/pull/1272)
18
+
5
19
  ## 0.23.0 - 2023-01-09
6
20
 
7
21
  ### Breaking changes
@@ -1,2 +1,2 @@
1
1
  StripeSdk_kotlinVersion=1.6.21
2
- StripeSdk_stripeVersion=20.16.+
2
+ StripeSdk_stripeVersion=20.19.+
@@ -5,8 +5,8 @@ import android.view.LayoutInflater
5
5
  import android.view.View
6
6
  import android.view.ViewGroup
7
7
  import android.widget.FrameLayout
8
- import androidx.appcompat.app.AppCompatActivity
9
8
  import androidx.fragment.app.Fragment
9
+ import androidx.fragment.app.FragmentActivity
10
10
  import com.facebook.react.bridge.*
11
11
  import com.reactnativestripesdk.utils.*
12
12
  import com.reactnativestripesdk.utils.createError
@@ -69,7 +69,7 @@ class FinancialConnectionsSheetFragment : Fragment() {
69
69
  }
70
70
  is FinancialConnectionsSheetForTokenResult.Completed -> {
71
71
  promise.resolve(createTokenResult(result))
72
- (context.currentActivity as? AppCompatActivity)?.supportFragmentManager?.beginTransaction()?.remove(this)?.commitAllowingStateLoss()
72
+ (context.currentActivity as? FragmentActivity)?.supportFragmentManager?.beginTransaction()?.remove(this)?.commitAllowingStateLoss()
73
73
  }
74
74
  }
75
75
  }
@@ -92,7 +92,7 @@ class FinancialConnectionsSheetFragment : Fragment() {
92
92
  it.putMap("session", mapFromSession(result.financialConnectionsSession))
93
93
  }
94
94
  )
95
- (context.currentActivity as? AppCompatActivity)?.supportFragmentManager?.beginTransaction()?.remove(this)?.commitAllowingStateLoss()
95
+ (context.currentActivity as? FragmentActivity)?.supportFragmentManager?.beginTransaction()?.remove(this)?.commitAllowingStateLoss()
96
96
  }
97
97
  }
98
98
  }
@@ -107,7 +107,7 @@ class FinancialConnectionsSheetFragment : Fragment() {
107
107
  stripeAccountId = stripeAccountId,
108
108
  )
109
109
 
110
- (context.currentActivity as? AppCompatActivity)?.let {
110
+ (context.currentActivity as? FragmentActivity)?.let {
111
111
  attemptToCleanupPreviousFragment(it)
112
112
  commitFragmentAndStartFlow(it)
113
113
  } ?: run {
@@ -116,13 +116,13 @@ class FinancialConnectionsSheetFragment : Fragment() {
116
116
  }
117
117
  }
118
118
 
119
- private fun attemptToCleanupPreviousFragment(currentActivity: AppCompatActivity) {
119
+ private fun attemptToCleanupPreviousFragment(currentActivity: FragmentActivity) {
120
120
  currentActivity.supportFragmentManager.beginTransaction()
121
121
  .remove(this)
122
122
  .commitAllowingStateLoss()
123
123
  }
124
124
 
125
- private fun commitFragmentAndStartFlow(currentActivity: AppCompatActivity) {
125
+ private fun commitFragmentAndStartFlow(currentActivity: FragmentActivity) {
126
126
  try {
127
127
  currentActivity.supportFragmentManager.beginTransaction()
128
128
  .add(this, TAG)
@@ -5,8 +5,8 @@ import android.view.LayoutInflater
5
5
  import android.view.View
6
6
  import android.view.ViewGroup
7
7
  import android.widget.FrameLayout
8
- import androidx.appcompat.app.AppCompatActivity
9
8
  import androidx.fragment.app.Fragment
9
+ import androidx.fragment.app.FragmentActivity
10
10
  import com.facebook.react.bridge.*
11
11
  import com.reactnativestripesdk.utils.*
12
12
  import com.reactnativestripesdk.utils.createError
@@ -57,7 +57,7 @@ class GooglePayLauncherFragment : Fragment() {
57
57
  allowCreditCards = googlePayParams.getBooleanOr("allowCreditCards", true),
58
58
  )
59
59
 
60
- (context.currentActivity as? AppCompatActivity)?.let {
60
+ (context.currentActivity as? FragmentActivity)?.let {
61
61
  attemptToCleanupPreviousFragment(it)
62
62
  commitFragmentAndStartFlow(it)
63
63
  } ?: run {
@@ -66,13 +66,13 @@ class GooglePayLauncherFragment : Fragment() {
66
66
  }
67
67
  }
68
68
 
69
- private fun attemptToCleanupPreviousFragment(currentActivity: AppCompatActivity) {
69
+ private fun attemptToCleanupPreviousFragment(currentActivity: FragmentActivity) {
70
70
  currentActivity.supportFragmentManager.beginTransaction()
71
71
  .remove(this)
72
72
  .commitAllowingStateLoss()
73
73
  }
74
74
 
75
- private fun commitFragmentAndStartFlow(currentActivity: AppCompatActivity) {
75
+ private fun commitFragmentAndStartFlow(currentActivity: FragmentActivity) {
76
76
  try {
77
77
  currentActivity.supportFragmentManager.beginTransaction()
78
78
  .add(this, TAG)
@@ -2,7 +2,7 @@ package com.reactnativestripesdk
2
2
 
3
3
  import android.app.Activity
4
4
  import android.content.Intent
5
- import androidx.appcompat.app.AppCompatActivity
5
+ import androidx.fragment.app.FragmentActivity
6
6
  import com.facebook.react.bridge.Promise
7
7
  import com.facebook.react.bridge.ReadableMap
8
8
  import com.facebook.react.bridge.WritableNativeMap
@@ -25,7 +25,7 @@ class GooglePayRequestHelper {
25
25
  companion object {
26
26
  internal const val LOAD_PAYMENT_DATA_REQUEST_CODE = 414243
27
27
 
28
- internal fun createPaymentRequest(activity: AppCompatActivity, factory: GooglePayJsonFactory, googlePayParams: ReadableMap): Task<PaymentData> {
28
+ internal fun createPaymentRequest(activity: FragmentActivity, factory: GooglePayJsonFactory, googlePayParams: ReadableMap): Task<PaymentData> {
29
29
  val transactionInfo = buildTransactionInfo(googlePayParams)
30
30
  val merchantInfo = GooglePayJsonFactory.MerchantInfo(googlePayParams.getString("merchantName").orEmpty())
31
31
  val billingAddressParameters = buildBillingAddressParameters(googlePayParams.getMap("billingAddressConfig"))
@@ -90,7 +90,7 @@ class GooglePayRequestHelper {
90
90
  )
91
91
  }
92
92
 
93
- internal fun createPaymentMethod(request: Task<PaymentData>, activity: AppCompatActivity) {
93
+ internal fun createPaymentMethod(request: Task<PaymentData>, activity: FragmentActivity) {
94
94
  AutoResolveHelper.resolveTask(
95
95
  request,
96
96
  activity,
@@ -5,8 +5,8 @@ import android.view.LayoutInflater
5
5
  import android.view.View
6
6
  import android.view.ViewGroup
7
7
  import android.widget.FrameLayout
8
- import androidx.appcompat.app.AppCompatActivity
9
8
  import androidx.fragment.app.Fragment
9
+ import androidx.fragment.app.FragmentActivity
10
10
  import com.facebook.react.bridge.Promise
11
11
  import com.facebook.react.bridge.ReactApplicationContext
12
12
  import com.reactnativestripesdk.utils.*
@@ -107,7 +107,7 @@ class PaymentLauncherFragment(
107
107
  }
108
108
 
109
109
  private fun addFragment(fragment: PaymentLauncherFragment, context: ReactApplicationContext, promise: Promise) {
110
- (context.currentActivity as? AppCompatActivity)?.let {
110
+ (context.currentActivity as? FragmentActivity)?.let {
111
111
  try {
112
112
  it.supportFragmentManager.beginTransaction()
113
113
  .add(fragment, TAG)
@@ -167,7 +167,7 @@ class PaymentLauncherFragment(
167
167
  }
168
168
 
169
169
  private fun retrieveSetupIntent(clientSecret: String, stripeAccountId: String?) {
170
- stripe.retrieveSetupIntent(clientSecret, stripeAccountId, object : ApiResultCallback<SetupIntent> {
170
+ stripe.retrieveSetupIntent(clientSecret, stripeAccountId, expand = listOf("payment_method"), object : ApiResultCallback<SetupIntent> {
171
171
  override fun onError(e: Exception) {
172
172
  promise.resolve(createError(ConfirmSetupIntentErrorType.Failed.toString(), e))
173
173
  removeFragment(context)
@@ -208,7 +208,7 @@ class PaymentLauncherFragment(
208
208
  }
209
209
 
210
210
  private fun retrievePaymentIntent(clientSecret: String, stripeAccountId: String?) {
211
- stripe.retrievePaymentIntent(clientSecret, stripeAccountId, object : ApiResultCallback<PaymentIntent> {
211
+ stripe.retrievePaymentIntent(clientSecret, stripeAccountId, expand = listOf("payment_method"), object : ApiResultCallback<PaymentIntent> {
212
212
  override fun onError(e: Exception) {
213
213
  promise.resolve(createError(ConfirmPaymentErrorType.Failed.toString(), e))
214
214
  removeFragment(context)
@@ -1,12 +1,13 @@
1
1
  package com.reactnativestripesdk
2
2
 
3
+ import android.content.Context
3
4
  import android.graphics.Color
4
5
  import android.os.Bundle
5
6
  import com.facebook.react.bridge.ReactContext
6
7
  import com.reactnativestripesdk.utils.PaymentSheetAppearanceException
7
8
  import com.stripe.android.paymentsheet.PaymentSheet
8
9
 
9
- fun buildPaymentSheetAppearance(userParams: Bundle?, context: ReactContext): PaymentSheet.Appearance {
10
+ fun buildPaymentSheetAppearance(userParams: Bundle?, context: Context): PaymentSheet.Appearance {
10
11
  val colorParams = userParams?.getBundle(PaymentSheetAppearanceKeys.COLORS)
11
12
  val lightColorParams = colorParams?.getBundle(PaymentSheetAppearanceKeys.LIGHT) ?: colorParams
12
13
  val darkColorParams = colorParams?.getBundle(PaymentSheetAppearanceKeys.DARK) ?: colorParams
@@ -20,7 +21,7 @@ fun buildPaymentSheetAppearance(userParams: Bundle?, context: ReactContext): Pay
20
21
  )
21
22
  }
22
23
 
23
- private fun buildTypography(fontParams: Bundle?, context: ReactContext): PaymentSheet.Typography {
24
+ private fun buildTypography(fontParams: Bundle?, context: Context): PaymentSheet.Typography {
24
25
  return PaymentSheet.Typography.default.copy(
25
26
  sizeScaleFactor = getFloatOr(fontParams, PaymentSheetAppearanceKeys.SCALE, PaymentSheet.Typography.default.sizeScaleFactor),
26
27
  fontResId = getFontResId(fontParams, PaymentSheetAppearanceKeys.FAMILY, PaymentSheet.Typography.default.fontResId, context)
@@ -65,7 +66,7 @@ private fun buildShapes(shapeParams: Bundle?): PaymentSheet.Shapes {
65
66
  )
66
67
  }
67
68
 
68
- private fun buildPrimaryButton(params: Bundle?, context: ReactContext): PaymentSheet.PrimaryButton {
69
+ private fun buildPrimaryButton(params: Bundle?, context: Context): PaymentSheet.PrimaryButton {
69
70
  if (params == null) {
70
71
  return PaymentSheet.PrimaryButton()
71
72
  }
@@ -121,7 +122,7 @@ private fun getFloatOrNull(bundle: Bundle?, key: String): Float? {
121
122
  }
122
123
 
123
124
  @Throws(PaymentSheetAppearanceException::class)
124
- private fun getFontResId(bundle: Bundle?, key: String, defaultValue: Int?, context: ReactContext): Int? {
125
+ private fun getFontResId(bundle: Bundle?, key: String, defaultValue: Int?, context: Context): Int? {
125
126
  val fontErrorPrefix = "Encountered an error when setting a custom font:"
126
127
  if (bundle?.containsKey(key) != true) {
127
128
  return defaultValue
@@ -4,7 +4,7 @@ import android.app.Activity
4
4
  import android.content.Intent
5
5
  import android.os.Parcelable
6
6
  import android.util.Log
7
- import androidx.appcompat.app.AppCompatActivity
7
+ import androidx.fragment.app.FragmentActivity
8
8
  import com.facebook.react.bridge.*
9
9
  import com.facebook.react.module.annotations.ReactModule
10
10
  import com.reactnativestripesdk.addresssheet.AddressLauncherFragment
@@ -610,7 +610,7 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
610
610
  when (launcherResult) {
611
611
  GooglePayLauncher.Result.Completed -> {
612
612
  if (isPaymentIntent) {
613
- stripe.retrievePaymentIntent(clientSecret, stripeAccountId, object : ApiResultCallback<PaymentIntent> {
613
+ stripe.retrievePaymentIntent(clientSecret, stripeAccountId, expand = listOf("payment_method"), object : ApiResultCallback<PaymentIntent> {
614
614
  override fun onError(e: Exception) {
615
615
  promise.resolve(createResult("paymentIntent", WritableNativeMap()))
616
616
  }
@@ -619,7 +619,7 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
619
619
  }
620
620
  })
621
621
  } else {
622
- stripe.retrieveSetupIntent(clientSecret, stripeAccountId, object : ApiResultCallback<SetupIntent> {
622
+ stripe.retrieveSetupIntent(clientSecret, stripeAccountId, expand = listOf("payment_method"), object : ApiResultCallback<SetupIntent> {
623
623
  override fun onError(e: Exception) {
624
624
  promise.resolve(createResult("setupIntent", WritableNativeMap()))
625
625
  }
@@ -861,8 +861,8 @@ class StripeSdkModule(reactContext: ReactApplicationContext) : ReactContextBaseJ
861
861
  * Safely get and cast the current activity as an AppCompatActivity. If that fails, the promise
862
862
  * provided will be resolved with an error message instructing the user to retry the method.
863
863
  */
864
- private fun getCurrentActivityOrResolveWithError(promise: Promise?): AppCompatActivity? {
865
- (currentActivity as? AppCompatActivity)?.let {
864
+ private fun getCurrentActivityOrResolveWithError(promise: Promise?): FragmentActivity? {
865
+ (currentActivity as? FragmentActivity)?.let {
866
866
  return it
867
867
  }
868
868
  promise?.resolve(createMissingActivityError())
@@ -5,8 +5,8 @@ import android.view.LayoutInflater
5
5
  import android.view.View
6
6
  import android.view.ViewGroup
7
7
  import android.widget.FrameLayout
8
- import androidx.appcompat.app.AppCompatActivity
9
8
  import androidx.fragment.app.Fragment
9
+ import androidx.fragment.app.FragmentActivity
10
10
  import com.facebook.react.bridge.ReactContext
11
11
  import com.facebook.react.bridge.WritableMap
12
12
  import com.reactnativestripesdk.utils.ErrorType
@@ -89,19 +89,19 @@ class AddressLauncherFragment : Fragment() {
89
89
  autocompleteCountries = autocompleteCountries,
90
90
  )
91
91
  this.callback = callback
92
- (context.currentActivity as? AppCompatActivity)?.let {
92
+ (context.currentActivity as? FragmentActivity)?.let {
93
93
  attemptToCleanupPreviousFragment(it)
94
94
  commitFragmentAndStartFlow(it)
95
95
  }
96
96
  }
97
97
 
98
- private fun attemptToCleanupPreviousFragment(currentActivity: AppCompatActivity) {
98
+ private fun attemptToCleanupPreviousFragment(currentActivity: FragmentActivity) {
99
99
  currentActivity.supportFragmentManager.beginTransaction()
100
100
  .remove(this)
101
101
  .commitAllowingStateLoss()
102
102
  }
103
103
 
104
- private fun commitFragmentAndStartFlow(currentActivity: AppCompatActivity) {
104
+ private fun commitFragmentAndStartFlow(currentActivity: FragmentActivity) {
105
105
  try {
106
106
  currentActivity.supportFragmentManager.beginTransaction()
107
107
  .add(this, TAG)
@@ -1,15 +1,15 @@
1
1
  package com.reactnativestripesdk.pushprovisioning
2
2
 
3
+ import android.content.Context
3
4
  import com.bumptech.glide.Glide
4
5
  import com.facebook.react.bridge.ReadableMap
5
6
  import com.facebook.react.common.MapBuilder
6
7
  import com.facebook.react.uimanager.SimpleViewManager
7
8
  import com.facebook.react.uimanager.ThemedReactContext
8
9
  import com.facebook.react.uimanager.annotations.ReactProp
9
- import com.facebook.react.bridge.ReactApplicationContext
10
10
 
11
11
 
12
- class AddToWalletButtonManager(applicationContext: ReactApplicationContext) : SimpleViewManager<AddToWalletButtonView?>() {
12
+ class AddToWalletButtonManager(applicationContext: Context) : SimpleViewManager<AddToWalletButtonView?>() {
13
13
  private val requestManager = Glide.with(applicationContext)
14
14
  override fun getName() = "AddToWalletButton"
15
15
 
@@ -83,34 +83,33 @@ object TapAndPayProxy {
83
83
  }
84
84
  }
85
85
 
86
- private fun mapFromTokenInfo(token: Any?): WritableMap? {
87
- if (token == null) {
88
- return null
89
- }
86
+ private fun mapFromTokenInfo(token: Any?): WritableMap {
90
87
  val result = WritableNativeMap()
91
- try {
92
- val tokenInfoClass = Class.forName("com.google.android.gms.tapandpay.issuer.TokenInfo")
93
- result.putString(
94
- "id",
95
- tokenInfoClass.getMethod("getIssuerTokenId").invoke(token) as String)
96
- result.putString(
97
- "cardLastFour",
98
- tokenInfoClass.getMethod("getFpanLastFour").invoke(token) as String)
99
- result.putString(
100
- "issuer",
101
- tokenInfoClass.getMethod("getIssuerName").invoke(token) as String)
102
- result.putString(
103
- "status",
104
- mapFromTokenState(tokenInfoClass.getMethod("getTokenState").invoke(token) as Int))
105
- result.putInt(
106
- "network",
107
- tokenInfoClass.getMethod("getNetwork").invoke(token) as Int)
108
- result.putInt(
109
- "serviceProvider",
110
- tokenInfoClass.getMethod("getTokenServiceProvider").invoke(token) as Int)
111
- } catch (e: Exception) {
112
- Log.e(TAG,
113
- "There was a problem finding the class com.google.android.gms.tapandpay.issuer.TokenInfo. Make sure you've included Google's TapAndPay dependency.")
88
+ token?.let {
89
+ try {
90
+ val tokenInfoClass = Class.forName("com.google.android.gms.tapandpay.issuer.TokenInfo")
91
+ result.putString(
92
+ "id",
93
+ tokenInfoClass.getMethod("getIssuerTokenId").invoke(it) as String)
94
+ result.putString(
95
+ "cardLastFour",
96
+ tokenInfoClass.getMethod("getFpanLastFour").invoke(it) as String)
97
+ result.putString(
98
+ "issuer",
99
+ tokenInfoClass.getMethod("getIssuerName").invoke(it) as String)
100
+ result.putString(
101
+ "status",
102
+ mapFromTokenState(tokenInfoClass.getMethod("getTokenState").invoke(it) as Int))
103
+ result.putInt(
104
+ "network",
105
+ tokenInfoClass.getMethod("getNetwork").invoke(it) as Int)
106
+ result.putInt(
107
+ "serviceProvider",
108
+ tokenInfoClass.getMethod("getTokenServiceProvider").invoke(it) as Int)
109
+ } catch (e: Exception) {
110
+ Log.e(TAG,
111
+ "There was a problem finding the class com.google.android.gms.tapandpay.issuer.TokenInfo. Make sure you've included Google's TapAndPay dependency.")
112
+ }
114
113
  }
115
114
  return result
116
115
  }
@@ -3,8 +3,8 @@ package com.reactnativestripesdk.utils
3
3
  import android.content.Context
4
4
  import android.view.View
5
5
  import android.view.inputmethod.InputMethodManager
6
- import androidx.appcompat.app.AppCompatActivity
7
6
  import androidx.fragment.app.Fragment
7
+ import androidx.fragment.app.FragmentActivity
8
8
  import com.facebook.react.bridge.ReactApplicationContext
9
9
  import com.facebook.react.bridge.ReadableMap
10
10
 
@@ -25,7 +25,7 @@ fun View.hideSoftKeyboard() {
25
25
  }
26
26
 
27
27
  fun Fragment.removeFragment(context: ReactApplicationContext) {
28
- (context.currentActivity as? AppCompatActivity)?.supportFragmentManager?.let {
28
+ (context.currentActivity as? FragmentActivity)?.supportFragmentManager?.let {
29
29
  if (it.findFragmentByTag(this.tag) != null) {
30
30
  it.beginTransaction().remove(this).commitAllowingStateLoss()
31
31
  }
@@ -17,14 +17,12 @@ internal fun createResult(key: String, value: WritableMap): WritableMap {
17
17
  internal fun createCanAddCardResult(canAddCard: Boolean, status: String? = null, token: WritableMap? = null): WritableNativeMap {
18
18
  val result = WritableNativeMap()
19
19
  val details = WritableNativeMap()
20
+ result.putBoolean("canAddCard", canAddCard)
20
21
  if (status != null) {
21
- result.putBoolean("canAddCard", false)
22
22
  details.putString("status", status)
23
- } else {
24
- result.putBoolean("canAddCard", canAddCard)
25
- if (token != null) {
26
- details.putMap("token", token)
27
- }
23
+ }
24
+ if (token != null) {
25
+ details.putMap("token", token)
28
26
  }
29
27
  result.putMap("details", details)
30
28
  return result
@@ -326,77 +324,69 @@ internal fun mapFromToken(token: Token): WritableMap {
326
324
 
327
325
  internal fun mapFromPaymentMethod(paymentMethod: PaymentMethod): WritableMap {
328
326
  val pm: WritableMap = WritableNativeMap()
329
- val card: WritableMap = WritableNativeMap()
330
- val sepaDebit: WritableMap = WritableNativeMap()
331
- val bacsDebit: WritableMap = WritableNativeMap()
332
- val auBECSDebit: WritableMap = WritableNativeMap()
333
- val sofort: WritableMap = WritableNativeMap()
334
- val ideal: WritableMap = WritableNativeMap()
335
- val fpx: WritableMap = WritableNativeMap()
336
- val upi: WritableMap = WritableNativeMap()
337
- val usBankAccount: WritableMap = WritableNativeMap()
338
-
339
- card.putString("brand", mapCardBrand(paymentMethod.card?.brand))
340
- card.putString("country", paymentMethod.card?.country)
341
- paymentMethod.card?.expiryYear?.let {
342
- card.putInt("expYear", it)
343
- }
344
- paymentMethod.card?.expiryMonth?.let {
345
- card.putInt("expMonth", it)
346
- }
347
- card.putString("funding", paymentMethod.card?.funding)
348
- card.putString("last4", paymentMethod.card?.last4)
349
- card.putString("fingerprint", paymentMethod.card?.fingerprint)
350
- card.putString("preferredNetwork", paymentMethod.card?.networks?.preferred)
351
- card.putArray("availableNetworks", paymentMethod.card?.networks?.available?.toList() as? ReadableArray)
352
-
353
- sepaDebit.putString("bankCode", paymentMethod.sepaDebit?.bankCode)
354
- sepaDebit.putString("country", paymentMethod.sepaDebit?.country)
355
- sepaDebit.putString("fingerprint", paymentMethod.sepaDebit?.fingerprint)
356
- sepaDebit.putString("last4", paymentMethod.sepaDebit?.branchCode)
357
-
358
- bacsDebit.putString("fingerprint", paymentMethod.bacsDebit?.fingerprint)
359
- bacsDebit.putString("last4", paymentMethod.bacsDebit?.last4)
360
- bacsDebit.putString("sortCode", paymentMethod.bacsDebit?.sortCode)
361
-
362
- auBECSDebit.putString("bsbNumber", paymentMethod.bacsDebit?.sortCode)
363
- auBECSDebit.putString("fingerprint", paymentMethod.bacsDebit?.fingerprint)
364
- auBECSDebit.putString("last4", paymentMethod.bacsDebit?.last4)
365
-
366
- sofort.putString("country", paymentMethod.sofort?.country)
367
-
368
- ideal.putString("bankName", paymentMethod.ideal?.bank)
369
- ideal.putString("bankIdentifierCode", paymentMethod.ideal?.bankIdentifierCode)
370
-
371
- fpx.putString("accountHolderType", paymentMethod.fpx?.accountHolderType)
372
- fpx.putString("bank", paymentMethod.fpx?.bank)
373
-
374
- upi.putString("vpa", paymentMethod.upi?.vpa)
375
-
376
- usBankAccount.putString("routingNumber", paymentMethod.usBankAccount?.routingNumber)
377
- usBankAccount.putString("accountType", mapFromUSBankAccountType(paymentMethod.usBankAccount?.accountType))
378
- usBankAccount.putString("accountHolderType", mapFromUSBankAccountHolderType(paymentMethod.usBankAccount?.accountHolderType))
379
- usBankAccount.putString("last4", paymentMethod.usBankAccount?.last4)
380
- usBankAccount.putString("bankName", paymentMethod.usBankAccount?.bankName)
381
- usBankAccount.putString("linkedAccount", paymentMethod.usBankAccount?.linkedAccount)
382
- usBankAccount.putString("fingerprint", paymentMethod.usBankAccount?.fingerprint)
383
- usBankAccount.putString("preferredNetworks", paymentMethod.usBankAccount?.networks?.preferred)
384
- usBankAccount.putArray("supportedNetworks", paymentMethod.usBankAccount?.networks?.supported as? ReadableArray)
385
327
 
386
328
  pm.putString("id", paymentMethod.id)
387
329
  pm.putString("paymentMethodType", mapPaymentMethodType(paymentMethod.type))
388
330
  pm.putBoolean("livemode", paymentMethod.liveMode)
389
331
  pm.putString("customerId", paymentMethod.customerId)
390
332
  pm.putMap("billingDetails", mapFromBillingDetails(paymentMethod.billingDetails))
391
- pm.putMap("Card", card)
392
- pm.putMap("SepaDebit", sepaDebit)
393
- pm.putMap("BacsDebit", bacsDebit)
394
- pm.putMap("AuBecsDebit", auBECSDebit)
395
- pm.putMap("Sofort", sofort)
396
- pm.putMap("Ideal", ideal)
397
- pm.putMap("Fpx", fpx)
398
- pm.putMap("Upi", upi)
399
- pm.putMap("USBankAccount", usBankAccount)
333
+ pm.putMap("Card", WritableNativeMap().also {
334
+ it.putString("brand", mapCardBrand(paymentMethod.card?.brand))
335
+ it.putString("country", paymentMethod.card?.country)
336
+ paymentMethod.card?.expiryYear?.let { year ->
337
+ it.putInt("expYear", year)
338
+ }
339
+ paymentMethod.card?.expiryMonth?.let { month ->
340
+ it.putInt("expMonth", month)
341
+ }
342
+ it.putString("funding", paymentMethod.card?.funding)
343
+ it.putString("last4", paymentMethod.card?.last4)
344
+ it.putString("fingerprint", paymentMethod.card?.fingerprint)
345
+ it.putString("preferredNetwork", paymentMethod.card?.networks?.preferred)
346
+ it.putArray("availableNetworks", paymentMethod.card?.networks?.available?.toList() as? ReadableArray)
347
+ })
348
+ pm.putMap("SepaDebit", WritableNativeMap().also {
349
+ it.putString("bankCode", paymentMethod.sepaDebit?.bankCode)
350
+ it.putString("country", paymentMethod.sepaDebit?.country)
351
+ it.putString("fingerprint", paymentMethod.sepaDebit?.fingerprint)
352
+ it.putString("last4", paymentMethod.sepaDebit?.branchCode)
353
+ })
354
+ pm.putMap("BacsDebit", WritableNativeMap().also {
355
+ it.putString("fingerprint", paymentMethod.bacsDebit?.fingerprint)
356
+ it.putString("last4", paymentMethod.bacsDebit?.last4)
357
+ it.putString("sortCode", paymentMethod.bacsDebit?.sortCode)
358
+ })
359
+ pm.putMap("AuBecsDebit",
360
+ WritableNativeMap().also {
361
+ it.putString("bsbNumber", paymentMethod.bacsDebit?.sortCode)
362
+ it.putString("fingerprint", paymentMethod.bacsDebit?.fingerprint)
363
+ it.putString("last4", paymentMethod.bacsDebit?.last4)
364
+ })
365
+ pm.putMap("Sofort", WritableNativeMap().also {
366
+ it.putString("country", paymentMethod.sofort?.country)
367
+ })
368
+ pm.putMap("Ideal", WritableNativeMap().also {
369
+ it.putString("bankName", paymentMethod.ideal?.bank)
370
+ it.putString("bankIdentifierCode", paymentMethod.ideal?.bankIdentifierCode)
371
+ })
372
+ pm.putMap("Fpx", WritableNativeMap().also {
373
+ it.putString("accountHolderType", paymentMethod.fpx?.accountHolderType)
374
+ it.putString("bank", paymentMethod.fpx?.bank)
375
+ })
376
+ pm.putMap("Upi", WritableNativeMap().also {
377
+ it.putString("vpa", paymentMethod.upi?.vpa)
378
+ })
379
+ pm.putMap("USBankAccount", WritableNativeMap().also {
380
+ it.putString("routingNumber", paymentMethod.usBankAccount?.routingNumber)
381
+ it.putString("accountType", mapFromUSBankAccountType(paymentMethod.usBankAccount?.accountType))
382
+ it.putString("accountHolderType", mapFromUSBankAccountHolderType(paymentMethod.usBankAccount?.accountHolderType))
383
+ it.putString("last4", paymentMethod.usBankAccount?.last4)
384
+ it.putString("bankName", paymentMethod.usBankAccount?.bankName)
385
+ it.putString("linkedAccount", paymentMethod.usBankAccount?.linkedAccount)
386
+ it.putString("fingerprint", paymentMethod.usBankAccount?.fingerprint)
387
+ it.putString("preferredNetworks", paymentMethod.usBankAccount?.networks?.preferred)
388
+ it.putArray("supportedNetworks", paymentMethod.usBankAccount?.networks?.supported as? ReadableArray)
389
+ })
400
390
 
401
391
  return pm
402
392
  }
@@ -407,6 +397,11 @@ internal fun mapFromPaymentIntentResult(paymentIntent: PaymentIntent): WritableM
407
397
  map.putString("clientSecret", paymentIntent.clientSecret)
408
398
  map.putBoolean("livemode", paymentIntent.isLiveMode)
409
399
  map.putString("paymentMethodId", paymentIntent.paymentMethodId)
400
+ map.putMap("paymentMethod", paymentIntent.paymentMethod?.let {
401
+ mapFromPaymentMethod(it)
402
+ } ?: run {
403
+ null
404
+ })
410
405
  map.putString("receiptEmail", paymentIntent.receiptEmail)
411
406
  map.putString("currency", paymentIntent.currency)
412
407
  map.putString("status", mapIntentStatus(paymentIntent.status))
@@ -786,6 +781,11 @@ internal fun mapFromSetupIntentResult(setupIntent: SetupIntent): WritableMap {
786
781
  map.putBoolean("livemode", setupIntent.isLiveMode)
787
782
  map.putString("clientSecret", setupIntent.clientSecret)
788
783
  map.putString("paymentMethodId", setupIntent.paymentMethodId)
784
+ map.putMap("paymentMethod", setupIntent.paymentMethod?.let {
785
+ mapFromPaymentMethod(it)
786
+ } ?: run {
787
+ null
788
+ })
789
789
  map.putString("usage", mapSetupIntentUsage(setupIntent.usage))
790
790
  map.putString("created", convertToUnixTimestamp(setupIntent.created))
791
791
  map.putMap("nextAction", mapNextAction(setupIntent.nextActionType, setupIntent.nextActionData))
@@ -167,6 +167,8 @@ extension StripeSdk : PKPaymentAuthorizationViewControllerDelegate, STPApplePayC
167
167
  ) {
168
168
  if let clientSecret = self.confirmApplePayPaymentClientSecret {
169
169
  completion(clientSecret, nil)
170
+ } else if let clientSecret = self.confirmApplePaySetupClientSecret {
171
+ completion(clientSecret, nil)
170
172
  } else {
171
173
  self.applePayCompletionCallback = completion
172
174
  let method = Mappers.mapFromPaymentMethod(paymentMethod.splitApplePayAddressByNewline())
package/ios/Mappers.swift CHANGED
@@ -381,6 +381,7 @@ class Mappers {
381
381
  "receiptEmail": paymentIntent.receiptEmail ?? NSNull(),
382
382
  "livemode": paymentIntent.livemode,
383
383
  "paymentMethodId": paymentIntent.paymentMethodId ?? NSNull(),
384
+ "paymentMethod": mapFromPaymentMethod(paymentIntent.paymentMethod) ?? NSNull(),
384
385
  "captureMethod": mapCaptureMethod(paymentIntent.captureMethod),
385
386
  "confirmationMethod": mapConfirmationMethod(paymentIntent.confirmationMethod),
386
387
  "created": convertDateToUnixTimestampMilliseconds(date: paymentIntent.created) ?? NSNull(),
@@ -718,6 +719,7 @@ class Mappers {
718
719
  "paymentMethodTypes": NSArray(),
719
720
  "usage": mapFromSetupIntentUsage(usage: setupIntent.usage),
720
721
  "paymentMethodId": setupIntent.paymentMethodID ?? NSNull(),
722
+ "paymentMethod": mapFromPaymentMethod(setupIntent.paymentMethod) ?? NSNull(),
721
723
  "created": NSNull(),
722
724
  "lastSetupError": NSNull(),
723
725
  "nextAction": mapNextAction(nextAction: setupIntent.nextAction) ?? NSNull(),
@@ -1 +1 @@
1
- {"version":3,"names":["AddToWalletButtonNative","requireNativeComponent","AddToWalletButton","onComplete","props","value","nativeEvent"],"sources":["AddToWalletButton.tsx"],"sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n StyleProp,\n ViewStyle,\n requireNativeComponent,\n NativeSyntheticEvent,\n ImageSourcePropType,\n} from 'react-native';\nimport type {\n Token,\n CardActionError,\n StripeError,\n GooglePayCardToken,\n} from '../types';\n\nconst AddToWalletButtonNative =\n requireNativeComponent<any>('AddToWalletButton');\n\n/**\n * Add to wallet button component props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n /** Sets the Apple Wallet/Google Pay button style. If the button is placed over a dark background, set this to 'onDarkBackground', otherwise set to 'onLightBackground'. */\n iOSButtonStyle?: 'onDarkBackground' | 'onLightBackground';\n /** The image asset to use as the Google Pay button. Downloadable from https://developers.google.com/pay/issuers/apis/push-provisioning/android/downloads/flutter/googlepay_flutter_buttons.zip */\n androidAssetSource: ImageSourcePropType;\n testID?: string;\n /** iOS only. Set this to `true` until shipping through TestFlight || App Store. If false, you must be using live cards, and have the proper iOS entitlement set up. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#requesting-access-for-ios */\n testEnv?: boolean;\n /** Details of the Issued Card you'd like added to the device's wallet */\n cardDetails: {\n /** The `primary_account_identifier` value from the issued card. */\n primaryAccountIdentifier: string | null;\n /** The card holder name (used only on iOS) */\n name: string;\n /** A user-facing description of the card. Required on Android.*/\n description: string;\n /** Last 4 digits of the card, only used on iOS */\n lastFour?: string;\n /** Optional, only used on iOS */\n brand?: Token.CardBrand;\n };\n // Optional, only for Android and only for cards that are in the \"yellow path\" (as defined by Google- https://developers.google.com/pay/issuers/apis/push-provisioning/android/wallet-operations#resolving_yellow_path). Obtain this value via the `isCardInWallet` method.\n token?: GooglePayCardToken | null;\n /** Used by stripe to securely obtain card info of the card being provisioned. */\n ephemeralKey: object;\n /** Called when the flow completes. If the `error` field is `null`, then the card was successfully added to the user's native wallet. */\n onComplete(result: { error: StripeError<CardActionError> | null }): void;\n}\n\n/**\n * Add to wallet button\n *\n * @example\n * ```ts\n * <AddToWalletButton\n * testEnv={true}\n * style={styles.myButtonStyle}\n * iOSButtonStyle=\"onLightBackground\"\n * cardDetails={{\n * primaryAccountIdentifier: \"V-123\",\n * name: \"David Wallace\",\n * lastFour: \"4242\",\n * }}\n * ephemeralKey={myEphemeralKey} // This object is retrieved from your server. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#update-your-backend\n * onComplete={(error) => {\n * Alert.alert(\n * error ? error.code : 'Success',\n * error\n * ? error.message\n * : 'Card was successfully added to the wallet.'\n * );\n * }}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function AddToWalletButton({ onComplete, ...props }: Props) {\n return (\n <AddToWalletButtonNative\n {...props}\n onCompleteAction={(\n value: NativeSyntheticEvent<{\n error: StripeError<CardActionError> | null;\n }>\n ) => onComplete(value.nativeEvent)}\n />\n );\n}\n"],"mappings":"wXAAA,oDACA,yCAOsB,qIAQtB,GAAMA,wBAAuB,CAC3B,GAAAC,mCAAsB,EAAM,mBAAmB,CAAC,CAgE3C,QAASC,kBAAiB,MAAkC,IAA/BC,WAAU,MAAVA,UAAU,CAAKC,KAAK,uDACtD,MACE,8BAAC,uBAAuB,0BAClBA,KAAK,EACT,gBAAgB,CAAE,0BAChBC,KAEE,QACCF,WAAU,CAACE,KAAK,CAACC,WAAW,CAAC,EAAC,6EACnC,CAEN"}
1
+ {"version":3,"names":["AddToWalletButtonNative","requireNativeComponent","AddToWalletButton","onComplete","props","value","nativeEvent"],"sources":["AddToWalletButton.tsx"],"sourcesContent":["import React from 'react';\nimport {\n AccessibilityProps,\n StyleProp,\n ViewStyle,\n requireNativeComponent,\n NativeSyntheticEvent,\n ImageSourcePropType,\n} from 'react-native';\nimport type {\n Token,\n CardActionError,\n StripeError,\n GooglePayCardToken,\n} from '../types';\n\nconst AddToWalletButtonNative =\n requireNativeComponent<any>('AddToWalletButton');\n\n/**\n * Add to wallet button component props\n */\nexport interface Props extends AccessibilityProps {\n style?: StyleProp<ViewStyle>;\n /** Sets the Apple Wallet/Google Pay button style. If the button is placed over a dark background, set this to 'onDarkBackground', otherwise set to 'onLightBackground'. */\n iOSButtonStyle?: 'onDarkBackground' | 'onLightBackground';\n /** The image asset to use as the Google Pay button. Downloadable from https://developers.google.com/static/pay/issuers/apis/push-provisioning/android/downloads/flutter/2022_googlepay_flutter_buttons.zip */\n androidAssetSource: ImageSourcePropType;\n testID?: string;\n /** iOS only. Set this to `true` until shipping through TestFlight || App Store. If false, you must be using live cards, and have the proper iOS entitlement set up. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#requesting-access-for-ios */\n testEnv?: boolean;\n /** Details of the Issued Card you'd like added to the device's wallet */\n cardDetails: {\n /** The `primary_account_identifier` value from the issued card. */\n primaryAccountIdentifier: string | null;\n /** The card holder name (used only on iOS) */\n name: string;\n /** A user-facing description of the card. Required on Android.*/\n description: string;\n /** Last 4 digits of the card, only used on iOS */\n lastFour?: string;\n /** Optional, only used on iOS */\n brand?: Token.CardBrand;\n };\n // Optional, only for Android and only for cards that are in the \"yellow path\" (as defined by Google- https://developers.google.com/pay/issuers/apis/push-provisioning/android/wallet-operations#resolving_yellow_path). Obtain this value via the `isCardInWallet` method.\n token?: GooglePayCardToken | null;\n /** Used by stripe to securely obtain card info of the card being provisioned. */\n ephemeralKey: object;\n /** Called when the flow completes. If the `error` field is `null`, then the card was successfully added to the user's native wallet. */\n onComplete(result: { error: StripeError<CardActionError> | null }): void;\n}\n\n/**\n * Add to wallet button\n *\n * @example\n * ```ts\n * <AddToWalletButton\n * testEnv={true}\n * style={styles.myButtonStyle}\n * iOSButtonStyle=\"onLightBackground\"\n * cardDetails={{\n * primaryAccountIdentifier: \"V-123\",\n * name: \"David Wallace\",\n * lastFour: \"4242\",\n * }}\n * ephemeralKey={myEphemeralKey} // This object is retrieved from your server. See https://stripe.com/docs/issuing/cards/digital-wallets?platform=react-native#update-your-backend\n * onComplete={(error) => {\n * Alert.alert(\n * error ? error.code : 'Success',\n * error\n * ? error.message\n * : 'Card was successfully added to the wallet.'\n * );\n * }}\n * />\n * ```\n * @param __namedParameters Props\n * @returns JSX.Element\n * @category ReactComponents\n */\nexport function AddToWalletButton({ onComplete, ...props }: Props) {\n return (\n <AddToWalletButtonNative\n {...props}\n onCompleteAction={(\n value: NativeSyntheticEvent<{\n error: StripeError<CardActionError> | null;\n }>\n ) => onComplete(value.nativeEvent)}\n />\n );\n}\n"],"mappings":"wXAAA,oDACA,yCAOsB,qIAQtB,GAAMA,wBAAuB,CAC3B,GAAAC,mCAAsB,EAAM,mBAAmB,CAAC,CAgE3C,QAASC,kBAAiB,MAAkC,IAA/BC,WAAU,MAAVA,UAAU,CAAKC,KAAK,uDACtD,MACE,8BAAC,uBAAuB,0BAClBA,KAAK,EACT,gBAAgB,CAAE,0BAChBC,KAEE,QACCF,WAAU,CAACE,KAAK,CAACC,WAAW,CAAC,EAAC,6EACnC,CAEN"}
@@ -1 +1 @@
1
- {"version":3,"names":["Status"],"sources":["PaymentIntent.ts"],"sourcesContent":["import type { StripeError } from '.';\nimport type { Address } from './Common';\nimport type { Result as PaymentMethodResult } from './PaymentMethod';\nimport type { NextAction } from './NextAction';\nimport type * as PaymentMethod from './PaymentMethod';\n\nexport interface Result {\n id: string;\n amount: number;\n /** The UNIX timestamp (in milliseconds) of the date this PaymentIntent was created. */\n created: string;\n currency: string;\n status: Status;\n description: string | null;\n receiptEmail: string | null;\n canceledAt: string | null;\n clientSecret: string;\n livemode: boolean;\n paymentMethodId: string;\n captureMethod: 'Automatic' | 'Manual';\n confirmationMethod: 'Automatic' | 'Manual';\n lastPaymentError: LastPaymentError | null;\n shipping: ShippingDetails | null;\n nextAction: NextAction | null;\n}\n\nexport type ConfirmParams = PaymentMethod.CreateParams;\n\nexport type ConfirmOptions = PaymentMethod.ConfirmOptions;\n\nexport type LastPaymentError = StripeError<string> & {\n paymentMethod: PaymentMethodResult;\n};\n\nexport type FutureUsage = 'OffSession' | 'OnSession';\n\nexport interface ShippingDetails {\n address: Required<Address>;\n name: string;\n carrier: string;\n phone: string;\n trackingNumber: string;\n}\n\nexport enum Status {\n Succeeded = 'Succeeded',\n RequiresPaymentMethod = 'RequiresPaymentMethod',\n RequiresConfirmation = 'RequiresConfirmation',\n Canceled = 'Canceled',\n Processing = 'Processing',\n RequiresAction = 'RequiresAction',\n RequiresCapture = 'RequiresCapture',\n Unknown = 'Unknown',\n}\n"],"mappings":"kFA4CYA,OAAM,iCAANA,MAAM,EAANA,MAAM,0BAANA,MAAM,kDAANA,MAAM,gDAANA,MAAM,wBAANA,MAAM,4BAANA,MAAM,oCAANA,MAAM,sCAANA,MAAM,yBAANA,MAAM,kBAANA,MAAM"}
1
+ {"version":3,"names":["Status"],"sources":["PaymentIntent.ts"],"sourcesContent":["import type { StripeError } from '.';\nimport type { Address } from './Common';\nimport type { Result as PaymentMethodResult } from './PaymentMethod';\nimport type { NextAction } from './NextAction';\nimport type * as PaymentMethod from './PaymentMethod';\n\nexport interface Result {\n id: string;\n amount: number;\n /** The UNIX timestamp (in milliseconds) of the date this PaymentIntent was created. */\n created: string;\n currency: string;\n status: Status;\n description: string | null;\n receiptEmail: string | null;\n canceledAt: string | null;\n clientSecret: string;\n livemode: boolean;\n /** @deprecated Use paymentMethod.id instead. */\n paymentMethodId: string;\n paymentMethod: PaymentMethodResult | null;\n captureMethod: 'Automatic' | 'Manual';\n confirmationMethod: 'Automatic' | 'Manual';\n lastPaymentError: LastPaymentError | null;\n shipping: ShippingDetails | null;\n nextAction: NextAction | null;\n}\n\nexport type ConfirmParams = PaymentMethod.CreateParams;\n\nexport type ConfirmOptions = PaymentMethod.ConfirmOptions;\n\nexport type LastPaymentError = StripeError<string> & {\n paymentMethod: PaymentMethodResult;\n};\n\nexport type FutureUsage = 'OffSession' | 'OnSession';\n\nexport interface ShippingDetails {\n address: Required<Address>;\n name: string;\n carrier: string;\n phone: string;\n trackingNumber: string;\n}\n\nexport enum Status {\n Succeeded = 'Succeeded',\n RequiresPaymentMethod = 'RequiresPaymentMethod',\n RequiresConfirmation = 'RequiresConfirmation',\n Canceled = 'Canceled',\n Processing = 'Processing',\n RequiresAction = 'RequiresAction',\n RequiresCapture = 'RequiresCapture',\n Unknown = 'Unknown',\n}\n"],"mappings":"kFA8CYA,OAAM,iCAANA,MAAM,EAANA,MAAM,0BAANA,MAAM,kDAANA,MAAM,gDAANA,MAAM,wBAANA,MAAM,4BAANA,MAAM,oCAANA,MAAM,sCAANA,MAAM,yBAANA,MAAM,kBAANA,MAAM"}