@primer-io/react-native 0.11.3 → 0.12.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/android/build.gradle
CHANGED
|
@@ -128,5 +128,5 @@ dependencies {
|
|
|
128
128
|
api 'com.facebook.react:react-native:+'
|
|
129
129
|
implementation "org.jetbrains.kotlin:kotlin-stdlib:$kotlin_version"
|
|
130
130
|
implementation "org.jetbrains.kotlinx:kotlinx-serialization-json:1.2.2"
|
|
131
|
-
implementation 'io.primer:android:1.
|
|
131
|
+
implementation 'io.primer:android:1.10.0'
|
|
132
132
|
}
|
|
@@ -22,13 +22,12 @@ extension PrimerRN: PrimerDelegate {
|
|
|
22
22
|
resumeHandler: ResumeHandlerProtocol
|
|
23
23
|
) {
|
|
24
24
|
do {
|
|
25
|
-
let
|
|
26
|
-
let
|
|
27
|
-
self.onTokenizeSuccessCallback?([
|
|
25
|
+
let json = try encoder.encode(paymentMethodToken)
|
|
26
|
+
let data = String(data: json, encoding: .utf8)!
|
|
27
|
+
self.onTokenizeSuccessCallback?([data])
|
|
28
28
|
} catch {
|
|
29
29
|
checkoutFailed(with: ErrorTypeRN.ParseJsonFailed)
|
|
30
30
|
}
|
|
31
|
-
|
|
32
31
|
onResumeFlowCallback = { error, clientToken in
|
|
33
32
|
if let error = error {
|
|
34
33
|
resumeHandler.handle(error: error)
|
package/ios/PrimerRN.swift
CHANGED
|
@@ -28,31 +28,31 @@ class PrimerRN: NSObject {
|
|
|
28
28
|
private var sdkWasInitialised = false
|
|
29
29
|
internal var haltExecution = false
|
|
30
30
|
|
|
31
|
-
@objc func configureSettings(_
|
|
31
|
+
@objc func configureSettings(_ request: String) {
|
|
32
32
|
do {
|
|
33
|
-
let
|
|
34
|
-
let
|
|
35
|
-
self.settings =
|
|
33
|
+
let json = request.data(using: .utf8)!
|
|
34
|
+
let settings = try JSONDecoder().decode(PrimerSettingsRN.self, from: json)
|
|
35
|
+
self.settings = settings
|
|
36
36
|
} catch {
|
|
37
37
|
checkoutFailed(with: ErrorTypeRN.ParseJsonFailed)
|
|
38
38
|
}
|
|
39
39
|
}
|
|
40
40
|
|
|
41
|
-
@objc func configureTheme(_
|
|
41
|
+
@objc func configureTheme(_ request: String) {
|
|
42
42
|
do {
|
|
43
|
-
let
|
|
44
|
-
let themeRN = try JSONDecoder().decode(PrimerThemeRN.self, from:
|
|
43
|
+
let json = request.data(using: .utf8)!
|
|
44
|
+
let themeRN = try JSONDecoder().decode(PrimerThemeRN.self, from: json)
|
|
45
45
|
self.theme = themeRN
|
|
46
46
|
} catch {
|
|
47
47
|
checkoutFailed(with: ErrorTypeRN.ParseJsonFailed)
|
|
48
48
|
}
|
|
49
49
|
}
|
|
50
50
|
|
|
51
|
-
@objc func configureIntent(_
|
|
51
|
+
@objc func configureIntent(_ request: String) {
|
|
52
52
|
do {
|
|
53
|
-
let
|
|
54
|
-
let
|
|
55
|
-
self.intent =
|
|
53
|
+
let json = request.data(using: .utf8)!
|
|
54
|
+
let intent = try JSONDecoder().decode(PrimerIntentRN.self, from: json)
|
|
55
|
+
self.intent = intent
|
|
56
56
|
} catch {
|
|
57
57
|
checkoutFailed(with: ErrorTypeRN.ParseJsonFailed)
|
|
58
58
|
}
|
|
@@ -112,27 +112,26 @@ class PrimerRN: NSObject {
|
|
|
112
112
|
Primer.shared.showUniversalCheckout(on: viewController, clientToken: token)
|
|
113
113
|
}
|
|
114
114
|
}
|
|
115
|
-
|
|
116
115
|
} catch {
|
|
117
116
|
self?.checkoutFailed(with: error)
|
|
118
117
|
}
|
|
119
118
|
}
|
|
120
119
|
}
|
|
121
120
|
|
|
122
|
-
@objc func resume(_
|
|
121
|
+
@objc func resume(_ request: String) -> Void {
|
|
123
122
|
DispatchQueue.main.async { [weak self] in
|
|
124
123
|
do {
|
|
125
|
-
let
|
|
126
|
-
let
|
|
124
|
+
let json = request.data(using: .utf8)!
|
|
125
|
+
let request = try JSONDecoder().decode(PrimerResumeRequest.self, from: json)
|
|
127
126
|
|
|
128
|
-
if let error =
|
|
129
|
-
|
|
130
|
-
|
|
131
|
-
} else if let clientToken = resumeRequest.token {
|
|
127
|
+
if let error = request.error {
|
|
128
|
+
self?.onResumeFlowCallback?(ErrorRN(message: error), nil)
|
|
129
|
+
} else if let clientToken = request.token {
|
|
132
130
|
self?.onResumeFlowCallback?(nil, clientToken)
|
|
133
131
|
} else {
|
|
134
132
|
self?.onResumeFlowCallback?(nil, nil)
|
|
135
133
|
}
|
|
134
|
+
|
|
136
135
|
self?.onResumeFlowCallback = nil
|
|
137
136
|
} catch {
|
|
138
137
|
self?.checkoutFailed(with: error)
|
|
@@ -140,16 +139,15 @@ class PrimerRN: NSObject {
|
|
|
140
139
|
}
|
|
141
140
|
}
|
|
142
141
|
|
|
143
|
-
@objc func actionResume(_
|
|
142
|
+
@objc func actionResume(_ request: String) -> Void {
|
|
144
143
|
DispatchQueue.main.async { [weak self] in
|
|
145
144
|
do {
|
|
146
|
-
let
|
|
147
|
-
let
|
|
145
|
+
let json = request.data(using: .utf8)!
|
|
146
|
+
let request = try JSONDecoder().decode(PrimerResumeRequest.self, from: json)
|
|
148
147
|
|
|
149
|
-
if let error =
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
} else if let clientToken = resumeRequestRN.token {
|
|
148
|
+
if let error = request.error {
|
|
149
|
+
self?.onActionResumeCallback?(ErrorRN(message: error), nil)
|
|
150
|
+
} else if let clientToken = request.token {
|
|
153
151
|
self?.onActionResumeCallback?(nil, clientToken)
|
|
154
152
|
} else {
|
|
155
153
|
self?.onActionResumeCallback?(nil, self?.clientToken)
|