judokit-react-native 3.3.9 → 3.4.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/JudoPay.tsx CHANGED
@@ -144,20 +144,30 @@ class JudoPay {
144
144
  *
145
145
  * @param mode - a JudoTransactionMode value that defines if the transaction is either a payment or pre-auth.
146
146
  * @param configuration - a JudoConfiguration object that is used to configure/customize the payment flow.
147
- * @param token - the saved card token string.
147
+ * @param cardToken - the saved card token string.
148
+ * @param securityCode - the saved card token security code.
149
+ * @param cardholderName - the saved card token cardholder name.
150
+ * @param cardScheme - the saved card token scheme name.
148
151
  *
149
152
  * @returns an asynchronous JudoResponse object, containing the transaction results.
150
153
  */
151
154
  public async performTokenTransaction(
152
155
  mode: JudoTransactionMode,
153
156
  configuration: JudoConfiguration,
154
- token: string
157
+ cardToken: string,
158
+ securityCode: string,
159
+ cardholderName: string,
160
+ cardScheme: string
155
161
  ): Promise<JudoResponse> {
156
162
  const params = this.generateTransactionModeParameters(
157
163
  mode,
158
164
  configuration
159
165
  )
160
- params['cardToken'] = token
166
+ params['cardToken'] = cardToken
167
+ params['securityCode'] = securityCode
168
+ params['cardholderName'] = cardholderName
169
+ params['cardScheme'] = cardScheme
170
+
161
171
  return NativeModules.RNJudo.performTokenTransaction(params)
162
172
  }
163
173
 
package/RNJudopay.podspec CHANGED
@@ -15,7 +15,7 @@ Pod::Spec.new do |s|
15
15
  s.source_files = "ios/Classes/**/*.{h,m}"
16
16
  s.requires_arc = true
17
17
  s.dependency "React"
18
- s.dependency "JudoKit-iOS", "2.4.6"
18
+ s.dependency "JudoKit-iOS", "3.0.2"
19
19
 
20
20
  s.test_spec 'RNJudoTests' do |test_spec|
21
21
  test_spec.source_files = 'ios/RNJudoTests/**/*.{h,m}'
@@ -86,6 +86,8 @@ repositories {
86
86
  mavenCentral()
87
87
  google()
88
88
 
89
+ maven { url 'https://vocalinkzapp.jfrog.io/artifactory/merchant-library-maven/' }
90
+
89
91
  maven { url "$projectDir/../node_modules/react-native/android" }
90
92
  }
91
93
 
@@ -99,7 +101,7 @@ dependencies {
99
101
  implementation "org.jetbrains.kotlin:kotlin-stdlib-jdk7:$kotlin_version"
100
102
  implementation 'androidx.localbroadcastmanager:localbroadcastmanager:1.1.0'
101
103
 
102
- implementation 'com.judopay:judokit-android:2.1.10'
104
+ implementation 'com.judopay:judokit-android:3.0.3'
103
105
 
104
106
  //JUnit 5
105
107
  testImplementation "org.junit.jupiter:junit-jupiter-api:$junit5_version"
@@ -7,6 +7,18 @@ import com.facebook.react.bridge.ReadableMap
7
7
  import com.judopay.judokit.android.JUDO_OPTIONS
8
8
  import com.judopay.judokit.android.Judo
9
9
  import com.judopay.judokit.android.JudoActivity
10
+ import com.judopay.judokit.android.model.CardNetwork
11
+
12
+ const val CARD_SCHEME_VISA = "visa"
13
+ const val CARD_SCHEME_MASTERCARD = "mastercard"
14
+ const val CARD_SCHEME_AMEX = "amex"
15
+
16
+ internal fun ReadableMap?.hasKey(key: String): Boolean {
17
+ if (this != null) {
18
+ return this.hasKey(key)
19
+ }
20
+ return false
21
+ }
10
22
 
11
23
  internal val ReadableMap.configuration: ReadableMap?
12
24
  get() = getMap("configuration")
@@ -31,6 +43,30 @@ internal val ReadableMap.securityCode: String?
31
43
  return null
32
44
  }
33
45
 
46
+ internal val ReadableMap.cardholderName: String?
47
+ get() {
48
+ if (hasKey("cardholderName")) {
49
+ return getString("cardholderName")
50
+ }
51
+ return null
52
+ }
53
+
54
+ internal val ReadableMap.cardType: CardNetwork
55
+ get() {
56
+ val cardScheme = if (hasKey("cardScheme")) {
57
+ getString("cardScheme") ?: ""
58
+ } else {
59
+ ""
60
+ }
61
+
62
+ return when (cardScheme.lowercase()) {
63
+ CARD_SCHEME_VISA -> CardNetwork.VISA
64
+ CARD_SCHEME_MASTERCARD -> CardNetwork.MASTERCARD
65
+ CARD_SCHEME_AMEX -> CardNetwork.AMEX
66
+ else -> CardNetwork.OTHER
67
+ }
68
+ }
69
+
34
70
  internal val ReadableMap.judoId: String?
35
71
  get() = configuration?.getString("judoId")
36
72
 
@@ -64,10 +100,153 @@ internal val ReadableMap.paymentReference: String?
64
100
  internal val ReadableMap.isInitialRecurringPayment: Boolean?
65
101
  get() = configuration?.getBoolean("isInitialRecurringPayment")
66
102
 
103
+ internal val ReadableMap.networkTimeout: ReadableMap?
104
+ get() {
105
+ if (configuration.hasKey("networkTimeout")) {
106
+ return configuration?.getMap("networkTimeout")
107
+ }
108
+ return null
109
+ }
110
+
111
+ internal val ReadableMap.cardAddress: ReadableMap?
112
+ get() {
113
+ if (configuration.hasKey("cardAddress")) {
114
+ return configuration?.getMap("cardAddress")
115
+ }
116
+ return null
117
+ }
118
+
119
+ internal val ReadableMap.cardAddressLine1: String?
120
+ get() {
121
+ if (cardAddress.hasKey("line1")) {
122
+ return cardAddress?.getString("line1")
123
+ }
124
+
125
+ return null
126
+ }
127
+
128
+ internal val ReadableMap.cardAddressLine2: String?
129
+ get() {
130
+ if (cardAddress.hasKey("line2")) {
131
+ return cardAddress?.getString("line2")
132
+ }
133
+
134
+ return null
135
+ }
136
+
137
+ internal val ReadableMap.cardAddressLine3: String?
138
+ get() {
139
+ if (cardAddress.hasKey("line3")) {
140
+ return cardAddress?.getString("line3")
141
+ }
142
+
143
+ return null
144
+ }
145
+
146
+ internal val ReadableMap.cardAddressPostCode: String?
147
+ get() {
148
+ if (cardAddress.hasKey("postCode")) {
149
+ return cardAddress?.getString("postCode")
150
+ }
151
+
152
+ return null
153
+ }
154
+
155
+ internal val ReadableMap.cardAddressTown: String?
156
+ get() {
157
+ if (cardAddress.hasKey("town")) {
158
+ return cardAddress?.getString("town")
159
+ }
160
+
161
+ return null
162
+ }
163
+
164
+ internal val ReadableMap.cardAddressCountryCode: Int?
165
+ get() {
166
+ if (cardAddress.hasKey("countryCode")) {
167
+ return cardAddress?.getString("countryCode")?.toInt()
168
+ }
169
+
170
+ return null
171
+ }
172
+
173
+ internal val ReadableMap.cardAddressBillingCountry: String?
174
+ get() {
175
+ if (cardAddress.hasKey("billingCountry")) {
176
+ return cardAddress?.getString("billingCountry")
177
+ }
178
+
179
+ return null
180
+ }
181
+
182
+ internal val ReadableMap.networkConnectTimeout: Long?
183
+ get() = networkTimeout?.getDouble("connectTimeout")?.toLong()
184
+
185
+ internal val ReadableMap.networkReadTimeout: Long?
186
+ get() = networkTimeout?.getDouble("readTimeout")?.toLong()
187
+
188
+ internal val ReadableMap.networkWriteTimeout: Long?
189
+ get() = networkTimeout?.getDouble("writeTimeout")?.toLong()
190
+
191
+ internal val ReadableMap.challengeRequestIndicator: String?
192
+ get() {
193
+ if (configuration.hasKey("challengeRequestIndicator")) {
194
+ return configuration?.getString("challengeRequestIndicator")
195
+ }
196
+ return null
197
+ }
198
+
199
+ internal val ReadableMap.scaExemption: String?
200
+ get() {
201
+ if (configuration.hasKey("scaExemption")) {
202
+ return configuration?.getString("scaExemption")
203
+ }
204
+ return null
205
+ }
206
+
207
+ internal val ReadableMap.mobileNumber: String?
208
+ get() {
209
+ if (configuration.hasKey("mobileNumber")) {
210
+ return configuration?.getString("mobileNumber")
211
+ }
212
+ return null
213
+ }
214
+
215
+ internal val ReadableMap.phoneCountryCode: String?
216
+ get() {
217
+ if (configuration.hasKey("phoneCountryCode")) {
218
+ return configuration?.getString("phoneCountryCode")
219
+ }
220
+ return null
221
+ }
222
+
223
+ internal val ReadableMap.emailAddress: String?
224
+ get() {
225
+ if (configuration.hasKey("emailAddress")) {
226
+ return configuration?.getString("emailAddress")
227
+ }
228
+ return null
229
+ }
230
+
231
+ internal val ReadableMap.threeDSTwoMaxTimeout: Int?
232
+ get() {
233
+ if (configuration.hasKey("threeDSTwoMaxTimeout")) {
234
+ return configuration?.getString("threeDSTwoMaxTimeout")?.toInt()
235
+ }
236
+ return null
237
+ }
238
+
239
+ internal val ReadableMap.threeDSTwoMessageVersion: String?
240
+ get() {
241
+ if (configuration.hasKey("threeDSTwoMessageVersion")) {
242
+ return configuration?.getString("threeDSTwoMessageVersion")
243
+ }
244
+ return null
245
+ }
246
+
67
247
  internal val ReadableMap.metadata: ReadableMap?
68
248
  get() {
69
- val hasKey = reference?.hasKey("metadata") ?: false
70
- if (hasKey) {
249
+ if (reference.hasKey("metadata")) {
71
250
  return reference?.getMap("metadata")
72
251
  }
73
252
  return null
@@ -75,8 +254,7 @@ internal val ReadableMap.metadata: ReadableMap?
75
254
 
76
255
  internal val ReadableMap.cardNetworkValue: Int?
77
256
  get() {
78
- val hasKey = configuration?.hasKey("supportedCardNetworks") ?: false
79
- if (hasKey) {
257
+ if (configuration.hasKey("supportedCardNetworks")) {
80
258
  return configuration?.getInt("supportedCardNetworks")
81
259
  }
82
260
  return null
@@ -84,8 +262,7 @@ internal val ReadableMap.cardNetworkValue: Int?
84
262
 
85
263
  internal val ReadableMap.paymentMethodValue: Int?
86
264
  get() {
87
- val hasKey = configuration?.hasKey("paymentMethods") ?: false
88
- if (hasKey) {
265
+ if (configuration.hasKey("paymentMethods")) {
89
266
  return configuration?.getInt("paymentMethods")
90
267
  }
91
268
  return null
@@ -93,8 +270,7 @@ internal val ReadableMap.paymentMethodValue: Int?
93
270
 
94
271
  internal val ReadableMap.uiConfiguration: ReadableMap?
95
272
  get() {
96
- val hasKey = configuration?.hasKey("uiConfiguration") ?: false
97
- if (hasKey) {
273
+ if (configuration.hasKey("uiConfiguration")) {
98
274
  return configuration?.getMap("uiConfiguration")
99
275
  }
100
276
  return null
@@ -112,10 +288,17 @@ internal val ReadableMap.shouldPaymentButtonDisplayAmount: Boolean?
112
288
  internal val ReadableMap.shouldPaymentMethodsVerifySecurityCode: Boolean?
113
289
  get() = uiConfiguration?.getBoolean("shouldPaymentMethodsVerifySecurityCode")
114
290
 
291
+ internal val ReadableMap.shouldAskForBillingInformation: Boolean
292
+ get() {
293
+ if (uiConfiguration.hasKey("shouldAskForBillingInformation")) {
294
+ return uiConfiguration?.getBoolean("shouldAskForBillingInformation") ?: true
295
+ }
296
+ return true
297
+ }
298
+
115
299
  internal val ReadableMap.primaryAccountDetails: ReadableMap?
116
300
  get() {
117
- val hasKey = configuration?.hasKey("primaryAccountDetails") ?: false
118
- if (hasKey) {
301
+ if (configuration.hasKey("primaryAccountDetails")) {
119
302
  return configuration?.getMap("primaryAccountDetails")
120
303
  }
121
304
  return null
@@ -123,8 +306,7 @@ internal val ReadableMap.primaryAccountDetails: ReadableMap?
123
306
 
124
307
  internal val ReadableMap.name: String?
125
308
  get() {
126
- val hasKey = primaryAccountDetails?.hasKey("name") ?: false
127
- if (hasKey) {
309
+ if (primaryAccountDetails.hasKey("name")) {
128
310
  return primaryAccountDetails?.getString("name")
129
311
  }
130
312
  return null
@@ -132,8 +314,7 @@ internal val ReadableMap.name: String?
132
314
 
133
315
  internal val ReadableMap.accountNumber: String?
134
316
  get() {
135
- val hasKey = primaryAccountDetails?.hasKey("accountNumber") ?: false
136
- if (hasKey) {
317
+ if (primaryAccountDetails.hasKey("accountNumber")) {
137
318
  return primaryAccountDetails?.getString("accountNumber")
138
319
  }
139
320
  return null
@@ -141,8 +322,7 @@ internal val ReadableMap.accountNumber: String?
141
322
 
142
323
  internal val ReadableMap.dateOfBirth: String?
143
324
  get() {
144
- val hasKey = primaryAccountDetails?.hasKey("dateOfBirth") ?: false
145
- if (hasKey) {
325
+ if (primaryAccountDetails.hasKey("dateOfBirth")) {
146
326
  return primaryAccountDetails?.getString("dateOfBirth")
147
327
  }
148
328
  return null
@@ -150,8 +330,7 @@ internal val ReadableMap.dateOfBirth: String?
150
330
 
151
331
  internal val ReadableMap.postCode: String?
152
332
  get() {
153
- val hasKey = primaryAccountDetails?.hasKey("postCode") ?: false
154
- if (hasKey) {
333
+ if (primaryAccountDetails.hasKey("postCode")) {
155
334
  return primaryAccountDetails?.getString("postCode")
156
335
  }
157
336
  return null
@@ -159,8 +338,7 @@ internal val ReadableMap.postCode: String?
159
338
 
160
339
  internal val ReadableMap.googlePayConfiguration: ReadableMap?
161
340
  get() {
162
- val hasKey = configuration?.hasKey("googlePayConfiguration") ?: false
163
- if (hasKey) {
341
+ if (configuration.hasKey("googlePayConfiguration")) {
164
342
  return configuration?.getMap("googlePayConfiguration")
165
343
  }
166
344
  return null
@@ -183,8 +361,7 @@ internal val ReadableMap.isShippingAddressRequired: Boolean?
183
361
 
184
362
  internal val ReadableMap.billingAddressParameters: ReadableMap?
185
363
  get() {
186
- val hasKey = googlePayConfiguration?.hasKey("billingAddressParameters") ?: false
187
- if (hasKey) {
364
+ if (googlePayConfiguration.hasKey("billingAddressParameters")) {
188
365
  return googlePayConfiguration?.getMap("billingAddressParameters")
189
366
  }
190
367
  return null
@@ -192,8 +369,7 @@ internal val ReadableMap.billingAddressParameters: ReadableMap?
192
369
 
193
370
  internal val ReadableMap.shippingAddressParameters: ReadableMap?
194
371
  get() {
195
- val hasKey = googlePayConfiguration?.hasKey("shippingAddressParameters") ?: false
196
- if (hasKey) {
372
+ if (googlePayConfiguration.hasKey("shippingAddressParameters")) {
197
373
  return googlePayConfiguration?.getMap("shippingAddressParameters")
198
374
  }
199
375
  return null
@@ -210,8 +386,7 @@ internal val ReadableMap.isShippingPhoneNumberRequired: Boolean?
210
386
 
211
387
  internal val ReadableMap.allowedCountryCodeList: ReadableArray?
212
388
  get() {
213
- val hasKey = shippingAddressParameters?.hasKey("allowedCountryCodes") ?: false
214
- if (hasKey) {
389
+ if (shippingAddressParameters.hasKey("allowedCountryCodes")) {
215
390
  return shippingAddressParameters?.getArray("allowedCountryCodes")
216
391
  }
217
392
  return null
@@ -219,17 +394,16 @@ internal val ReadableMap.allowedCountryCodeList: ReadableArray?
219
394
 
220
395
  internal val ReadableMap.pbbaConfiguration: ReadableMap?
221
396
  get() {
222
- val hasKey = configuration?.hasKey("pbbaConfiguration") ?: false
223
- if (hasKey) {
397
+ if (configuration.hasKey("pbbaConfiguration")) {
224
398
  return configuration?.getMap("pbbaConfiguration")
225
399
  }
226
400
  return null
227
401
  }
228
402
 
229
- internal val ReadableMap.mobileNumber: String?
403
+ internal val ReadableMap.pbbaMobileNumber: String?
230
404
  get() = pbbaConfiguration?.getString("mobileNumber")
231
405
 
232
- internal val ReadableMap.emailAddress: String?
406
+ internal val ReadableMap.pbbaEmailAddress: String?
233
407
  get() = pbbaConfiguration?.getString("emailAddress")
234
408
 
235
409
  internal val ReadableMap.deeplinkScheme: String?
@@ -237,8 +411,7 @@ internal val ReadableMap.deeplinkScheme: String?
237
411
 
238
412
  internal val ReadableMap.deeplinkURL: String?
239
413
  get() {
240
- val hasKey = pbbaConfiguration?.hasKey("deeplinkURL") ?: false
241
- return if (hasKey) {
414
+ return if (pbbaConfiguration.hasKey("deeplinkURL")) {
242
415
  pbbaConfiguration?.getString("deeplinkURL")
243
416
  } else {
244
417
  null
@@ -246,5 +419,5 @@ internal val ReadableMap.deeplinkURL: String?
246
419
  }
247
420
 
248
421
  fun Judo.toJudoActivityIntent(packageContext: Context): Intent =
249
- Intent(packageContext, JudoActivity::class.java)
250
- .also { it.putExtra(JUDO_OPTIONS, this) }
422
+ Intent(packageContext, JudoActivity::class.java)
423
+ .also { it.putExtra(JUDO_OPTIONS, this) }
@@ -9,17 +9,8 @@ import com.judopay.judokit.android.Judo
9
9
  import com.judopay.judokit.android.api.model.Authorization
10
10
  import com.judopay.judokit.android.api.model.BasicAuthorization
11
11
  import com.judopay.judokit.android.api.model.PaymentSessionAuthorization
12
- import com.judopay.judokit.android.model.Amount
13
- import com.judopay.judokit.android.model.CardNetwork
14
- import com.judopay.judokit.android.model.Currency
15
- import com.judopay.judokit.android.model.GooglePayConfiguration
16
- import com.judopay.judokit.android.model.JudoResult
17
- import com.judopay.judokit.android.model.PBBAConfiguration
18
- import com.judopay.judokit.android.model.PaymentMethod
19
- import com.judopay.judokit.android.model.PaymentWidgetType
20
- import com.judopay.judokit.android.model.PrimaryAccountDetails
21
- import com.judopay.judokit.android.model.Reference
22
- import com.judopay.judokit.android.model.UiConfiguration
12
+ import com.judopay.judokit.android.api.model.request.Address
13
+ import com.judopay.judokit.android.model.*
23
14
  import com.judopay.judokit.android.model.googlepay.GooglePayAddressFormat
24
15
  import com.judopay.judokit.android.model.googlepay.GooglePayBillingAddressParameters
25
16
  import com.judopay.judokit.android.model.googlepay.GooglePayEnvironment
@@ -118,21 +109,71 @@ internal fun getJudoConfiguration(type: PaymentWidgetType, options: ReadableMap)
118
109
  val primaryAccountDetails = getPrimaryAccountDetails(options)
119
110
  val googlePayConfiguration = getGooglePayConfiguration(options)
120
111
  val pbbaConfiguration = getPBBAConfiguration(options)
112
+ val timeouts = getNetworkTimeout(options)
113
+ val challengeRequestIndicator = getChallengeRequestIndicator(options)
114
+ val scaExemption = getScaExemption(options)
115
+ val address = getAddress(options)
121
116
 
122
117
  return Judo.Builder(type)
123
- .setAuthorization(authorization)
124
- .setIsSandboxed(options.isSandboxed)
125
- .setJudoId(options.judoId)
126
- .setAmount(amount)
127
- .setReference(reference)
128
- .setSupportedCardNetworks(cardNetworks)
129
- .setPaymentMethods(paymentMethods)
130
- .setUiConfiguration(uiConfiguration)
131
- .setPrimaryAccountDetails(primaryAccountDetails)
132
- .setGooglePayConfiguration(googlePayConfiguration)
133
- .setPBBAConfiguration(pbbaConfiguration)
134
- .setInitialRecurringPayment(options.isInitialRecurringPayment)
118
+ .setAuthorization(authorization)
119
+ .setIsSandboxed(options.isSandboxed)
120
+ .setJudoId(options.judoId)
121
+ .setAmount(amount)
122
+ .setReference(reference)
123
+ .setSupportedCardNetworks(cardNetworks)
124
+ .setPaymentMethods(paymentMethods)
125
+ .setUiConfiguration(uiConfiguration)
126
+ .setPrimaryAccountDetails(primaryAccountDetails)
127
+ .setGooglePayConfiguration(googlePayConfiguration)
128
+ .setPBBAConfiguration(pbbaConfiguration)
129
+ .setInitialRecurringPayment(options.isInitialRecurringPayment)
130
+ .setNetworkTimeout(timeouts)
131
+ .setChallengeRequestIndicator(challengeRequestIndicator)
132
+ .setScaExemption(scaExemption)
133
+ .setMobileNumber(options.mobileNumber)
134
+ .setEmailAddress(options.emailAddress)
135
+ .setThreeDSTwoMaxTimeout(options.threeDSTwoMaxTimeout)
136
+ .setThreeDSTwoMessageVersion(options.threeDSTwoMessageVersion)
137
+ .setPhoneCountryCode(options.phoneCountryCode)
138
+ .setAddress(address)
139
+ .build()
140
+ }
141
+
142
+ internal fun getAddress(options: ReadableMap): Address? {
143
+ if (options.cardAddress != null) {
144
+ return Address.Builder()
145
+ .setLine1(options.cardAddressLine1)
146
+ .setLine2(options.cardAddressLine2)
147
+ .setLine3(options.cardAddressLine3)
148
+ .setTown(options.cardAddressTown)
149
+ .setPostCode(options.cardAddressPostCode)
150
+ .setBillingCountry(options.cardAddressBillingCountry)
151
+ .setCountryCode(options.cardAddressCountryCode)
135
152
  .build()
153
+ }
154
+ return null
155
+ }
156
+
157
+ internal fun getNetworkTimeout(options: ReadableMap): NetworkTimeout? {
158
+ val networkTimeout = options.networkTimeout
159
+ if (networkTimeout != null) {
160
+ return NetworkTimeout.Builder()
161
+ .setConnectTimeout(options.networkConnectTimeout)
162
+ .setReadTimeout(options.networkReadTimeout)
163
+ .setWriteTimeout(options.networkWriteTimeout)
164
+ .build()
165
+ }
166
+ return null
167
+ }
168
+
169
+ internal fun getChallengeRequestIndicator(options: ReadableMap): ChallengeRequestIndicator? {
170
+ val challengeRequestIndicator = ChallengeRequestIndicator.values().firstOrNull { it.value == options.challengeRequestIndicator }
171
+ return challengeRequestIndicator ?: ChallengeRequestIndicator.CHALLENGE_AS_MANDATE
172
+ }
173
+
174
+ internal fun getScaExemption(options: ReadableMap): ScaExemption {
175
+ val scaExemption = ScaExemption.values().firstOrNull { it.value == options.scaExemption }
176
+ return scaExemption ?: ScaExemption.LOW_VALUE
136
177
  }
137
178
 
138
179
  internal fun getAuthorization(options: ReadableMap): Authorization {
@@ -140,16 +181,16 @@ internal fun getAuthorization(options: ReadableMap): Authorization {
140
181
 
141
182
  options.secret?.let { secret ->
142
183
  return BasicAuthorization.Builder()
143
- .setApiToken(token)
144
- .setApiSecret(secret)
145
- .build()
184
+ .setApiToken(token)
185
+ .setApiSecret(secret)
186
+ .build()
146
187
  }
147
188
 
148
189
  options.paymentSession?.let { paymentSession ->
149
190
  return PaymentSessionAuthorization.Builder()
150
- .setApiToken(token)
151
- .setPaymentSession(paymentSession)
152
- .build()
191
+ .setApiToken(token)
192
+ .setPaymentSession(paymentSession)
193
+ .build()
153
194
  }
154
195
 
155
196
  throw IllegalArgumentException("No secret or payment session in the authorization")
@@ -174,16 +215,16 @@ internal fun getAmount(options: ReadableMap): Amount {
174
215
  else -> Currency.valueOf(currencyValue)
175
216
  }
176
217
  return Amount.Builder()
177
- .setAmount(options.amountValue)
178
- .setCurrency(currency)
179
- .build()
218
+ .setAmount(options.amountValue)
219
+ .setCurrency(currency)
220
+ .build()
180
221
  }
181
222
 
182
223
  internal fun getReference(options: ReadableMap): Reference? {
183
224
 
184
225
  var builder = Reference.Builder()
185
- .setConsumerReference(options.consumerReference)
186
- .setPaymentReference(options.paymentReference)
226
+ .setConsumerReference(options.consumerReference)
227
+ .setPaymentReference(options.paymentReference)
187
228
 
188
229
  val metadataMap = options.metadata
189
230
  metadataMap?.let {
@@ -291,11 +332,12 @@ internal fun getPaymentMethods(options: ReadableMap): Array<PaymentMethod>? {
291
332
  internal fun getUIConfiguration(options: ReadableMap): UiConfiguration? {
292
333
  return if (options.uiConfiguration != null) {
293
334
  UiConfiguration.Builder()
294
- .setAvsEnabled(options.isAVSEnabled)
295
- .setShouldPaymentMethodsDisplayAmount(options.shouldPaymentMethodsDisplayAmount)
296
- .setShouldPaymentButtonDisplayAmount(options.shouldPaymentButtonDisplayAmount)
297
- .setShouldPaymentMethodsVerifySecurityCode(options.shouldPaymentMethodsVerifySecurityCode)
298
- .build()
335
+ .setAvsEnabled(options.isAVSEnabled)
336
+ .setShouldPaymentMethodsDisplayAmount(options.shouldPaymentMethodsDisplayAmount)
337
+ .setShouldPaymentButtonDisplayAmount(options.shouldPaymentButtonDisplayAmount)
338
+ .setShouldPaymentMethodsVerifySecurityCode(options.shouldPaymentMethodsVerifySecurityCode)
339
+ .setShouldAskForBillingInformation(options.shouldAskForBillingInformation)
340
+ .build()
299
341
  } else {
300
342
  null
301
343
  }
@@ -326,14 +368,14 @@ internal fun getGooglePayConfiguration(options: ReadableMap): GooglePayConfigura
326
368
 
327
369
  return if (options.googlePayConfiguration != null) {
328
370
  GooglePayConfiguration.Builder()
329
- .setTransactionCountryCode(options.countryCode)
330
- .setEnvironment(environment)
331
- .setIsEmailRequired(options.isEmailRequired)
332
- .setIsBillingAddressRequired(options.isBillingAddressRequired)
333
- .setBillingAddressParameters(billingParameters)
334
- .setIsShippingAddressRequired(options.isShippingAddressRequired)
335
- .setShippingAddressParameters(shippingParameters)
336
- .build()
371
+ .setTransactionCountryCode(options.countryCode)
372
+ .setEnvironment(environment)
373
+ .setIsEmailRequired(options.isEmailRequired)
374
+ .setIsBillingAddressRequired(options.isBillingAddressRequired)
375
+ .setBillingAddressParameters(billingParameters)
376
+ .setIsShippingAddressRequired(options.isShippingAddressRequired)
377
+ .setShippingAddressParameters(shippingParameters)
378
+ .build()
337
379
  } else {
338
380
  null
339
381
  }
@@ -345,8 +387,8 @@ internal fun getBillingParameters(options: ReadableMap): GooglePayBillingAddress
345
387
  else -> GooglePayAddressFormat.FULL
346
388
  }
347
389
  return GooglePayBillingAddressParameters(
348
- addressFormat,
349
- options.isBillingPhoneNumberRequired
390
+ addressFormat,
391
+ options.isBillingPhoneNumberRequired
350
392
  )
351
393
  }
352
394
 
@@ -361,8 +403,8 @@ internal fun getShippingParameters(options: ReadableMap): GooglePayShippingAddre
361
403
  }
362
404
 
363
405
  return GooglePayShippingAddressParameters(
364
- allowedCountryCodes,
365
- options.isShippingPhoneNumberRequired
406
+ allowedCountryCodes,
407
+ options.isShippingPhoneNumberRequired
366
408
  )
367
409
  }
368
410
 
@@ -375,11 +417,11 @@ internal fun getPBBAConfiguration(options: ReadableMap): PBBAConfiguration? {
375
417
  }
376
418
 
377
419
  PBBAConfiguration.Builder()
378
- .setMobileNumber(options.mobileNumber)
379
- .setEmailAddress(options.emailAddress)
380
- .setDeepLinkURL(deeplinkUri)
381
- .setDeepLinkScheme(options.deeplinkScheme)
382
- .build()
420
+ .setMobileNumber(options.pbbaMobileNumber)
421
+ .setEmailAddress(options.pbbaEmailAddress)
422
+ .setDeepLinkURL(deeplinkUri)
423
+ .setDeepLinkScheme(options.deeplinkScheme)
424
+ .build()
383
425
  } else {
384
426
  null
385
427
  }