From c402d4478c3e78de2239fcf3d52d6553658b8f02 Mon Sep 17 00:00:00 2001 From: Nazli Yurdakul <69359432+nazli-stripe@users.noreply.github.com> Date: Tue, 28 Nov 2023 02:12:54 +0300 Subject: [PATCH] Add new parameters for PaymentIntent (#574) * support statement descriptor suffix * return PM id * sdkUUID camelcase * bric fixes --- .../com/stripeterminalreactnative/Mappers.kt | 5 +- .../StripeTerminalReactNativeModule.kt | 40 +++++++------ ios/Mappers.swift | 7 ++- ios/StripeTerminalReactNative.swift | 56 ++++++++++--------- src/types/PaymentIntent.ts | 3 +- src/types/SetupIntent.ts | 2 +- src/types/index.ts | 1 + 7 files changed, 62 insertions(+), 52 deletions(-) diff --git a/android/src/main/java/com/stripeterminalreactnative/Mappers.kt b/android/src/main/java/com/stripeterminalreactnative/Mappers.kt index dfb210eb..99a40648 100644 --- a/android/src/main/java/com/stripeterminalreactnative/Mappers.kt +++ b/android/src/main/java/com/stripeterminalreactnative/Mappers.kt @@ -156,7 +156,8 @@ internal fun mapFromPaymentIntent(paymentIntent: PaymentIntent, uuid: String): R putString("status", mapFromPaymentIntentStatus(paymentIntent.status)) putArray("charges", mapFromChargesList(paymentIntent.getCharges())) putString("created", convertToUnixTimestamp(paymentIntent.created)) - putString("sdk_uuid", uuid) + putString("sdkUuid", uuid) + putString("paymentMethodId", paymentIntent.paymentMethodId) } internal fun mapFromSetupIntent(setupIntent: SetupIntent, uuid: String): ReadableMap = nativeMapOf { @@ -172,7 +173,7 @@ internal fun mapFromSetupIntent(setupIntent: SetupIntent, uuid: String): Readabl putString("onBehalfOfId", setupIntent.onBehalfOfId) putString("paymentMethodId", setupIntent.paymentMethodId) putString("singleUseMandateId", setupIntent.singleUseMandateId) - putString("sdk_uuid", uuid) + putString("sdkUuid", uuid) } internal fun mapFromSetupAttempt(attempt: SetupAttempt?): ReadableMap? = attempt?.let { diff --git a/android/src/main/java/com/stripeterminalreactnative/StripeTerminalReactNativeModule.kt b/android/src/main/java/com/stripeterminalreactnative/StripeTerminalReactNativeModule.kt index 2f46fea7..f1bd6b2e 100644 --- a/android/src/main/java/com/stripeterminalreactnative/StripeTerminalReactNativeModule.kt +++ b/android/src/main/java/com/stripeterminalreactnative/StripeTerminalReactNativeModule.kt @@ -318,6 +318,7 @@ class StripeTerminalReactNativeModule(reactContext: ReactApplicationContext) : val applicationFeeAmount = getInt(params, "applicationFeeAmount") val stripeDescription = params.getString("stripeDescription") val statementDescriptor = params.getString("statementDescriptor") + val statementDescriptorSuffix = params.getString("statementDescriptorSuffix") val receiptEmail = params.getString("receiptEmail") val customer = params.getString("customer") val transferGroup = params.getString("transferGroup") @@ -349,6 +350,9 @@ class StripeTerminalReactNativeModule(reactContext: ReactApplicationContext) : statementDescriptor?.let { intentParams.setStatementDescriptor(it) } + statementDescriptorSuffix?.let { + intentParams.setStatementDescriptorSuffix(it) + } receiptEmail?.let { intentParams.setReceiptEmail(it) } @@ -427,11 +431,11 @@ class StripeTerminalReactNativeModule(reactContext: ReactApplicationContext) : val paymentIntentJson = requireParam(params.getMap("paymentIntent")) { "You must provide a paymentIntent" } - val uuid = requireParam(paymentIntentJson.getString("sdk_uuid")) { - "The PaymentIntent is missing sdk_uuid field. This method requires you to use the PaymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent." + val uuid = requireParam(paymentIntentJson.getString("sdkUuid")) { + "The PaymentIntent is missing sdkUuid field. This method requires you to use the PaymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent." } val paymentIntent = requireParam(paymentIntents[uuid]) { - "No PaymentIntent was found with the sdk_uuid $uuid. The PaymentIntent provided must be re-retrieved with retrievePaymentIntent or a new PaymentIntent must be created with createPaymentIntent." + "No PaymentIntent was found with the sdkUuid $uuid. The PaymentIntent provided must be re-retrieved with retrievePaymentIntent or a new PaymentIntent must be created with createPaymentIntent." } val configBuilder = CollectConfiguration.Builder() @@ -476,11 +480,11 @@ class StripeTerminalReactNativeModule(reactContext: ReactApplicationContext) : @ReactMethod @Suppress("unused") fun confirmPaymentIntent(paymentIntent: ReadableMap, promise: Promise) = withExceptionResolver(promise) { - val uuid = requireParam(paymentIntent.getString("sdk_uuid")) { - "The PaymentIntent is missing sdk_uuid field. This method requires you to use the PaymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent." + val uuid = requireParam(paymentIntent.getString("sdkUuid")) { + "The PaymentIntent is missing sdkUuid field. This method requires you to use the PaymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent." } val paymentIntent = requireParam(paymentIntents[uuid]) { - "No PaymentIntent was found with the sdk_uuid $uuid. The PaymentIntent provided must be re-retrieved with retrievePaymentIntent or a new PaymentIntent must be created with createPaymentIntent." + "No PaymentIntent was found with the sdkUuid $uuid. The PaymentIntent provided must be re-retrieved with retrievePaymentIntent or a new PaymentIntent must be created with createPaymentIntent." } terminal.confirmPaymentIntent(paymentIntent, RNPaymentIntentCallback(promise, uuid) { @@ -526,11 +530,11 @@ class StripeTerminalReactNativeModule(reactContext: ReactApplicationContext) : @Suppress("unused") fun cancelPaymentIntent(paymentIntent: ReadableMap, promise: Promise) = withExceptionResolver(promise) { - val uuid = requireParam(paymentIntent.getString("sdk_uuid")) { - "The PaymentIntent is missing sdk_uuid field. This method requires you to use the PaymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent." + val uuid = requireParam(paymentIntent.getString("sdkUuid")) { + "The PaymentIntent is missing sdkUuid field. This method requires you to use the PaymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent." } val paymentIntent = requireParam(paymentIntents[uuid]) { - "No PaymentIntent was found with the sdk_uuid $uuid. The PaymentIntent provided must be re-retrieved with retrievePaymentIntent or a new PaymentIntent must be created with createPaymentIntent." + "No PaymentIntent was found with the sdkUuid $uuid. The PaymentIntent provided must be re-retrieved with retrievePaymentIntent or a new PaymentIntent must be created with createPaymentIntent." } terminal.cancelPaymentIntent(paymentIntent, RNPaymentIntentCallback(promise, uuid) { @@ -545,11 +549,11 @@ class StripeTerminalReactNativeModule(reactContext: ReactApplicationContext) : val setupIntentJson = requireParam(params.getMap("setupIntent")) { "You must provide a setupIntent" } - val uuid = requireParam(setupIntentJson.getString("sdk_uuid")) { - "The SetupIntent is missing sdk_uuid field. This method requires you to use the SetupIntent that was returned from either createPaymentIntent or retrievePaymentIntent." + val uuid = requireParam(setupIntentJson.getString("sdkUuid")) { + "The SetupIntent is missing sdkUuid field. This method requires you to use the SetupIntent that was returned from either createPaymentIntent or retrievePaymentIntent." } val setupIntent = requireParam(setupIntents[uuid]) { - "No SetupIntent was found with the sdk_uuid $uuid. The SetupIntent provided must be re-retrieved with retrieveSetupIntent or a new SetupIntent must be created with createSetupIntent." + "No SetupIntent was found with the sdkUuid $uuid. The SetupIntent provided must be re-retrieved with retrieveSetupIntent or a new SetupIntent must be created with createSetupIntent." } val customerConsentCollected = getBoolean(params, "customerConsentCollected") @@ -608,11 +612,11 @@ class StripeTerminalReactNativeModule(reactContext: ReactApplicationContext) : @Suppress("unused") fun cancelSetupIntent(setupIntent: ReadableMap, promise: Promise) = withExceptionResolver(promise) { - val uuid = requireParam(setupIntent.getString("sdk_uuid")) { - "The SetupIntent is missing sdk_uuid field. This method requires you to use the SetupIntent that was returned from either createPaymentIntent or retrievePaymentIntent." + val uuid = requireParam(setupIntent.getString("sdkUuid")) { + "The SetupIntent is missing sdkUuid field. This method requires you to use the SetupIntent that was returned from either createPaymentIntent or retrievePaymentIntent." } val setupIntent = requireParam(setupIntents[uuid]) { - "No SetupIntent was found with the sdk_uuid $uuid. The SetupIntent provided must be re-retrieved with retrieveSetupIntent or a new SetupIntent must be created with createSetupIntent." + "No SetupIntent was found with the sdkUuid $uuid. The SetupIntent provided must be re-retrieved with retrieveSetupIntent or a new SetupIntent must be created with createSetupIntent." } val params = SetupIntentCancellationParameters.Builder().build() @@ -626,11 +630,11 @@ class StripeTerminalReactNativeModule(reactContext: ReactApplicationContext) : @Suppress("unused") fun confirmSetupIntent(setupIntent: ReadableMap, promise: Promise) = withExceptionResolver(promise) { - val uuid = requireParam(setupIntent.getString("sdk_uuid")) { - "The SetupIntent is missing sdk_uuid field. This method requires you to use the SetupIntent that was returned from either createPaymentIntent or retrievePaymentIntent." + val uuid = requireParam(setupIntent.getString("sdkUuid")) { + "The SetupIntent is missing sdkUuid field. This method requires you to use the SetupIntent that was returned from either createPaymentIntent or retrievePaymentIntent." } val setupIntent = requireParam(setupIntents[uuid]) { - "No SetupIntent was found with the sdk_uuid $uuid. The SetupIntent provided must be re-retrieved with retrieveSetupIntent or a new SetupIntent must be created with createSetupIntent." + "No SetupIntent was found with the sdkUuid $uuid. The SetupIntent provided must be re-retrieved with retrieveSetupIntent or a new SetupIntent must be created with createSetupIntent." } terminal.confirmSetupIntent(setupIntent, RNSetupIntentCallback(promise, uuid) { diff --git a/ios/Mappers.swift b/ios/Mappers.swift index 11dbbc23..cd4a3793 100644 --- a/ios/Mappers.swift +++ b/ios/Mappers.swift @@ -145,7 +145,8 @@ class Mappers { "currency": paymentIntent.currency, "status": mapFromPaymentIntentStatus(paymentIntent.status), "id": paymentIntent.stripeId, - "sdk_uuid": uuid, + "sdkUuid": uuid, + "paymentMethodId": paymentIntent.paymentMethodId, ] return result } @@ -153,7 +154,7 @@ class Mappers { class func mapFromSetupIntent(_ setupIntent: SetupIntent, uuid: String) -> NSDictionary { let result: NSDictionary = [ "id": setupIntent.stripeId, - "sdk_uuid": uuid, + "sdkUuid": uuid, "created": convertDateToUnixTimestamp(date: setupIntent.created) ?? NSNull(), "status": mapFromSetupIntentStatus(setupIntent.status), "latestAttempt": mapFromSetupAttempt(setupIntent.latestAttempt) ?? NSNull(), @@ -515,7 +516,7 @@ class Mappers { default: return "unknown" } } - + class func mapFromOfflineStatus(_ offlineStatus: OfflineStatus) -> NSDictionary { let result: NSDictionary = [ "networkStatus": mapFromNetworkStatus(offlineStatus.sdk.networkStatus) diff --git a/ios/StripeTerminalReactNative.swift b/ios/StripeTerminalReactNative.swift index f6812046..b92970cd 100644 --- a/ios/StripeTerminalReactNative.swift +++ b/ios/StripeTerminalReactNative.swift @@ -77,7 +77,7 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe Terminal.setTokenProvider(TokenProvider.shared) Terminal.shared.logLevel = logLevel } - + Terminal.shared.offlineDelegate = self if Terminal.shared.responds(to: NSSelectorFromString("setReactNativeSdkVersion:")) && params["reactNativeVersion"] != nil { @@ -364,6 +364,7 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe let stripeDescription = params["stripeDescription"] as? String let statementDescriptor = params["statementDescriptor"] as? String + let statementDescriptorSuffix = params["statementDescriptorSuffix"] as? String let receiptEmail = params["receiptEmail"] as? String let customer = params["customer"] as? String let transferGroup = params["transferGroup"] as? String @@ -383,6 +384,7 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe .setApplicationFeeAmount(applicationFeeAmount) .setStripeDescription(stripeDescription) .setStatementDescriptor(statementDescriptor) + .setStatementDescriptorSuffix(statementDescriptorSuffix) .setReceiptEmail(receiptEmail) .setCustomer(customer) .setTransferGroup(transferGroup) @@ -434,7 +436,7 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe default: return OfflineBehavior.preferOnline } }() - + let offlineCreateConfig: CreateConfiguration do { offlineCreateConfig = try CreateConfigurationBuilder().setOfflineBehavior(offlineBehaviorFromTransactionLimit).build() @@ -442,7 +444,7 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe resolve(Errors.createError(nsError: error as NSError)) return } - + Terminal.shared.createPaymentIntent(paymentParams, createConfig: offlineCreateConfig) { pi, error in if let error = error as NSError? { resolve(Errors.createError(nsError: error)) @@ -485,12 +487,12 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "You must provide paymentIntent.")) return } - guard let uuid = paymentIntentJSON["sdk_uuid"] as? String else { - resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "The PaymentIntent is missing sdk_uuid field. This method requires you to use the PaymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent.")) + guard let uuid = paymentIntentJSON["sdkUuid"] as? String else { + resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "The PaymentIntent is missing sdkUuid field. This method requires you to use the PaymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent.")) return } guard let paymentIntent = self.paymentIntents[uuid] else { - resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "No PaymentIntent was found with the sdk_uuid \(uuid). The PaymentIntent provided must be re-retrieved with retrievePaymentIntent or a new PaymentIntent must be created with createPaymentIntent.")) + resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "No PaymentIntent was found with the sdkUuid \(uuid). The PaymentIntent provided must be re-retrieved with retrievePaymentIntent or a new PaymentIntent must be created with createPaymentIntent.")) return } @@ -594,12 +596,12 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe @objc(confirmPaymentIntent:resolver:rejecter:) func confirmPaymentIntent(paymentIntentJson: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) { - guard let uuid = paymentIntentJson["sdk_uuid"] as? String else { - resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "The PaymentIntent is missing sdk_uuid field. This method requires you to use the PaymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent.")) + guard let uuid = paymentIntentJson["sdkUuid"] as? String else { + resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "The PaymentIntent is missing sdkUuid field. This method requires you to use the PaymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent.")) return } guard let paymentIntent = self.paymentIntents[uuid] else { - resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "No PaymentIntent was found with the sdk_uuid \(uuid). The PaymentIntent provided must be re-retrieved with retrievePaymentIntent or a new PaymentIntent must be created with createPaymentIntent.")) + resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "No PaymentIntent was found with the sdkUuid \(uuid). The PaymentIntent provided must be re-retrieved with retrievePaymentIntent or a new PaymentIntent must be created with createPaymentIntent.")) return } @@ -654,12 +656,12 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe @objc(cancelPaymentIntent:resolver:rejecter:) func cancelPaymentIntent(paymentIntentJson: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) { - guard let uuid = paymentIntentJson["sdk_uuid"] as? String else { - resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "The PaymentIntent is missing sdk_uuid field. This method requires you to use the PaymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent.")) + guard let uuid = paymentIntentJson["sdkUuid"] as? String else { + resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "The PaymentIntent is missing sdkUuid field. This method requires you to use the PaymentIntent that was returned from either createPaymentIntent or retrievePaymentIntent.")) return } guard let paymentIntent = self.paymentIntents[uuid] else { - resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "No PaymentIntent was found with the sdk_uuid \(uuid). The PaymentIntent provided must be re-retrieved with retrievePaymentIntent or a new PaymentIntent must be created with createPaymentIntent.")) + resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "No PaymentIntent was found with the sdkUuid \(uuid). The PaymentIntent provided must be re-retrieved with retrievePaymentIntent or a new PaymentIntent must be created with createPaymentIntent.")) return } Terminal.shared.cancelPaymentIntent(paymentIntent) { pi, collectError in @@ -730,12 +732,12 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe @objc(cancelSetupIntent:resolver:rejecter:) func cancelSetupIntent(setupIntentJson: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) { - guard let uuid = setupIntentJson["sdk_uuid"] as? String else { - resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "The SetupIntent is missing sdk_uuid field. This method requires you to use the SetupIntent that was returned from either createPaymentIntent or retrievePaymentIntent.")) + guard let uuid = setupIntentJson["sdkUuid"] as? String else { + resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "The SetupIntent is missing sdkUuid field. This method requires you to use the SetupIntent that was returned from either createPaymentIntent or retrievePaymentIntent.")) return } guard let setupIntent = self.setupIntents[uuid] else { - resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "No SetupIntent was found with the sdk_uuid \(uuid). The SetupIntent provided must be re-retrieved with retrieveSetupIntent or a new SetupIntent must be created with createSetupIntent.")) + resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "No SetupIntent was found with the sdkUuid \(uuid). The SetupIntent provided must be re-retrieved with retrieveSetupIntent or a new SetupIntent must be created with createSetupIntent.")) return } Terminal.shared.cancelSetupIntent(setupIntent) { si, collectError in @@ -786,12 +788,12 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe return } - guard let uuid = setupIntentJson["sdk_uuid"] as? String else { - resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "The SetupIntent is missing sdk_uuid field. This method requires you to use the SetupIntent that was returned from either createPaymentIntent or retrievePaymentIntent.")) + guard let uuid = setupIntentJson["sdkUuid"] as? String else { + resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "The SetupIntent is missing sdkUuid field. This method requires you to use the SetupIntent that was returned from either createPaymentIntent or retrievePaymentIntent.")) return } guard let setupIntent = self.setupIntents[uuid] else { - resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "No SetupIntent was found with the sdk_uuid \(uuid). The SetupIntent provided must be re-retrieved with retrieveSetupIntent or a new SetupIntent must be created with createSetupIntent.")) + resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "No SetupIntent was found with the sdkUuid \(uuid). The SetupIntent provided must be re-retrieved with retrieveSetupIntent or a new SetupIntent must be created with createSetupIntent.")) return } @@ -805,7 +807,7 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe resolve(Errors.createError(nsError: error as NSError)) return } - + self.collectSetupIntentCancelable = Terminal.shared.collectSetupIntentPaymentMethod(setupIntent, customerConsentCollected: customerConsentCollected, setupConfig: setupIntentConfiguration) { si, collectError in if let error = collectError as NSError? { @@ -820,12 +822,12 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe @objc(confirmSetupIntent:resolver:rejecter:) func confirmSetupIntent(setupIntentJson: NSDictionary, resolver resolve: @escaping RCTPromiseResolveBlock, rejecter reject: @escaping RCTPromiseRejectBlock) { - guard let uuid = setupIntentJson["sdk_uuid"] as? String else { - resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "The SetupIntent is missing sdk_uuid field. This method requires you to use the SetupIntent that was returned from either createPaymentIntent or retrievePaymentIntent.")) + guard let uuid = setupIntentJson["sdkUuid"] as? String else { + resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "The SetupIntent is missing sdkUuid field. This method requires you to use the SetupIntent that was returned from either createPaymentIntent or retrievePaymentIntent.")) return } guard let setupIntent = self.setupIntents[uuid] else { - resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "No SetupIntent was found with the sdk_uuid \(uuid). The SetupIntent provided must be re-retrieved with retrieveSetupIntent or a new SetupIntent must be created with createSetupIntent.")) + resolve(Errors.createError(code: CommonErrorType.InvalidRequiredParameter, message: "No SetupIntent was found with the sdkUuid \(uuid). The SetupIntent provided must be re-retrieved with retrieveSetupIntent or a new SetupIntent must be created with createSetupIntent.")) return } @@ -867,7 +869,7 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe resolve(Errors.createError(nsError: error as NSError)) return } - + let refundConfiguration: RefundConfiguration do { refundConfiguration = try RefundConfigurationBuilder().setEnableCustomerCancellation(enableCustomerCancellation) @@ -917,12 +919,12 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe "offlinePaymentsCount": Terminal.shared.offlineStatus.sdk.paymentsCount ?? 0, "offlinePaymentAmountsByCurrency": Terminal.shared.offlineStatus.sdk.paymentAmountsByCurrency ] - + let readDic: NSDictionary = [ "offlinePaymentsCount": Terminal.shared.offlineStatus.reader?.paymentsCount ?? 0, "offlinePaymentAmountsByCurrency": Terminal.shared.offlineStatus.reader?.paymentAmountsByCurrency ?? {} ] - + resolve(["sdk": sdkDic, "reader": readDic]) } @@ -1004,12 +1006,12 @@ class StripeTerminalReactNative: RCTEventEmitter, DiscoveryDelegate, BluetoothRe let offlineStatus = Mappers.mapFromOfflineStatus(offlineStatus) sendEvent(withName: ReactNativeConstants.CHANGE_OFFLINE_STATUS.rawValue, body: ["result": offlineStatus]) } - + func terminal(_ terminal: Terminal, didForwardPaymentIntent intent: PaymentIntent, error: Error?) { let result = Mappers.mapFromPaymentIntent(intent, uuid: "") sendEvent(withName: ReactNativeConstants.FORWARD_PAYMENT_INTENT.rawValue, body: ["result": result]) } - + func terminal(_ terminal: Terminal, didReportForwardingError error: Error) { let result = Errors.createError(nsError: error as NSError) sendEvent(withName: ReactNativeConstants.REPORT_FORWARDING_ERROR.rawValue, body: ["result": result]) diff --git a/src/types/PaymentIntent.ts b/src/types/PaymentIntent.ts index caea5de9..b9e8e7e5 100644 --- a/src/types/PaymentIntent.ts +++ b/src/types/PaymentIntent.ts @@ -8,7 +8,8 @@ export namespace PaymentIntent { created: string; currency: string; status: Status; - sdk_uuid: string; + sdkUuid: string; + paymentMethodId: string; } export type Status = diff --git a/src/types/SetupIntent.ts b/src/types/SetupIntent.ts index 0e6ff461..649ba5f2 100644 --- a/src/types/SetupIntent.ts +++ b/src/types/SetupIntent.ts @@ -8,7 +8,7 @@ export namespace SetupIntent { status: Status; latestAttempt: SetupAttempt; usage: Usage; - sdk_uuid: string; + sdkUuid: string; }; export type Status = diff --git a/src/types/index.ts b/src/types/index.ts index 0a26698e..4de5c295 100644 --- a/src/types/index.ts +++ b/src/types/index.ts @@ -160,6 +160,7 @@ export type CreatePaymentIntentParams = CreatePaymentIntentIOSParams & { applicationFeeAmount?: number; stripeDescription?: string; statementDescriptor?: string; + statementDescriptorSuffix?: string; receiptEmail?: string; customer?: string; transferGroup?: string;