judokit-react-native 4.1.2 → 4.2.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.
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 +653 -0
  10. package/android/src/main/java/com/judopay/judokit/reactnative/JudoActivityEventListener.kt +49 -0
  11. package/android/src/main/java/com/judopay/judokit/reactnative/JudoKitReactNativeModule.kt +238 -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 +268 -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 +267 -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 +50 -0
  64. package/src/judo-kit/index.ts +262 -0
  65. package/src/types/index.ts +53 -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
@@ -1,947 +0,0 @@
1
- //
2
- // RNWrappersTest.m
3
- // RNJudo
4
- //
5
- // Copyright (c) 2020 Alternative Payments Ltd
6
- //
7
- // Permission is hereby granted, free of charge, to any person obtaining a copy
8
- // of this software and associated documentation files (the "Software"), to deal
9
- // in the Software without restriction, including without limitation the rights
10
- // to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
11
- // copies of the Software, and to permit persons to whom the Software is
12
- // furnished to do so, subject to the following conditions:
13
- //
14
- // The above copyright notice and this permission notice shall be included in all
15
- // copies or substantial portions of the Software.
16
- //
17
- // THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
18
- // IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
19
- // FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
20
- // AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
21
- // LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
22
- // OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
23
- // SOFTWARE.
24
-
25
- #import <XCTest/XCTest.h>
26
- #import "RNWrappers.h"
27
- #import "RNMocks.h"
28
-
29
- @interface RNWrappersTest : XCTestCase
30
-
31
- @end
32
-
33
- @implementation RNWrappersTest
34
-
35
- /*
36
- * GIVEN: a configuration NSDictionary is passed to the wrapper
37
- *
38
- * WHEN: the NSDictionary is valid
39
- *
40
- * THEN: a configured JPConfiguration instance should be returned
41
- */
42
- - (void)test_OnValidDictionary_ReturnConfiguration {
43
- NSDictionary *mockProps = RNMocks.properties;
44
- XCTAssertNotNil([RNWrappers judoSessionFromProperties:mockProps]);
45
- }
46
-
47
- /*
48
- * GIVEN: a configuration NSDictionary is passed to the wrapper
49
- *
50
- * WHEN: the [token] property is missing
51
- *
52
- * THEN: a 'missing API token' exception should be thrown
53
- */
54
- - (void)test_OnMissingToken_ThrowError {
55
- NSDictionary *props = [self propertiesWithAuthorizationValue:nil forKey:@"token"];
56
- XCTAssertThrows([RNWrappers judoSessionFromProperties:props]);
57
- }
58
-
59
- /*
60
- * GIVEN: a configuration NSDictionary is passed to the wrapper
61
- *
62
- * WHEN: the [token] property is not an NSString
63
- *
64
- * THEN: an 'invalid API token' exception should be thrown
65
- */
66
- - (void)test_OnInvalidToken_ThrowError {
67
- NSDictionary *props = [self propertiesWithAuthorizationValue:@123 forKey:@"token"];
68
- XCTAssertThrows([RNWrappers judoSessionFromProperties:props]);
69
- }
70
-
71
- /*
72
- * GIVEN: a configuration NSDictionary is passed to the wrapper
73
- *
74
- * WHEN: the [secret] property is missing
75
- *
76
- * THEN: a 'missing API secret' exception should be thrown
77
- */
78
- - (void)test_OnMissingSecret_ThrowError {
79
- NSDictionary *props = [self propertiesWithAuthorizationValue:nil forKey:@"secret"];
80
- XCTAssertThrows([RNWrappers judoSessionFromProperties:props]);
81
- }
82
-
83
- /*
84
- * GIVEN: a configuration NSDictionary is passed to the wrapper
85
- *
86
- * WHEN: the [secret] property is not an NSString
87
- *
88
- * THEN: an 'invalid API secret' exception should be thrown
89
- */
90
- - (void)test_OnInvalidSecret_ThrowError {
91
- NSDictionary *props = [self propertiesWithAuthorizationValue:@123 forKey:@"secret"];
92
- XCTAssertThrows([RNWrappers judoSessionFromProperties:props]);
93
- }
94
-
95
- /*
96
- * GIVEN: a configuration NSDictionary is passed to the wrapper
97
- *
98
- * WHEN: the [sandboxed] property is missing
99
- *
100
- * THEN: a 'missing sandbox setting' exception should be thrown
101
- */
102
- - (void)test_OnMissingSandbox_ThrowError {
103
- NSDictionary *props = [self propertiesByChangingValue:nil forKey:@"sandboxed"];
104
- XCTAssertThrows([RNWrappers judoSessionFromProperties:props]);
105
- }
106
-
107
- /*
108
- * GIVEN: a configuration NSDictionary is passed to the wrapper
109
- *
110
- * WHEN: the [sandboxed] property is not an integer
111
- *
112
- * THEN: an 'invalid sandbox setting' exception should be thrown
113
- */
114
- - (void)test_OnInvalidSandbox_ThrowError {
115
- NSDictionary *props = [self propertiesByChangingValue:@"true" forKey:@"sandboxed"];
116
- XCTAssertThrows([RNWrappers judoSessionFromProperties:props]);
117
- }
118
-
119
- /*
120
- * GIVEN: a configuration NSDictionary is passed to the wrapper
121
- *
122
- * WHEN: the [transactionType] property is missing
123
- *
124
- * THEN: a 'missing transaction type' exception should be thrown
125
- */
126
- - (void)test_OnMissingTransactionTypes_ThrowError {
127
- NSMutableDictionary *mockProps = RNMocks.properties;
128
- mockProps[@"transactionType"] = nil;
129
- XCTAssertThrows([RNWrappers transactionTypeFromProperties:mockProps]);
130
- }
131
-
132
- /*
133
- * GIVEN: a configuration NSDictionary is passed to the wrapper
134
- *
135
- * WHEN: the [transactionType] property is not an integer
136
- *
137
- * THEN: an 'invalid transaction type' exception should be thrown
138
- */
139
- - (void)test_OnInvalidTransactionType_ThrowError {
140
- NSMutableDictionary *mockProps = RNMocks.properties;
141
- mockProps[@"transactionType"] = @"hello";
142
- XCTAssertThrows([RNWrappers transactionTypeFromProperties:mockProps]);
143
- }
144
-
145
- /*
146
- * GIVEN: a configuration NSDictionary is passed to the wrapper
147
- *
148
- * WHEN: the [transactionMode] property is missing
149
- *
150
- * THEN: a 'missing transaction mode' exception should be thrown
151
- */
152
- - (void)test_OnMissingTransactionMode_ThrowError {
153
- NSMutableDictionary *mockProps = RNMocks.properties;
154
- mockProps[@"transactionMode"] = nil;
155
- XCTAssertThrows([RNWrappers transactionModeFromProperties:mockProps]);
156
- }
157
-
158
- /*
159
- * GIVEN: a configuration NSDictionary is passed to the wrapper
160
- *
161
- * WHEN: the [transactionMode] property is not an integer
162
- *
163
- * THEN: an 'invalid transaction mode' exception should be thrown
164
- */
165
- - (void)test_OnInvalidTransactionMode_ThrowError {
166
- NSMutableDictionary *mockProps = RNMocks.properties;
167
- mockProps[@"transactionMode"] = @"hello";
168
- XCTAssertThrows([RNWrappers transactionModeFromProperties:mockProps]);
169
- }
170
-
171
- /*
172
- * GIVEN: a configuration NSDictionary is passed to the wrapper
173
- *
174
- * WHEN: the [configuration] property is missing
175
- *
176
- * THEN: a 'missing configuration' exception should be thrown
177
- */
178
- - (void)test_OnMissingConfiguration_ThrowError {
179
- NSMutableDictionary *mockProps = RNMocks.properties;
180
- mockProps[@"configuration"] = nil;
181
- XCTAssertThrows([RNWrappers configurationFromProperties:mockProps]);
182
- }
183
-
184
- /*
185
- * GIVEN: a configuration NSDictionary is passed to the wrapper
186
- *
187
- * WHEN: the [configuration] property is not an NSDictionary
188
- *
189
- * THEN: an 'invalid configuration' exception should be thrown
190
- */
191
- - (void)test_OnInvalidConfiguration_ThrowError {
192
- NSMutableDictionary *mockProps = RNMocks.properties;
193
- mockProps[@"configuration"] = @"hello";
194
- XCTAssertThrows([RNWrappers configurationFromProperties:mockProps]);
195
- }
196
-
197
- /*
198
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
199
- *
200
- * WHEN: the [judoId] property of the [configuration] dictionary is missing
201
- *
202
- * THEN: a 'missing Judo ID' exception should be thrown
203
- */
204
- - (void)test_OnMissingJudoId_ThrowError {
205
- NSDictionary *props = [self propertiesWithConfigurationValue:nil forKey:@"judoId"];
206
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
207
- }
208
-
209
- /*
210
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
211
- *
212
- * WHEN: the [judoId] property of the [configuration] dictionary is not an NSString
213
- *
214
- * THEN: a 'invalid Judo ID' exception should be thrown
215
- */
216
- - (void)test_OnInvalidJudoId_ThrowError {
217
- NSDictionary *props = [self propertiesWithConfigurationValue:@123 forKey:@"judoId"];
218
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
219
- }
220
-
221
- /*
222
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
223
- *
224
- * WHEN: the [amount] property of the [configuration] dictionary is missing
225
- *
226
- * THEN: a 'missing amount' exception should be thrown
227
- */
228
- - (void)test_OnMissingAmount_ThrowError {
229
- NSDictionary *props = [self propertiesWithConfigurationValue:nil forKey:@"amount"];
230
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
231
- }
232
-
233
- /*
234
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
235
- *
236
- * WHEN: the [amount] property of the [configuration] dictionary is not an NSDictionary
237
- *
238
- * THEN: a 'invalid amount' exception should be thrown
239
- */
240
- - (void)test_OnInvalidAmount_ThrowError {
241
- NSDictionary *props = [self propertiesWithConfigurationValue:@"hello" forKey:@"amount"];
242
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
243
- }
244
-
245
- /*
246
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
247
- *
248
- * WHEN: the [value] property of the [amount] dictionary is missing
249
- *
250
- * THEN: a 'missing amount value' exception should be thrown
251
- */
252
- - (void)test_OnMissingAmountValue_ThrowError {
253
- NSDictionary *props = [self propertiesWithConfigurationValue:nil
254
- forKey:@"value"
255
- orDictionaryName:@"amount"];
256
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
257
- }
258
-
259
- /*
260
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
261
- *
262
- * WHEN: the [value] property of the [amount] dictionary is not an NSString
263
- *
264
- * THEN: an 'invalid amount value' exception should be thrown
265
- */
266
- - (void)test_OnInvalidAmountValue_ThrowError {
267
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
268
- forKey:@"value"
269
- orDictionaryName:@"amount"];
270
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
271
- }
272
-
273
- /*
274
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
275
- *
276
- * WHEN: the [currency] property of the [amount] dictionary is missing
277
- *
278
- * THEN: a 'missing amount currency' exception should be thrown
279
- */
280
- - (void)test_OnMissingAmountCurrency_ThrowError {
281
- NSDictionary *props = [self propertiesWithConfigurationValue:nil
282
- forKey:@"currency"
283
- orDictionaryName:@"amount"];
284
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
285
- }
286
-
287
- /*
288
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
289
- *
290
- * WHEN: the [currency] property of the [amount] dictionary is not an NSString
291
- *
292
- * THEN: an 'invalid amount currency' exception should be thrown
293
- */
294
- - (void)test_OnInvalidAmountCurrency_ThrowError {
295
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
296
- forKey:@"currency"
297
- orDictionaryName:@"amount"];
298
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
299
- }
300
-
301
- /*
302
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
303
- *
304
- * WHEN: the [reference] property of the [configuration] dictionary is missing
305
- *
306
- * THEN: a 'missing reference' exception should be thrown
307
- */
308
- - (void)test_OnMissingReference_ThrowError {
309
- NSDictionary *props = [self propertiesWithConfigurationValue:nil forKey:@"reference"];
310
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
311
- }
312
-
313
- /*
314
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
315
- *
316
- * WHEN: the [reference] property of the [configuration] dictionary is not an NSDictionary
317
- *
318
- * THEN: an 'invalid reference' exception should be thrown
319
- */
320
- - (void)test_OnInvalidReference_ThrowError {
321
- NSDictionary *props = [self propertiesWithConfigurationValue:@123 forKey:@"reference"];
322
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
323
- }
324
-
325
- /*
326
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
327
- *
328
- * WHEN: the [consumerReference] property of the [reference] dictionary is missing
329
- *
330
- * THEN: a 'missing consumer reference' exception should be thrown
331
- */
332
- - (void)test_OnMissingConsumerReference_ThrowError {
333
- NSDictionary *props = [self propertiesWithConfigurationValue:nil
334
- forKey:@"consumerReference"
335
- orDictionaryName:@"reference"];
336
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
337
- }
338
-
339
- /*
340
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
341
- *
342
- * WHEN: the [consumerReference] property of the [reference] dictionary is not an NSString
343
- *
344
- * THEN: an 'invalid consumer reference' exception should be thrown
345
- */
346
- - (void)test_OnInvalidConsumerReference_ThrowError {
347
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
348
- forKey:@"consumerReference"
349
- orDictionaryName:@"reference"];
350
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
351
- }
352
-
353
- /*
354
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
355
- *
356
- * WHEN: the [paymentReference] property of the [reference] dictionary is not an NSString
357
- *
358
- * THEN: an 'invalid payment reference' exception should be thrown
359
- */
360
- - (void)test_OnInvalidPaymentReference_ThrowError {
361
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
362
- forKey:@"paymentReference"
363
- orDictionaryName:@"reference"];
364
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
365
- }
366
-
367
- /*
368
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
369
- *
370
- * WHEN: the [metadata] property of the [reference] dictionary is not an NSDictionary
371
- *
372
- * THEN: an 'invalid reference metadata' exception should be thrown
373
- */
374
- - (void)test_OnInvalidReferenceMetadata_ThrowError {
375
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
376
- forKey:@"metadata"
377
- orDictionaryName:@"reference"];
378
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
379
- }
380
-
381
- /*
382
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
383
- *
384
- * WHEN: the [cardAddress] property of the [configuration] dictionary is not an NSDictionary
385
- *
386
- * THEN: an 'invalid card address' exception should be thrown
387
- */
388
- - (void)test_OnInvalidCardAddress_ThrowError {
389
- NSDictionary *props = [self propertiesWithConfigurationValue:@123 forKey:@"cardAddress"];
390
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
391
- }
392
-
393
- /*
394
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
395
- *
396
- * WHEN: the [line1] property of the [cardAddress] dictionary is not an NSString
397
- *
398
- * THEN: an 'invalid card address line 1' exception should be thrown
399
- */
400
- - (void)test_OnInvalidCardAddressLine1_ThrowError {
401
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
402
- forKey:@"line1"
403
- orDictionaryName:@"cardAddress"];
404
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
405
- }
406
-
407
- /*
408
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
409
- *
410
- * WHEN: the [line2] property of the [cardAddress] dictionary is not an NSString
411
- *
412
- * THEN: an 'invalid card address line 2' exception should be thrown
413
- */
414
- - (void)test_OnInvalidCardAddressLine2_ThrowError {
415
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
416
- forKey:@"line2"
417
- orDictionaryName:@"cardAddress"];
418
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
419
- }
420
-
421
- /*
422
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
423
- *
424
- * WHEN: the [line3] property of the [cardAddress] dictionary is not an NSString
425
- *
426
- * THEN: an 'invalid card address line 3' exception should be thrown
427
- */
428
- - (void)test_OnInvalidCardAddressLine3_ThrowError {
429
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
430
- forKey:@"line3"
431
- orDictionaryName:@"cardAddress"];
432
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
433
- }
434
-
435
- /*
436
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
437
- *
438
- * WHEN: the [postCode] property of the [cardAddress] dictionary is not an NSString
439
- *
440
- * THEN: an 'invalid card address post code' exception should be thrown
441
- */
442
- - (void)test_OnInvalidCardAddressPostCode_ThrowError {
443
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
444
- forKey:@"postCode"
445
- orDictionaryName:@"cardAddress"];
446
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
447
- }
448
-
449
- /*
450
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
451
- *
452
- * WHEN: the [town] property of the [cardAddress] dictionary is not an NSString
453
- *
454
- * THEN: an 'invalid card address town' exception should be thrown
455
- */
456
- - (void)test_OnInvalidCardAddressTown_ThrowError {
457
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
458
- forKey:@"town"
459
- orDictionaryName:@"cardAddress"];
460
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
461
- }
462
-
463
- /*
464
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
465
- *
466
- * WHEN: the [countryCode] property of the [cardAddress] dictionary is not an integer
467
- *
468
- * THEN: an 'invalid card address country code' exception should be thrown
469
- */
470
- - (void)test_OnInvalidCardAddressCountryCode_ThrowError {
471
- NSDictionary *props = [self propertiesWithConfigurationValue:@"hello"
472
- forKey:@"countryCode"
473
- orDictionaryName:@"cardAddress"];
474
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
475
- }
476
-
477
- /*
478
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
479
- *
480
- * WHEN: the [uiConfiguration] property of the [configuration] dictionary is missing
481
- *
482
- * THEN: set the default UI Configuration
483
- */
484
- - (void)test_OnMissingUIConfiguration_SetDefault {
485
- NSDictionary *props = [self propertiesWithConfigurationValue:nil forKey:@"uiConfiguration"];
486
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
487
- XCTAssertNotNil(config.uiConfiguration);
488
- }
489
-
490
- /*
491
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
492
- *
493
- * WHEN: the [uiConfiguration] property of the [configuration] dictionary is not an NSDictionary
494
- *
495
- * THEN: an 'invalid UI configuration' exception should be thrown
496
- */
497
- - (void)test_OnInvalidUIConfiguration_ThrowError {
498
- NSDictionary *props = [self propertiesWithConfigurationValue:@123 forKey:@"uiConfiguration"];
499
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
500
- }
501
-
502
- /*
503
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
504
- *
505
- * WHEN: the [isAVSEnabled] property of the [uiConfiguration] dictionary is not an integer
506
- *
507
- * THEN: an 'invalid AVS setting' exception should be thrown
508
- */
509
- - (void)test_OnInvalidUIConfigurationAVSEnabled_ThrowError {
510
- NSDictionary *props = [self propertiesWithConfigurationValue:@"hello"
511
- forKey:@"isAVSEnabled"
512
- orDictionaryName:@"uiConfiguration"];
513
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
514
- }
515
-
516
- /*
517
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
518
- *
519
- * WHEN: the [shouldPaymentMethodsDisplayAmount] property of the [uiConfiguration] dictionary is not an integer
520
- *
521
- * THEN: an 'invalid amount display setting' exception should be thrown
522
- */
523
- - (void)test_OnInvalidUIConfigurationDisplayAmount_ThrowError {
524
- NSDictionary *props = [self propertiesWithConfigurationValue:@"hello"
525
- forKey:@"shouldPaymentMethodsDisplayAmount"
526
- orDictionaryName:@"uiConfiguration"];
527
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
528
- }
529
-
530
- /*
531
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
532
- *
533
- * WHEN: the [shouldPaymentButtonDisplayAmount] property of the [uiConfiguration] dictionary is not an integer
534
- *
535
- * THEN: an 'invalid payment button amount display setting' exception should be thrown
536
- */
537
- - (void)test_OnInvalidUIConfigurationPayButtonAmountVisibility_ThrowError {
538
- NSDictionary *props = [self propertiesWithConfigurationValue:@"hello"
539
- forKey:@"shouldPaymentButtonDisplayAmount"
540
- orDictionaryName:@"uiConfiguration"];
541
-
542
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
543
- }
544
-
545
- /*
546
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
547
- *
548
- * WHEN: the [shouldPaymentMethodsVerifySecurityCode] property of the [uiConfiguration] dictionary is
549
- * not an integer
550
- *
551
- * THEN: an 'invalid secure code check setting type' exception should be thrown
552
- */
553
- - (void)test_OnInvalidUIConfigurationCV2EnabledType_ThrowError {
554
- NSDictionary *props = [self propertiesWithConfigurationValue:@"hello"
555
- forKey:@"shouldPaymentMethodsVerifySecurityCode"
556
- orDictionaryName:@"uiConfiguration"];
557
-
558
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
559
- }
560
-
561
- /*
562
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
563
- *
564
- * WHEN: the [theme] property of the [uiConfiguration] dictionary is missing
565
- *
566
- * THEN: set the default JPTheme object
567
- */
568
- - (void)test_OnMissingUIConfigurationTheme_SetDefault {
569
- NSDictionary *props = [self propertiesWithConfigurationValue:nil
570
- forKey:@"theme"
571
- orDictionaryName:@"uiConfiguration"];
572
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
573
- XCTAssertNotNil(config.uiConfiguration.theme);
574
- }
575
-
576
- /*
577
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
578
- *
579
- * WHEN: the [theme] property of the [uiConfiguration] dictionary is not an NSDictionary
580
- *
581
- * THEN: an 'invalid theme' exception should be thrown
582
- */
583
- - (void)test_OnInvalidUIConfigurationTheme_ThrowError {
584
- NSDictionary *props = [self propertiesWithConfigurationValue:@"hello"
585
- forKey:@"theme"
586
- orDictionaryName:@"uiConfiguration"];
587
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
588
- }
589
-
590
- /*
591
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
592
- *
593
- * WHEN: the [paymentMethods] property of the [configuration] dictionary is not an integer
594
- *
595
- * THEN: an 'invalid payment methods' exception should be thrown
596
- */
597
- - (void)test_OnInvalidPaymentMethods_ThrowError {
598
- NSDictionary *props = [self propertiesWithConfigurationValue:@"hello" forKey:@"paymentMethods"];
599
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
600
- }
601
-
602
- /*
603
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
604
- *
605
- * WHEN: the [paymentMethods] value is set to 1
606
- *
607
- * THEN: Card payment method should be enabled
608
- */
609
- - (void)test_OnPaymentMethodValue1_EnableCard {
610
- NSDictionary *props = [self propertiesWithConfigurationValue:@1 forKey:@"paymentMethods"];
611
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
612
- XCTAssertEqual(config.paymentMethods.firstObject.type, JPPaymentMethodTypeCard);
613
- }
614
-
615
- /*
616
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
617
- *
618
- * WHEN: the [paymentMethods] value is set to 2
619
- *
620
- * THEN: Apple Pay payment method should be enabled
621
- */
622
- - (void)test_OnPaymentMethodValue2_EnableApplePay {
623
- NSDictionary *props = [self propertiesWithConfigurationValue:@2 forKey:@"paymentMethods"];
624
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
625
- XCTAssertEqual(config.paymentMethods.firstObject.type, JPPaymentMethodTypeApplePay);
626
- }
627
-
628
- /*
629
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
630
- *
631
- * WHEN: the [paymentMethods] value is set to 8
632
- *
633
- * THEN: iDEAL payment method should be enabled
634
- */
635
- - (void)test_OnPaymentMethodValue8_EnableIDEAL {
636
- NSDictionary *props = [self propertiesWithConfigurationValue:@8 forKey:@"paymentMethods"];
637
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
638
- XCTAssertEqual(config.paymentMethods.firstObject.type, JPPaymentMethodTypeIDeal);
639
- }
640
-
641
- /*
642
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
643
- *
644
- * WHEN: the [paymentMethods] value is set to 16
645
- *
646
- * THEN: Pay By Bank App payment method should be enabled
647
- */
648
- - (void)test_OnPaymentMethodValue32_EnablePBBA {
649
- NSDictionary *props = [self propertiesWithConfigurationValue:@16 forKey:@"paymentMethods"];
650
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
651
- XCTAssertEqual(config.paymentMethods.firstObject.type, JPPaymentMethodTypePbba);
652
- }
653
-
654
- /*
655
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
656
- *
657
- * WHEN: the [paymentMethods] value is set to 32
658
- *
659
- * THEN: All payment method should be enabled
660
- */
661
- - (void)test_OnPaymentMethodValue32_EnableAll {
662
- NSDictionary *props = [self propertiesWithConfigurationValue:@32 forKey:@"paymentMethods"];
663
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
664
- XCTAssertEqual(config.paymentMethods.count, 4);
665
- }
666
-
667
- /*
668
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
669
- *
670
- * WHEN: the [supportedCardNetworks] property of the [configuration] dictionary is not an integer
671
- *
672
- * THEN: an 'invalid supported card networks' exception should be thrown
673
- */
674
- - (void)test_OnInvalidSupportedCardNetworks_ThrowError {
675
- NSDictionary *props = [self propertiesWithConfigurationValue:@"hello" forKey:@"supportedCardNetworks"];
676
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
677
- }
678
-
679
- /*
680
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
681
- *
682
- * WHEN: the [supportedCardNetworks] value is set to 1
683
- *
684
- * THEN: Visa must be set as supported
685
- */
686
- - (void)test_OnSupportedCardNetworkValue1_SetVisa {
687
- NSDictionary *props = [self propertiesWithConfigurationValue:@1 forKey:@"supportedCardNetworks"];
688
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
689
- XCTAssertEqual(config.supportedCardNetworks, JPCardNetworkTypeVisa);
690
- }
691
-
692
- /*
693
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
694
- *
695
- * WHEN: the [supportedCardNetworks] value is set to 2
696
- *
697
- * THEN: MasterCard must be set as supported
698
- */
699
- - (void)test_OnSupportedCardNetworkValue2_SetMasterCard {
700
- NSDictionary *props = [self propertiesWithConfigurationValue:@2 forKey:@"supportedCardNetworks"];
701
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
702
- XCTAssertEqual(config.supportedCardNetworks, JPCardNetworkTypeMasterCard);
703
- }
704
-
705
- /*
706
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
707
- *
708
- * WHEN: the [supportedCardNetworks] value is set to 4
709
- *
710
- * THEN: Maestro must be set as supported
711
- */
712
- - (void)test_OnSupportedCardNetworkValue4_SetMaestro {
713
- NSDictionary *props = [self propertiesWithConfigurationValue:@4 forKey:@"supportedCardNetworks"];
714
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
715
- XCTAssertEqual(config.supportedCardNetworks, JPCardNetworkTypeMaestro);
716
- }
717
-
718
- /*
719
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
720
- *
721
- * WHEN: the [supportedCardNetworks] value is set to 8
722
- *
723
- * THEN: AMEX must be set as supported
724
- */
725
- - (void)test_OnSupportedCardNetworkValue8_SetAMEX {
726
- NSDictionary *props = [self propertiesWithConfigurationValue:@8 forKey:@"supportedCardNetworks"];
727
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
728
- XCTAssertEqual(config.supportedCardNetworks, JPCardNetworkTypeAMEX);
729
- }
730
-
731
- /*
732
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
733
- *
734
- * WHEN: the [supportedCardNetworks] value is set to 16
735
- *
736
- * THEN: China Union Pay must be set as supported
737
- */
738
- - (void)test_OnSupportedCardNetworkValue16_SetChinaUnionPay {
739
- NSDictionary *props = [self propertiesWithConfigurationValue:@16 forKey:@"supportedCardNetworks"];
740
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
741
- XCTAssertEqual(config.supportedCardNetworks, JPCardNetworkTypeChinaUnionPay);
742
- }
743
-
744
- /*
745
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
746
- *
747
- * WHEN: the [supportedCardNetworks] value is set to 32
748
- *
749
- * THEN: JCB must be set as supported
750
- */
751
- - (void)test_OnSupportedCardNetworkValue32_SetJCB {
752
- NSDictionary *props = [self propertiesWithConfigurationValue:@32 forKey:@"supportedCardNetworks"];
753
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
754
- XCTAssertEqual(config.supportedCardNetworks, JPCardNetworkTypeJCB);
755
- }
756
-
757
- /*
758
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
759
- *
760
- * WHEN: the [supportedCardNetworks] value is set to 64
761
- *
762
- * THEN: Discover must be set as supported
763
- */
764
- - (void)test_OnSupportedCardNetworkValue64_SetDiscover {
765
- NSDictionary *props = [self propertiesWithConfigurationValue:@64 forKey:@"supportedCardNetworks"];
766
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
767
- XCTAssertEqual(config.supportedCardNetworks, JPCardNetworkTypeDiscover);
768
- }
769
-
770
- /*
771
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
772
- *
773
- * WHEN: the [supportedCardNetworks] value is set to 128
774
- *
775
- * THEN: DinersClub must be set as supported
776
- */
777
- - (void)test_OnSupportedCardNetworkValue128_SetDinersClub {
778
- NSDictionary *props = [self propertiesWithConfigurationValue:@128 forKey:@"supportedCardNetworks"];
779
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
780
- XCTAssertEqual(config.supportedCardNetworks, JPCardNetworkTypeDinersClub);
781
- }
782
-
783
- /*
784
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
785
- *
786
- * WHEN: the [supportedCardNetworks] value is set to 256
787
- *
788
- * THEN: All card networks must be set as supported
789
- */
790
- - (void)test_OnSupportedCardNetworkValue256_SetAll {
791
- NSDictionary *props = [self propertiesWithConfigurationValue:@256 forKey:@"supportedCardNetworks"];
792
- JPConfiguration *config = [RNWrappers configurationFromProperties:props];
793
- XCTAssertEqual(config.supportedCardNetworks, JPCardNetworkTypeAll);
794
- }
795
-
796
- /*
797
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
798
- *
799
- * WHEN: the [primaryAccountDetails] property of the [configuration] dictionary is not an NSDictionary
800
- *
801
- * THEN: an 'invalid primary account details' exception should be thrown
802
- */
803
- - (void)test_OnInvalidPrimaryAccountDetails_ThrowError {
804
- NSDictionary *props = [self propertiesWithConfigurationValue:@"hello" forKey:@"primaryAccountDetails"];
805
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
806
- }
807
-
808
- /*
809
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
810
- *
811
- * WHEN: the [name] property of the [primaryAccountDetails] dictionary is not an NSString
812
- *
813
- * THEN: an 'invalid primary account details name' exception should be thrown
814
- */
815
- - (void)test_OnInvalidPrimaryAccountDetailsName_ThrowError {
816
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
817
- forKey:@"name"
818
- orDictionaryName:@"primaryAccountDetails"];
819
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
820
- }
821
-
822
- /*
823
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
824
- *
825
- * WHEN: the [accountNumber] property of the [primaryAccountDetails] dictionary is not an NSString
826
- *
827
- * THEN: an 'invalid primary account details account number' exception should be thrown
828
- */
829
- - (void)test_OnInvalidPrimaryAccountDetailsAccountNumber_ThrowError {
830
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
831
- forKey:@"accountNumber"
832
- orDictionaryName:@"primaryAccountDetails"];
833
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
834
- }
835
-
836
- /*
837
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
838
- *
839
- * WHEN: the [dateOfBirth] property of the [primaryAccountDetails] dictionary is not an NSString
840
- *
841
- * THEN: an 'invalid primary account details date of birth' exception should be thrown
842
- */
843
- - (void)test_OnInvalidPrimaryAccountDetailsDateOfBirth_ThrowError {
844
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
845
- forKey:@"dateOfBirth"
846
- orDictionaryName:@"primaryAccountDetails"];
847
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
848
- }
849
-
850
- /*
851
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
852
- *
853
- * WHEN: the [postCode] property of the [primaryAccountDetails] dictionary is not an NSString
854
- *
855
- * THEN: an 'invalid primary account details post code' exception should be thrown
856
- */
857
- - (void)test_OnInvalidPrimaryAccountDetailsPostCode_ThrowError {
858
- NSDictionary *props = [self propertiesWithConfigurationValue:@123
859
- forKey:@"postCode"
860
- orDictionaryName:@"primaryAccountDetails"];
861
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
862
- }
863
-
864
- /*
865
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [configuration] property
866
- *
867
- * WHEN: the [applePayConfiguration] property of the [configuration] dictionary is not an NSDictionary
868
- *
869
- * THEN: an 'invalid Apple Pay configuration' exception should be thrown
870
- */
871
- - (void)test_OnInvalidApplePayConfiguration_ThrowError {
872
- NSDictionary *props = [self propertiesWithConfigurationValue:@"hello" forKey:@"applePayConfiguration"];
873
- XCTAssertThrows([RNWrappers configurationFromProperties:props]);
874
- }
875
-
876
- /*
877
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [cardToken] property
878
- *
879
- * THEN: the correct card token value should be extracted
880
- */
881
- - (void)test_OnValidParameterFormat_FetchCardToken {
882
- NSDictionary *props = [self propertiesByChangingValue:@"hello" forKey:@"cardToken"];
883
- NSString *cardToken = [RNWrappers cardTokenFromProperties:props];
884
- XCTAssertEqual(cardToken, @"hello");
885
- }
886
-
887
- /*
888
- * GIVEN: a configuration NSDictionary is passed to the wrapper with a valid [receiptId] property
889
- *
890
- * THEN: the correct receipt ID value should be extracted
891
- */
892
- - (void)test_OnValidParameterFormat_FetchReceiptId {
893
- NSDictionary *props = [self propertiesByChangingValue:@"hello" forKey:@"receiptId"];
894
- NSString *receiptId = [RNWrappers receiptIdFromProperties:props];
895
- XCTAssertEqual(receiptId, @"hello");
896
- }
897
-
898
- #pragma mark - Helpers
899
-
900
- - (NSMutableDictionary *)propertiesByChangingValue:(id)value
901
- forKey:(NSString *)key {
902
- NSMutableDictionary *mockProps = RNMocks.properties;
903
- mockProps[key] = value;
904
- return mockProps;
905
- }
906
-
907
- - (NSMutableDictionary *)propertiesWithAuthorizationValue:(id)value
908
- forKey:(NSString *)key {
909
-
910
- NSMutableDictionary *mockProps = RNMocks.properties;
911
- NSMutableDictionary *mockAuthorization = RNMocks.authorization;
912
-
913
- mockAuthorization[key] = value;
914
- mockProps[@"authorization"] = mockAuthorization;
915
-
916
- return mockProps;
917
- }
918
-
919
- - (NSMutableDictionary *)propertiesWithConfigurationValue:(id)value
920
- forKey:(NSString *)key {
921
-
922
- NSMutableDictionary *mockProps = RNMocks.properties;
923
- NSMutableDictionary *mockConfig = RNMocks.configuration;
924
-
925
- mockConfig[key] = value;
926
- mockProps[@"configuration"] = mockConfig;
927
-
928
- return mockProps;
929
- }
930
-
931
- - (NSMutableDictionary *)propertiesWithConfigurationValue:(id)value
932
- forKey:(NSString *)key
933
- orDictionaryName:(NSString *)name{
934
-
935
- NSMutableDictionary *mockProps = RNMocks.properties;
936
- NSMutableDictionary *mockConfig = RNMocks.configuration;
937
-
938
- NSMutableDictionary *item = [mockConfig[name] mutableCopy];
939
- item[key] = value;
940
-
941
- mockConfig[name] = item;
942
- mockProps[@"configuration"] = mockConfig;
943
-
944
- return mockProps;
945
- }
946
-
947
- @end