@primer-io/react-native 2.21.0 → 2.21.1
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/android/src/main/java/com/primerioreactnative/PrimerRNHeadlessUniversalCheckoutListener.kt +24 -3
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerPaymentMethodDataRN.kt +1 -1
- package/android/src/main/java/com/primerioreactnative/extensions/PrimerPaymentMethodData.kt +1 -1
- package/ios/Sources/Headless Universal Checkout/RNTPrimerHeadlessUniversalCheckout.swift +3 -1
- package/ios/Sources/Helpers/PrimerCheckoutPaymentMethodData+RN.swift +21 -0
- package/ios/Sources/RNTPrimer.swift +4 -2
- package/ios/Sources/version.swift +1 -1
- package/lib/typescript/models/PrimerCheckoutPaymentMethodData.d.ts +1 -0
- package/lib/typescript/models/PrimerCheckoutPaymentMethodData.d.ts.map +1 -1
- package/package.json +1 -1
- package/src/models/PrimerCheckoutPaymentMethodData.ts +6 -1
package/android/src/main/java/com/primerioreactnative/PrimerRNHeadlessUniversalCheckoutListener.kt
CHANGED
|
@@ -68,21 +68,42 @@ class PrimerRNHeadlessUniversalCheckoutListener : PrimerHeadlessUniversalCheckou
|
|
|
68
68
|
override fun onPreparationStarted(paymentMethodType: String) {
|
|
69
69
|
sendEvent?.invoke(
|
|
70
70
|
PrimerHeadlessUniversalCheckoutEvent.ON_PREPARE_START.eventName,
|
|
71
|
-
JSONObject(
|
|
71
|
+
JSONObject(
|
|
72
|
+
Json.encodeToString(
|
|
73
|
+
PrimerPaymentMethodDataRN(
|
|
74
|
+
paymentMethodType = paymentMethodType,
|
|
75
|
+
paymentMethod = paymentMethodType
|
|
76
|
+
)
|
|
77
|
+
)
|
|
78
|
+
)
|
|
72
79
|
)
|
|
73
80
|
}
|
|
74
81
|
|
|
75
82
|
override fun onPaymentMethodShowed(paymentMethodType: String) {
|
|
76
83
|
sendEvent?.invoke(
|
|
77
84
|
PrimerHeadlessUniversalCheckoutEvent.ON_PAYMENT_METHOD_SHOW.eventName,
|
|
78
|
-
JSONObject(
|
|
85
|
+
JSONObject(
|
|
86
|
+
Json.encodeToString(
|
|
87
|
+
PrimerPaymentMethodDataRN(
|
|
88
|
+
paymentMethodType = paymentMethodType,
|
|
89
|
+
paymentMethod = paymentMethodType
|
|
90
|
+
)
|
|
91
|
+
)
|
|
92
|
+
)
|
|
79
93
|
)
|
|
80
94
|
}
|
|
81
95
|
|
|
82
96
|
override fun onTokenizationStarted(paymentMethodType: String) {
|
|
83
97
|
sendEvent?.invoke(
|
|
84
98
|
PrimerHeadlessUniversalCheckoutEvent.ON_TOKENIZE_START.eventName,
|
|
85
|
-
JSONObject(
|
|
99
|
+
JSONObject(
|
|
100
|
+
Json.encodeToString(
|
|
101
|
+
PrimerPaymentMethodDataRN(
|
|
102
|
+
paymentMethodType = paymentMethodType,
|
|
103
|
+
paymentMethod = paymentMethodType
|
|
104
|
+
)
|
|
105
|
+
)
|
|
106
|
+
)
|
|
86
107
|
)
|
|
87
108
|
}
|
|
88
109
|
|
|
@@ -4,4 +4,4 @@ import com.primerioreactnative.datamodels.PrimerPaymentMethodDataRN
|
|
|
4
4
|
import io.primer.android.domain.tokenization.models.PrimerPaymentMethodData
|
|
5
5
|
|
|
6
6
|
internal fun PrimerPaymentMethodData.toPrimerPaymentMethodDataRN() =
|
|
7
|
-
PrimerPaymentMethodDataRN(paymentMethodType)
|
|
7
|
+
PrimerPaymentMethodDataRN(paymentMethodType, paymentMethodType)
|
|
@@ -450,7 +450,9 @@ extension RNTPrimerHeadlessUniversalCheckout: PrimerHeadlessUniversalCheckoutDel
|
|
|
450
450
|
}
|
|
451
451
|
|
|
452
452
|
do {
|
|
453
|
-
let checkoutPaymentmethodJson = try data
|
|
453
|
+
let checkoutPaymentmethodJson = try data
|
|
454
|
+
.toPrimerCheckoutPaymentMethodDataRN()
|
|
455
|
+
.toJsonObject()
|
|
454
456
|
self.sendEvent(
|
|
455
457
|
withName: rnCallbackName,
|
|
456
458
|
body: checkoutPaymentmethodJson)
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PrimerCheckoutPaymentMethodData+RN.swift
|
|
3
|
+
// primer-io-react-native
|
|
4
|
+
//
|
|
5
|
+
// Created by Niall Quinn on 19/03/24.
|
|
6
|
+
//
|
|
7
|
+
|
|
8
|
+
import Foundation
|
|
9
|
+
import PrimerSDK
|
|
10
|
+
|
|
11
|
+
extension PrimerCheckoutPaymentMethodData {
|
|
12
|
+
func toPrimerCheckoutPaymentMethodDataRN() -> PrimerCheckoutPaymentMethodDataRN {
|
|
13
|
+
PrimerCheckoutPaymentMethodDataRN(paymentMethodType: self.paymentMethodType,
|
|
14
|
+
paymentMethod: self.paymentMethodType.type)
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
|
|
18
|
+
struct PrimerCheckoutPaymentMethodDataRN: Codable {
|
|
19
|
+
let paymentMethodType: PrimerCheckoutPaymentMethodType
|
|
20
|
+
let paymentMethod: String
|
|
21
|
+
}
|
|
@@ -348,6 +348,7 @@ extension RNTPrimer: PrimerDelegate {
|
|
|
348
348
|
|
|
349
349
|
|
|
350
350
|
func primerWillCreatePaymentWithData(_ data: PrimerCheckoutPaymentMethodData, decisionHandler: @escaping (PrimerPaymentCreationDecision) -> Void) {
|
|
351
|
+
|
|
351
352
|
if self.implementedRNCallbacks?.isOnBeforePaymentCreateImplemented == true {
|
|
352
353
|
self.primerWillCreatePaymentWithDataDecisionHandler = { errorMessage in
|
|
353
354
|
DispatchQueue.main.async {
|
|
@@ -361,8 +362,9 @@ extension RNTPrimer: PrimerDelegate {
|
|
|
361
362
|
|
|
362
363
|
DispatchQueue.main.async {
|
|
363
364
|
do {
|
|
364
|
-
let
|
|
365
|
-
|
|
365
|
+
let checkoutPaymentmethodJson = try data
|
|
366
|
+
.toPrimerCheckoutPaymentMethodDataRN()
|
|
367
|
+
.toJsonObject()
|
|
366
368
|
self.sendEvent(withName: PrimerEvents.onBeforePaymentCreate.stringValue, body: checkoutPaymentmethodJson)
|
|
367
369
|
} catch {
|
|
368
370
|
self.handleRNBridgeError(error, checkoutData: nil, stopOnDebug: true)
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// swiftlint:disable:next identifier_name
|
|
2
|
-
public let PrimerReactNativeSDKVersion = "2.21.
|
|
2
|
+
public let PrimerReactNativeSDKVersion = "2.21.1"
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export declare type PrimerCheckoutPaymentMethodData = IPrimerCheckoutPaymentMethodData;
|
|
2
2
|
interface IPrimerCheckoutPaymentMethodData {
|
|
3
3
|
paymentMethodType: string;
|
|
4
|
+
paymentMethod: string;
|
|
4
5
|
}
|
|
5
6
|
export {};
|
|
6
7
|
//# sourceMappingURL=PrimerCheckoutPaymentMethodData.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"PrimerCheckoutPaymentMethodData.d.ts","sourceRoot":"","sources":["../../../src/models/PrimerCheckoutPaymentMethodData.ts"],"names":[],"mappings":"AAAA,oBAAY,+BAA+B,GAAG,gCAAgC,CAAC;AAE/E,UAAU,gCAAgC;
|
|
1
|
+
{"version":3,"file":"PrimerCheckoutPaymentMethodData.d.ts","sourceRoot":"","sources":["../../../src/models/PrimerCheckoutPaymentMethodData.ts"],"names":[],"mappings":"AAAA,oBAAY,+BAA+B,GAAG,gCAAgC,CAAC;AAE/E,UAAU,gCAAgC;IAItC,iBAAiB,EAAE,MAAM,CAAC;IAE1B,aAAa,EAAE,MAAM,CAAC;CACzB"}
|
package/package.json
CHANGED