judokit-react-native 4.1.3 → 4.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (101) hide show
  1. package/JudoKit-ReactNative.podspec +42 -0
  2. package/LICENSE +1 -2
  3. package/README.md +106 -119
  4. package/android/build.gradle +65 -202
  5. package/android/gradle.properties +6 -1
  6. package/android/src/main/AndroidManifest.xml +2 -2
  7. package/android/src/main/AndroidManifestNew.xml +2 -0
  8. package/android/src/main/java/com/judopay/judokit/reactnative/Extensions.kt +382 -0
  9. package/android/src/main/java/com/judopay/judokit/reactnative/Helpers.kt +678 -0
  10. package/android/src/main/java/com/judopay/judokit/reactnative/JudoActivityEventListener.kt +50 -0
  11. package/android/src/main/java/com/judopay/judokit/reactnative/JudoKitReactNativeModule.kt +153 -0
  12. package/android/src/main/java/com/judopay/judokit/reactnative/JudoKitReactNativePackage.kt +16 -0
  13. package/ios/{Classes/Extensions → Extensions}/NSDictionary+JudoConvert.h +1 -1
  14. package/ios/{Classes/Extensions → Extensions}/NSDictionary+JudoConvert.m +2 -2
  15. package/ios/{Classes/Extensions → Extensions}/NSException+JudoValidationExceptions.h +1 -1
  16. package/ios/{Classes/Extensions → Extensions}/NSException+JudoValidationExceptions.m +1 -1
  17. package/ios/{Classes/Extensions → Extensions}/UIColor+RNAdditions.h +1 -1
  18. package/ios/{Classes/Extensions → Extensions}/UIColor+RNAdditions.m +3 -3
  19. package/ios/{Classes/RNJudo.h → JudoKitReactNative.h} +12 -6
  20. package/ios/{Classes/RNJudo.m → JudoKitReactNative.mm} +83 -81
  21. package/ios/{Classes/RNTypes.h → RNTypes.h} +8 -2
  22. package/ios/{Classes/Wrappers → Wrappers}/RNApplePayWrappers.h +1 -1
  23. package/ios/{Classes/Wrappers → Wrappers}/RNApplePayWrappers.m +105 -4
  24. package/ios/{Classes/Wrappers → Wrappers}/RNWrappers.h +14 -14
  25. package/ios/{Classes/Wrappers → Wrappers}/RNWrappers.m +46 -25
  26. package/lib/commonjs/index.js +274 -0
  27. package/lib/commonjs/index.js.map +1 -0
  28. package/lib/commonjs/judo-kit/index.js +212 -0
  29. package/lib/commonjs/judo-kit/index.js.map +1 -0
  30. package/lib/commonjs/types/index.js +273 -0
  31. package/lib/commonjs/types/index.js.map +1 -0
  32. package/lib/commonjs/types/judo-apple-pay-configuration.js +49 -0
  33. package/lib/commonjs/types/judo-apple-pay-configuration.js.map +1 -0
  34. package/lib/commonjs/types/judo-configuration.js +71 -0
  35. package/lib/commonjs/types/judo-configuration.js.map +1 -0
  36. package/lib/commonjs/types/judo-google-pay-configuration.js +28 -0
  37. package/lib/commonjs/types/judo-google-pay-configuration.js.map +1 -0
  38. package/lib/module/index.js +6 -0
  39. package/lib/module/index.js.map +1 -0
  40. package/lib/module/judo-kit/index.js +205 -0
  41. package/lib/module/judo-kit/index.js.map +1 -0
  42. package/lib/module/types/index.js +8 -0
  43. package/lib/module/types/index.js.map +1 -0
  44. package/lib/module/types/judo-apple-pay-configuration.js +43 -0
  45. package/lib/module/types/judo-apple-pay-configuration.js.map +1 -0
  46. package/lib/module/types/judo-configuration.js +65 -0
  47. package/lib/module/types/judo-configuration.js.map +1 -0
  48. package/lib/module/types/judo-google-pay-configuration.js +22 -0
  49. package/lib/module/types/judo-google-pay-configuration.js.map +1 -0
  50. package/lib/typescript/src/index.d.ts +4 -0
  51. package/lib/typescript/src/index.d.ts.map +1 -0
  52. package/lib/typescript/src/judo-kit/index.d.ts +86 -0
  53. package/lib/typescript/src/judo-kit/index.d.ts.map +1 -0
  54. package/lib/typescript/src/types/index.d.ts +4 -0
  55. package/lib/typescript/src/types/index.d.ts.map +1 -0
  56. package/lib/typescript/src/types/judo-apple-pay-configuration.d.ts +75 -0
  57. package/lib/typescript/src/types/judo-apple-pay-configuration.d.ts.map +1 -0
  58. package/lib/typescript/src/types/judo-configuration.d.ts +236 -0
  59. package/lib/typescript/src/types/judo-configuration.d.ts.map +1 -0
  60. package/lib/typescript/src/types/judo-google-pay-configuration.d.ts +42 -0
  61. package/lib/typescript/src/types/judo-google-pay-configuration.d.ts.map +1 -0
  62. package/package.json +158 -79
  63. package/src/index.tsx +51 -0
  64. package/src/judo-kit/index.ts +262 -0
  65. package/src/types/index.ts +54 -0
  66. package/src/types/judo-apple-pay-configuration.ts +85 -0
  67. package/src/types/judo-configuration.ts +263 -0
  68. package/src/types/judo-google-pay-configuration.ts +47 -0
  69. package/JudoPay.tsx +0 -334
  70. package/RNJudopay.podspec +0 -24
  71. package/android/src/main/java/com/reactlibrary/Extensions.kt +0 -372
  72. package/android/src/main/java/com/reactlibrary/Helpers.kt +0 -606
  73. package/android/src/main/java/com/reactlibrary/JudoReactNativeActivityEventListener.kt +0 -48
  74. package/android/src/main/java/com/reactlibrary/JudoReactNativeModule.kt +0 -257
  75. package/android/src/main/java/com/reactlibrary/JudoReactNativePBBAManager.kt +0 -52
  76. package/android/src/main/java/com/reactlibrary/JudoReactNativePackage.kt +0 -14
  77. package/components/JudoPBBAButton.ts +0 -2
  78. package/ios/.xcode.env +0 -11
  79. package/ios/Classes/Views/RNPBBAButtonManager.m +0 -42
  80. package/ios/Classes/Wrappers/RNPBBAWrappers.h +0 -40
  81. package/ios/Classes/Wrappers/RNPBBAWrappers.m +0 -57
  82. package/ios/Podfile +0 -44
  83. package/ios/Podfile.lock +0 -572
  84. package/ios/RNJudo.xcodeproj/project.pbxproj +0 -703
  85. package/ios/RNJudo.xcodeproj/project.xcworkspace/contents.xcworkspacedata +0 -7
  86. package/ios/RNJudo.xcodeproj/xcshareddata/xcschemes/RNJudo.xcscheme +0 -97
  87. package/ios/RNJudo.xcworkspace/contents.xcworkspacedata +0 -10
  88. package/ios/RNJudoTests/Info.plist +0 -22
  89. package/ios/RNJudoTests/MockConfiguration.json +0 -114
  90. package/ios/RNJudoTests/NSDictionaryConvertTests.m +0 -475
  91. package/ios/RNJudoTests/RNApplePayWrappersTests.m +0 -770
  92. package/ios/RNJudoTests/RNJudoTests.m +0 -37
  93. package/ios/RNJudoTests/RNMocks.h +0 -54
  94. package/ios/RNJudoTests/RNMocks.m +0 -55
  95. package/ios/RNJudoTests/RNPBBAWrappersTests.m +0 -121
  96. package/ios/RNJudoTests/RNThemeTests.m +0 -576
  97. package/ios/RNJudoTests/RNWrappersTests.m +0 -947
  98. package/types/JudoApplePayTypes.tsx +0 -59
  99. package/types/JudoGooglePayTypes.tsx +0 -47
  100. package/types/JudoPBBATypes.tsx +0 -7
  101. package/types/JudoTypes.tsx +0 -251
package/JudoPay.tsx DELETED
@@ -1,334 +0,0 @@
1
- import { NativeModules } from 'react-native'
2
- import JudoPBBAButton from './components/JudoPBBAButton'
3
- import { version as packageVersion } from './package.json'
4
-
5
- import {
6
- JudoConfiguration,
7
- JudoResponse,
8
- JudoTransactionMode,
9
- JudoTransactionType,
10
- JudoAuthorization
11
- } from './types/JudoTypes'
12
-
13
- export {
14
- JudoTransactionType,
15
- JudoTransactionMode,
16
- JudoPaymentMethod,
17
- JudoCardNetwork,
18
- ChallengeRequestIndicator,
19
- JudoThreeDSButtonType,
20
- ScaExemption
21
- } from './types/JudoTypes'
22
-
23
- export type {
24
- JudoAmount,
25
- JudoReference,
26
- JudoAddress,
27
- JudoUIConfiguration,
28
- JudoAccountDetails,
29
- JudoTheme,
30
- JudoResponse,
31
- JudoConfiguration,
32
- JudoAuthorization,
33
- NetworkTimeout,
34
- JudoThreeDSButtonCustomization,
35
- JudoThreeDSLabelCustomization,
36
- JudoThreeDSTextBoxCustomization,
37
- JudoThreeDSToolbarCustomization,
38
- JudoThreeDSUIConfiguration
39
- } from './types/JudoTypes'
40
-
41
- export {
42
- JudoPaymentSummaryItemType,
43
- JudoMerchantCapability,
44
- JudoContactField,
45
- JudoShippingType,
46
- JudoReturnedInfo
47
- } from './types/JudoApplePayTypes'
48
-
49
- export type {
50
- JudoApplePayConfiguration,
51
- JudoPaymentSummaryItem,
52
- JudoShippingMethod
53
- } from './types/JudoApplePayTypes'
54
-
55
- export {
56
- JudoAddressFormat,
57
- JudoGooglePayEnvironment
58
- } from './types/JudoGooglePayTypes'
59
-
60
- export type {
61
- JudoGooglePayConfiguration,
62
- JudoBillingAddressParameters,
63
- JudoShippingAddressParameters
64
- } from './types/JudoGooglePayTypes'
65
-
66
- export type { JudoPBBAConfiguration } from './types/JudoPBBATypes'
67
-
68
- export { JudoPBBAButton }
69
-
70
- class JudoPay {
71
- //------------------------------------------------------------------
72
- // Private properties
73
- //------------------------------------------------------------------
74
-
75
- private readonly authorization: JudoAuthorization
76
-
77
- //------------------------------------------------------------------
78
- // Public properties
79
- //------------------------------------------------------------------
80
-
81
- /**
82
- * This property is used to toggle the sandbox environment on and off.
83
- * You can use the sandbox environment to test our SDK features.
84
- */
85
- public isSandboxed = true
86
-
87
- //------------------------------------------------------------------
88
- // Initializers
89
- //------------------------------------------------------------------
90
-
91
- /**
92
- * The designated initializer that is used to configure the JudoPay session, based
93
- * on a provided object that implements the JudoAuthorization interface.
94
- *
95
- * @param authorization - can be either a JudoBasicAuthorization (token & secret) or
96
- * a JudoSessionAuthorization (token & payment session) instance.
97
- */
98
- constructor(authorization: JudoAuthorization) {
99
- this.authorization = authorization
100
- }
101
-
102
- //------------------------------------------------------------------
103
- // SDK Features
104
- //------------------------------------------------------------------
105
-
106
- /**
107
- * A method used to verify if any Pay By Bank App supported banking apps are installed
108
- * on the device.
109
- *
110
- * This can be useful for conditionally rendering the PBBA button only if the bank app
111
- * is available (PBBA won't work otherwise).
112
- *
113
- * @returns an asynchronous boolean value that indicates if any PBBA apps are installed.
114
- */
115
- public isBankingAppAvailable(): Promise<boolean> {
116
- return NativeModules.RNJudo.isBankingAppAvailable()
117
- }
118
-
119
- /**
120
- * A method used to verify if ApplePay is supported for given configuration object
121
- *
122
- * This needs to be invoked before invoking ApplePay transactions.
123
- *
124
- * @returns an asynchronous boolean value that indicates if ApplePay is available.
125
- */
126
- public isApplePayAvailableWithConfiguration(
127
- configuration: JudoConfiguration
128
- ): Promise<boolean> {
129
- const params = this.generateJudoParameters(configuration)
130
- return NativeModules.RNJudo.isApplePayAvailableWithConfiguration(params)
131
- }
132
-
133
- /**
134
- * A method for invoking the Judo UI for card transactions.
135
- * Supported operations - payments, pre-auths, register card, save card, check card.
136
- *
137
- * @param type - a JudoTransactionType value that defines the transaction type.
138
- * @param configuration - a JudoConfiguration object that is used to configure/customize the payment flow.
139
- *
140
- * @returns an asynchronous JudoResponse object, containing the transaction results.
141
- */
142
- public async invokeTransaction(
143
- type: JudoTransactionType,
144
- configuration: JudoConfiguration
145
- ): Promise<JudoResponse> {
146
- const params = {
147
- ...this.generateTransactionTypeParameters(type, configuration),
148
- packageVersion
149
- }
150
- return NativeModules.RNJudo.invokeTransaction(params)
151
- }
152
-
153
- public async fetchTransactionDetails(
154
- receiptId: string
155
- ): Promise<JudoResponse> {
156
- const params = {
157
- authorization: this.generateAuthorizationParameters(),
158
- sandboxed: this.isSandboxed,
159
- receiptId,
160
- packageVersion
161
- }
162
-
163
- return NativeModules.RNJudo.fetchTransactionDetails(params)
164
- }
165
-
166
- /**
167
- * A method for completing a payment/pre-auth transaction using a saved card token.
168
- *
169
- * @param mode - a JudoTransactionMode value that defines if the transaction is either a payment or pre-auth.
170
- * @param configuration - a JudoConfiguration object that is used to configure/customize the payment flow.
171
- * @param cardToken - the saved card token string.
172
- * @param securityCode - the saved card token security code.
173
- * @param cardholderName - the saved card token cardholder name.
174
- * @param cardScheme - the saved card token scheme name.
175
- *
176
- * @returns an asynchronous JudoResponse object, containing the transaction results.
177
- */
178
- public async performTokenTransaction(
179
- mode: JudoTransactionMode,
180
- configuration: JudoConfiguration,
181
- cardToken: string,
182
- securityCode: string | undefined | null,
183
- cardholderName: string | undefined | null,
184
- cardScheme: string
185
- ): Promise<JudoResponse> {
186
- const params = {
187
- ...this.generateTransactionModeParameters(mode, configuration),
188
- ...{
189
- cardToken,
190
- securityCode,
191
- cardholderName,
192
- cardScheme
193
- },
194
- packageVersion
195
- }
196
- return NativeModules.RNJudo.performTokenTransaction(params)
197
- }
198
-
199
- /**
200
- * A method for invoking Apple Pay transactions.
201
- * For this transaction to work, the required JudoApplePayConfiguration parameters must be present as part of
202
- * the JudoConfiguration object passed to the method.
203
- *
204
- * @param mode - a JudoTransactionMode value that defines if the transaction is either a payment or pre-auth.
205
- * @param configuration - a JudoConfiguration object that is used to configure/customize the payment flow.
206
- *
207
- * @returns an asynchronous JudoResponse object, containing the transaction results.
208
- */
209
- public async invokeApplePay(
210
- mode: JudoTransactionMode,
211
- configuration: JudoConfiguration
212
- ): Promise<JudoResponse> {
213
- const params = {
214
- ...this.generateTransactionModeParameters(mode, configuration),
215
- packageVersion
216
- }
217
- return NativeModules.RNJudo.invokeApplePay(params)
218
- }
219
-
220
- /**
221
- * A method for invoking Google Pay transactions.
222
- * For this transaction to work, the required JudoGooglePayConfiguration parameters must be present as part of
223
- * the JudoConfiguration object passed to the method.
224
- *
225
- * @param mode - a JudoTransactionMode value that defines if the transaction is either a payment or pre-auth.
226
- * @param configuration - a JudoConfiguration object that is used to configure/customize the payment flow.
227
- *
228
- * @returns an asynchronous JudoResponse object, containing the transaction results.
229
- */
230
- public async invokeGooglePay(
231
- mode: JudoTransactionMode,
232
- configuration: JudoConfiguration
233
- ): Promise<JudoResponse> {
234
- const params = {
235
- ...this.generateTransactionModeParameters(mode, configuration),
236
- packageVersion
237
- }
238
- return NativeModules.RNJudo.invokeGooglePay(params)
239
- }
240
-
241
- /**
242
- * A method for invoking Pay By Bank App transactions.
243
- *
244
- * @param configuration - a JudoConfiguration object that is used to configure/customize the payment flow.
245
- *
246
- * @returns an asynchronous JudoResponse object, containing the transaction results.
247
- */
248
- public async invokePayByBankApp(
249
- configuration: JudoConfiguration
250
- ): Promise<JudoResponse> {
251
- const params = {
252
- ...this.generateJudoParameters(configuration),
253
- packageVersion
254
- }
255
- return NativeModules.RNJudo.invokePayByBankApp(params)
256
- }
257
-
258
- /**
259
- * A method for invoking the Judo wallet, allowing users to pay with their preferred payment method.
260
- * (Cards, Apple Pay/Google Pay, iDEAL, Pay By Bank App)
261
- *
262
- * @param mode - a JudoTransactionMode value that defines if the transaction is either a payment or pre-auth.
263
- * @param configuration - a JudoConfiguration object that is used to configure/customize the payment flow.
264
- *
265
- * @returns an asynchronous JudoResponse object, containing the transaction results.
266
- */
267
- public async invokePaymentMethodScreen(
268
- mode: JudoTransactionMode,
269
- configuration: JudoConfiguration
270
- ): Promise<JudoResponse> {
271
- const params = {
272
- ...this.generateTransactionModeParameters(mode, configuration),
273
- packageVersion
274
- }
275
- return NativeModules.RNJudo.invokePaymentMethodScreen(params)
276
- }
277
-
278
- //------------------------------------------------------------------
279
- // Private helper methods
280
- //------------------------------------------------------------------
281
-
282
- private readonly generateJudoParameters = (
283
- configuration: JudoConfiguration
284
- ): Record<string, any> => {
285
- return {
286
- authorization: this.generateAuthorizationParameters(),
287
- sandboxed: this.isSandboxed,
288
- configuration: configuration
289
- }
290
- }
291
-
292
- private readonly generateTransactionTypeParameters = (
293
- type: JudoTransactionType,
294
- configuration: JudoConfiguration
295
- ): Record<string, any> => {
296
- return {
297
- authorization: this.generateAuthorizationParameters(),
298
- sandboxed: this.isSandboxed,
299
- transactionType: type,
300
- configuration: configuration
301
- }
302
- }
303
-
304
- private readonly generateTransactionModeParameters = (
305
- mode: JudoTransactionMode,
306
- configuration: JudoConfiguration
307
- ): Record<string, any> => {
308
- return {
309
- authorization: this.generateAuthorizationParameters(),
310
- sandboxed: this.isSandboxed,
311
- transactionMode: mode,
312
- configuration: configuration
313
- }
314
- }
315
-
316
- private readonly generateAuthorizationParameters = (): Record<
317
- string,
318
- any
319
- > => {
320
- if (this.authorization.secret) {
321
- return {
322
- token: this.authorization.token,
323
- secret: this.authorization.secret
324
- }
325
- }
326
-
327
- return {
328
- token: this.authorization.token,
329
- paymentSession: this.authorization.paymentSession
330
- }
331
- }
332
- }
333
-
334
- export default JudoPay
package/RNJudopay.podspec DELETED
@@ -1,24 +0,0 @@
1
- require "json"
2
-
3
- package = JSON.parse(File.read(File.join(__dir__, "package.json")))
4
-
5
- Pod::Spec.new do |s|
6
- s.name = "RNJudopay"
7
- s.version = package["version"]
8
- s.summary = "React Native module for Judopay"
9
- s.description = package["description"]
10
- s.homepage = "https://github.com/judopay/judo-reactnative"
11
- s.license = { :file => 'LICENSE' }
12
- s.author = { "Judopay" => "devteam@judopayments.com" }
13
- s.platform = :ios, "11.0"
14
- s.source = { :path => 'ios' }
15
- s.source_files = "ios/Classes/**/*.{h,m}"
16
- s.requires_arc = true
17
- s.dependency "React"
18
- s.dependency "JudoKit-iOS", "3.2.5"
19
-
20
- s.test_spec 'RNJudoTests' do |test_spec|
21
- test_spec.source_files = 'ios/RNJudoTests/**/*.{h,m}'
22
- end
23
-
24
- end