fidel-react-native 1.6.3 → 2.0.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/CHANGELOG.md +10 -0
- package/README.md +54 -55
- package/android/build.gradle +11 -8
- package/android/src/main/java/com/fidelreactlibrary/FidelModule.java +52 -44
- package/android/src/main/java/com/fidelreactlibrary/FidelPackage.java +64 -49
- package/android/src/main/java/com/fidelreactlibrary/adapters/CardVerificationConfigurationProperties.java +22 -0
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelCardSchemesAdapter.java +46 -29
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelCardVerificationChoiceAdapter.java +57 -0
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelCountryAdapter.java +47 -19
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelProgramTypeAdapter.java +46 -0
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelSetupAdapter.java +108 -6
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelSetupProperties.java +67 -0
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelVerificationConfigurationAdapter.java +35 -0
- package/android/src/main/java/com/fidelreactlibrary/adapters/ImageFromReadableMapAdapter.java +5 -1
- package/android/src/main/java/com/fidelreactlibrary/adapters/ResultsAdapter.java +288 -0
- package/android/src/main/java/com/fidelreactlibrary/adapters/abstraction/CardSchemesAdapter.java +6 -2
- package/android/src/main/java/com/fidelreactlibrary/adapters/abstraction/CardVerificationChoiceAdapter.java +11 -0
- package/android/src/main/java/com/fidelreactlibrary/adapters/abstraction/CountryAdapter.java +14 -3
- package/android/src/main/java/com/fidelreactlibrary/adapters/abstraction/DataAdapter.java +5 -0
- package/android/src/main/java/com/fidelreactlibrary/adapters/abstraction/ProgramTypeAdapter.java +11 -0
- package/android/src/main/java/com/fidelreactlibrary/adapters/abstraction/VerificationConfigurationAdapter.java +9 -0
- package/android/src/main/java/com/fidelreactlibrary/events/BridgeLibraryEvent.java +17 -0
- package/android/src/main/java/com/fidelreactlibrary/events/BridgeLibraryEventEmitter.java +24 -0
- package/android/src/main/java/com/fidelreactlibrary/events/CardVerificationChoiceObserver.java +29 -0
- package/android/src/main/java/com/fidelreactlibrary/events/CardVerificationStartedObserver.java +31 -0
- package/android/src/main/java/com/fidelreactlibrary/events/ResultsObserver.java +72 -0
- package/android/src/test/java/com/fidelreactlibrary/FidelModuleTests.java +50 -31
- package/android/src/test/java/com/fidelreactlibrary/FidelPackageTests.java +0 -1
- package/android/src/test/java/com/fidelreactlibrary/{FidelCardSchemesAdapterTests.java → adapters/FidelCardSchemesAdapterTests.java} +51 -47
- package/android/src/test/java/com/fidelreactlibrary/adapters/FidelCardVerificationChoiceAdapterTest.java +70 -0
- package/android/src/test/java/com/fidelreactlibrary/adapters/FidelCountryAdapterTests.java +157 -0
- package/android/src/test/java/com/fidelreactlibrary/adapters/FidelProgramTypeAdapterTests.java +54 -0
- package/android/src/test/java/com/fidelreactlibrary/adapters/FidelSetupAdapterTests.java +900 -0
- package/android/src/test/java/com/fidelreactlibrary/adapters/FidelVerificationConfigurationAdapterTest.java +51 -0
- package/android/src/test/java/com/fidelreactlibrary/adapters/ResultsAdapterTests.java +74 -0
- package/android/src/test/java/com/fidelreactlibrary/{ErrorEventEmitterTests.java → events/BridgeLibraryEventEmitterTests.java} +18 -7
- package/android/src/test/java/com/fidelreactlibrary/events/BridgeLibraryEventTests.java +17 -0
- package/android/src/test/java/com/fidelreactlibrary/events/CardVerificationStartedObserverTests.java +49 -0
- package/android/src/test/java/com/fidelreactlibrary/events/ResultsObserverTests.java +38 -0
- package/android/src/test/java/com/fidelreactlibrary/fakes/CardSchemeAdapterStub.java +17 -6
- package/android/src/test/java/com/fidelreactlibrary/fakes/ConstantsProviderStub.java +2 -2
- package/android/src/test/java/com/fidelreactlibrary/fakes/CountryAdapterStub.java +25 -10
- package/android/src/test/java/com/fidelreactlibrary/fakes/{DataConverterStub.java → DataAdapterStub.java} +3 -3
- package/android/src/test/java/com/fidelreactlibrary/fakes/ProgramTypeAdapterStub.java +31 -0
- package/android/src/test/java/com/fidelreactlibrary/fakes/ReactContextMock.java +1 -1
- package/android/src/test/java/com/fidelreactlibrary/fakes/ReadableArrayStub.java +82 -0
- package/android/src/test/java/com/fidelreactlibrary/fakes/ReadableMapStub.java +175 -40
- package/android/src/test/java/com/fidelreactlibrary/fakes/VerificationConfigurationAdapterStub.java +13 -0
- package/fidel-react-native.podspec +1 -1
- package/index.js +71 -19
- package/ios/Adapters/CardSchemesAdapter.swift +13 -0
- package/ios/Adapters/ConsentDetailsAdapter.swift +19 -0
- package/ios/Adapters/EnrollmentResultAdapter.swift +28 -0
- package/ios/Adapters/ErrorResultAdapter.swift +71 -0
- package/ios/{FLRNImageAdapter.h → Adapters/FLRNImageFromRNAdapter.h} +2 -3
- package/ios/Adapters/FidelSetupAdapter.swift +89 -0
- package/ios/Adapters/FidelVerificationConfigurationAdapter.swift +19 -0
- package/ios/Adapters/VerificationResultAdapter.swift +17 -0
- package/ios/CardVerificationConfigurationProperties.swift +14 -0
- package/ios/Constants/CardSchemeConstants.swift +38 -0
- package/ios/Constants/CardVerificationChoiceConstants.swift +24 -0
- package/ios/Constants/CountryConstants.swift +47 -0
- package/ios/Constants/EnrollmentErrorTypeConstants.swift +25 -0
- package/ios/Constants/ErrorTypeConstants.swift +37 -0
- package/ios/Constants/ExportedConstantsProvider.swift +42 -0
- package/ios/Constants/ProgramTypeConstants.swift +30 -0
- package/ios/Constants/ResultTypeConstants.swift +35 -0
- package/ios/Constants/VerificationErrorTypeConstants.swift +29 -0
- package/ios/Events/BridgeLibraryEvent.swift +14 -0
- package/ios/Events/CardVerificationChoiceSelectedObserver.swift +23 -0
- package/ios/Events/CardVerificationStartedObserver.swift +21 -0
- package/ios/Events/EventObserver.swift +13 -0
- package/ios/Events/JSResultProperties.swift +15 -0
- package/ios/Events/JSResultTypes.swift +14 -0
- package/ios/Events/ResultsObserver.swift +37 -0
- package/ios/FidelSetupProperties.swift +33 -0
- package/ios/NativeFidelBridge.m +11 -0
- package/ios/NativeFidelBridge.swift +93 -0
- package/package.json +1 -4
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelOptionsAdapter.java +0 -121
- package/android/src/main/java/com/fidelreactlibrary/adapters/WritableMapDataConverter.java +0 -94
- package/android/src/main/java/com/fidelreactlibrary/adapters/abstraction/DataConverter.java +0 -5
- package/android/src/main/java/com/fidelreactlibrary/events/CallbackActivityEventListener.java +0 -64
- package/android/src/main/java/com/fidelreactlibrary/events/CallbackInput.java +0 -7
- package/android/src/main/java/com/fidelreactlibrary/events/ErrorEventEmitter.java +0 -22
- package/android/src/test/java/com/fidelreactlibrary/CallbackActivityEventListenerTests.java +0 -133
- package/android/src/test/java/com/fidelreactlibrary/FidelCountryAdapterTests.java +0 -74
- package/android/src/test/java/com/fidelreactlibrary/FidelOptionsAdapterTests.java +0 -414
- package/android/src/test/java/com/fidelreactlibrary/FidelSetupAdapterTests.java +0 -65
- package/android/src/test/java/com/fidelreactlibrary/WritableMapDataConverterTests.java +0 -186
- package/android/src/test/java/com/fidelreactlibrary/fakes/CallbackInputSpy.java +0 -12
- package/android/src/test/java/com/fidelreactlibrary/fakes/CallbackSpy.java +0 -18
- package/android/src/test/java/com/fidelreactlibrary/fakes/IntentMock.java +0 -20
- package/ios/FLRNCardSchemesAdapter.h +0 -16
- package/ios/FLRNCardSchemesFromJSAdapter.h +0 -14
- package/ios/FLRNCardSchemesFromJSAdapter.m +0 -39
- package/ios/FLRNConstantsProvider.h +0 -15
- package/ios/FLRNImageFromRNAdapter.h +0 -14
- package/ios/FLRNObjectToDictionaryAdapter.h +0 -15
- package/ios/FLRNOptionsAdapter.h +0 -24
- package/ios/FLRNOptionsAdapter.m +0 -133
- package/ios/FLRNRuntimeObjectToDictionaryAdapter.h +0 -14
- package/ios/FLRNRuntimeObjectToDictionaryAdapter.m +0 -36
- package/ios/FLRNSDKOptions.h +0 -24
- package/ios/FLRNSDKSetupOptions.h +0 -14
- package/ios/FLRNSetupAdapter.h +0 -17
- package/ios/FLRNSetupAdapter.m +0 -50
- package/ios/Fidel.h +0 -20
- package/ios/Fidel.m +0 -79
- package/ios/RCTConvert+CardScheme.h +0 -33
- package/ios/RCTConvert+Options.h +0 -52
- package/ios/RCTConvert+Options.m +0 -21
- /package/ios/{FLRNImageFromRNAdapter.m → Adapters/FLRNImageFromRNAdapter.m} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -1,5 +1,15 @@
|
|
|
1
1
|
# Fidel React Native bridge library change log
|
|
2
2
|
|
|
3
|
+
## 1.6.4
|
|
4
|
+
- Updated the consent text for United States and Canadian issued cards.
|
|
5
|
+
|
|
6
|
+
## 1.6.3
|
|
7
|
+
- Replace "Fidel" with "Fidel API" in the consent text.
|
|
8
|
+
- Allow expiration date editing on Android without switching to country selection.
|
|
9
|
+
|
|
10
|
+
## 1.6.2
|
|
11
|
+
- Update Fidel API logo
|
|
12
|
+
|
|
3
13
|
## 1.6.2
|
|
4
14
|
- Update Fidel API logo
|
|
5
15
|
|
package/README.md
CHANGED
|
@@ -1,4 +1,3 @@
|
|
|
1
|
-
|
|
2
1
|
# Fidel React Native bridge SDK
|
|
3
2
|
|
|
4
3
|
This SDK is a bridge between React Native and Fidel's native iOS and Android SDKs. It helps you to add card linking technology to your React Native apps in minutes. It captures credit/debit card numbers securely and links them to your programs.
|
|
@@ -49,23 +48,23 @@ buildscript {
|
|
|
49
48
|
Import Fidel in your RN project:
|
|
50
49
|
|
|
51
50
|
```javascript
|
|
52
|
-
import Fidel from
|
|
51
|
+
import Fidel from "fidel-react-native";
|
|
53
52
|
```
|
|
54
53
|
|
|
55
54
|
Set up Fidel with your API key and your program ID. Without them you can't open the Fidel card linking UI:
|
|
56
55
|
|
|
57
56
|
```javascript
|
|
58
57
|
Fidel.setup({
|
|
59
|
-
apiKey:
|
|
60
|
-
programId:
|
|
61
|
-
})
|
|
58
|
+
apiKey: "your api key",
|
|
59
|
+
programId: "your program id",
|
|
60
|
+
});
|
|
62
61
|
```
|
|
63
62
|
|
|
64
63
|
Set the options that create the experience of linking a card with Fidel:
|
|
65
64
|
|
|
66
65
|
```javascript
|
|
67
|
-
const myImage = require(
|
|
68
|
-
const resolveAssetSource = require(
|
|
66
|
+
const myImage = require("./images/fdl_test_banner.png");
|
|
67
|
+
const resolveAssetSource = require("react-native/Libraries/Image/resolveAssetSource");
|
|
69
68
|
const resolvedImage = resolveAssetSource(myImage);
|
|
70
69
|
|
|
71
70
|
//this is the default value for supported card schemes,
|
|
@@ -73,7 +72,7 @@ const resolvedImage = resolveAssetSource(myImage);
|
|
|
73
72
|
const cardSchemes = new Set([
|
|
74
73
|
Fidel.CardScheme.visa,
|
|
75
74
|
Fidel.CardScheme.mastercard,
|
|
76
|
-
Fidel.CardScheme.americanExpress
|
|
75
|
+
Fidel.CardScheme.americanExpress,
|
|
77
76
|
]);
|
|
78
77
|
|
|
79
78
|
const countries = [Fidel.Country.ireland, Fidel.Country.unitedStates];
|
|
@@ -84,12 +83,12 @@ Fidel.setOptions({
|
|
|
84
83
|
defaultSelectedCountry: Fidel.Country.unitedStates,
|
|
85
84
|
supportedCardSchemes: Array.from(cardSchemes),
|
|
86
85
|
autoScan: false,
|
|
87
|
-
metaData: {
|
|
88
|
-
companyName:
|
|
89
|
-
deleteInstructions:
|
|
90
|
-
privacyUrl:
|
|
91
|
-
termsConditionsUrl:
|
|
92
|
-
programName:
|
|
86
|
+
metaData: { "meta-data-1": "value1" }, // additional data to pass with the card
|
|
87
|
+
companyName: "My RN Company", // the company name displayed in the checkbox text
|
|
88
|
+
deleteInstructions: "Your custom delete instructions!",
|
|
89
|
+
privacyUrl: "https://fidel.uk",
|
|
90
|
+
termsConditionsUrl: "https://fidel.uk/privacy", // mandatory when you include USA/Canada in the list of allowed countries or when the user can select USA/Canada from the country selection UI
|
|
91
|
+
programName: "My program name", // optional, is used when you include USA/Canada in the list of allowed countries or when the user can select USA/Canada from the country selection UI
|
|
93
92
|
});
|
|
94
93
|
```
|
|
95
94
|
|
|
@@ -134,9 +133,9 @@ Both `result` and `error` are objects that look like in the following examples:
|
|
|
134
133
|
|
|
135
134
|
```javascript
|
|
136
135
|
{
|
|
137
|
-
code: "item-save" // the code of the error
|
|
138
|
-
date: "2019-04-22T05:34:04.621Z" // the date of the card link request
|
|
139
|
-
message: "Item already exists" // the message of the error
|
|
136
|
+
code: "item-save"; // the code of the error
|
|
137
|
+
date: "2019-04-22T05:34:04.621Z"; // the date of the card link request
|
|
138
|
+
message: "Item already exists"; // the message of the error
|
|
140
139
|
}
|
|
141
140
|
```
|
|
142
141
|
|
|
@@ -178,7 +177,7 @@ To set the countries that the users can select, use
|
|
|
178
177
|
```javascript
|
|
179
178
|
const countries = [Fidel.Country.ireland, Fidel.Country.unitedStates];
|
|
180
179
|
Fidel.setOptions({
|
|
181
|
-
allowedCountries: countries
|
|
180
|
+
allowedCountries: countries,
|
|
182
181
|
});
|
|
183
182
|
```
|
|
184
183
|
|
|
@@ -190,7 +189,7 @@ Use this parameter to set the country that will be selected by default when open
|
|
|
190
189
|
|
|
191
190
|
```javascript
|
|
192
191
|
Fidel.setOptions({
|
|
193
|
-
defaultSelectedCountry: Fidel.Country.unitedKingdom
|
|
192
|
+
defaultSelectedCountry: Fidel.Country.unitedKingdom,
|
|
194
193
|
});
|
|
195
194
|
```
|
|
196
195
|
|
|
@@ -210,10 +209,10 @@ Please check the example below:
|
|
|
210
209
|
const cardSchemes = new Set([
|
|
211
210
|
Fidel.CardScheme.visa,
|
|
212
211
|
Fidel.CardScheme.mastercard,
|
|
213
|
-
Fidel.CardScheme.americanExpress
|
|
212
|
+
Fidel.CardScheme.americanExpress,
|
|
214
213
|
]);
|
|
215
214
|
Fidel.setOptions({
|
|
216
|
-
supportedCardSchemes: Array.from(cardSchemes)
|
|
215
|
+
supportedCardSchemes: Array.from(cardSchemes),
|
|
217
216
|
});
|
|
218
217
|
```
|
|
219
218
|
|
|
@@ -223,7 +222,7 @@ Set this property to `true`, if you want to open the card scanning UI immediatel
|
|
|
223
222
|
|
|
224
223
|
```javascript
|
|
225
224
|
Fidel.setOptions({
|
|
226
|
-
autoScan: true
|
|
225
|
+
autoScan: true,
|
|
227
226
|
});
|
|
228
227
|
```
|
|
229
228
|
|
|
@@ -233,7 +232,7 @@ Use this option to pass any other data with the card data:
|
|
|
233
232
|
|
|
234
233
|
```javascript
|
|
235
234
|
Fidel.setOptions({
|
|
236
|
-
metaData: {
|
|
235
|
+
metaData: { "meta-data-key-1": "value1" },
|
|
237
236
|
});
|
|
238
237
|
```
|
|
239
238
|
|
|
@@ -243,7 +242,7 @@ Set your company name as it will appear in our consent checkbox text. Please set
|
|
|
243
242
|
|
|
244
243
|
```javascript
|
|
245
244
|
Fidel.setOptions({
|
|
246
|
-
companyName:
|
|
245
|
+
companyName: "Your Company Name",
|
|
247
246
|
});
|
|
248
247
|
```
|
|
249
248
|
|
|
@@ -253,7 +252,7 @@ Write your custom opt-out instructions for your users. They will be displayed in
|
|
|
253
252
|
|
|
254
253
|
```javascript
|
|
255
254
|
Fidel.setOptions({
|
|
256
|
-
deleteInstructions:
|
|
255
|
+
deleteInstructions: "Your custom card delete instructions!",
|
|
257
256
|
});
|
|
258
257
|
```
|
|
259
258
|
|
|
@@ -263,7 +262,7 @@ This is the privacy policy URL that you can set for the consent checkbox text.
|
|
|
263
262
|
|
|
264
263
|
```javascript
|
|
265
264
|
Fidel.setOptions({
|
|
266
|
-
privacyUrl:
|
|
265
|
+
privacyUrl: "https://fidel.uk",
|
|
267
266
|
});
|
|
268
267
|
```
|
|
269
268
|
|
|
@@ -273,7 +272,7 @@ Set your program name as it will appear in the consent text. Note that **this pa
|
|
|
273
272
|
|
|
274
273
|
```javascript
|
|
275
274
|
Fidel.setOptions({
|
|
276
|
-
programName:
|
|
275
|
+
programName: "Your Program Name",
|
|
277
276
|
});
|
|
278
277
|
```
|
|
279
278
|
|
|
@@ -283,7 +282,7 @@ This is the terms & conditions URL that you can set for the consent text. Note t
|
|
|
283
282
|
|
|
284
283
|
```javascript
|
|
285
284
|
Fidel.setOptions({
|
|
286
|
-
termsConditionsUrl:
|
|
285
|
+
termsConditionsUrl: "https://fidel.uk",
|
|
287
286
|
});
|
|
288
287
|
```
|
|
289
288
|
|
|
@@ -293,15 +292,15 @@ In order to properly set the consent text, please follow these steps:
|
|
|
293
292
|
|
|
294
293
|
1. **Set the company name**
|
|
295
294
|
|
|
296
|
-
This parameter is optional, but we recommended setting it. If you don't set a company name, we'll show the default value in the consent text:
|
|
295
|
+
This parameter is optional, but we recommended setting it. If you don't set a company name, we'll show the default value in the consent text: `Your Company Name`
|
|
297
296
|
|
|
298
297
|
2. **Set the privacy policy URL**
|
|
299
298
|
|
|
300
|
-
This is an optional parameter. It is added as a hyperlink to the
|
|
299
|
+
This is an optional parameter. It is added as a hyperlink to the `privacy policy` text. Please see the full behaviour below.
|
|
301
300
|
|
|
302
301
|
3. **Set the delete instructions**
|
|
303
302
|
|
|
304
|
-
Optional parameter whose default value is
|
|
303
|
+
Optional parameter whose default value is `going to your account settings`. This default value is applied for both consent texts - for the USA & Canada as well as for the rest of the world.
|
|
305
304
|
|
|
306
305
|
4. **Set the card scheme name**
|
|
307
306
|
|
|
@@ -309,12 +308,11 @@ By default, we allow the user to input card numbers from either Visa, Mastercard
|
|
|
309
308
|
|
|
310
309
|
5. **Set the program name (applied to the consent text only for USA and Canada)**
|
|
311
310
|
|
|
312
|
-
This parameter is taken into account only for USA and Canada. The default value for program name is
|
|
311
|
+
This parameter is taken into account only for USA and Canada. The default value for program name is `our`.
|
|
313
312
|
|
|
314
313
|
6. **Set the terms and conditions URL (applied to the consent text only for USA and Canada)**
|
|
315
314
|
|
|
316
|
-
This parameter is mandatory for USA and Canada. Once set, it will be applied as a hyperlink on the
|
|
317
|
-
|
|
315
|
+
This parameter is mandatory for USA and Canada. Once set, it will be applied as a hyperlink on the `Terms and Conditions` text.
|
|
318
316
|
|
|
319
317
|
Note that the consent text has a different form depending on the allowed countries you set or the country the user can select. Below you can find the specifics for each case.
|
|
320
318
|
|
|
@@ -322,64 +320,66 @@ Note that the consent text has a different form depending on the allowed countri
|
|
|
322
320
|
|
|
323
321
|
When you set United States and/or Canada as allowed countries or don't set any countries (meaning that the user is free to select United States or Canada as their country), a different consent text will be applied.
|
|
324
322
|
|
|
325
|
-
For USA & Canada, the following would be an example Terms & Conditions text for
|
|
323
|
+
For USA & Canada, the following would be an example Terms & Conditions text for `Cashback Inc` (an example company) that uses `Awesome Bonus` as their program name:
|
|
326
324
|
|
|
327
|
-
|
|
325
|
+
_By submitting your card information and checking this box, you authorize `card_scheme_name` to monitor and share transaction data with Fidel (our service provider) to participate in `Awesome Bonus` program. You also acknowledge and agree that Fidel may share certain details of your qualifying transactions with `Cashback Inc` to enable your participation in `Awesome Bonus` program and for other purposes in accordance with the `Cashback Inc` Terms and Conditions, `Cashback Inc` privacy policy and Fidel’s Privacy Policy. You may opt-out of transaction monitoring on the linked card at any time by `deleteInstructions`._
|
|
328
326
|
|
|
329
327
|
There are two specific parameters that you can set for this consent text:
|
|
330
328
|
|
|
331
329
|
#### 1. termsConditionsUrl
|
|
332
|
-
|
|
330
|
+
|
|
331
|
+
This parameter is mandatory when you set United States and/or Canada as allowed countries or don't set any countries (meaning that the user is free to select United States or Canada as their country). When you set this parameter, the `Terms and Conditions` from the consent text will get a hyperlink with the URL you set.
|
|
333
332
|
|
|
334
333
|
```javascript
|
|
335
334
|
Fidel.setOptions({
|
|
336
|
-
termsConditionsUrl:
|
|
335
|
+
termsConditionsUrl: "https://fidel.uk",
|
|
337
336
|
});
|
|
338
337
|
```
|
|
339
338
|
|
|
340
|
-
If you don't set this parameter, you'll get an error when trying to open the card linking interface:
|
|
339
|
+
If you don't set this parameter, you'll get an error when trying to open the card linking interface: `You have included a North American country in the list of allowed countries or you allow the user to select a North American country. For North American countries it is mandatory for you to provide the Terms and Conditions URL.`
|
|
341
340
|
|
|
342
341
|
#### 2. programName
|
|
343
|
-
|
|
342
|
+
|
|
343
|
+
This parameter is optional when you set United States or Canada as allowed countries or don't set any allowed countries. If you don't set a program name, we'll use `our` as the default value (for example, in the text above, you would see _...to monitor and share transaction data with Fidel (our service provider) to participate in `our` program..._)
|
|
344
344
|
|
|
345
345
|
```javascript
|
|
346
346
|
Fidel.setOptions({
|
|
347
|
-
programName:
|
|
347
|
+
programName: "Your Program Name",
|
|
348
348
|
});
|
|
349
349
|
```
|
|
350
350
|
|
|
351
351
|
#### Consent text behaviour for card scheme name
|
|
352
352
|
|
|
353
|
-
If you don't set a card scheme (meaning the user can input either Visa, Mastercard or American Express cards)
|
|
353
|
+
If you don't set a card scheme (meaning the user can input either Visa, Mastercard or American Express cards) _OR_ set 2 or 3 card scheme names, the default value used will be `your payment card network` (e.g. _you authorize `your payment card network` to monitor and share transaction data with Fidel (our service provider)_). When the user starts typing in a card number, `your payment card network` will be replaced with the scheme name of the card that they typed in (e.g. Visa).
|
|
354
354
|
|
|
355
|
-
If you set one card scheme name, it will be displayed in the consent text (e.g. for Mastercard it would be _you authorize
|
|
355
|
+
If you set one card scheme name, it will be displayed in the consent text (e.g. for Mastercard it would be _you authorize `Mastercard` to monitor and share transaction data with Fidel (our service provider)_) This value - `Mastercard` - will not change when the user starts typing in a card number.
|
|
356
356
|
|
|
357
357
|
#### Consent text behaviour for privacy policy
|
|
358
358
|
|
|
359
|
-
Notice the following excerpt from the consent text above: _in accordance with the
|
|
360
|
-
If you do not set a
|
|
359
|
+
Notice the following excerpt from the consent text above: _in accordance with the `Cashback Inc` Terms and Conditions, `Cashback Inc` privacy policy and Fidel’s Privacy Policy_. If you set a `privacyUrl`, this is the text that will be displayed, along with a hyperlink set on _privacy policy_.
|
|
360
|
+
If you do not set a `privacyUrl`, the text will become _in accordance with the `Cashback Inc` Terms and Conditions and Fidel’s Privacy Policy._
|
|
361
361
|
|
|
362
362
|
### Consent text for the rest of the world
|
|
363
363
|
|
|
364
364
|
When you set Ireland, Japan , Sweden, United Arab Emirates or United Kingdom as allowed countries or the user selects one of these countries from the list, a consent text specific for these countries will be applied.
|
|
365
365
|
|
|
366
|
-
The following would be an example Terms & Conditions text for
|
|
366
|
+
The following would be an example Terms & Conditions text for `Cashback Inc` (an example company):
|
|
367
367
|
|
|
368
|
-
|
|
368
|
+
_I authorise `card_scheme_name` to monitor my payment card to identify transactions that qualify for a reward and for `card_scheme_name` to share such information with `Cashback Inc`, to enable my card linked offers and target offers that may be of interest to me. For information about `Cashback Inc` privacy practices, please see the privacy policy. You may opt-out of transaction monitoring on the payment card you entered at any time by `deleteInstructions`._
|
|
369
369
|
|
|
370
370
|
#### Consent text behaviour for card scheme name
|
|
371
371
|
|
|
372
|
-
If you don't set a card scheme (meaning the user can input either Visa, Mastercard or American Express cards)
|
|
372
|
+
If you don't set a card scheme (meaning the user can input either Visa, Mastercard or American Express cards) _OR_ set 2 or 3 card scheme names, the default value used will be `my card network` (e.g. _I authorise `my card network` to monitor my payment card_). When the user starts typing in a card number, `my card network` will be replaced with the scheme name of the card that they typed in (e.g. Visa).
|
|
373
373
|
|
|
374
|
-
If you set one card scheme name, it will be displayed in the consent text (e.g. for Mastercard it would be _I authorise
|
|
374
|
+
If you set one card scheme name, it will be displayed in the consent text (e.g. for Mastercard it would be _I authorise `Mastercard` to monitor my payment card_) This value - `Mastercard` - will not change when the user starts typing in a card number.
|
|
375
375
|
|
|
376
376
|
#### Consent text behaviour for privacy policy
|
|
377
377
|
|
|
378
378
|
If you do not set a privacy policy URL, the privacy policy related phrase will be removed from the text.
|
|
379
379
|
|
|
380
|
-
Notice the following excerpt from the consent text above: _...may be of interest to me. For information about
|
|
380
|
+
Notice the following excerpt from the consent text above: _...may be of interest to me. For information about `Cashback Inc` privacy practices, please see the privacy policy. You may opt-out of..._ If you set a `privacyUrl`, this is the text that will be displayed, along with a hyperlink set on _privacy policy_.
|
|
381
381
|
|
|
382
|
-
If you do not set a
|
|
382
|
+
If you do not set a `privacyUrl`, the text will become _...may be of interest to me. You may opt-out of..._
|
|
383
383
|
|
|
384
384
|
## Localisation
|
|
385
385
|
|
|
@@ -391,11 +391,11 @@ Please make sure that your project also supports localisation for the languages
|
|
|
391
391
|
|
|
392
392
|
In the test environment please use our VISA, Mastercard or American Express test card numbers. You must use a test API Key for them to work.
|
|
393
393
|
|
|
394
|
-
VISA: _4444000000004
|
|
394
|
+
VISA: _4444000000004\*\*\*_ (the last 3 numbers can be anything)
|
|
395
395
|
|
|
396
|
-
Mastercard: _5555000000005
|
|
396
|
+
Mastercard: _5555000000005\*\*\*_ (the last 3 numbers can be anything)
|
|
397
397
|
|
|
398
|
-
American Express: _3400000000003
|
|
398
|
+
American Express: _3400000000003\*\*_ or _3700000000003\*\*_ (the last 2 numbers can be anything)
|
|
399
399
|
|
|
400
400
|
## Feedback
|
|
401
401
|
|
|
@@ -404,4 +404,3 @@ The Fidel SDK is in active development, we welcome your feedback!
|
|
|
404
404
|
Get in touch:
|
|
405
405
|
|
|
406
406
|
GitHub Issues - For SDK issues and feedback
|
|
407
|
-
Fidel Developers Forum - [https://community.fidel.uk](https://community.fidel.uk) - for personal support at any phase of integration
|
package/android/build.gradle
CHANGED
|
@@ -14,14 +14,14 @@ apply plugin: 'com.android.library'
|
|
|
14
14
|
apply from: 'jacoco.gradle'
|
|
15
15
|
|
|
16
16
|
android {
|
|
17
|
-
compileSdkVersion
|
|
17
|
+
compileSdkVersion 33
|
|
18
18
|
buildToolsVersion "30.0.3"
|
|
19
19
|
|
|
20
20
|
defaultConfig {
|
|
21
21
|
minSdkVersion 21
|
|
22
|
-
targetSdkVersion
|
|
22
|
+
targetSdkVersion 32
|
|
23
23
|
versionCode 1
|
|
24
|
-
versionName "
|
|
24
|
+
versionName "2.0.0"
|
|
25
25
|
}
|
|
26
26
|
lintOptions {
|
|
27
27
|
abortOnError false
|
|
@@ -35,15 +35,18 @@ android {
|
|
|
35
35
|
}
|
|
36
36
|
|
|
37
37
|
repositories {
|
|
38
|
-
mavenCentral
|
|
38
|
+
mavenCentral {
|
|
39
|
+
content {
|
|
40
|
+
excludeGroup("com.facebook.react")
|
|
41
|
+
}
|
|
42
|
+
}
|
|
39
43
|
}
|
|
40
44
|
|
|
41
45
|
dependencies {
|
|
42
46
|
implementation 'com.facebook.react:react-native:+'
|
|
43
|
-
implementation 'com.github.FidelLimited:android-sdk:
|
|
44
|
-
|
|
47
|
+
implementation 'com.github.FidelLimited:android-sdk:2.0.0'
|
|
45
48
|
testImplementation 'junit:junit:4.13.2'
|
|
46
|
-
testImplementation 'androidx.test.ext:junit:1.1.
|
|
49
|
+
testImplementation 'androidx.test.ext:junit:1.1.5'
|
|
47
50
|
testImplementation 'org.assertj:assertj-core:3.13.2'
|
|
48
|
-
testImplementation 'org.robolectric:robolectric:4.
|
|
51
|
+
testImplementation 'org.robolectric:robolectric:4.10'
|
|
49
52
|
}
|
|
@@ -2,23 +2,24 @@
|
|
|
2
2
|
package com.fidelreactlibrary;
|
|
3
3
|
|
|
4
4
|
import android.app.Activity;
|
|
5
|
-
|
|
5
|
+
|
|
6
|
+
import androidx.annotation.NonNull;
|
|
7
|
+
|
|
6
8
|
import com.facebook.react.bridge.ReactApplicationContext;
|
|
7
9
|
import com.facebook.react.bridge.ReactContextBaseJavaModule;
|
|
8
10
|
import com.facebook.react.bridge.ReactMethod;
|
|
9
11
|
import com.facebook.react.bridge.ReadableMap;
|
|
10
|
-
import com.
|
|
11
|
-
import com.
|
|
12
|
-
import com.
|
|
13
|
-
import com.
|
|
12
|
+
import com.fidelapi.Fidel;
|
|
13
|
+
import com.fidelapi.entities.CardVerificationConfiguration;
|
|
14
|
+
import com.fidelapi.entities.abstraction.OnCardVerificationChoiceSelectedObserver;
|
|
15
|
+
import com.fidelapi.entities.abstraction.OnCardVerificationStartedObserver;
|
|
16
|
+
import com.fidelapi.entities.abstraction.OnResultObserver;
|
|
14
17
|
import com.fidelreactlibrary.adapters.abstraction.ConstantsProvider;
|
|
15
18
|
import com.fidelreactlibrary.adapters.abstraction.DataProcessor;
|
|
16
|
-
import com.fidelreactlibrary.adapters.abstraction.
|
|
17
|
-
import com.fidelreactlibrary.events.
|
|
18
|
-
import com.fidelreactlibrary.events.CallbackInput;
|
|
19
|
-
import com.fidel.sdk.data.abstraction.FidelCardLinkingObserver;
|
|
20
|
-
import com.fidelreactlibrary.events.ErrorEventEmitter;
|
|
19
|
+
import com.fidelreactlibrary.adapters.abstraction.VerificationConfigurationAdapter;
|
|
20
|
+
import com.fidelreactlibrary.events.BridgeLibraryEvent;
|
|
21
21
|
|
|
22
|
+
import java.util.HashMap;
|
|
22
23
|
import java.util.List;
|
|
23
24
|
import java.util.Map;
|
|
24
25
|
|
|
@@ -26,25 +27,30 @@ import javax.annotation.Nullable;
|
|
|
26
27
|
|
|
27
28
|
public class FidelModule extends ReactContextBaseJavaModule {
|
|
28
29
|
|
|
29
|
-
private final CallbackInput callbackInput;
|
|
30
30
|
private final DataProcessor<ReadableMap> setupProcessor;
|
|
31
|
-
private final
|
|
31
|
+
private final OnCardVerificationChoiceSelectedObserver onCardVerificationChoiceSelectedObserver;
|
|
32
32
|
private final List<ConstantsProvider> constantsProviderList;
|
|
33
|
-
private final
|
|
33
|
+
private final OnResultObserver onResultObserver;
|
|
34
|
+
private final OnCardVerificationStartedObserver onCardVerificationStartedObserver;
|
|
35
|
+
private final VerificationConfigurationAdapter verificationAdapter;
|
|
34
36
|
|
|
35
37
|
public FidelModule(ReactApplicationContext reactContext,
|
|
36
|
-
|
|
37
|
-
|
|
38
|
-
|
|
39
|
-
|
|
38
|
+
DataProcessor<ReadableMap> setupProcessor,
|
|
39
|
+
OnResultObserver onResultObserver,
|
|
40
|
+
OnCardVerificationStartedObserver onCardVerificationStartedObserver,
|
|
41
|
+
OnCardVerificationChoiceSelectedObserver onCardVerificationChoiceSelectedObserver,
|
|
42
|
+
List<ConstantsProvider> constantsProviderList,
|
|
43
|
+
VerificationConfigurationAdapter verificationAdapter) {
|
|
40
44
|
super(reactContext);
|
|
41
45
|
this.setupProcessor = setupProcessor;
|
|
42
|
-
this.
|
|
43
|
-
this.callbackInput = callbackInput;
|
|
46
|
+
this.onCardVerificationChoiceSelectedObserver = onCardVerificationChoiceSelectedObserver;
|
|
44
47
|
this.constantsProviderList = constantsProviderList;
|
|
45
|
-
this.
|
|
48
|
+
this.onResultObserver = onResultObserver;
|
|
49
|
+
this.onCardVerificationStartedObserver = onCardVerificationStartedObserver;
|
|
50
|
+
this.verificationAdapter = verificationAdapter;
|
|
46
51
|
}
|
|
47
52
|
|
|
53
|
+
@NonNull
|
|
48
54
|
@Override
|
|
49
55
|
public String getName() {
|
|
50
56
|
return "NativeFidelBridge";
|
|
@@ -52,51 +58,53 @@ public class FidelModule extends ReactContextBaseJavaModule {
|
|
|
52
58
|
|
|
53
59
|
@ReactMethod
|
|
54
60
|
public void addListener(String eventName) {
|
|
55
|
-
|
|
61
|
+
if (eventName.equals(BridgeLibraryEvent.RESULT_AVAILABLE.getEventName())) {
|
|
62
|
+
Fidel.onResult = onResultObserver;
|
|
63
|
+
} else if (eventName.equals(BridgeLibraryEvent.CARD_VERIFICATION_STARTED.getEventName())) {
|
|
64
|
+
Fidel.onCardVerificationStarted = onCardVerificationStartedObserver;
|
|
65
|
+
} else if (eventName.equals(BridgeLibraryEvent.CARD_VERIFICATION_CHOICE.getEventName())) {
|
|
66
|
+
Fidel.onCardVerificationChoiceSelected = onCardVerificationChoiceSelectedObserver;
|
|
67
|
+
}
|
|
56
68
|
}
|
|
57
69
|
|
|
58
70
|
@ReactMethod
|
|
59
71
|
public void removeListeners(Integer count) {
|
|
60
|
-
|
|
72
|
+
Fidel.onResult = null;
|
|
61
73
|
}
|
|
62
74
|
|
|
63
75
|
@ReactMethod
|
|
64
|
-
public void
|
|
76
|
+
public void start() {
|
|
65
77
|
final Activity activity = getCurrentActivity();
|
|
66
|
-
final FidelCardLinkingObserver cardLinkingObserver = getCardLinkingObserver();
|
|
67
78
|
if (activity != null) {
|
|
68
|
-
|
|
69
|
-
Fidel.present(activity);
|
|
79
|
+
Fidel.start(activity);
|
|
70
80
|
}
|
|
71
|
-
callbackInput.callbackIsReady(callback);
|
|
72
81
|
}
|
|
73
82
|
|
|
74
83
|
@ReactMethod
|
|
75
84
|
public void setup(ReadableMap map) {
|
|
76
85
|
setupProcessor.process(map);
|
|
86
|
+
final Activity activity = getCurrentActivity();
|
|
87
|
+
if (activity != null) {
|
|
88
|
+
Fidel.onMainActivityCreate(activity);
|
|
89
|
+
}
|
|
77
90
|
}
|
|
78
91
|
|
|
79
92
|
@ReactMethod
|
|
80
|
-
public void
|
|
81
|
-
|
|
93
|
+
public void verifyCard(ReadableMap data) {
|
|
94
|
+
final Activity activity = getCurrentActivity();
|
|
95
|
+
if (activity != null) {
|
|
96
|
+
CardVerificationConfiguration cardVerificationConfig = verificationAdapter.adapt(data);
|
|
97
|
+
Fidel.verifyCard(activity, cardVerificationConfig);
|
|
98
|
+
}
|
|
82
99
|
}
|
|
83
100
|
|
|
84
101
|
@Nullable
|
|
85
102
|
@Override
|
|
86
103
|
public Map<String, Object> getConstants() {
|
|
87
|
-
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
new WritableMapDataConverter(new ObjectFactory<WritableMap>() {
|
|
93
|
-
@Override
|
|
94
|
-
public WritableMap create() {
|
|
95
|
-
return new WritableNativeMap();
|
|
96
|
-
}
|
|
97
|
-
});
|
|
98
|
-
ErrorEventEmitter errorEventEmitter =
|
|
99
|
-
new ErrorEventEmitter(reactContext);
|
|
100
|
-
return new CallbackActivityEventListener(linkResultConverter, errorEventEmitter);
|
|
104
|
+
Map<String, Object> constants = new HashMap<>();
|
|
105
|
+
for (ConstantsProvider provider : constantsProviderList) {
|
|
106
|
+
constants.putAll(provider.getConstants());
|
|
107
|
+
}
|
|
108
|
+
return constants;
|
|
101
109
|
}
|
|
102
|
-
}
|
|
110
|
+
}
|