fidel-react-native 2.4.0 → 3.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/android/build.gradle +1 -1
- package/android/src/main/java/com/fidelreactlibrary/FidelModule.java +2 -28
- package/android/src/main/java/com/fidelreactlibrary/FidelPackage.java +1 -19
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelProgramTypeAdapter.java +0 -1
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelSetupAdapter.java +0 -4
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelSetupProperties.java +0 -1
- package/android/src/main/java/com/fidelreactlibrary/adapters/ResultsAdapter.java +0 -65
- package/android/src/main/java/com/fidelreactlibrary/events/BridgeLibraryEvent.java +0 -2
- package/android/src/main/java/com/fidelreactlibrary/events/ResultsObserver.java +0 -8
- package/android/src/test/java/com/fidelreactlibrary/FidelModuleTests.java +0 -21
- package/android/src/test/java/com/fidelreactlibrary/adapters/FidelProgramTypeAdapterTests.java +0 -5
- package/android/src/test/java/com/fidelreactlibrary/adapters/FidelSetupAdapterTests.java +0 -76
- package/android/src/test/java/com/fidelreactlibrary/events/BridgeLibraryEventEmitterTests.java +0 -11
- package/android/src/test/java/com/fidelreactlibrary/events/BridgeLibraryEventTests.java +0 -5
- package/android/src/test/java/com/fidelreactlibrary/fakes/ReadableMapStub.java +0 -23
- package/index.js +0 -43
- package/ios/Adapters/ErrorResultAdapter.swift +1 -15
- package/ios/Adapters/FidelSetupAdapter.swift +5 -8
- package/ios/Constants/ErrorTypeConstants.swift +4 -7
- package/ios/Constants/ExportedConstantsProvider.swift +1 -3
- package/ios/Constants/ProgramTypeConstants.swift +4 -8
- package/ios/Constants/ResultTypeConstants.swift +3 -5
- package/ios/Events/BridgeLibraryEvent.swift +0 -2
- package/ios/Events/JSResultProperties.swift +0 -1
- package/ios/Events/JSResultTypes.swift +0 -1
- package/ios/Events/ResultsObserver.swift +2 -5
- package/ios/FidelSetupProperties.swift +2 -3
- package/ios/NativeFidelBridge.m +0 -2
- package/ios/NativeFidelBridge.swift +13 -25
- package/package.json +1 -1
- package/android/src/main/java/com/fidelreactlibrary/adapters/CardVerificationConfigurationProperties.java +0 -22
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelCardVerificationChoiceAdapter.java +0 -57
- package/android/src/main/java/com/fidelreactlibrary/adapters/FidelVerificationConfigurationAdapter.java +0 -35
- package/android/src/main/java/com/fidelreactlibrary/adapters/abstraction/CardVerificationChoiceAdapter.java +0 -11
- package/android/src/main/java/com/fidelreactlibrary/adapters/abstraction/VerificationConfigurationAdapter.java +0 -9
- package/android/src/main/java/com/fidelreactlibrary/events/CardVerificationChoiceObserver.java +0 -29
- package/android/src/main/java/com/fidelreactlibrary/events/CardVerificationStartedObserver.java +0 -31
- package/android/src/test/java/com/fidelreactlibrary/adapters/FidelCardVerificationChoiceAdapterTest.java +0 -70
- package/android/src/test/java/com/fidelreactlibrary/adapters/FidelVerificationConfigurationAdapterTest.java +0 -51
- package/android/src/test/java/com/fidelreactlibrary/events/CardVerificationStartedObserverTests.java +0 -49
- package/android/src/test/java/com/fidelreactlibrary/fakes/VerificationConfigurationAdapterStub.java +0 -13
- package/ios/Adapters/FidelVerificationConfigurationAdapter.swift +0 -19
- package/ios/Adapters/VerificationResultAdapter.swift +0 -17
- package/ios/Constants/CardVerificationChoiceConstants.swift +0 -24
- package/ios/Constants/VerificationErrorTypeConstants.swift +0 -29
- package/ios/Events/CardVerificationChoiceSelectedObserver.swift +0 -23
- package/ios/Events/CardVerificationStartedObserver.swift +0 -21
package/android/build.gradle
CHANGED
|
@@ -44,7 +44,7 @@ repositories {
|
|
|
44
44
|
|
|
45
45
|
dependencies {
|
|
46
46
|
implementation 'com.facebook.react:react-native:+'
|
|
47
|
-
implementation 'com.github.Enigmatic-Smile:android-sdk:
|
|
47
|
+
implementation 'com.github.Enigmatic-Smile:android-sdk:3.0.0'
|
|
48
48
|
implementation 'com.github.Enigmatic-Smile:kotlin-multiplatform-analytics:1.4.0'
|
|
49
49
|
testImplementation 'junit:junit:4.13.2'
|
|
50
50
|
testImplementation 'androidx.test.ext:junit:1.1.5'
|
|
@@ -12,13 +12,9 @@ import com.facebook.react.bridge.ReadableMap;
|
|
|
12
12
|
import com.fidelapi.Fidel;
|
|
13
13
|
import com.fidelapi.analytics.Analytics;
|
|
14
14
|
import com.fidelapi.analytics.domain.SdkDetails;
|
|
15
|
-
import com.fidelapi.entities.CardVerificationConfiguration;
|
|
16
|
-
import com.fidelapi.entities.abstraction.OnCardVerificationChoiceSelectedObserver;
|
|
17
|
-
import com.fidelapi.entities.abstraction.OnCardVerificationStartedObserver;
|
|
18
15
|
import com.fidelapi.entities.abstraction.OnResultObserver;
|
|
19
16
|
import com.fidelreactlibrary.adapters.abstraction.ConstantsProvider;
|
|
20
17
|
import com.fidelreactlibrary.adapters.abstraction.DataProcessor;
|
|
21
|
-
import com.fidelreactlibrary.adapters.abstraction.VerificationConfigurationAdapter;
|
|
22
18
|
import com.fidelreactlibrary.events.BridgeLibraryEvent;
|
|
23
19
|
|
|
24
20
|
import java.util.HashMap;
|
|
@@ -30,26 +26,17 @@ import javax.annotation.Nullable;
|
|
|
30
26
|
public class FidelModule extends ReactContextBaseJavaModule {
|
|
31
27
|
|
|
32
28
|
private final DataProcessor<ReadableMap> setupProcessor;
|
|
33
|
-
private final OnCardVerificationChoiceSelectedObserver onCardVerificationChoiceSelectedObserver;
|
|
34
29
|
private final List<ConstantsProvider> constantsProviderList;
|
|
35
30
|
private final OnResultObserver onResultObserver;
|
|
36
|
-
private final OnCardVerificationStartedObserver onCardVerificationStartedObserver;
|
|
37
|
-
private final VerificationConfigurationAdapter verificationAdapter;
|
|
38
31
|
|
|
39
32
|
public FidelModule(ReactApplicationContext reactContext,
|
|
40
33
|
DataProcessor<ReadableMap> setupProcessor,
|
|
41
34
|
OnResultObserver onResultObserver,
|
|
42
|
-
|
|
43
|
-
OnCardVerificationChoiceSelectedObserver onCardVerificationChoiceSelectedObserver,
|
|
44
|
-
List<ConstantsProvider> constantsProviderList,
|
|
45
|
-
VerificationConfigurationAdapter verificationAdapter) {
|
|
35
|
+
List<ConstantsProvider> constantsProviderList) {
|
|
46
36
|
super(reactContext);
|
|
47
37
|
this.setupProcessor = setupProcessor;
|
|
48
|
-
this.onCardVerificationChoiceSelectedObserver = onCardVerificationChoiceSelectedObserver;
|
|
49
38
|
this.constantsProviderList = constantsProviderList;
|
|
50
39
|
this.onResultObserver = onResultObserver;
|
|
51
|
-
this.onCardVerificationStartedObserver = onCardVerificationStartedObserver;
|
|
52
|
-
this.verificationAdapter = verificationAdapter;
|
|
53
40
|
}
|
|
54
41
|
|
|
55
42
|
@NonNull
|
|
@@ -62,10 +49,6 @@ public class FidelModule extends ReactContextBaseJavaModule {
|
|
|
62
49
|
public void addListener(String eventName) {
|
|
63
50
|
if (eventName.equals(BridgeLibraryEvent.RESULT_AVAILABLE.getEventName())) {
|
|
64
51
|
Fidel.onResult = onResultObserver;
|
|
65
|
-
} else if (eventName.equals(BridgeLibraryEvent.CARD_VERIFICATION_STARTED.getEventName())) {
|
|
66
|
-
Fidel.onCardVerificationStarted = onCardVerificationStartedObserver;
|
|
67
|
-
} else if (eventName.equals(BridgeLibraryEvent.CARD_VERIFICATION_CHOICE.getEventName())) {
|
|
68
|
-
Fidel.onCardVerificationChoiceSelected = onCardVerificationChoiceSelectedObserver;
|
|
69
52
|
}
|
|
70
53
|
}
|
|
71
54
|
|
|
@@ -91,22 +74,13 @@ public class FidelModule extends ReactContextBaseJavaModule {
|
|
|
91
74
|
}
|
|
92
75
|
}
|
|
93
76
|
|
|
94
|
-
@ReactMethod
|
|
95
|
-
public void verifyCard(ReadableMap data) {
|
|
96
|
-
final Activity activity = getCurrentActivity();
|
|
97
|
-
if (activity != null) {
|
|
98
|
-
CardVerificationConfiguration cardVerificationConfig = verificationAdapter.adapt(data);
|
|
99
|
-
Fidel.verifyCard(activity, cardVerificationConfig);
|
|
100
|
-
}
|
|
101
|
-
}
|
|
102
|
-
|
|
103
77
|
@ReactMethod
|
|
104
78
|
public void identifyMetricsDataSource(String name, String version) {
|
|
105
79
|
SdkDetails reactNativeSdkDetails = new SdkDetails(name, version);
|
|
106
80
|
Analytics analytics = new Analytics();
|
|
107
81
|
analytics.identifyMultiplatformDataSource(reactNativeSdkDetails);
|
|
108
82
|
}
|
|
109
|
-
|
|
83
|
+
|
|
110
84
|
@Nullable
|
|
111
85
|
@Override
|
|
112
86
|
public Map<String, Object> getConstants() {
|
|
@@ -16,11 +16,9 @@ import com.facebook.react.bridge.WritableNativeMap;
|
|
|
16
16
|
import com.facebook.react.uimanager.ViewManager;
|
|
17
17
|
import com.fidelapi.utils.FidelExperimental;
|
|
18
18
|
import com.fidelreactlibrary.adapters.FidelCardSchemesAdapter;
|
|
19
|
-
import com.fidelreactlibrary.adapters.FidelCardVerificationChoiceAdapter;
|
|
20
19
|
import com.fidelreactlibrary.adapters.FidelCountryAdapter;
|
|
21
20
|
import com.fidelreactlibrary.adapters.FidelProgramTypeAdapter;
|
|
22
21
|
import com.fidelreactlibrary.adapters.FidelSetupAdapter;
|
|
23
|
-
import com.fidelreactlibrary.adapters.FidelVerificationConfigurationAdapter;
|
|
24
22
|
import com.fidelreactlibrary.adapters.ImageFromReadableMapAdapter;
|
|
25
23
|
import com.fidelreactlibrary.adapters.ResultsAdapter;
|
|
26
24
|
import com.fidelreactlibrary.adapters.abstraction.CardSchemesAdapter;
|
|
@@ -28,8 +26,6 @@ import com.fidelreactlibrary.adapters.abstraction.ConstantsProvider;
|
|
|
28
26
|
import com.fidelreactlibrary.adapters.abstraction.CountryAdapter;
|
|
29
27
|
import com.fidelreactlibrary.adapters.abstraction.DataProcessor;
|
|
30
28
|
import com.fidelreactlibrary.events.BridgeLibraryEvent;
|
|
31
|
-
import com.fidelreactlibrary.events.CardVerificationChoiceObserver;
|
|
32
|
-
import com.fidelreactlibrary.events.CardVerificationStartedObserver;
|
|
33
29
|
import com.fidelreactlibrary.events.ResultsObserver;
|
|
34
30
|
import com.fidelreactlibrary.events.BridgeLibraryEventEmitter;
|
|
35
31
|
|
|
@@ -55,29 +51,15 @@ public class FidelPackage implements ReactPackage {
|
|
|
55
51
|
BridgeLibraryEvent.RESULT_AVAILABLE);
|
|
56
52
|
ResultsObserver resultsObserver = new ResultsObserver(resultsAdapter, resultHandler, WritableNativeMap::new);
|
|
57
53
|
|
|
58
|
-
DataProcessor<ReadableMap> cardVerificationStartedHandler = new BridgeLibraryEventEmitter(reactContext,
|
|
59
|
-
BridgeLibraryEvent.CARD_VERIFICATION_STARTED);
|
|
60
|
-
DataProcessor<ReadableMap> cardVerificationChoiceHandler = new BridgeLibraryEventEmitter(reactContext,
|
|
61
|
-
BridgeLibraryEvent.CARD_VERIFICATION_CHOICE);
|
|
62
|
-
CardVerificationStartedObserver cardVerificationStartedObserver = new CardVerificationStartedObserver(
|
|
63
|
-
cardVerificationStartedHandler, WritableNativeMap::new);
|
|
64
|
-
FidelCardVerificationChoiceAdapter cardVerificationChoiceAdapter = new FidelCardVerificationChoiceAdapter(WritableNativeMap::new);
|
|
65
|
-
CardVerificationChoiceObserver cardVerificationChoiceObserver = new CardVerificationChoiceObserver(
|
|
66
|
-
cardVerificationChoiceHandler, cardVerificationChoiceAdapter);
|
|
67
|
-
|
|
68
54
|
constantsProviderList.add(setupAdapter);
|
|
69
55
|
constantsProviderList.add(resultsAdapter);
|
|
70
56
|
constantsProviderList.add(resultsObserver);
|
|
71
|
-
constantsProviderList.add(cardVerificationChoiceAdapter);
|
|
72
57
|
|
|
73
58
|
FidelModule fidelModule = new FidelModule(
|
|
74
59
|
reactContext,
|
|
75
60
|
setupAdapter,
|
|
76
61
|
resultsObserver,
|
|
77
|
-
|
|
78
|
-
cardVerificationChoiceObserver,
|
|
79
|
-
constantsProviderList,
|
|
80
|
-
new FidelVerificationConfigurationAdapter());
|
|
62
|
+
constantsProviderList);
|
|
81
63
|
return Collections.singletonList(fidelModule);
|
|
82
64
|
}
|
|
83
65
|
|
|
@@ -14,7 +14,6 @@ public class FidelProgramTypeAdapter implements ProgramTypeAdapter {
|
|
|
14
14
|
public @NonNull String keyFor(@NonNull ProgramType programType) {
|
|
15
15
|
switch (programType) {
|
|
16
16
|
case TRANSACTION_SELECT: return "transactionSelect";
|
|
17
|
-
case TRANSACTION_STREAM: return "transactionStream";
|
|
18
17
|
default: return "notFound";
|
|
19
18
|
}
|
|
20
19
|
}
|
|
@@ -65,10 +65,6 @@ public final class FidelSetupAdapter implements DataProcessor<ReadableMap>, Data
|
|
|
65
65
|
Fidel.supportedCardSchemes = cardSchemesAdapter.cardSchemesWithReadableArray(
|
|
66
66
|
optionsMap.getArray(FidelSetupProperties.Options.SUPPORTED_CARD_SCHEMES.jsName()));
|
|
67
67
|
}
|
|
68
|
-
if (optionsMap.hasKey(FidelSetupProperties.Options.THIRD_PARTY_VERIFICATION_CHOICE.jsName())) {
|
|
69
|
-
Fidel.thirdPartyVerificationChoice = optionsMap
|
|
70
|
-
.getBoolean(FidelSetupProperties.Options.THIRD_PARTY_VERIFICATION_CHOICE.jsName());
|
|
71
|
-
}
|
|
72
68
|
if (optionsMap.hasKey(FidelSetupProperties.Options.META_DATA.jsName())) {
|
|
73
69
|
ReadableMap metaDataMap = optionsMap.getMap(FidelSetupProperties.Options.META_DATA.jsName());
|
|
74
70
|
if (metaDataMap != null) {
|
|
@@ -14,7 +14,6 @@ public enum FidelSetupProperties {
|
|
|
14
14
|
ALLOWED_COUNTRIES("allowedCountries"),
|
|
15
15
|
DEFAULT_SELECTED_COUNTRY("defaultSelectedCountry"),
|
|
16
16
|
SUPPORTED_CARD_SCHEMES("supportedCardSchemes"),
|
|
17
|
-
THIRD_PARTY_VERIFICATION_CHOICE("thirdPartyVerificationChoice"),
|
|
18
17
|
META_DATA("metaData");
|
|
19
18
|
|
|
20
19
|
private final @NonNull String jsName;
|
|
@@ -8,7 +8,6 @@ import com.fidelapi.entities.CardScheme;
|
|
|
8
8
|
import com.fidelapi.entities.Country;
|
|
9
9
|
import com.fidelapi.entities.EnrollmentErrorType;
|
|
10
10
|
import com.fidelapi.entities.FidelErrorType;
|
|
11
|
-
import com.fidelapi.entities.VerificationErrorType;
|
|
12
11
|
import com.fidelreactlibrary.adapters.abstraction.CardSchemesAdapter;
|
|
13
12
|
import com.fidelreactlibrary.adapters.abstraction.ConstantsProvider;
|
|
14
13
|
import com.fidelreactlibrary.adapters.abstraction.CountryAdapter;
|
|
@@ -132,8 +131,6 @@ public final class ResultsAdapter implements DataAdapter<Object, WritableMap>, C
|
|
|
132
131
|
return "sdkConfigurationError";
|
|
133
132
|
} else if (errorType instanceof FidelErrorType.EnrollmentError) {
|
|
134
133
|
return "enrollmentError";
|
|
135
|
-
} else if (errorType instanceof FidelErrorType.VerificationError) {
|
|
136
|
-
return "verificationError";
|
|
137
134
|
}
|
|
138
135
|
return "unknown";
|
|
139
136
|
}
|
|
@@ -143,9 +140,6 @@ public final class ResultsAdapter implements DataAdapter<Object, WritableMap>, C
|
|
|
143
140
|
if (errorType instanceof FidelErrorType.EnrollmentError) {
|
|
144
141
|
FidelErrorType.EnrollmentError enrollmentError = (FidelErrorType.EnrollmentError)errorType;
|
|
145
142
|
return enrollmentErrorTypeJSValue(enrollmentError.type);
|
|
146
|
-
} else if (errorType instanceof FidelErrorType.VerificationError) {
|
|
147
|
-
FidelErrorType.VerificationError verificationError = (FidelErrorType.VerificationError)errorType;
|
|
148
|
-
return verificationErrorTypeJSValue(verificationError.type);
|
|
149
143
|
}
|
|
150
144
|
return null;
|
|
151
145
|
}
|
|
@@ -160,20 +154,6 @@ public final class ResultsAdapter implements DataAdapter<Object, WritableMap>, C
|
|
|
160
154
|
return "invalidSdkKey";
|
|
161
155
|
case INEXISTENT_PROGRAM:
|
|
162
156
|
return "inexistentProgram";
|
|
163
|
-
case CARD_CONSENT_ISSUER_PROCESSING_CHARGE_ERROR:
|
|
164
|
-
return "cardConsentIssuerProcessingChargeError";
|
|
165
|
-
case CARD_CONSENT_DUPLICATE_TRANSACTION_ERROR:
|
|
166
|
-
return "cardConsentDuplicateTransactionError";
|
|
167
|
-
case CARD_CONSENT_INSUFFICIENT_FUNDS_ERROR:
|
|
168
|
-
return "cardConsentInsufficientFundsError";
|
|
169
|
-
case CARD_CONSENT_PROCESSING_CHARGE_ERROR:
|
|
170
|
-
return "cardConsentProcessingChargeError";
|
|
171
|
-
case CARD_CONSENT_INCORRECT_CARD_DETAILS_ERROR:
|
|
172
|
-
return "cardConsentIncorrectCardDetailsError";
|
|
173
|
-
case CARD_CONSENT_CARD_LIMIT_EXCEEDED:
|
|
174
|
-
return "cardConsentCardLimitExceeded";
|
|
175
|
-
case CARD_CONSENT_ERROR_GENERIC:
|
|
176
|
-
return "cardConsentErrorGeneric";
|
|
177
157
|
case UNAUTHORIZED:
|
|
178
158
|
return "unauthorized";
|
|
179
159
|
case UNEXPECTED:
|
|
@@ -182,28 +162,6 @@ public final class ResultsAdapter implements DataAdapter<Object, WritableMap>, C
|
|
|
182
162
|
return "unexpected";
|
|
183
163
|
}
|
|
184
164
|
|
|
185
|
-
private String verificationErrorTypeJSValue(VerificationErrorType enrollmentErrorType) {
|
|
186
|
-
switch (enrollmentErrorType) {
|
|
187
|
-
case UNEXPECTED:
|
|
188
|
-
return "unexpected";
|
|
189
|
-
case UNAUTHORIZED:
|
|
190
|
-
return "unauthorized";
|
|
191
|
-
case INCORRECT_AMOUNT:
|
|
192
|
-
return "incorrectAmount";
|
|
193
|
-
case MAXIMUM_ATTEMPTS_REACHED:
|
|
194
|
-
return "maximumAttemptsReached";
|
|
195
|
-
case CARD_ALREADY_VERIFIED:
|
|
196
|
-
return "cardAlreadyVerified";
|
|
197
|
-
case CARD_NOT_FOUND:
|
|
198
|
-
return "cardNotFound";
|
|
199
|
-
case VERIFICATION_NOT_FOUND:
|
|
200
|
-
return "verificationNotFound";
|
|
201
|
-
case GENERIC_ERROR:
|
|
202
|
-
return "genericError";
|
|
203
|
-
}
|
|
204
|
-
return "unexpected";
|
|
205
|
-
}
|
|
206
|
-
|
|
207
165
|
@NonNull
|
|
208
166
|
@Override
|
|
209
167
|
public Map<String, Object> getConstants() {
|
|
@@ -213,7 +171,6 @@ public final class ResultsAdapter implements DataAdapter<Object, WritableMap>, C
|
|
|
213
171
|
putErrorTypeConstant(errorTypeConstants, FidelErrorType.DeviceNotSecure.INSTANCE);
|
|
214
172
|
putErrorTypeConstant(errorTypeConstants, FidelErrorType.SdkConfigurationError.INSTANCE);
|
|
215
173
|
putErrorTypeConstant(errorTypeConstants, new FidelErrorType.EnrollmentError(EnrollmentErrorType.CARD_ALREADY_EXISTS));
|
|
216
|
-
putErrorTypeConstant(errorTypeConstants, new FidelErrorType.VerificationError(VerificationErrorType.CARD_ALREADY_VERIFIED));
|
|
217
174
|
errorConstants.put("ErrorType", errorTypeConstants);
|
|
218
175
|
|
|
219
176
|
Map<String, String> enrollmentErrorTypeConstants = new HashMap<>();
|
|
@@ -221,27 +178,10 @@ public final class ResultsAdapter implements DataAdapter<Object, WritableMap>, C
|
|
|
221
178
|
putEnrollmentErrorTypeConstant(enrollmentErrorTypeConstants, EnrollmentErrorType.INEXISTENT_PROGRAM);
|
|
222
179
|
putEnrollmentErrorTypeConstant(enrollmentErrorTypeConstants, EnrollmentErrorType.INVALID_PROGRAM_ID);
|
|
223
180
|
putEnrollmentErrorTypeConstant(enrollmentErrorTypeConstants, EnrollmentErrorType.INVALID_SDK_KEY);
|
|
224
|
-
putEnrollmentErrorTypeConstant(enrollmentErrorTypeConstants, EnrollmentErrorType.CARD_CONSENT_ISSUER_PROCESSING_CHARGE_ERROR);
|
|
225
|
-
putEnrollmentErrorTypeConstant(enrollmentErrorTypeConstants, EnrollmentErrorType.CARD_CONSENT_DUPLICATE_TRANSACTION_ERROR);
|
|
226
|
-
putEnrollmentErrorTypeConstant(enrollmentErrorTypeConstants, EnrollmentErrorType.CARD_CONSENT_INSUFFICIENT_FUNDS_ERROR);
|
|
227
|
-
putEnrollmentErrorTypeConstant(enrollmentErrorTypeConstants, EnrollmentErrorType.CARD_CONSENT_PROCESSING_CHARGE_ERROR);
|
|
228
|
-
putEnrollmentErrorTypeConstant(enrollmentErrorTypeConstants, EnrollmentErrorType.CARD_CONSENT_INCORRECT_CARD_DETAILS_ERROR);
|
|
229
|
-
putEnrollmentErrorTypeConstant(enrollmentErrorTypeConstants, EnrollmentErrorType.CARD_CONSENT_CARD_LIMIT_EXCEEDED);
|
|
230
|
-
putEnrollmentErrorTypeConstant(enrollmentErrorTypeConstants, EnrollmentErrorType.CARD_CONSENT_ERROR_GENERIC);
|
|
231
181
|
putEnrollmentErrorTypeConstant(enrollmentErrorTypeConstants, EnrollmentErrorType.UNAUTHORIZED);
|
|
232
182
|
putEnrollmentErrorTypeConstant(enrollmentErrorTypeConstants, EnrollmentErrorType.UNEXPECTED);
|
|
233
183
|
errorConstants.put("EnrollmentErrorType", enrollmentErrorTypeConstants);
|
|
234
184
|
|
|
235
|
-
Map<String, String> verificationErrorTypeConstants = new HashMap<>();
|
|
236
|
-
putVerificationErrorTypeConstant(verificationErrorTypeConstants, VerificationErrorType.GENERIC_ERROR);
|
|
237
|
-
putVerificationErrorTypeConstant(verificationErrorTypeConstants, VerificationErrorType.UNEXPECTED);
|
|
238
|
-
putVerificationErrorTypeConstant(verificationErrorTypeConstants, VerificationErrorType.CARD_ALREADY_VERIFIED);
|
|
239
|
-
putVerificationErrorTypeConstant(verificationErrorTypeConstants, VerificationErrorType.VERIFICATION_NOT_FOUND);
|
|
240
|
-
putVerificationErrorTypeConstant(verificationErrorTypeConstants, VerificationErrorType.MAXIMUM_ATTEMPTS_REACHED);
|
|
241
|
-
putVerificationErrorTypeConstant(verificationErrorTypeConstants, VerificationErrorType.INCORRECT_AMOUNT);
|
|
242
|
-
putVerificationErrorTypeConstant(verificationErrorTypeConstants, VerificationErrorType.UNAUTHORIZED);
|
|
243
|
-
putVerificationErrorTypeConstant(verificationErrorTypeConstants, VerificationErrorType.CARD_NOT_FOUND);
|
|
244
|
-
errorConstants.put("VerificationErrorType", verificationErrorTypeConstants);
|
|
245
185
|
return errorConstants;
|
|
246
186
|
}
|
|
247
187
|
|
|
@@ -255,11 +195,6 @@ public final class ResultsAdapter implements DataAdapter<Object, WritableMap>, C
|
|
|
255
195
|
map.put(errorTypeJSValue, errorTypeJSValue);
|
|
256
196
|
}
|
|
257
197
|
|
|
258
|
-
private void putVerificationErrorTypeConstant(Map<String, String> map, VerificationErrorType errorType) {
|
|
259
|
-
String errorTypeJSValue = verificationErrorTypeJSValue(errorType);
|
|
260
|
-
map.put(errorTypeJSValue, errorTypeJSValue);
|
|
261
|
-
}
|
|
262
|
-
|
|
263
198
|
private WritableMap getMapFor(JSONObject json) {
|
|
264
199
|
Iterator<String> jsonKeyIterator = json.keys();
|
|
265
200
|
WritableMap map = writableMapFactory.create();
|
|
@@ -2,8 +2,6 @@ package com.fidelreactlibrary.events;
|
|
|
2
2
|
|
|
3
3
|
public enum BridgeLibraryEvent {
|
|
4
4
|
RESULT_AVAILABLE("ResultAvailable"),
|
|
5
|
-
CARD_VERIFICATION_STARTED("CardVerificationStarted"),
|
|
6
|
-
CARD_VERIFICATION_CHOICE("CardVerificationChoiceSelected");
|
|
7
5
|
|
|
8
6
|
private final String eventName;
|
|
9
7
|
|
|
@@ -7,7 +7,6 @@ import com.facebook.react.bridge.WritableMap;
|
|
|
7
7
|
import com.fidelapi.entities.EnrollmentResult;
|
|
8
8
|
import com.fidelapi.entities.FidelError;
|
|
9
9
|
import com.fidelapi.entities.FidelResult;
|
|
10
|
-
import com.fidelapi.entities.VerificationResult;
|
|
11
10
|
import com.fidelapi.entities.abstraction.OnResultObserver;
|
|
12
11
|
import com.fidelreactlibrary.adapters.abstraction.ConstantsProvider;
|
|
13
12
|
import com.fidelreactlibrary.adapters.abstraction.DataAdapter;
|
|
@@ -25,7 +24,6 @@ public final class ResultsObserver implements OnResultObserver, ConstantsProvide
|
|
|
25
24
|
|
|
26
25
|
private final String ENROLLMENT_RESULT_TYPE = "EnrollmentResult";
|
|
27
26
|
private final String ERROR_RESULT_TYPE = "Error";
|
|
28
|
-
private final String VERIFICATION_RESULT_TYPE = "VerificationResult";
|
|
29
27
|
|
|
30
28
|
public ResultsObserver(DataAdapter<Object, WritableMap> resultAdapter,
|
|
31
29
|
DataProcessor<ReadableMap> resultHandler,
|
|
@@ -44,11 +42,6 @@ public final class ResultsObserver implements OnResultObserver, ConstantsProvide
|
|
|
44
42
|
WritableMap adaptedObject = resultAdapter.getAdaptedObjectFor(enrollmentResult);
|
|
45
43
|
resultMap.putString(RESULT_TYPE_KEY, ENROLLMENT_RESULT_TYPE);
|
|
46
44
|
resultMap.putMap("enrollmentResult", adaptedObject);
|
|
47
|
-
} else if (fidelResult instanceof FidelResult.Verification) {
|
|
48
|
-
VerificationResult verificationResult = ((FidelResult.Verification) fidelResult).getVerificationResult();
|
|
49
|
-
WritableMap adaptedObject = resultAdapter.getAdaptedObjectFor(verificationResult);
|
|
50
|
-
resultMap.putString(RESULT_TYPE_KEY, VERIFICATION_RESULT_TYPE);
|
|
51
|
-
resultMap.putMap("verificationResult", adaptedObject);
|
|
52
45
|
} else {
|
|
53
46
|
resultMap.putString(RESULT_TYPE_KEY, ERROR_RESULT_TYPE);
|
|
54
47
|
FidelError error = ((FidelResult.Error) fidelResult).getError();
|
|
@@ -65,7 +58,6 @@ public final class ResultsObserver implements OnResultObserver, ConstantsProvide
|
|
|
65
58
|
final Map<String, String> resultTypesMap = new HashMap<>();
|
|
66
59
|
resultTypesMap.put(ENROLLMENT_RESULT_TYPE, ENROLLMENT_RESULT_TYPE);
|
|
67
60
|
resultTypesMap.put(ERROR_RESULT_TYPE, ERROR_RESULT_TYPE);
|
|
68
|
-
resultTypesMap.put(VERIFICATION_RESULT_TYPE, VERIFICATION_RESULT_TYPE);
|
|
69
61
|
constants.put("ResultType", resultTypesMap);
|
|
70
62
|
return constants;
|
|
71
63
|
}
|
|
@@ -4,15 +4,12 @@ import android.content.Context;
|
|
|
4
4
|
|
|
5
5
|
import com.facebook.react.bridge.ReadableMap;
|
|
6
6
|
import com.fidelapi.Fidel;
|
|
7
|
-
import com.fidelapi.entities.abstraction.OnCardVerificationChoiceSelectedObserver;
|
|
8
|
-
import com.fidelapi.entities.abstraction.OnCardVerificationStartedObserver;
|
|
9
7
|
import com.fidelapi.entities.abstraction.OnResultObserver;
|
|
10
8
|
import com.fidelreactlibrary.adapters.abstraction.ConstantsProvider;
|
|
11
9
|
import com.fidelreactlibrary.fakes.ConstantsProviderStub;
|
|
12
10
|
import com.fidelreactlibrary.fakes.DataProcessorSpy;
|
|
13
11
|
import com.fidelreactlibrary.fakes.ReactContextMock;
|
|
14
12
|
import com.fidelreactlibrary.fakes.ReadableMapStub;
|
|
15
|
-
import com.fidelreactlibrary.fakes.VerificationConfigurationAdapterStub;
|
|
16
13
|
|
|
17
14
|
import org.junit.After;
|
|
18
15
|
import org.junit.Before;
|
|
@@ -35,9 +32,6 @@ public class FidelModuleTests {
|
|
|
35
32
|
private DataProcessorSpy<ReadableMap> setupAdapterSpy = new DataProcessorSpy<>();;
|
|
36
33
|
private List<ConstantsProvider> constantsProviderListStub = new ArrayList<>();
|
|
37
34
|
private final OnResultObserver testOnResultObserver = fidelResult -> {};
|
|
38
|
-
private final OnCardVerificationStartedObserver testOnCardVerificationStartedObserver = consentDetails -> {};
|
|
39
|
-
|
|
40
|
-
private final OnCardVerificationChoiceSelectedObserver testOnCardVerificationChoiceSelectedObserver = cardVerificationChoice -> {};
|
|
41
35
|
|
|
42
36
|
@Before
|
|
43
37
|
public final void setUp() {
|
|
@@ -46,10 +40,7 @@ public class FidelModuleTests {
|
|
|
46
40
|
sut = new FidelModule(reactContext,
|
|
47
41
|
setupAdapterSpy,
|
|
48
42
|
testOnResultObserver,
|
|
49
|
-
testOnCardVerificationStartedObserver,
|
|
50
|
-
testOnCardVerificationChoiceSelectedObserver,
|
|
51
43
|
constantsProviderListStub,
|
|
52
|
-
new VerificationConfigurationAdapterStub()
|
|
53
44
|
);
|
|
54
45
|
}
|
|
55
46
|
|
|
@@ -83,18 +74,6 @@ public class FidelModuleTests {
|
|
|
83
74
|
assertEquals(testOnResultObserver, Fidel.onResult);
|
|
84
75
|
}
|
|
85
76
|
|
|
86
|
-
@Test
|
|
87
|
-
public void test_WhenACardVerificationStartedListenerHasBeenAdded_AddTheObserverToFidel() {
|
|
88
|
-
sut.addListener("CardVerificationStarted");
|
|
89
|
-
assertEquals(testOnCardVerificationStartedObserver, Fidel.onCardVerificationStarted);
|
|
90
|
-
}
|
|
91
|
-
|
|
92
|
-
@Test
|
|
93
|
-
public void test_WhenACardVerificationChoiceSelectedListenerHasBeenAdded_AddTheObserverToFidel() {
|
|
94
|
-
sut.addListener("CardVerificationChoiceSelected");
|
|
95
|
-
assertEquals(testOnCardVerificationChoiceSelectedObserver, Fidel.onCardVerificationChoiceSelected);
|
|
96
|
-
}
|
|
97
|
-
|
|
98
77
|
@Test
|
|
99
78
|
public void test_WhenListenersHaveBeenRemoved_AddTheOnResultObserverToFidel() {
|
|
100
79
|
Fidel.onResult = testOnResultObserver;
|
package/android/src/test/java/com/fidelreactlibrary/adapters/FidelProgramTypeAdapterTests.java
CHANGED
|
@@ -46,9 +46,4 @@ public class FidelProgramTypeAdapterTests {
|
|
|
46
46
|
public void test_WhenReceivingToParseProgramTypeWithTransactionSelectValue_ShouldReturnTransactionSelectProgramType() {
|
|
47
47
|
assertEquals(ProgramType.TRANSACTION_SELECT, sut.parseProgramType(ProgramType.TRANSACTION_SELECT.name()));
|
|
48
48
|
}
|
|
49
|
-
|
|
50
|
-
@Test
|
|
51
|
-
public void test_WhenReceivingToParseProgramTypeWithTransactionStreamValue_ShouldReturnTransactionStreamProgramType() {
|
|
52
|
-
assertEquals(ProgramType.TRANSACTION_STREAM, sut.parseProgramType(ProgramType.TRANSACTION_STREAM.name()));
|
|
53
|
-
}
|
|
54
49
|
}
|
|
@@ -69,7 +69,6 @@ public class FidelSetupAdapterTests {
|
|
|
69
69
|
Fidel.programName = null;
|
|
70
70
|
Fidel.deleteInstructions = null;
|
|
71
71
|
Fidel.programType = ProgramType.TRANSACTION_SELECT;
|
|
72
|
-
Fidel.thirdPartyVerificationChoice = false;
|
|
73
72
|
}
|
|
74
73
|
|
|
75
74
|
@Test
|
|
@@ -88,7 +87,6 @@ public class FidelSetupAdapterTests {
|
|
|
88
87
|
assertNull(Fidel.programName);
|
|
89
88
|
assertNull(Fidel.deleteInstructions);
|
|
90
89
|
assertEquals(ProgramType.TRANSACTION_SELECT, Fidel.programType);
|
|
91
|
-
assertFalse(Fidel.thirdPartyVerificationChoice);
|
|
92
90
|
}
|
|
93
91
|
|
|
94
92
|
@Test
|
|
@@ -785,80 +783,6 @@ public class FidelSetupAdapterTests {
|
|
|
785
783
|
assertEquals(expectedValue, Fidel.deleteInstructions);
|
|
786
784
|
}
|
|
787
785
|
|
|
788
|
-
@Test
|
|
789
|
-
public void test_IfDoesNotHaveProgramTypeKey_ShouldNotSetTheProgramTypeForFidel() {
|
|
790
|
-
ReadableMapStub map = ReadableMapStub.withoutKey(FidelSetupProperties.PROGRAM_TYPE);
|
|
791
|
-
|
|
792
|
-
Fidel.programType = ProgramType.TRANSACTION_STREAM;
|
|
793
|
-
programTypeAdapterStub.programTypeToReturn = ProgramType.TRANSACTION_SELECT;
|
|
794
|
-
sut.process(map);
|
|
795
|
-
|
|
796
|
-
assertTrue(map.keyNamesCheckedFor.contains(FidelSetupProperties.PROGRAM_TYPE.jsName()));
|
|
797
|
-
assertFalse(map.keyNamesAskedValueFor.contains(FidelSetupProperties.PROGRAM_TYPE.jsName()));
|
|
798
|
-
assertNull(programTypeAdapterStub.receivedProgramTypeString);
|
|
799
|
-
assertEquals(ProgramType.TRANSACTION_STREAM, Fidel.programType);
|
|
800
|
-
}
|
|
801
|
-
|
|
802
|
-
@Test
|
|
803
|
-
public void test_IfDoesHaveProgramTypeKey_ShouldSetTheValueProvidedByTheProgramTypeAdapter() {
|
|
804
|
-
ReadableMapStub map = ReadableMapStub.mapWithAllValidSetupKeys();
|
|
805
|
-
String testProgramTypeValue = "program type value";
|
|
806
|
-
map.stringForKeyToReturn.put(FidelSetupProperties.PROGRAM_TYPE.jsName(), testProgramTypeValue);
|
|
807
|
-
|
|
808
|
-
Fidel.programType = ProgramType.TRANSACTION_SELECT;
|
|
809
|
-
programTypeAdapterStub.programTypeToReturn = ProgramType.TRANSACTION_STREAM;
|
|
810
|
-
sut.process(map);
|
|
811
|
-
|
|
812
|
-
assertTrue(map.keyNamesAskedValueFor.contains(FidelSetupProperties.PROGRAM_TYPE.jsName()));
|
|
813
|
-
assertEquals(testProgramTypeValue, programTypeAdapterStub.receivedProgramTypeString);
|
|
814
|
-
assertEquals(ProgramType.TRANSACTION_STREAM, Fidel.programType);
|
|
815
|
-
}
|
|
816
|
-
|
|
817
|
-
@Test
|
|
818
|
-
public void test_WhenThirdPartyVerificationChoiceIsTrue_ShouldBeSetToTrueForTheSDK() {
|
|
819
|
-
ReadableMapStub map = ReadableMapStub.mapWithAllValidSetupKeys();
|
|
820
|
-
ReadableMapStub optionsMap = (ReadableMapStub) map.mapsForKeysToReturn
|
|
821
|
-
.get(FidelSetupProperties.OPTIONS.jsName());
|
|
822
|
-
assertNotNull(optionsMap);
|
|
823
|
-
optionsMap.boolToReturn = true;
|
|
824
|
-
|
|
825
|
-
sut.process(map);
|
|
826
|
-
|
|
827
|
-
assertTrue(Fidel.thirdPartyVerificationChoice);
|
|
828
|
-
}
|
|
829
|
-
|
|
830
|
-
@Test
|
|
831
|
-
public void test_ThirdPartyVerificationChoiceIsFalse_ShouldBeSetToFalseForTheSDK() {
|
|
832
|
-
ReadableMapStub map = ReadableMapStub.mapWithAllValidSetupKeys();
|
|
833
|
-
ReadableMapStub optionsMap = (ReadableMapStub) map.mapsForKeysToReturn
|
|
834
|
-
.get(FidelSetupProperties.OPTIONS.jsName());
|
|
835
|
-
assertNotNull(optionsMap);
|
|
836
|
-
optionsMap.boolToReturn = false;
|
|
837
|
-
|
|
838
|
-
sut.process(map);
|
|
839
|
-
|
|
840
|
-
assertFalse(Fidel.thirdPartyVerificationChoice);
|
|
841
|
-
}
|
|
842
|
-
|
|
843
|
-
@Test
|
|
844
|
-
public void test_IfDoesNotHaveThirdPartyVerificationChoiceKey_DoNotSetThisPropertyForFidel() {
|
|
845
|
-
ReadableMapStub map = ReadableMapStub
|
|
846
|
-
.withoutOptionsKey(FidelSetupProperties.Options.THIRD_PARTY_VERIFICATION_CHOICE);
|
|
847
|
-
ReadableMapStub optionsMap = (ReadableMapStub) map.mapsForKeysToReturn
|
|
848
|
-
.get(FidelSetupProperties.OPTIONS.jsName());
|
|
849
|
-
assertNotNull(optionsMap);
|
|
850
|
-
|
|
851
|
-
Fidel.thirdPartyVerificationChoice = true;
|
|
852
|
-
sut.process(map);
|
|
853
|
-
|
|
854
|
-
assertTrue(map.keyNamesAskedValueFor.contains(FidelSetupProperties.OPTIONS.jsName()));
|
|
855
|
-
assertTrue(optionsMap.keyNamesCheckedFor
|
|
856
|
-
.contains(FidelSetupProperties.Options.THIRD_PARTY_VERIFICATION_CHOICE.jsName()));
|
|
857
|
-
assertFalse(optionsMap.keyNamesAskedValueFor
|
|
858
|
-
.contains(FidelSetupProperties.Options.THIRD_PARTY_VERIFICATION_CHOICE.jsName()));
|
|
859
|
-
assertTrue(Fidel.thirdPartyVerificationChoice);
|
|
860
|
-
}
|
|
861
|
-
|
|
862
786
|
// Exposed constants tests
|
|
863
787
|
|
|
864
788
|
@Test
|
package/android/src/test/java/com/fidelreactlibrary/events/BridgeLibraryEventEmitterTests.java
CHANGED
|
@@ -53,15 +53,4 @@ public class BridgeLibraryEventEmitterTests {
|
|
|
53
53
|
assertEquals(reactContext.receivedErrorData, map);
|
|
54
54
|
assertEquals(reactContext.eventEmitterInvokedMethodName, "emit");
|
|
55
55
|
}
|
|
56
|
-
|
|
57
|
-
@Test
|
|
58
|
-
public void test_WhenReceivingWritableData_SendCorrectCardVerificationStartedEventUsingTheObtainedJSModule() {
|
|
59
|
-
sut = new BridgeLibraryEventEmitter(reactContext, BridgeLibraryEvent.CARD_VERIFICATION_STARTED);
|
|
60
|
-
WritableMap map = new JavaOnlyMap();
|
|
61
|
-
map.putString("testKey", "testValue");
|
|
62
|
-
sut.process(map);
|
|
63
|
-
assertEquals(reactContext.receivedErrorName, BridgeLibraryEvent.CARD_VERIFICATION_STARTED.getEventName());
|
|
64
|
-
assertEquals(reactContext.receivedErrorData, map);
|
|
65
|
-
assertEquals(reactContext.eventEmitterInvokedMethodName, "emit");
|
|
66
|
-
}
|
|
67
56
|
}
|
|
@@ -9,9 +9,4 @@ public class BridgeLibraryEventTests {
|
|
|
9
9
|
public void test_ResultAvailableEventType_ShouldHaveCorrectEventName() {
|
|
10
10
|
assertEquals("ResultAvailable", BridgeLibraryEvent.RESULT_AVAILABLE.getEventName());
|
|
11
11
|
}
|
|
12
|
-
|
|
13
|
-
@Test
|
|
14
|
-
public void test_CardVerificationStartedEventType_ShouldHaveCorrectEventName() {
|
|
15
|
-
assertEquals("CardVerificationStarted", BridgeLibraryEvent.CARD_VERIFICATION_STARTED.getEventName());
|
|
16
|
-
}
|
|
17
12
|
}
|
|
@@ -9,7 +9,6 @@ import com.facebook.react.bridge.ReadableArray;
|
|
|
9
9
|
import com.facebook.react.bridge.ReadableMap;
|
|
10
10
|
import com.facebook.react.bridge.ReadableMapKeySetIterator;
|
|
11
11
|
import com.facebook.react.bridge.ReadableType;
|
|
12
|
-
import com.fidelreactlibrary.adapters.CardVerificationConfigurationProperties;
|
|
13
12
|
import com.fidelreactlibrary.adapters.FidelSetupProperties;
|
|
14
13
|
|
|
15
14
|
import java.util.ArrayList;
|
|
@@ -160,28 +159,6 @@ public class ReadableMapStub implements ReadableMap {
|
|
|
160
159
|
return mapStub;
|
|
161
160
|
}
|
|
162
161
|
|
|
163
|
-
public static ReadableMapStub cardConfigWithAllValidConfigKeys() {
|
|
164
|
-
ReadableMapStub mapStub = new ReadableMapStub();
|
|
165
|
-
String[] keyJsNames = Arrays.stream(CardVerificationConfigurationProperties.values())
|
|
166
|
-
.map(CardVerificationConfigurationProperties::jsName).toArray(String[]::new);
|
|
167
|
-
mapStub.hasKeyStrings.addAll(Arrays.asList(keyJsNames));
|
|
168
|
-
mapStub.stringForKeyToReturn.put(CardVerificationConfigurationProperties.ID.jsName(), "123");
|
|
169
|
-
mapStub.stringForKeyToReturn.put(CardVerificationConfigurationProperties.CONSENT_ID.jsName(), "456");
|
|
170
|
-
mapStub.stringForKeyToReturn.put(CardVerificationConfigurationProperties.LAST_4_DIGITS.jsName(), "4567");
|
|
171
|
-
return mapStub;
|
|
172
|
-
}
|
|
173
|
-
|
|
174
|
-
public static ReadableMapStub cardConfigWithAllInValidConfigKeys() {
|
|
175
|
-
ReadableMapStub mapStub = new ReadableMapStub();
|
|
176
|
-
String[] keyJsNames = Arrays.stream(CardVerificationConfigurationProperties.values())
|
|
177
|
-
.map(CardVerificationConfigurationProperties::jsName).toArray(String[]::new);
|
|
178
|
-
mapStub.hasKeyStrings.addAll(Arrays.asList(keyJsNames));
|
|
179
|
-
mapStub.stringForKeyToReturn.put(CardVerificationConfigurationProperties.ID.jsName(), null);
|
|
180
|
-
mapStub.stringForKeyToReturn.put(CardVerificationConfigurationProperties.CONSENT_ID.jsName(), null);
|
|
181
|
-
mapStub.stringForKeyToReturn.put(CardVerificationConfigurationProperties.LAST_4_DIGITS.jsName(), null);
|
|
182
|
-
return mapStub;
|
|
183
|
-
}
|
|
184
|
-
|
|
185
162
|
public void putString(String key, String value) {
|
|
186
163
|
stringForKeyToReturn.put(key, value);
|
|
187
164
|
}
|
package/index.js
CHANGED
|
@@ -10,47 +10,11 @@ export default class Fidel {
|
|
|
10
10
|
static ProgramType = NativeFidelBridge.ProgramType;
|
|
11
11
|
static ErrorType = NativeFidelBridge.ErrorType;
|
|
12
12
|
static EnrollmentErrorType = NativeFidelBridge.EnrollmentErrorType;
|
|
13
|
-
static VerificationErrorType = NativeFidelBridge.VerificationErrorType;
|
|
14
|
-
static CardVerificationChoice = NativeFidelBridge.CardVerificationChoice;
|
|
15
13
|
|
|
16
14
|
static setup(params, callback) {
|
|
17
15
|
if (this.eventSubscription != null) {
|
|
18
16
|
this.eventSubscription.remove();
|
|
19
17
|
}
|
|
20
|
-
const { onCardVerificationStarted } = params;
|
|
21
|
-
if (
|
|
22
|
-
onCardVerificationStarted != null &&
|
|
23
|
-
onCardVerificationStarted != undefined &&
|
|
24
|
-
typeof onCardVerificationStarted === "function"
|
|
25
|
-
) {
|
|
26
|
-
if (this.onCardVerificationStartedEventSubscription != null) {
|
|
27
|
-
this.onCardVerificationStartedEventSubscription.remove();
|
|
28
|
-
}
|
|
29
|
-
this.onCardVerificationStartedEventSubscription =
|
|
30
|
-
Fidel.emitter.addListener(
|
|
31
|
-
"CardVerificationStarted",
|
|
32
|
-
(consentDetails) => {
|
|
33
|
-
onCardVerificationStarted(consentDetails);
|
|
34
|
-
}
|
|
35
|
-
);
|
|
36
|
-
}
|
|
37
|
-
const { onCardVerificationChoiceSelected } = params;
|
|
38
|
-
if (
|
|
39
|
-
onCardVerificationChoiceSelected != null &&
|
|
40
|
-
onCardVerificationChoiceSelected != undefined &&
|
|
41
|
-
typeof onCardVerificationChoiceSelected === "function"
|
|
42
|
-
) {
|
|
43
|
-
if (this.onCardVerificationChoiceSelectedEventSubscription != null) {
|
|
44
|
-
this.onCardVerificationChoiceSelectedEventSubscription.remove();
|
|
45
|
-
}
|
|
46
|
-
this.onCardVerificationChoiceSelectedEventSubscription =
|
|
47
|
-
Fidel.emitter.addListener(
|
|
48
|
-
"CardVerificationChoiceSelected",
|
|
49
|
-
(verificationChoice) => {
|
|
50
|
-
onCardVerificationChoiceSelected(verificationChoice);
|
|
51
|
-
}
|
|
52
|
-
);
|
|
53
|
-
}
|
|
54
18
|
if (
|
|
55
19
|
callback != null &&
|
|
56
20
|
callback != undefined &&
|
|
@@ -69,11 +33,6 @@ export default class Fidel {
|
|
|
69
33
|
NativeFidelBridge.start();
|
|
70
34
|
}
|
|
71
35
|
|
|
72
|
-
static verifyCard(params) {
|
|
73
|
-
Fidel.identifyMetricsDataSource()
|
|
74
|
-
NativeFidelBridge.verifyCard(params);
|
|
75
|
-
}
|
|
76
|
-
|
|
77
36
|
static identifyMetricsDataSource() {
|
|
78
37
|
NativeFidelBridge.identifyMetricsDataSource("rn", version);
|
|
79
38
|
}
|
|
@@ -81,5 +40,3 @@ export default class Fidel {
|
|
|
81
40
|
|
|
82
41
|
export const ENROLLMENT_RESULT = NativeFidelBridge.ResultType.EnrollmentResult;
|
|
83
42
|
export const ERROR = NativeFidelBridge.ResultType.Error;
|
|
84
|
-
export const VERIFICATION_RESULT =
|
|
85
|
-
NativeFidelBridge.ResultType.VerificationResult;
|