@primer-io/react-native 0.6.3 → 0.6.7
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/.gradle/7.0.2/dependencies-accessors/dependencies-accessors.lock +0 -0
- package/android/.gradle/7.0.2/dependencies-accessors/gc.properties +0 -0
- package/android/.gradle/7.0.2/executionHistory/executionHistory.lock +0 -0
- package/android/.gradle/7.0.2/fileChanges/last-build.bin +0 -0
- package/android/.gradle/7.0.2/fileHashes/fileHashes.lock +0 -0
- package/android/.gradle/7.0.2/gc.properties +0 -0
- package/android/.gradle/buildOutputCleanup/buildOutputCleanup.lock +0 -0
- package/android/.gradle/buildOutputCleanup/cache.properties +2 -0
- package/android/.gradle/checksums/checksums.lock +0 -0
- package/android/.gradle/checksums/md5-checksums.bin +0 -0
- package/android/.gradle/checksums/sha1-checksums.bin +0 -0
- package/android/.gradle/vcs-1/gc.properties +0 -0
- package/android/build.gradle +1 -1
- package/android/src/main/java/com/primerioreactnative/PrimerRN.kt +34 -61
- package/android/src/main/java/com/primerioreactnative/PrimerRNEventListener.kt +21 -3
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerRequestRN.kt +1 -0
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerSettingsRN.kt +85 -12
- package/android/src/main/java/com/primerioreactnative/datamodels/PrimerThemeRN.kt +6 -14
- package/ios/DataModels/PrimerRequestRN.swift +1 -0
- package/ios/DataModels/PrimerSettingsRN.swift +33 -5
- package/ios/PrimerRN+PrimerDelegate.swift +86 -0
- package/ios/PrimerRN.swift +10 -4
- package/ios/ReactNative.m +2 -0
- package/ios/ReactNative.xcodeproj/project.pbxproj +0 -44
- package/lib/commonjs/Primer.js +25 -3
- package/lib/commonjs/Primer.js.map +1 -1
- package/lib/commonjs/models/action-request.js +2 -0
- package/lib/commonjs/models/action-request.js.map +1 -0
- package/lib/module/Primer.js +25 -3
- package/lib/module/Primer.js.map +1 -1
- package/lib/module/models/action-request.js +2 -0
- package/lib/module/models/action-request.js.map +1 -0
- package/lib/typescript/models/action-request.d.ts +10 -0
- package/lib/typescript/models/primer-callbacks.d.ts +2 -0
- package/lib/typescript/models/primer-config.d.ts +1 -0
- package/lib/typescript/models/primer-request.d.ts +2 -2
- package/lib/typescript/models/primer-settings.d.ts +8 -6
- package/package.json +1 -1
- package/primer-io-react-native.podspec +1 -1
- package/src/Primer.ts +24 -3
- package/src/models/action-request.ts +12 -0
- package/src/models/primer-callbacks.ts +6 -0
- package/src/models/primer-config.ts +3 -0
- package/src/models/primer-request.ts +2 -2
- package/src/models/primer-settings.ts +8 -6
- package/ios/Podfile.lock +0 -3
- package/ios/ReactNative.xcworkspace/xcuserdata/carleriksson.xcuserdatad/UserInterfaceState.xcuserstate +0 -0
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
Binary file
|
|
File without changes
|
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.4.0'
|
|
132
132
|
}
|
|
@@ -8,6 +8,7 @@ import com.facebook.react.bridge.ReactContextBaseJavaModule
|
|
|
8
8
|
import com.facebook.react.bridge.ReactMethod
|
|
9
9
|
import com.primerioreactnative.datamodels.*
|
|
10
10
|
import io.primer.android.Primer
|
|
11
|
+
import io.primer.android.model.dto.*
|
|
11
12
|
import kotlinx.serialization.decodeFromString
|
|
12
13
|
import kotlinx.serialization.encodeToString
|
|
13
14
|
import kotlinx.serialization.json.Json
|
|
@@ -87,6 +88,11 @@ class PrimerRN(reactContext: ReactApplicationContext) : ReactContextBaseJavaModu
|
|
|
87
88
|
mListener.configureOnTokenizeSuccess(callback)
|
|
88
89
|
}
|
|
89
90
|
|
|
91
|
+
@ReactMethod
|
|
92
|
+
fun configureOnResumeSuccess(callback: Callback) {
|
|
93
|
+
mListener.configureOnResumeSuccess(callback)
|
|
94
|
+
}
|
|
95
|
+
|
|
90
96
|
@ReactMethod
|
|
91
97
|
fun configureOnVaultSuccess(callback: Callback) {
|
|
92
98
|
mListener.configureOnVaultSuccess(callback)
|
|
@@ -113,9 +119,28 @@ class PrimerRN(reactContext: ReactApplicationContext) : ReactContextBaseJavaModu
|
|
|
113
119
|
}
|
|
114
120
|
|
|
115
121
|
private fun startSdk(token: String) {
|
|
116
|
-
val
|
|
117
|
-
val
|
|
118
|
-
|
|
122
|
+
val theme = theme.format()
|
|
123
|
+
val settings = settings.format()
|
|
124
|
+
val config = PrimerConfig(theme, settings)
|
|
125
|
+
|
|
126
|
+
// todo: refactor with next version
|
|
127
|
+
mListener.completion = { error, clientToken ->
|
|
128
|
+
currentActivity?.let {
|
|
129
|
+
it.runOnUiThread {
|
|
130
|
+
if (error) {
|
|
131
|
+
Primer.instance.showError()
|
|
132
|
+
} else {
|
|
133
|
+
if (clientToken == null) {
|
|
134
|
+
mListener.resumeHandler?.handleSuccess()
|
|
135
|
+
} else {
|
|
136
|
+
mListener.resumeHandler?.handleNewClientToken(clientToken)
|
|
137
|
+
}
|
|
138
|
+
}
|
|
139
|
+
}
|
|
140
|
+
}
|
|
141
|
+
}
|
|
142
|
+
|
|
143
|
+
Primer.instance.configure(config, mListener)
|
|
119
144
|
sdkWasInitialised = true
|
|
120
145
|
}
|
|
121
146
|
|
|
@@ -125,28 +150,12 @@ class PrimerRN(reactContext: ReactApplicationContext) : ReactContextBaseJavaModu
|
|
|
125
150
|
|
|
126
151
|
if (!sdkWasInitialised) startSdk(token)
|
|
127
152
|
|
|
128
|
-
Primer.
|
|
129
|
-
try {
|
|
130
|
-
val paymentMethods = data.map { PrimerPaymentInstrumentTokenRN.fromPaymentMethodToken(it) }
|
|
131
|
-
val request = json.encodeToString(paymentMethods)
|
|
132
|
-
mListener.onSavedPaymentInstrumentsFetchedQueue?.addRequestAndPoll(request)
|
|
133
|
-
} catch (e: Exception) {
|
|
134
|
-
Log.e("PrimerRN", "fetch saved payment methods error: $e")
|
|
135
|
-
val exception = PrimerErrorRN(
|
|
136
|
-
ErrorTypeRN.ParseJsonFailed,
|
|
137
|
-
"failed to parse fetched payment methods.",
|
|
138
|
-
)
|
|
139
|
-
val encoded = json.encodeToString(exception)
|
|
140
|
-
mListener.onPrimerErrorQueue?.addRequestAndPoll(encoded)
|
|
141
|
-
haltExecution = true
|
|
142
|
-
}
|
|
143
|
-
}
|
|
153
|
+
Primer.instance.fetchSavedPaymentInstruments(token)
|
|
144
154
|
}
|
|
145
155
|
|
|
146
156
|
@ReactMethod
|
|
147
157
|
fun initialize(token: String) {
|
|
148
158
|
try {
|
|
149
|
-
|
|
150
159
|
if (haltExecution) {
|
|
151
160
|
haltExecution = false
|
|
152
161
|
return
|
|
@@ -154,50 +163,13 @@ class PrimerRN(reactContext: ReactApplicationContext) : ReactContextBaseJavaModu
|
|
|
154
163
|
|
|
155
164
|
Log.d("PrimerRN", "init with client token: $token")
|
|
156
165
|
|
|
157
|
-
val theme = this.theme.primerTheme
|
|
158
|
-
|
|
159
|
-
val context = currentActivity as Context
|
|
160
|
-
|
|
161
166
|
startSdk(token)
|
|
162
167
|
|
|
163
|
-
val
|
|
164
|
-
Primer.loadPaymentMethods(paymentMethods)
|
|
165
|
-
|
|
166
|
-
mListener.completion = { error ->
|
|
167
|
-
currentActivity?.let {
|
|
168
|
-
it.runOnUiThread {
|
|
169
|
-
if (error) {
|
|
170
|
-
Primer.showError()
|
|
171
|
-
} else {
|
|
172
|
-
Primer.showSuccess()
|
|
173
|
-
}
|
|
174
|
-
}
|
|
175
|
-
}
|
|
176
|
-
}
|
|
168
|
+
val context = currentActivity as Context
|
|
177
169
|
|
|
178
170
|
when (intent.vault) {
|
|
179
|
-
false -> Primer.
|
|
180
|
-
|
|
181
|
-
mListener,
|
|
182
|
-
isStandalonePaymentMethod = paymentMethods.size < 2,
|
|
183
|
-
doNotShowUi = !(settings.options?.isLoadingScreenEnabled ?: true),
|
|
184
|
-
preferWebView = true,
|
|
185
|
-
currency = settings.order?.currency,
|
|
186
|
-
amount = settings.order?.amount,
|
|
187
|
-
clearAllListeners = true,
|
|
188
|
-
webBrowserRedirectScheme = settings.options?.android?.redirectScheme,
|
|
189
|
-
)
|
|
190
|
-
true -> Primer.showVault(
|
|
191
|
-
context,
|
|
192
|
-
mListener,
|
|
193
|
-
isStandalonePaymentMethod = paymentMethods.size < 2,
|
|
194
|
-
doNotShowUi = !(settings.options?.isLoadingScreenEnabled ?: true),
|
|
195
|
-
preferWebView = true,
|
|
196
|
-
currency = settings.order?.currency,
|
|
197
|
-
amount = settings.order?.amount,
|
|
198
|
-
clearAllListeners = true,
|
|
199
|
-
webBrowserRedirectScheme = settings.options?.android?.redirectScheme,
|
|
200
|
-
)
|
|
171
|
+
false -> Primer.instance.showUniversalCheckout(context, token)
|
|
172
|
+
true -> Primer.instance.showVaultManager(context, token)
|
|
201
173
|
}
|
|
202
174
|
} catch (e: Exception) {
|
|
203
175
|
Log.e("PrimerRN", "init error: $e")
|
|
@@ -213,8 +185,9 @@ class PrimerRN(reactContext: ReactApplicationContext) : ReactContextBaseJavaModu
|
|
|
213
185
|
@ReactMethod
|
|
214
186
|
fun resume(request: String) {
|
|
215
187
|
try {
|
|
188
|
+
Log.d("PrimerRN", "resume: $request")
|
|
216
189
|
val data = json.decodeFromString<PrimerResumeRequest>(request)
|
|
217
|
-
mListener.completion?.invoke(data.error)
|
|
190
|
+
mListener.completion?.invoke(data.error, data.token)
|
|
218
191
|
} catch (e: Exception) {
|
|
219
192
|
Log.e("PrimerRN", "configure settings error: $e")
|
|
220
193
|
val exception = PrimerErrorRN(
|
|
@@ -7,7 +7,7 @@ import com.primerioreactnative.datamodels.PrimerErrorRN
|
|
|
7
7
|
import com.primerioreactnative.datamodels.PrimerPaymentInstrumentTokenRN
|
|
8
8
|
import com.primerioreactnative.utils.PrimerEventQueueRN
|
|
9
9
|
import io.primer.android.CheckoutEventListener
|
|
10
|
-
import io.primer.android.
|
|
10
|
+
import io.primer.android.completion.ResumeHandler
|
|
11
11
|
import io.primer.android.events.CheckoutEvent
|
|
12
12
|
import kotlinx.serialization.encodeToString
|
|
13
13
|
import kotlinx.serialization.json.Json
|
|
@@ -15,18 +15,26 @@ import kotlinx.serialization.json.Json
|
|
|
15
15
|
class PrimerRNEventListener : CheckoutEventListener {
|
|
16
16
|
|
|
17
17
|
private var onTokenizeSuccessQueue: PrimerEventQueueRN? = null
|
|
18
|
+
private var onResumeSuccessQueue: PrimerEventQueueRN? = null
|
|
18
19
|
private var onVaultSuccessQueue: PrimerEventQueueRN? = null
|
|
19
20
|
private var onDismissQueue: PrimerEventQueueRN? = null
|
|
20
21
|
var onPrimerErrorQueue: PrimerEventQueueRN? = null
|
|
21
22
|
var onSavedPaymentInstrumentsFetchedQueue: PrimerEventQueueRN? = null
|
|
22
23
|
|
|
23
|
-
var completion: ((error: Boolean) -> Unit)? = null
|
|
24
|
+
var completion: ((error: Boolean, token: String?) -> Unit)? = null
|
|
25
|
+
|
|
26
|
+
var resumeHandler: ResumeHandler? = null
|
|
24
27
|
|
|
25
28
|
fun configureOnTokenizeSuccess(callback: Callback) {
|
|
26
29
|
onTokenizeSuccessQueue = PrimerEventQueueRN()
|
|
27
30
|
onTokenizeSuccessQueue?.poll(callback)
|
|
28
31
|
}
|
|
29
32
|
|
|
33
|
+
fun configureOnResumeSuccess(callback: Callback) {
|
|
34
|
+
onResumeSuccessQueue = PrimerEventQueueRN()
|
|
35
|
+
onResumeSuccessQueue?.poll(callback)
|
|
36
|
+
}
|
|
37
|
+
|
|
30
38
|
fun configureOnVaultSuccess(callback: Callback) {
|
|
31
39
|
onVaultSuccessQueue = PrimerEventQueueRN()
|
|
32
40
|
onVaultSuccessQueue?.poll(callback)
|
|
@@ -58,14 +66,24 @@ class PrimerRNEventListener : CheckoutEventListener {
|
|
|
58
66
|
val token = PrimerPaymentInstrumentTokenRN.fromPaymentMethodToken(e.data)
|
|
59
67
|
val request = Json.encodeToString(token)
|
|
60
68
|
onTokenizeSuccessQueue?.addRequestAndPoll(request)
|
|
69
|
+
resumeHandler = e.resumeHandler
|
|
61
70
|
}
|
|
62
71
|
is CheckoutEvent.TokenSelected -> {
|
|
63
72
|
val token = PrimerPaymentInstrumentTokenRN.fromPaymentMethodToken(e.data)
|
|
64
73
|
val request = Json.encodeToString(token)
|
|
65
74
|
onTokenizeSuccessQueue?.addRequestAndPoll(request)
|
|
66
75
|
}
|
|
76
|
+
is CheckoutEvent.ResumeSuccess -> {
|
|
77
|
+
val token = e.resumeToken
|
|
78
|
+
onResumeSuccessQueue?.addRequestAndPoll(token)
|
|
79
|
+
resumeHandler = e.resumeHandler
|
|
80
|
+
}
|
|
81
|
+
is CheckoutEvent.SavedPaymentInstrumentsFetched -> {
|
|
82
|
+
val list = e.data.map { PrimerPaymentInstrumentTokenRN.fromPaymentMethodToken(it) }
|
|
83
|
+
val request = Json.encodeToString(list)
|
|
84
|
+
onSavedPaymentInstrumentsFetchedQueue?.addRequestAndPoll(request)
|
|
85
|
+
}
|
|
67
86
|
is CheckoutEvent.Exit -> {
|
|
68
|
-
println("🔥 exit event ${e.data}")
|
|
69
87
|
onDismissQueue?.addRequestAndPoll("dismiss")
|
|
70
88
|
onDismissQueue = null
|
|
71
89
|
}
|
|
@@ -1,14 +1,24 @@
|
|
|
1
1
|
package com.primerioreactnative.datamodels
|
|
2
2
|
|
|
3
|
+
import io.primer.android.model.PrimerDebugOptions
|
|
4
|
+
import io.primer.android.model.dto.*
|
|
3
5
|
import kotlinx.serialization.Serializable
|
|
4
6
|
|
|
5
7
|
@Serializable
|
|
6
8
|
class PrimerSettingsRN(
|
|
7
9
|
val order: OrderRN? = null,
|
|
8
10
|
val business: BusinessRN? = null,
|
|
9
|
-
val customer: CustomerRN? = null,
|
|
10
|
-
val options: OptionsRN? = null,
|
|
11
|
-
)
|
|
11
|
+
private val customer: CustomerRN? = null,
|
|
12
|
+
private val options: OptionsRN? = null,
|
|
13
|
+
) {
|
|
14
|
+
fun format(): PrimerSettings {
|
|
15
|
+
val order = order?.format() ?: Order()
|
|
16
|
+
val customer = customer?.format() ?: Customer()
|
|
17
|
+
val business = business?.format() ?: Business()
|
|
18
|
+
val options = options?.format() ?: Options()
|
|
19
|
+
return PrimerSettings(order, customer, business, options)
|
|
20
|
+
}
|
|
21
|
+
}
|
|
12
22
|
|
|
13
23
|
@Serializable
|
|
14
24
|
data class OrderRN(
|
|
@@ -17,7 +27,16 @@ data class OrderRN(
|
|
|
17
27
|
val countryCode: String? = null,
|
|
18
28
|
val items: List<OrderItemRN>? = null,
|
|
19
29
|
val shipping: PrimerAddressRN? = null,
|
|
20
|
-
)
|
|
30
|
+
) {
|
|
31
|
+
fun format(): Order {
|
|
32
|
+
return Order(
|
|
33
|
+
amount = amount,
|
|
34
|
+
currency = currency,
|
|
35
|
+
countryCode = countryCode?.let { CountryCode.valueOf(it) },
|
|
36
|
+
|
|
37
|
+
)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
21
40
|
|
|
22
41
|
@Serializable
|
|
23
42
|
data class OrderItemRN(
|
|
@@ -34,7 +53,18 @@ data class BusinessRN(
|
|
|
34
53
|
val email: String? = null,
|
|
35
54
|
val phone: String? = null,
|
|
36
55
|
val address: PrimerAddressRN? = null,
|
|
37
|
-
)
|
|
56
|
+
) {
|
|
57
|
+
|
|
58
|
+
fun format(): Business {
|
|
59
|
+
return Business(
|
|
60
|
+
name = name,
|
|
61
|
+
registrationNumber = registrationNumber,
|
|
62
|
+
email = email,
|
|
63
|
+
phone = phone,
|
|
64
|
+
address = address?.format(),
|
|
65
|
+
)
|
|
66
|
+
}
|
|
67
|
+
}
|
|
38
68
|
|
|
39
69
|
@Serializable
|
|
40
70
|
data class CustomerRN(
|
|
@@ -44,16 +74,39 @@ data class CustomerRN(
|
|
|
44
74
|
val email: String? = null,
|
|
45
75
|
val phone: String? = null,
|
|
46
76
|
val billing: PrimerAddressRN? = null,
|
|
47
|
-
)
|
|
77
|
+
) {
|
|
78
|
+
fun format(): Customer {
|
|
79
|
+
return Customer(
|
|
80
|
+
id = id,
|
|
81
|
+
firstName = firstName,
|
|
82
|
+
lastName = lastName,
|
|
83
|
+
email = email,
|
|
84
|
+
homePhone = phone,
|
|
85
|
+
billingAddress = billing?.format(),
|
|
86
|
+
)
|
|
87
|
+
}
|
|
88
|
+
}
|
|
48
89
|
|
|
49
90
|
@Serializable
|
|
50
91
|
data class OptionsRN(
|
|
51
92
|
val isResultScreenEnabled: Boolean? = null,
|
|
52
93
|
val isLoadingScreenEnabled: Boolean? = null,
|
|
53
94
|
val isFullScreenEnabled: Boolean? = null,
|
|
95
|
+
val isThreeDsEnabled: Boolean? = null,
|
|
54
96
|
val locale: String? = null,
|
|
55
97
|
val android: AndroidOptionsRN? = null,
|
|
56
|
-
)
|
|
98
|
+
) {
|
|
99
|
+
fun format(): Options {
|
|
100
|
+
return Options(
|
|
101
|
+
showUI = isLoadingScreenEnabled ?: true,
|
|
102
|
+
redirectScheme = android?.redirectScheme,
|
|
103
|
+
is3DSOnVaultingEnabled = isThreeDsEnabled ?: false,
|
|
104
|
+
debugOptions = PrimerDebugOptions(
|
|
105
|
+
is3DSSanityCheckEnabled = true, // false on emulator
|
|
106
|
+
),
|
|
107
|
+
)
|
|
108
|
+
}
|
|
109
|
+
}
|
|
57
110
|
|
|
58
111
|
@Serializable
|
|
59
112
|
data class AndroidOptionsRN(
|
|
@@ -62,10 +115,30 @@ data class AndroidOptionsRN(
|
|
|
62
115
|
|
|
63
116
|
@Serializable
|
|
64
117
|
data class PrimerAddressRN(
|
|
65
|
-
val line1: String
|
|
118
|
+
val line1: String?,
|
|
66
119
|
val line2: String? = null,
|
|
67
|
-
val postalCode: String
|
|
120
|
+
val postalCode: String?,
|
|
68
121
|
val state: String? = null,
|
|
69
|
-
val city: String
|
|
70
|
-
val country: String
|
|
71
|
-
)
|
|
122
|
+
val city: String?,
|
|
123
|
+
val country: String?,
|
|
124
|
+
) {
|
|
125
|
+
|
|
126
|
+
fun format(): Address? {
|
|
127
|
+
if (
|
|
128
|
+
line1 == null ||
|
|
129
|
+
postalCode == null ||
|
|
130
|
+
city == null ||
|
|
131
|
+
country == null
|
|
132
|
+
) {
|
|
133
|
+
return null
|
|
134
|
+
}
|
|
135
|
+
|
|
136
|
+
return Address(
|
|
137
|
+
line1 = line1,
|
|
138
|
+
line2 = line2,
|
|
139
|
+
city = city,
|
|
140
|
+
countryCode = CountryCode.valueOf(country),
|
|
141
|
+
postalCode = postalCode,
|
|
142
|
+
)
|
|
143
|
+
}
|
|
144
|
+
}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
package com.primerioreactnative.datamodels
|
|
2
2
|
|
|
3
|
-
import io.primer.android.
|
|
3
|
+
import io.primer.android.InputThemeData
|
|
4
|
+
import io.primer.android.PrimerTheme
|
|
4
5
|
import kotlinx.serialization.Serializable
|
|
5
6
|
|
|
6
7
|
@Serializable
|
|
@@ -8,20 +9,11 @@ class PrimerThemeRN(
|
|
|
8
9
|
private val colors: ColorThemeRN? = null,
|
|
9
10
|
val darkModeColors: ColorThemeRN? = null,
|
|
10
11
|
) {
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
textDefaultColor = colors?.text?.hex,
|
|
15
|
-
textDangerColor = colors?.error?.hex,
|
|
16
|
-
textMutedColor = colors?.disabled?.hex,
|
|
17
|
-
backgroundColor = colors?.background?.hex,
|
|
18
|
-
buttonPrimaryColor = colors?.mainColor?.hex,
|
|
19
|
-
buttonPrimaryColorDisabled = colors?.disabled?.hex,
|
|
20
|
-
primaryColor = colors?.mainColor?.hex,
|
|
21
|
-
inputBackgroundColor = colors?.background?.hex,
|
|
22
|
-
buttonDefaultBorderColor = colors?.borders?.hex,
|
|
12
|
+
fun format(): PrimerTheme {
|
|
13
|
+
return PrimerTheme.build(
|
|
14
|
+
input = InputThemeData()
|
|
23
15
|
)
|
|
24
|
-
|
|
16
|
+
}
|
|
25
17
|
}
|
|
26
18
|
|
|
27
19
|
@Serializable
|
|
@@ -9,6 +9,18 @@ struct PrimerSettingsRN: Decodable {
|
|
|
9
9
|
|
|
10
10
|
extension PrimerSettingsRN {
|
|
11
11
|
func asPrimerSettings() -> PrimerSettings {
|
|
12
|
+
var address: Address?
|
|
13
|
+
if let billingAddress = customer?.billing {
|
|
14
|
+
address = Address(
|
|
15
|
+
addressLine1: billingAddress.line1,
|
|
16
|
+
addressLine2: billingAddress.line2,
|
|
17
|
+
city: billingAddress.city,
|
|
18
|
+
state: billingAddress.state,
|
|
19
|
+
countryCode: billingAddress.country?.rawValue,
|
|
20
|
+
postalCode: billingAddress.postalCode
|
|
21
|
+
)
|
|
22
|
+
}
|
|
23
|
+
|
|
12
24
|
return PrimerSettings(
|
|
13
25
|
merchantIdentifier: options?.ios?.merchantIdentifier,
|
|
14
26
|
customerId: customer?.id,
|
|
@@ -22,14 +34,26 @@ extension PrimerSettingsRN {
|
|
|
22
34
|
hasDisabledSuccessScreen: !(options?.isResultScreenEnabled ?? true),
|
|
23
35
|
businessDetails: business?.primerFormat,
|
|
24
36
|
orderItems: order?.itemsFormatted ?? [],
|
|
25
|
-
isInitialLoadingHidden: !(options?.isLoadingScreenEnabled ?? true)
|
|
37
|
+
isInitialLoadingHidden: !(options?.isLoadingScreenEnabled ?? true),
|
|
38
|
+
orderId: order?.id,
|
|
39
|
+
customer: Customer(
|
|
40
|
+
firstName: customer?.firstName,
|
|
41
|
+
lastName: customer?.lastName,
|
|
42
|
+
email: customer?.email,
|
|
43
|
+
homePhoneNumber: nil,
|
|
44
|
+
mobilePhoneNumber: customer?.phone,
|
|
45
|
+
workPhoneNumber: nil,
|
|
46
|
+
billingAddress: address
|
|
47
|
+
)
|
|
26
48
|
)
|
|
27
49
|
}
|
|
28
50
|
}
|
|
29
51
|
|
|
30
52
|
fileprivate struct OrderRN: Decodable {
|
|
53
|
+
let id: String?
|
|
31
54
|
let amount: Int?
|
|
32
55
|
let currency: Currency?
|
|
56
|
+
// FIXME: Move countryCode only within Address (RN & Android)
|
|
33
57
|
let countryCode: CountryCode?
|
|
34
58
|
let items: [OrderItemRN]?
|
|
35
59
|
let shipping: AddressRN?
|
|
@@ -70,11 +94,15 @@ fileprivate struct BusinessRN: Decodable {
|
|
|
70
94
|
let registrationNumber: String?
|
|
71
95
|
let email: String?
|
|
72
96
|
let phone: String?
|
|
73
|
-
let address: AddressRN
|
|
97
|
+
let address: AddressRN?
|
|
74
98
|
}
|
|
75
99
|
|
|
76
100
|
fileprivate extension BusinessRN {
|
|
77
|
-
var primerFormat: BusinessDetails {
|
|
101
|
+
var primerFormat: BusinessDetails? {
|
|
102
|
+
guard let address = address else {
|
|
103
|
+
return nil
|
|
104
|
+
}
|
|
105
|
+
|
|
78
106
|
return BusinessDetails(
|
|
79
107
|
name: name,
|
|
80
108
|
address: address.primerFormat
|
|
@@ -97,7 +125,7 @@ fileprivate struct AddressRN: Decodable {
|
|
|
97
125
|
let postalCode: String?
|
|
98
126
|
let city: String?
|
|
99
127
|
let state: String?
|
|
100
|
-
let country:
|
|
128
|
+
let country: CountryCode?
|
|
101
129
|
}
|
|
102
130
|
|
|
103
131
|
fileprivate extension AddressRN {
|
|
@@ -107,7 +135,7 @@ fileprivate extension AddressRN {
|
|
|
107
135
|
addressLine2: line2,
|
|
108
136
|
city: city,
|
|
109
137
|
state: state,
|
|
110
|
-
countryCode: country,
|
|
138
|
+
countryCode: country?.rawValue,
|
|
111
139
|
postalCode: postalCode
|
|
112
140
|
)
|
|
113
141
|
}
|
|
@@ -0,0 +1,86 @@
|
|
|
1
|
+
//
|
|
2
|
+
// PrimerRN+PrimerDelegate.swift
|
|
3
|
+
// primer-io-react-native
|
|
4
|
+
//
|
|
5
|
+
// Created by Carl Eriksson on 22/09/2021.
|
|
6
|
+
//
|
|
7
|
+
import PrimerSDK
|
|
8
|
+
|
|
9
|
+
extension PrimerRN: PrimerDelegate {
|
|
10
|
+
|
|
11
|
+
func clientTokenCallback(_ completion: @escaping (String?, Error?) -> Void) {
|
|
12
|
+
guard let clientToken = clientToken else {
|
|
13
|
+
checkoutFailed(with: ErrorTypeRN.clientTokenNotConfigured)
|
|
14
|
+
completion(nil, ErrorTypeRN.clientTokenNotConfigured)
|
|
15
|
+
return
|
|
16
|
+
}
|
|
17
|
+
completion(clientToken, nil)
|
|
18
|
+
}
|
|
19
|
+
|
|
20
|
+
func onTokenizeSuccess(
|
|
21
|
+
_ paymentMethodToken: PaymentMethodToken,
|
|
22
|
+
resumeHandler: ResumeHandlerProtocol
|
|
23
|
+
) {
|
|
24
|
+
do {
|
|
25
|
+
let json = try encoder.encode(paymentMethodToken)
|
|
26
|
+
let data = String(data: json, encoding: .utf8)!
|
|
27
|
+
self.onTokenizeSuccessCallback?([data])
|
|
28
|
+
} catch {
|
|
29
|
+
checkoutFailed(with: ErrorTypeRN.ParseJsonFailed)
|
|
30
|
+
}
|
|
31
|
+
onResumeFlowCallback = { error, token in
|
|
32
|
+
if let token = token {
|
|
33
|
+
resumeHandler.handle(newClientToken: token)
|
|
34
|
+
} else if let error = error {
|
|
35
|
+
resumeHandler.handle(error: error)
|
|
36
|
+
} else {
|
|
37
|
+
resumeHandler.handle(error: PrimerError.generic)
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
|
|
42
|
+
func onResumeSuccess(_ clientToken: String, resumeHandler: ResumeHandlerProtocol) {
|
|
43
|
+
self.onResumeSuccessCallback?([clientToken])
|
|
44
|
+
|
|
45
|
+
onResumeFlowCallback = { error, token in
|
|
46
|
+
if let error = error {
|
|
47
|
+
resumeHandler.handle(error: error)
|
|
48
|
+
} else if let token = token {
|
|
49
|
+
resumeHandler.handle(newClientToken: token)
|
|
50
|
+
} else {
|
|
51
|
+
resumeHandler.handleSuccess()
|
|
52
|
+
}
|
|
53
|
+
}
|
|
54
|
+
}
|
|
55
|
+
|
|
56
|
+
func tokenAddedToVault(_ token: PaymentMethodToken) {
|
|
57
|
+
do {
|
|
58
|
+
let json = try encoder.encode(token)
|
|
59
|
+
let data = String(data: json, encoding: .utf8)!
|
|
60
|
+
self.onVaultSuccessCallback?([data])
|
|
61
|
+
} catch {
|
|
62
|
+
checkoutFailed(with: ErrorTypeRN.ParseJsonFailed)
|
|
63
|
+
}
|
|
64
|
+
}
|
|
65
|
+
|
|
66
|
+
func onCheckoutDismissed() {
|
|
67
|
+
self.onDismissCallback?([])
|
|
68
|
+
self.onDismissCallback = nil
|
|
69
|
+
}
|
|
70
|
+
|
|
71
|
+
func checkoutFailed(with error: Error) {
|
|
72
|
+
do {
|
|
73
|
+
if let error = error as? ErrorTypeRN {
|
|
74
|
+
let exception = PrimerErrorRN(exceptionType: error, description: nil)
|
|
75
|
+
let json = try encoder.encode(exception)
|
|
76
|
+
let data = String(data: json, encoding: .utf8)!
|
|
77
|
+
self.onPrimerErrorCallback?([data])
|
|
78
|
+
} else {
|
|
79
|
+
self.onPrimerErrorCallback?(["{\"exceptionType\":\"CheckoutFlowFailed\"}"])
|
|
80
|
+
}
|
|
81
|
+
} catch {
|
|
82
|
+
self.onPrimerErrorCallback?(["{\"exceptionType\":\"ParseJsonFailed\"}"])
|
|
83
|
+
}
|
|
84
|
+
haltExecution = true
|
|
85
|
+
}
|
|
86
|
+
}
|
package/ios/PrimerRN.swift
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import UIKit
|
|
2
2
|
import PrimerSDK
|
|
3
3
|
|
|
4
|
-
typealias BasicCompletionBlock = ((Error?) -> Void)
|
|
4
|
+
typealias BasicCompletionBlock = ((Error?, String?) -> Void)
|
|
5
5
|
|
|
6
6
|
@objc(PrimerRN)
|
|
7
7
|
class PrimerRN: NSObject {
|
|
@@ -17,6 +17,7 @@ class PrimerRN: NSObject {
|
|
|
17
17
|
var theme: PrimerThemeRN?
|
|
18
18
|
var flow: PrimerSessionFlow?
|
|
19
19
|
var onTokenizeSuccessCallback: RCTResponseSenderBlock?
|
|
20
|
+
var onResumeSuccessCallback: RCTResponseSenderBlock?
|
|
20
21
|
var onVaultSuccessCallback: RCTResponseSenderBlock?
|
|
21
22
|
var onDismissCallback: RCTResponseSenderBlock?
|
|
22
23
|
var onPrimerErrorCallback: RCTResponseSenderBlock?
|
|
@@ -60,6 +61,10 @@ class PrimerRN: NSObject {
|
|
|
60
61
|
self.onTokenizeSuccessCallback = callback
|
|
61
62
|
}
|
|
62
63
|
|
|
64
|
+
@objc func configureOnResumeSuccess(_ callback: @escaping RCTResponseSenderBlock) {
|
|
65
|
+
self.onResumeSuccessCallback = callback
|
|
66
|
+
}
|
|
67
|
+
|
|
63
68
|
@objc func configureOnVaultSuccess(_ callback: @escaping RCTResponseSenderBlock) {
|
|
64
69
|
self.onVaultSuccessCallback = callback
|
|
65
70
|
}
|
|
@@ -122,7 +127,6 @@ class PrimerRN: NSObject {
|
|
|
122
127
|
Primer.shared.delegate = self
|
|
123
128
|
Primer.shared.configure(settings: settings, theme: theme)
|
|
124
129
|
Primer.shared.showCheckout(viewController, flow: flow)
|
|
125
|
-
|
|
126
130
|
} catch {
|
|
127
131
|
self?.checkoutFailed(with: error)
|
|
128
132
|
}
|
|
@@ -136,9 +140,11 @@ class PrimerRN: NSObject {
|
|
|
136
140
|
let request = try JSONDecoder().decode(PrimerResumeRequest.self, from: json)
|
|
137
141
|
|
|
138
142
|
if (request.error) {
|
|
139
|
-
self?.onResumeFlowCallback?(ErrorTypeRN.ParseJsonFailed)
|
|
143
|
+
self?.onResumeFlowCallback?(ErrorTypeRN.ParseJsonFailed, nil)
|
|
144
|
+
} else if let token = request.token {
|
|
145
|
+
self?.onResumeFlowCallback?(nil, token)
|
|
140
146
|
} else {
|
|
141
|
-
self?.onResumeFlowCallback?(nil)
|
|
147
|
+
self?.onResumeFlowCallback?(nil, nil)
|
|
142
148
|
}
|
|
143
149
|
self?.onResumeFlowCallback = nil
|
|
144
150
|
} catch {
|
package/ios/ReactNative.m
CHANGED
|
@@ -11,6 +11,8 @@ RCT_EXTERN_METHOD(configureIntent: (NSString *)request)
|
|
|
11
11
|
|
|
12
12
|
RCT_EXTERN_METHOD(configureOnTokenizeSuccess: (RCTResponseSenderBlock)callback)
|
|
13
13
|
|
|
14
|
+
RCT_EXTERN_METHOD(configureOnResumeSuccess: (RCTResponseSenderBlock)callback)
|
|
15
|
+
|
|
14
16
|
RCT_EXTERN_METHOD(configureOnVaultSuccess: (RCTResponseSenderBlock)callback)
|
|
15
17
|
|
|
16
18
|
RCT_EXTERN_METHOD(configureOnDismiss: (RCTResponseSenderBlock)callback)
|
|
@@ -7,7 +7,6 @@
|
|
|
7
7
|
objects = {
|
|
8
8
|
|
|
9
9
|
/* Begin PBXBuildFile section */
|
|
10
|
-
0113F67F9659E3C6C60C0C9D /* libPods-ReactNative.a in Frameworks */ = {isa = PBXBuildFile; fileRef = A4C6F4B9FE3886B130190CE6 /* libPods-ReactNative.a */; };
|
|
11
10
|
1D14D92125C8DB0E00206A38 /* ReactNative.m in Sources */ = {isa = PBXBuildFile; fileRef = B3E7B5891CC2AC0600A0062D /* ReactNative.m */; };
|
|
12
11
|
1DEBE0F726C2D594004E3064 /* PrimerRN.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DEBE0F626C2D594004E3064 /* PrimerRN.swift */; };
|
|
13
12
|
1DEBE0FA26C2D75A004E3064 /* PrimerFlowRN.swift in Sources */ = {isa = PBXBuildFile; fileRef = 1DEBE0F926C2D75A004E3064 /* PrimerFlowRN.swift */; };
|
|
@@ -38,9 +37,6 @@
|
|
|
38
37
|
1DEBE0FD26C2D875004E3064 /* PrimerSettingsRN.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimerSettingsRN.swift; sourceTree = "<group>"; };
|
|
39
38
|
1DEBE0FF26C2D88E004E3064 /* PrimerThemeRN.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PrimerThemeRN.swift; sourceTree = "<group>"; };
|
|
40
39
|
1DEBE10126C2D8BA004E3064 /* PaymentInstrumentTokenRN.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PaymentInstrumentTokenRN.swift; sourceTree = "<group>"; };
|
|
41
|
-
5CEA01D396917A3CB5917524 /* Pods-ReactNative.release.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNative.release.xcconfig"; path = "Target Support Files/Pods-ReactNative/Pods-ReactNative.release.xcconfig"; sourceTree = "<group>"; };
|
|
42
|
-
A4C6F4B9FE3886B130190CE6 /* libPods-ReactNative.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = "libPods-ReactNative.a"; sourceTree = BUILT_PRODUCTS_DIR; };
|
|
43
|
-
A693C215DDA197B3899816CB /* Pods-ReactNative.debug.xcconfig */ = {isa = PBXFileReference; includeInIndex = 1; lastKnownFileType = text.xcconfig; name = "Pods-ReactNative.debug.xcconfig"; path = "Target Support Files/Pods-ReactNative/Pods-ReactNative.debug.xcconfig"; sourceTree = "<group>"; };
|
|
44
40
|
B3E7B5891CC2AC0600A0062D /* ReactNative.m */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.objc; path = ReactNative.m; sourceTree = "<group>"; };
|
|
45
41
|
F4FF95D5245B92E700C19C63 /* ReactNative-Bridging-Header.h */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.c.h; path = "ReactNative-Bridging-Header.h"; sourceTree = "<group>"; };
|
|
46
42
|
F4FF95D6245B92E800C19C63 /* UniversalCheckoutRN.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = UniversalCheckoutRN.swift; sourceTree = "<group>"; };
|
|
@@ -51,7 +47,6 @@
|
|
|
51
47
|
isa = PBXFrameworksBuildPhase;
|
|
52
48
|
buildActionMask = 2147483647;
|
|
53
49
|
files = (
|
|
54
|
-
0113F67F9659E3C6C60C0C9D /* libPods-ReactNative.a in Frameworks */,
|
|
55
50
|
);
|
|
56
51
|
runOnlyForDeploymentPostprocessing = 0;
|
|
57
52
|
};
|
|
@@ -66,14 +61,6 @@
|
|
|
66
61
|
name = Products;
|
|
67
62
|
sourceTree = "<group>";
|
|
68
63
|
};
|
|
69
|
-
1CAA66213DDE9D1490BE5DD3 /* Frameworks */ = {
|
|
70
|
-
isa = PBXGroup;
|
|
71
|
-
children = (
|
|
72
|
-
A4C6F4B9FE3886B130190CE6 /* libPods-ReactNative.a */,
|
|
73
|
-
);
|
|
74
|
-
name = Frameworks;
|
|
75
|
-
sourceTree = "<group>";
|
|
76
|
-
};
|
|
77
64
|
1DEBE0F826C2D70C004E3064 /* DataModels */ = {
|
|
78
65
|
isa = PBXGroup;
|
|
79
66
|
children = (
|
|
@@ -89,8 +76,6 @@
|
|
|
89
76
|
38076040A533828516C55677 /* Pods */ = {
|
|
90
77
|
isa = PBXGroup;
|
|
91
78
|
children = (
|
|
92
|
-
A693C215DDA197B3899816CB /* Pods-ReactNative.debug.xcconfig */,
|
|
93
|
-
5CEA01D396917A3CB5917524 /* Pods-ReactNative.release.xcconfig */,
|
|
94
79
|
);
|
|
95
80
|
path = Pods;
|
|
96
81
|
sourceTree = "<group>";
|
|
@@ -105,7 +90,6 @@
|
|
|
105
90
|
F4FF95D5245B92E700C19C63 /* ReactNative-Bridging-Header.h */,
|
|
106
91
|
134814211AA4EA7D00B7C361 /* Products */,
|
|
107
92
|
38076040A533828516C55677 /* Pods */,
|
|
108
|
-
1CAA66213DDE9D1490BE5DD3 /* Frameworks */,
|
|
109
93
|
);
|
|
110
94
|
sourceTree = "<group>";
|
|
111
95
|
};
|
|
@@ -116,7 +100,6 @@
|
|
|
116
100
|
isa = PBXNativeTarget;
|
|
117
101
|
buildConfigurationList = 58B511EF1A9E6C8500147676 /* Build configuration list for PBXNativeTarget "ReactNative" */;
|
|
118
102
|
buildPhases = (
|
|
119
|
-
6C137ED3C07C4CC17E75E2E6 /* [CP] Check Pods Manifest.lock */,
|
|
120
103
|
58B511D71A9E6C8500147676 /* Sources */,
|
|
121
104
|
58B511D81A9E6C8500147676 /* Frameworks */,
|
|
122
105
|
58B511D91A9E6C8500147676 /* CopyFiles */,
|
|
@@ -162,31 +145,6 @@
|
|
|
162
145
|
};
|
|
163
146
|
/* End PBXProject section */
|
|
164
147
|
|
|
165
|
-
/* Begin PBXShellScriptBuildPhase section */
|
|
166
|
-
6C137ED3C07C4CC17E75E2E6 /* [CP] Check Pods Manifest.lock */ = {
|
|
167
|
-
isa = PBXShellScriptBuildPhase;
|
|
168
|
-
buildActionMask = 2147483647;
|
|
169
|
-
files = (
|
|
170
|
-
);
|
|
171
|
-
inputFileListPaths = (
|
|
172
|
-
);
|
|
173
|
-
inputPaths = (
|
|
174
|
-
"${PODS_PODFILE_DIR_PATH}/Podfile.lock",
|
|
175
|
-
"${PODS_ROOT}/Manifest.lock",
|
|
176
|
-
);
|
|
177
|
-
name = "[CP] Check Pods Manifest.lock";
|
|
178
|
-
outputFileListPaths = (
|
|
179
|
-
);
|
|
180
|
-
outputPaths = (
|
|
181
|
-
"$(DERIVED_FILE_DIR)/Pods-ReactNative-checkManifestLockResult.txt",
|
|
182
|
-
);
|
|
183
|
-
runOnlyForDeploymentPostprocessing = 0;
|
|
184
|
-
shellPath = /bin/sh;
|
|
185
|
-
shellScript = "diff \"${PODS_PODFILE_DIR_PATH}/Podfile.lock\" \"${PODS_ROOT}/Manifest.lock\" > /dev/null\nif [ $? != 0 ] ; then\n # print error to STDERR\n echo \"error: The sandbox is not in sync with the Podfile.lock. Run 'pod install' or update your CocoaPods installation.\" >&2\n exit 1\nfi\n# This output is used by Xcode 'outputs' to avoid re-running this script phase.\necho \"SUCCESS\" > \"${SCRIPT_OUTPUT_FILE_0}\"\n";
|
|
186
|
-
showEnvVarsInLog = 0;
|
|
187
|
-
};
|
|
188
|
-
/* End PBXShellScriptBuildPhase section */
|
|
189
|
-
|
|
190
148
|
/* Begin PBXSourcesBuildPhase section */
|
|
191
149
|
58B511D71A9E6C8500147676 /* Sources */ = {
|
|
192
150
|
isa = PBXSourcesBuildPhase;
|
|
@@ -310,7 +268,6 @@
|
|
|
310
268
|
};
|
|
311
269
|
58B511F01A9E6C8500147676 /* Debug */ = {
|
|
312
270
|
isa = XCBuildConfiguration;
|
|
313
|
-
baseConfigurationReference = A693C215DDA197B3899816CB /* Pods-ReactNative.debug.xcconfig */;
|
|
314
271
|
buildSettings = {
|
|
315
272
|
HEADER_SEARCH_PATHS = (
|
|
316
273
|
"$(inherited)",
|
|
@@ -330,7 +287,6 @@
|
|
|
330
287
|
};
|
|
331
288
|
58B511F11A9E6C8500147676 /* Release */ = {
|
|
332
289
|
isa = XCBuildConfiguration;
|
|
333
|
-
baseConfigurationReference = 5CEA01D396917A3CB5917524 /* Pods-ReactNative.release.xcconfig */;
|
|
334
290
|
buildSettings = {
|
|
335
291
|
HEADER_SEARCH_PATHS = (
|
|
336
292
|
"$(inherited)",
|
package/lib/commonjs/Primer.js
CHANGED
|
@@ -56,6 +56,7 @@ function configure(config) {
|
|
|
56
56
|
configureOnDismiss(config.onDismiss);
|
|
57
57
|
configureOnError(config.onError);
|
|
58
58
|
configureOnTokenizeSuccess(config.onTokenizeSuccess);
|
|
59
|
+
configureOnResumeSuccess(config.onResumeSuccess);
|
|
59
60
|
configureOnSavedPaymentInstrumentsFetched(config.onSavedPaymentInstrumentsFetched);
|
|
60
61
|
}
|
|
61
62
|
|
|
@@ -88,10 +89,31 @@ function configureOnTokenizeSuccess(callback = (_, __) => {}) {
|
|
|
88
89
|
const parsedData = JSON.parse(data);
|
|
89
90
|
callback(parsedData, {
|
|
90
91
|
resumeWithError: () => resume({
|
|
91
|
-
error: true
|
|
92
|
+
error: true,
|
|
93
|
+
token: ''
|
|
92
94
|
}),
|
|
93
|
-
resumeWithSuccess:
|
|
94
|
-
error: false
|
|
95
|
+
resumeWithSuccess: token => resume({
|
|
96
|
+
error: false,
|
|
97
|
+
token
|
|
98
|
+
})
|
|
99
|
+
});
|
|
100
|
+
} catch (e) {
|
|
101
|
+
console.log('failed to parse json', e);
|
|
102
|
+
}
|
|
103
|
+
});
|
|
104
|
+
}
|
|
105
|
+
|
|
106
|
+
function configureOnResumeSuccess(callback = (_, __) => {}) {
|
|
107
|
+
NativeModule.configureOnResumeSuccess(token => {
|
|
108
|
+
try {
|
|
109
|
+
callback(token, {
|
|
110
|
+
resumeWithError: () => resume({
|
|
111
|
+
error: true,
|
|
112
|
+
token: null
|
|
113
|
+
}),
|
|
114
|
+
resumeWithSuccess: t => resume({
|
|
115
|
+
error: false,
|
|
116
|
+
token: t
|
|
95
117
|
})
|
|
96
118
|
});
|
|
97
119
|
} catch (e) {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Primer.ts"],"names":["PrimerRN","NativeModule","NativeModules","PrimerNativeMapping","showUniversalCheckout","token","config","configureIntent","vault","paymentMethod","configure","initialize","showVaultManager","showPaymentMethod","intent","fetchSavedPaymentInstruments","dispose","configureTheme","theme","configureSettings","settings","configureOnVaultSuccess","onTokenAddedToVault","configureOnDismiss","onDismiss","configureOnError","onError","configureOnTokenizeSuccess","onTokenizeSuccess","configureOnSavedPaymentInstrumentsFetched","onSavedPaymentInstrumentsFetched","data","JSON","stringify","resume","request","callback","_","__","parsedData","parse","resumeWithError","error","resumeWithSuccess","e","console","log","configureOnPrimerError"],"mappings":";;;;;;;AAAA;;AAkBA;;AAEA,MAAM;AAAEA,EAAAA,QAAQ,EAAEC;AAAZ,IAA6BC,0BAAnC;AAEO,MAAMC,mBAA4B,GAAG;AAC1CC,EAAAA,qBAAqB,CAACC,KAAD,EAAgBC,MAAhB,EAA4C;AAC/DC,IAAAA,eAAe,CAAC;AAAEC,MAAAA,KAAK,EAAE,KAAT;AAAgBC,MAAAA,aAAa,EAAE;AAA/B,KAAD,CAAf;AACAC,IAAAA,SAAS,CAACJ,MAAD,CAAT;AACAL,IAAAA,YAAY,CAACU,UAAb,CAAwBN,KAAxB;AACD,GALyC;;AAO1CO,EAAAA,gBAAgB,CAACP,KAAD,EAAgBC,MAAhB,EAA4C;AAC1DC,IAAAA,eAAe,CAAC;AAAEC,MAAAA,KAAK,EAAE,IAAT;AAAeC,MAAAA,aAAa,EAAE;AAA9B,KAAD,CAAf;AACAC,IAAAA,SAAS,CAACJ,MAAD,CAAT;AACAL,IAAAA,YAAY,CAACU,UAAb,CAAwBN,KAAxB;AACD,GAXyC;;AAa1CQ,EAAAA,iBAAiB,CACfR,KADe,EAEfS,MAFe,EAGfR,MAHe,EAIT;AACNC,IAAAA,eAAe,CAACO,MAAD,CAAf;AACAJ,IAAAA,SAAS,CAACJ,MAAD,CAAT;AACAL,IAAAA,YAAY,CAACU,UAAb,CAAwBN,KAAxB;AACD,GArByC;;AAuB1CU,EAAAA,4BAA4B,CAACV,KAAD,EAAgBC,MAAhB,EAA4C;AACtEI,IAAAA,SAAS,CAACJ,MAAD,CAAT;AACAL,IAAAA,YAAY,CAACc,4BAAb,CAA0CV,KAA1C;AACD,GA1ByC;;AA4B1CW,EAAAA,OAAO,GAAS;AACdf,IAAAA,YAAY,CAACe,OAAb;AACD;;AA9ByC,CAArC;;;AAiCP,SAASN,SAAT,CAAmBJ,MAAnB,EAA+C;AAC7CW,EAAAA,cAAc,CAACX,MAAM,CAACY,KAAR,CAAd;AACAC,EAAAA,iBAAiB,CAACb,MAAM,CAACc,QAAR,CAAjB;AACAC,EAAAA,uBAAuB,CAACf,MAAM,CAACgB,mBAAR,CAAvB;AACAC,EAAAA,kBAAkB,CAACjB,MAAM,CAACkB,SAAR,CAAlB;AACAC,EAAAA,gBAAgB,CAACnB,MAAM,CAACoB,OAAR,CAAhB;AACAC,EAAAA,0BAA0B,CAACrB,MAAM,CAACsB,iBAAR,CAA1B;AACAC,EAAAA,
|
|
1
|
+
{"version":3,"sources":["Primer.ts"],"names":["PrimerRN","NativeModule","NativeModules","PrimerNativeMapping","showUniversalCheckout","token","config","configureIntent","vault","paymentMethod","configure","initialize","showVaultManager","showPaymentMethod","intent","fetchSavedPaymentInstruments","dispose","configureTheme","theme","configureSettings","settings","configureOnVaultSuccess","onTokenAddedToVault","configureOnDismiss","onDismiss","configureOnError","onError","configureOnTokenizeSuccess","onTokenizeSuccess","configureOnResumeSuccess","onResumeSuccess","configureOnSavedPaymentInstrumentsFetched","onSavedPaymentInstrumentsFetched","data","JSON","stringify","resume","request","callback","_","__","parsedData","parse","resumeWithError","error","resumeWithSuccess","e","console","log","t","configureOnPrimerError"],"mappings":";;;;;;;AAAA;;AAkBA;;AAEA,MAAM;AAAEA,EAAAA,QAAQ,EAAEC;AAAZ,IAA6BC,0BAAnC;AAEO,MAAMC,mBAA4B,GAAG;AAC1CC,EAAAA,qBAAqB,CAACC,KAAD,EAAgBC,MAAhB,EAA4C;AAC/DC,IAAAA,eAAe,CAAC;AAAEC,MAAAA,KAAK,EAAE,KAAT;AAAgBC,MAAAA,aAAa,EAAE;AAA/B,KAAD,CAAf;AACAC,IAAAA,SAAS,CAACJ,MAAD,CAAT;AACAL,IAAAA,YAAY,CAACU,UAAb,CAAwBN,KAAxB;AACD,GALyC;;AAO1CO,EAAAA,gBAAgB,CAACP,KAAD,EAAgBC,MAAhB,EAA4C;AAC1DC,IAAAA,eAAe,CAAC;AAAEC,MAAAA,KAAK,EAAE,IAAT;AAAeC,MAAAA,aAAa,EAAE;AAA9B,KAAD,CAAf;AACAC,IAAAA,SAAS,CAACJ,MAAD,CAAT;AACAL,IAAAA,YAAY,CAACU,UAAb,CAAwBN,KAAxB;AACD,GAXyC;;AAa1CQ,EAAAA,iBAAiB,CACfR,KADe,EAEfS,MAFe,EAGfR,MAHe,EAIT;AACNC,IAAAA,eAAe,CAACO,MAAD,CAAf;AACAJ,IAAAA,SAAS,CAACJ,MAAD,CAAT;AACAL,IAAAA,YAAY,CAACU,UAAb,CAAwBN,KAAxB;AACD,GArByC;;AAuB1CU,EAAAA,4BAA4B,CAACV,KAAD,EAAgBC,MAAhB,EAA4C;AACt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AK,EAAE,KAAT;AAAgBvC,UAAAA,KAAK,EAAE4C;AAAvB,SAAD;AAFlB,OAAR,CAAR;AAID,KALD,CAKE,OAAOH,CAAP,EAAU;AACVC,MAAAA,OAAO,CAACC,GAAR,CAAY,sBAAZ,EAAoCF,CAApC;AACD;AACF,GATD;AAUD;;AAED,SAASzB,uBAAT,CACEiB,QAAqC,GAAIC,CAAD,IAAO,CAAE,CADnD,EAEE;AACAtC,EAAAA,YAAY,CAACoB,uBAAb,CAAsCY,IAAD,IAAe;AAClD,8BAAsCA,IAAtC,EAA4CK,QAA5C;AACD,GAFD;AAGD;;AAED,SAASf,kBAAT,CAA4Be,QAA2B,GAAG,MAAM,CAAE,CAAlE,EAAoE;AAClErC,EAAAA,YAAY,CAACsB,kBAAb,CAAiCgB,CAAD,IAAYD,QAAQ,EAApD;AACD;;AAED,SAASb,gBAAT,CAA0Ba,QAA+B,GAAIC,CAAD,IAAO,CAAE,CAArE,EAAuE;AACrEtC,EAAAA,YAAY,CAACiD,sBAAb,CAAqCjB,IAAD,IAAe;AACjD,8BAA2BA,IAA3B,EAAiCK,QAAjC;AACD,GAFD;AAGD;;AAED,SAASP,yCAAT,CACEO,QAAkD,GAAIC,CAAD,IAAO,CAAE,CADhE,EAEE;AACAtC,EAAAA,YAAY,CAAC8B,yCAAb,CAAwDE,IAAD,IAAe;AACpE,8BAAwCA,IAAxC,EAA8CK,QAA9C;AACD,GAFD;AAGD","sourcesContent":["import { NativeModules } from 'react-native';\nimport type { PaymentInstrumentToken } from './models/payment-instrument-token';\nimport type { IPrimer } from './models/primer';\nimport type {\n OnDismissCallback,\n OnPrimerErrorCallback,\n OnSavedPaymentInstrumentsFetchedCallback,\n OnTokenAddedToVaultCallback,\n OnTokenizeSuccessCallback,\n} from './models/primer-callbacks';\nimport type { PrimerConfig } from './models/primer-config';\nimport type { PrimerError } from './models/primer-error';\nimport type {\n PrimerIntent,\n PrimerPaymentMethodIntent,\n} from './models/primer-intent';\nimport type { PrimerSettings } from './models/primer-settings';\nimport type { PrimerTheme } from './models/primer-theme';\nimport { parseCallback } from './utils';\n\nconst { PrimerRN: NativeModule } = NativeModules;\n\nexport const PrimerNativeMapping: IPrimer = {\n showUniversalCheckout(token: String, config: PrimerConfig): void {\n configureIntent({ vault: false, paymentMethod: 'Any' });\n configure(config);\n NativeModule.initialize(token);\n },\n\n showVaultManager(token: String, config: PrimerConfig): void {\n configureIntent({ vault: true, paymentMethod: 'Any' });\n configure(config);\n NativeModule.initialize(token);\n },\n\n showPaymentMethod(\n token: String,\n intent: PrimerPaymentMethodIntent,\n config: PrimerConfig\n ): void {\n configureIntent(intent);\n configure(config);\n NativeModule.initialize(token);\n },\n\n fetchSavedPaymentInstruments(token: String, config: PrimerConfig): void {\n configure(config);\n NativeModule.fetchSavedPaymentInstruments(token);\n },\n\n dispose(): void {\n NativeModule.dispose();\n },\n};\n\nfunction configure(config: PrimerConfig): void {\n configureTheme(config.theme);\n configureSettings(config.settings);\n configureOnVaultSuccess(config.onTokenAddedToVault);\n configureOnDismiss(config.onDismiss);\n configureOnError(config.onError);\n configureOnTokenizeSuccess(config.onTokenizeSuccess);\n configureOnResumeSuccess(config.onResumeSuccess);\n configureOnSavedPaymentInstrumentsFetched(\n config.onSavedPaymentInstrumentsFetched\n );\n}\n\nfunction configureSettings(settings: PrimerSettings = {}): void {\n const data = JSON.stringify(settings);\n NativeModule.configureSettings(data);\n}\n\nfunction configureTheme(theme: PrimerTheme = {}): void {\n const data = JSON.stringify(theme);\n NativeModule.configureTheme(data);\n}\n\nfunction configureIntent(\n intent: PrimerIntent = { vault: false, paymentMethod: 'Any' }\n): void {\n const data = JSON.stringify(intent);\n NativeModule.configureIntent(data);\n}\n\nfunction resume(request: ResumeRequest) {\n const data = JSON.stringify(request);\n NativeModule.resume(data);\n}\n\nfunction configureOnTokenizeSuccess(\n callback: OnTokenizeSuccessCallback = (_, __) => {}\n) {\n NativeModule.configureOnTokenizeSuccess((data: any) => {\n try {\n const parsedData = JSON.parse(data) as PaymentInstrumentToken;\n callback(parsedData, {\n resumeWithError: () => resume({ error: true, token: '' }),\n resumeWithSuccess: (token) => resume({ error: false, token }),\n });\n } catch (e) {\n console.log('failed to parse json', e);\n }\n });\n}\n\nfunction configureOnResumeSuccess(\n callback: OnTokenizeSuccessCallback = (_, __) => {}\n) {\n NativeModule.configureOnResumeSuccess((token: any) => {\n try {\n callback(token, {\n resumeWithError: () => resume({ error: true, token: null }),\n resumeWithSuccess: (t) => resume({ error: false, token: t }),\n });\n } catch (e) {\n console.log('failed to parse json', e);\n }\n });\n}\n\nfunction configureOnVaultSuccess(\n callback: OnTokenAddedToVaultCallback = (_) => {}\n) {\n NativeModule.configureOnVaultSuccess((data: any) => {\n parseCallback<PaymentInstrumentToken>(data, callback);\n });\n}\n\nfunction configureOnDismiss(callback: OnDismissCallback = () => {}) {\n NativeModule.configureOnDismiss((_: any) => callback());\n}\n\nfunction configureOnError(callback: OnPrimerErrorCallback = (_) => {}) {\n NativeModule.configureOnPrimerError((data: any) => {\n parseCallback<PrimerError>(data, callback);\n });\n}\n\nfunction configureOnSavedPaymentInstrumentsFetched(\n callback: OnSavedPaymentInstrumentsFetchedCallback = (_) => {}\n) {\n NativeModule.configureOnSavedPaymentInstrumentsFetched((data: any) => {\n parseCallback<PaymentInstrumentToken[]>(data, callback);\n });\n}\n\ninterface ResumeRequest {\n error: boolean;\n token: string | null;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
package/lib/module/Primer.js
CHANGED
|
@@ -46,6 +46,7 @@ function configure(config) {
|
|
|
46
46
|
configureOnDismiss(config.onDismiss);
|
|
47
47
|
configureOnError(config.onError);
|
|
48
48
|
configureOnTokenizeSuccess(config.onTokenizeSuccess);
|
|
49
|
+
configureOnResumeSuccess(config.onResumeSuccess);
|
|
49
50
|
configureOnSavedPaymentInstrumentsFetched(config.onSavedPaymentInstrumentsFetched);
|
|
50
51
|
}
|
|
51
52
|
|
|
@@ -78,10 +79,31 @@ function configureOnTokenizeSuccess(callback = (_, __) => {}) {
|
|
|
78
79
|
const parsedData = JSON.parse(data);
|
|
79
80
|
callback(parsedData, {
|
|
80
81
|
resumeWithError: () => resume({
|
|
81
|
-
error: true
|
|
82
|
+
error: true,
|
|
83
|
+
token: ''
|
|
82
84
|
}),
|
|
83
|
-
resumeWithSuccess:
|
|
84
|
-
error: false
|
|
85
|
+
resumeWithSuccess: token => resume({
|
|
86
|
+
error: false,
|
|
87
|
+
token
|
|
88
|
+
})
|
|
89
|
+
});
|
|
90
|
+
} catch (e) {
|
|
91
|
+
console.log('failed to parse json', e);
|
|
92
|
+
}
|
|
93
|
+
});
|
|
94
|
+
}
|
|
95
|
+
|
|
96
|
+
function configureOnResumeSuccess(callback = (_, __) => {}) {
|
|
97
|
+
NativeModule.configureOnResumeSuccess(token => {
|
|
98
|
+
try {
|
|
99
|
+
callback(token, {
|
|
100
|
+
resumeWithError: () => resume({
|
|
101
|
+
error: true,
|
|
102
|
+
token: null
|
|
103
|
+
}),
|
|
104
|
+
resumeWithSuccess: t => resume({
|
|
105
|
+
error: false,
|
|
106
|
+
token: t
|
|
85
107
|
})
|
|
86
108
|
});
|
|
87
109
|
} catch (e) {
|
package/lib/module/Primer.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["Primer.ts"],"names":["NativeModules","parseCallback","PrimerRN","NativeModule","PrimerNativeMapping","showUniversalCheckout","token","config","configureIntent","vault","paymentMethod","configure","initialize","showVaultManager","showPaymentMethod","intent","fetchSavedPaymentInstruments","dispose","configureTheme","theme","configureSettings","settings","configureOnVaultSuccess","onTokenAddedToVault","configureOnDismiss","onDismiss","configureOnError","onError","configureOnTokenizeSuccess","onTokenizeSuccess","configureOnSavedPaymentInstrumentsFetched","onSavedPaymentInstrumentsFetched","data","JSON","stringify","resume","request","callback","_","__","parsedData","parse","resumeWithError","error","resumeWithSuccess","e","console","log","configureOnPrimer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CAACY,KAAR,CAAd;AACAC,EAAAA,iBAAiB,CAACb,MAAM,CAACc,QAAR,CAAjB;AACAC,EAAAA,uBAAuB,CAACf,MAAM,CAACgB,mBAAR,CAAvB;AACAC,EAAAA,kBAAkB,CAACjB,MAAM,CAACkB,SAAR,CAAlB;AACAC,EAAAA,gBAAgB,CAACnB,MAAM,CAACoB,OAAR,CAAhB;AACAC,EAAAA,0BAA0B,CAACrB,MAAM,CAACsB,iBAAR,CAA1B;AACAC,EAAAA,
|
|
1
|
+
{"version":3,"sources":["Primer.ts"],"names":["NativeModules","parseCallback","PrimerRN","NativeModule","PrimerNativeMapping","showUniversalCheckout","token","config","configureIntent","vault","paymentMethod","configure","initialize","showVaultManager","showPaymentMethod","intent","fetchSavedPaymentInstruments","dispose","configureTheme","theme","configureSettings","settings","configureOnVaultSuccess","onTokenAddedToVault","configureOnDismiss","onDismiss","configureOnError","onError","configureOnTokenizeSuccess","onTokenizeSuccess","configureOnResumeSuccess","onResumeSuccess","configureOnSavedPaymentInstrumentsFetched","onSavedPaymentInstrumentsFetched","data","JSON","stringify","resume","request","callback","_","__","parsedData","parse","resumeWithError","error","resumeWithSuccess","e","console","log","t","configureOnPrimerError"],"mappings":"AAAA,SAASA,aAAT,QAA8B,cAA9B;AAkBA,SAASC,aAAT,QAA8B,SAA9B;AAEA,MAAM;AAAEC,EAAAA,QAAQ,EAAEC;AAAZ,IAA6BH,aAAnC;AAEA,OAAO,MAAMI,mBAA4B,GAAG;AAC1CC,EAAAA,qBAAqB,CAACC,KAAD,EAAgBC,MAAhB,EAA4C;AAC/DC,IAAAA,eAAe,CAAC;AAAEC,MAAAA,KAAK,EAAE,KAAT;AAAgBC,MAAAA,aAAa,EAAE;AAA/B,KAAD,CAAf;AACAC,IAAAA,SAAS,CAACJ,MAAD,CAAT;AACAJ,IAAAA,YAAY,CAACS,UAAb,CAAwBN,KAAxB;AACD,GALyC;;AAO1CO,EAAAA,gBAAgB,CAACP,KAAD,EAAgBC,MAAhB,E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,SAASP,yCAAT,CACEO,QAAkD,GAAIC,CAAD,IAAO,CAAE,CADhE,EAEE;AACArC,EAAAA,YAAY,CAAC6B,yCAAb,CAAwDE,IAAD,IAAe;AACpEjC,IAAAA,aAAa,CAA2BiC,IAA3B,EAAiCK,QAAjC,CAAb;AACD,GAFD;AAGD","sourcesContent":["import { NativeModules } from 'react-native';\nimport type { PaymentInstrumentToken } from './models/payment-instrument-token';\nimport type { IPrimer } from './models/primer';\nimport type {\n OnDismissCallback,\n OnPrimerErrorCallback,\n OnSavedPaymentInstrumentsFetchedCallback,\n OnTokenAddedToVaultCallback,\n OnTokenizeSuccessCallback,\n} from './models/primer-callbacks';\nimport type { PrimerConfig } from './models/primer-config';\nimport type { PrimerError } from './models/primer-error';\nimport type {\n PrimerIntent,\n PrimerPaymentMethodIntent,\n} from './models/primer-intent';\nimport type { PrimerSettings } from './models/primer-settings';\nimport type { PrimerTheme } from './models/primer-theme';\nimport { parseCallback } from './utils';\n\nconst { PrimerRN: NativeModule } = NativeModules;\n\nexport const PrimerNativeMapping: IPrimer = {\n showUniversalCheckout(token: String, config: PrimerConfig): void {\n configureIntent({ vault: false, paymentMethod: 'Any' });\n configure(config);\n NativeModule.initialize(token);\n },\n\n showVaultManager(token: String, config: PrimerConfig): void {\n configureIntent({ vault: true, paymentMethod: 'Any' });\n configure(config);\n NativeModule.initialize(token);\n },\n\n showPaymentMethod(\n token: String,\n intent: PrimerPaymentMethodIntent,\n config: PrimerConfig\n ): void {\n configureIntent(intent);\n configure(config);\n NativeModule.initialize(token);\n },\n\n fetchSavedPaymentInstruments(token: String, config: PrimerConfig): void {\n configure(config);\n NativeModule.fetchSavedPaymentInstruments(token);\n },\n\n dispose(): void {\n NativeModule.dispose();\n },\n};\n\nfunction configure(config: PrimerConfig): void {\n configureTheme(config.theme);\n configureSettings(config.settings);\n configureOnVaultSuccess(config.onTokenAddedToVault);\n configureOnDismiss(config.onDismiss);\n configureOnError(config.onError);\n configureOnTokenizeSuccess(config.onTokenizeSuccess);\n configureOnResumeSuccess(config.onResumeSuccess);\n configureOnSavedPaymentInstrumentsFetched(\n config.onSavedPaymentInstrumentsFetched\n );\n}\n\nfunction configureSettings(settings: PrimerSettings = {}): void {\n const data = JSON.stringify(settings);\n NativeModule.configureSettings(data);\n}\n\nfunction configureTheme(theme: PrimerTheme = {}): void {\n const data = JSON.stringify(theme);\n NativeModule.configureTheme(data);\n}\n\nfunction configureIntent(\n intent: PrimerIntent = { vault: false, paymentMethod: 'Any' }\n): void {\n const data = JSON.stringify(intent);\n NativeModule.configureIntent(data);\n}\n\nfunction resume(request: ResumeRequest) {\n const data = JSON.stringify(request);\n NativeModule.resume(data);\n}\n\nfunction configureOnTokenizeSuccess(\n callback: OnTokenizeSuccessCallback = (_, __) => {}\n) {\n NativeModule.configureOnTokenizeSuccess((data: any) => {\n try {\n const parsedData = JSON.parse(data) as PaymentInstrumentToken;\n callback(parsedData, {\n resumeWithError: () => resume({ error: true, token: '' }),\n resumeWithSuccess: (token) => resume({ error: false, token }),\n });\n } catch (e) {\n console.log('failed to parse json', e);\n }\n });\n}\n\nfunction configureOnResumeSuccess(\n callback: OnTokenizeSuccessCallback = (_, __) => {}\n) {\n NativeModule.configureOnResumeSuccess((token: any) => {\n try {\n callback(token, {\n resumeWithError: () => resume({ error: true, token: null }),\n resumeWithSuccess: (t) => resume({ error: false, token: t }),\n });\n } catch (e) {\n console.log('failed to parse json', e);\n }\n });\n}\n\nfunction configureOnVaultSuccess(\n callback: OnTokenAddedToVaultCallback = (_) => {}\n) {\n NativeModule.configureOnVaultSuccess((data: any) => {\n parseCallback<PaymentInstrumentToken>(data, callback);\n });\n}\n\nfunction configureOnDismiss(callback: OnDismissCallback = () => {}) {\n NativeModule.configureOnDismiss((_: any) => callback());\n}\n\nfunction configureOnError(callback: OnPrimerErrorCallback = (_) => {}) {\n NativeModule.configureOnPrimerError((data: any) => {\n parseCallback<PrimerError>(data, callback);\n });\n}\n\nfunction configureOnSavedPaymentInstrumentsFetched(\n callback: OnSavedPaymentInstrumentsFetchedCallback = (_) => {}\n) {\n NativeModule.configureOnSavedPaymentInstrumentsFetched((data: any) => {\n parseCallback<PaymentInstrumentToken[]>(data, callback);\n });\n}\n\ninterface ResumeRequest {\n error: boolean;\n token: string | null;\n}\n"]}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":[],"names":[],"mappings":"","sourcesContent":[]}
|
|
@@ -1,7 +1,9 @@
|
|
|
1
|
+
import type { ActionRequest } from './action-request';
|
|
1
2
|
import type { PaymentInstrumentToken } from './payment-instrument-token';
|
|
2
3
|
import type { PrimerError } from './primer-error';
|
|
3
4
|
import type { PrimerResumeHandler } from './primer-request';
|
|
4
5
|
export declare type OnTokenizeSuccessCallback = (req: PaymentInstrumentToken, completion: PrimerResumeHandler) => void;
|
|
6
|
+
export declare type OnDataChangeCallback = (req: ActionRequest, completion: PrimerResumeHandler) => void;
|
|
5
7
|
export declare type OnTokenAddedToVaultCallback = (data: PaymentInstrumentToken) => void;
|
|
6
8
|
export declare type OnDismissCallback = () => void;
|
|
7
9
|
export declare type OnPrimerErrorCallback = (data: PrimerError) => void;
|
|
@@ -15,6 +15,7 @@ interface IPrimerConfig {
|
|
|
15
15
|
* Use this callback to grab a Primer payment instrument token and complete a payment.
|
|
16
16
|
*/
|
|
17
17
|
onTokenizeSuccess?: OnTokenizeSuccessCallback;
|
|
18
|
+
onResumeSuccess?: OnTokenizeSuccessCallback;
|
|
18
19
|
/**
|
|
19
20
|
* Use this callback to perform some action when a payment instrument was saved to Primer.
|
|
20
21
|
*/
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export declare type PrimerResumeHandler = IPrimerResumeHandler;
|
|
2
2
|
interface IPrimerResumeHandler {
|
|
3
|
-
resumeWithError: () => void;
|
|
4
|
-
resumeWithSuccess: () => void;
|
|
3
|
+
resumeWithError: (error: string | null) => void;
|
|
4
|
+
resumeWithSuccess: (clientToken: string | null) => void;
|
|
5
5
|
}
|
|
6
6
|
export {};
|
|
@@ -8,6 +8,7 @@ interface IPrimerSettings {
|
|
|
8
8
|
options?: IOptions;
|
|
9
9
|
}
|
|
10
10
|
interface IOrder {
|
|
11
|
+
id?: string;
|
|
11
12
|
amount?: number;
|
|
12
13
|
currency?: CurrencyCode;
|
|
13
14
|
countryCode?: CountryCode;
|
|
@@ -21,11 +22,11 @@ interface IOrderItem {
|
|
|
21
22
|
isPending?: boolean;
|
|
22
23
|
}
|
|
23
24
|
interface IBusiness {
|
|
24
|
-
name
|
|
25
|
+
name?: string;
|
|
25
26
|
registrationNumber?: string;
|
|
26
27
|
email?: string;
|
|
27
28
|
phone?: string;
|
|
28
|
-
address
|
|
29
|
+
address?: IAddress;
|
|
29
30
|
}
|
|
30
31
|
interface ICustomer {
|
|
31
32
|
id?: string;
|
|
@@ -39,9 +40,10 @@ interface IOptions {
|
|
|
39
40
|
isResultScreenEnabled?: boolean;
|
|
40
41
|
isLoadingScreenEnabled?: boolean;
|
|
41
42
|
isFullScreenEnabled?: boolean;
|
|
43
|
+
isThreeDsEnabled?: boolean;
|
|
42
44
|
locale?: string;
|
|
43
45
|
ios?: IIosOptions;
|
|
44
|
-
|
|
46
|
+
android?: IAndroidOptions;
|
|
45
47
|
}
|
|
46
48
|
interface IIosOptions {
|
|
47
49
|
urlScheme?: string;
|
|
@@ -52,11 +54,11 @@ interface IAndroidOptions {
|
|
|
52
54
|
redirectScheme?: string;
|
|
53
55
|
}
|
|
54
56
|
interface IAddress {
|
|
55
|
-
line1
|
|
57
|
+
line1?: String;
|
|
56
58
|
line2?: String;
|
|
57
59
|
postalCode?: String;
|
|
58
60
|
state?: String;
|
|
59
|
-
city
|
|
60
|
-
country
|
|
61
|
+
city?: String;
|
|
62
|
+
country?: CountryCode;
|
|
61
63
|
}
|
|
62
64
|
export {};
|
package/package.json
CHANGED
package/src/Primer.ts
CHANGED
|
@@ -60,6 +60,7 @@ function configure(config: PrimerConfig): void {
|
|
|
60
60
|
configureOnDismiss(config.onDismiss);
|
|
61
61
|
configureOnError(config.onError);
|
|
62
62
|
configureOnTokenizeSuccess(config.onTokenizeSuccess);
|
|
63
|
+
configureOnResumeSuccess(config.onResumeSuccess);
|
|
63
64
|
configureOnSavedPaymentInstrumentsFetched(
|
|
64
65
|
config.onSavedPaymentInstrumentsFetched
|
|
65
66
|
);
|
|
@@ -82,7 +83,7 @@ function configureIntent(
|
|
|
82
83
|
NativeModule.configureIntent(data);
|
|
83
84
|
}
|
|
84
85
|
|
|
85
|
-
function resume(request:
|
|
86
|
+
function resume(request: ResumeRequest) {
|
|
86
87
|
const data = JSON.stringify(request);
|
|
87
88
|
NativeModule.resume(data);
|
|
88
89
|
}
|
|
@@ -94,8 +95,23 @@ function configureOnTokenizeSuccess(
|
|
|
94
95
|
try {
|
|
95
96
|
const parsedData = JSON.parse(data) as PaymentInstrumentToken;
|
|
96
97
|
callback(parsedData, {
|
|
97
|
-
resumeWithError: () => resume({ error: true }),
|
|
98
|
-
resumeWithSuccess: () => resume({ error: false }),
|
|
98
|
+
resumeWithError: () => resume({ error: true, token: '' }),
|
|
99
|
+
resumeWithSuccess: (token) => resume({ error: false, token }),
|
|
100
|
+
});
|
|
101
|
+
} catch (e) {
|
|
102
|
+
console.log('failed to parse json', e);
|
|
103
|
+
}
|
|
104
|
+
});
|
|
105
|
+
}
|
|
106
|
+
|
|
107
|
+
function configureOnResumeSuccess(
|
|
108
|
+
callback: OnTokenizeSuccessCallback = (_, __) => {}
|
|
109
|
+
) {
|
|
110
|
+
NativeModule.configureOnResumeSuccess((token: any) => {
|
|
111
|
+
try {
|
|
112
|
+
callback(token, {
|
|
113
|
+
resumeWithError: () => resume({ error: true, token: null }),
|
|
114
|
+
resumeWithSuccess: (t) => resume({ error: false, token: t }),
|
|
99
115
|
});
|
|
100
116
|
} catch (e) {
|
|
101
117
|
console.log('failed to parse json', e);
|
|
@@ -128,3 +144,8 @@ function configureOnSavedPaymentInstrumentsFetched(
|
|
|
128
144
|
parseCallback<PaymentInstrumentToken[]>(data, callback);
|
|
129
145
|
});
|
|
130
146
|
}
|
|
147
|
+
|
|
148
|
+
interface ResumeRequest {
|
|
149
|
+
error: boolean;
|
|
150
|
+
token: string | null;
|
|
151
|
+
}
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import type { ActionRequest } from './action-request';
|
|
1
2
|
import type { PaymentInstrumentToken } from './payment-instrument-token';
|
|
2
3
|
import type { PrimerError } from './primer-error';
|
|
3
4
|
import type { PrimerResumeHandler } from './primer-request';
|
|
@@ -7,6 +8,11 @@ export type OnTokenizeSuccessCallback = (
|
|
|
7
8
|
completion: PrimerResumeHandler
|
|
8
9
|
) => void;
|
|
9
10
|
|
|
11
|
+
export type OnDataChangeCallback = (
|
|
12
|
+
req: ActionRequest,
|
|
13
|
+
completion: PrimerResumeHandler
|
|
14
|
+
) => void;
|
|
15
|
+
|
|
10
16
|
export type OnTokenAddedToVaultCallback = (
|
|
11
17
|
data: PaymentInstrumentToken
|
|
12
18
|
) => void;
|
|
@@ -22,6 +22,9 @@ interface IPrimerConfig {
|
|
|
22
22
|
* Use this callback to grab a Primer payment instrument token and complete a payment.
|
|
23
23
|
*/
|
|
24
24
|
onTokenizeSuccess?: OnTokenizeSuccessCallback;
|
|
25
|
+
|
|
26
|
+
onResumeSuccess?: OnTokenizeSuccessCallback;
|
|
27
|
+
|
|
25
28
|
/**
|
|
26
29
|
* Use this callback to perform some action when a payment instrument was saved to Primer.
|
|
27
30
|
*/
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
export type PrimerResumeHandler = IPrimerResumeHandler;
|
|
2
2
|
interface IPrimerResumeHandler {
|
|
3
|
-
resumeWithError: () => void;
|
|
4
|
-
resumeWithSuccess: () => void;
|
|
3
|
+
resumeWithError: (error: string | null) => void;
|
|
4
|
+
resumeWithSuccess: (clientToken: string | null) => void;
|
|
5
5
|
}
|
|
@@ -10,6 +10,7 @@ interface IPrimerSettings {
|
|
|
10
10
|
}
|
|
11
11
|
|
|
12
12
|
interface IOrder {
|
|
13
|
+
id?: string;
|
|
13
14
|
amount?: number;
|
|
14
15
|
currency?: CurrencyCode;
|
|
15
16
|
countryCode?: CountryCode;
|
|
@@ -25,11 +26,11 @@ interface IOrderItem {
|
|
|
25
26
|
}
|
|
26
27
|
|
|
27
28
|
interface IBusiness {
|
|
28
|
-
name
|
|
29
|
+
name?: string;
|
|
29
30
|
registrationNumber?: string;
|
|
30
31
|
email?: string;
|
|
31
32
|
phone?: string;
|
|
32
|
-
address
|
|
33
|
+
address?: IAddress;
|
|
33
34
|
}
|
|
34
35
|
|
|
35
36
|
interface ICustomer {
|
|
@@ -45,9 +46,10 @@ interface IOptions {
|
|
|
45
46
|
isResultScreenEnabled?: boolean;
|
|
46
47
|
isLoadingScreenEnabled?: boolean;
|
|
47
48
|
isFullScreenEnabled?: boolean;
|
|
49
|
+
isThreeDsEnabled?: boolean;
|
|
48
50
|
locale?: string;
|
|
49
51
|
ios?: IIosOptions;
|
|
50
|
-
|
|
52
|
+
android?: IAndroidOptions;
|
|
51
53
|
}
|
|
52
54
|
|
|
53
55
|
interface IIosOptions {
|
|
@@ -60,10 +62,10 @@ interface IAndroidOptions {
|
|
|
60
62
|
}
|
|
61
63
|
|
|
62
64
|
interface IAddress {
|
|
63
|
-
line1
|
|
65
|
+
line1?: String;
|
|
64
66
|
line2?: String;
|
|
65
67
|
postalCode?: String;
|
|
66
68
|
state?: String;
|
|
67
|
-
city
|
|
68
|
-
country
|
|
69
|
+
city?: String;
|
|
70
|
+
country?: CountryCode;
|
|
69
71
|
}
|
package/ios/Podfile.lock
DELETED