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
|
@@ -1,51 +0,0 @@
|
|
|
1
|
-
package com.fidelreactlibrary.adapters;
|
|
2
|
-
|
|
3
|
-
import com.fidelreactlibrary.fakes.ReadableMapStub;
|
|
4
|
-
import com.fidelapi.entities.CardVerificationConfiguration;
|
|
5
|
-
import static org.junit.Assert.*;
|
|
6
|
-
|
|
7
|
-
import org.junit.Test;
|
|
8
|
-
|
|
9
|
-
public class FidelVerificationConfigurationAdapterTest {
|
|
10
|
-
|
|
11
|
-
private FidelVerificationConfigurationAdapter sut = new FidelVerificationConfigurationAdapter();
|
|
12
|
-
|
|
13
|
-
@Test
|
|
14
|
-
public void test_ShouldMapEmptyMapCorrectly() {
|
|
15
|
-
CardVerificationConfiguration expectedConfig = new CardVerificationConfiguration("", "", null);
|
|
16
|
-
|
|
17
|
-
CardVerificationConfiguration cardVerificationConfig = sut.adapt(ReadableMapStub.mapWithNoKey());
|
|
18
|
-
|
|
19
|
-
assertEquals(expectedConfig, cardVerificationConfig);
|
|
20
|
-
}
|
|
21
|
-
|
|
22
|
-
@Test
|
|
23
|
-
public void test_ShouldMapNonEmptyValidMapCorrectly() {
|
|
24
|
-
CardVerificationConfiguration expectedConfig = new CardVerificationConfiguration("123", "456", "4567");
|
|
25
|
-
|
|
26
|
-
CardVerificationConfiguration cardVerificationConfig = sut.adapt(ReadableMapStub.cardConfigWithAllValidConfigKeys());
|
|
27
|
-
|
|
28
|
-
assertEquals(expectedConfig, cardVerificationConfig);
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
@Test
|
|
32
|
-
public void test_ShouldMapNullIdCorrectly() {
|
|
33
|
-
CardVerificationConfiguration cardVerificationConfig = sut.adapt(ReadableMapStub.cardConfigWithAllInValidConfigKeys());
|
|
34
|
-
|
|
35
|
-
assertEquals("", cardVerificationConfig.id);
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
@Test
|
|
39
|
-
public void test_ShouldMapNullConsentIdCorrectly() {
|
|
40
|
-
CardVerificationConfiguration cardVerificationConfig = sut.adapt(ReadableMapStub.cardConfigWithAllInValidConfigKeys());
|
|
41
|
-
|
|
42
|
-
assertEquals("", cardVerificationConfig.consentId);
|
|
43
|
-
}
|
|
44
|
-
|
|
45
|
-
@Test
|
|
46
|
-
public void test_ShouldMapNullLast4DigitsCorrectly() {
|
|
47
|
-
CardVerificationConfiguration cardVerificationConfig = sut.adapt(ReadableMapStub.cardConfigWithAllInValidConfigKeys());
|
|
48
|
-
|
|
49
|
-
assertNull(cardVerificationConfig.last4Digits);
|
|
50
|
-
}
|
|
51
|
-
}
|
package/android/src/test/java/com/fidelreactlibrary/events/CardVerificationStartedObserverTests.java
DELETED
|
@@ -1,49 +0,0 @@
|
|
|
1
|
-
package com.fidelreactlibrary.events;
|
|
2
|
-
|
|
3
|
-
import static org.junit.Assert.assertEquals;
|
|
4
|
-
|
|
5
|
-
import com.facebook.react.bridge.JavaOnlyMap;
|
|
6
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
7
|
-
import com.fidelapi.entities.ConsentDetails;
|
|
8
|
-
import com.fidelreactlibrary.fakes.DataProcessorSpy;
|
|
9
|
-
|
|
10
|
-
import org.junit.Before;
|
|
11
|
-
import org.junit.Test;
|
|
12
|
-
|
|
13
|
-
public class CardVerificationStartedObserverTests {
|
|
14
|
-
private DataProcessorSpy<ReadableMap> adaptedConsentDetailsProcessorSpy;
|
|
15
|
-
private CardVerificationStartedObserver observer;
|
|
16
|
-
|
|
17
|
-
@Before
|
|
18
|
-
public void setup() {
|
|
19
|
-
adaptedConsentDetailsProcessorSpy = new DataProcessorSpy<>();
|
|
20
|
-
observer = new CardVerificationStartedObserver(
|
|
21
|
-
adaptedConsentDetailsProcessorSpy,
|
|
22
|
-
JavaOnlyMap::new
|
|
23
|
-
);
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
@Test
|
|
27
|
-
public void test_WhenCardVerificationStarted_ShouldForwardMapWithCorrectCardID() {
|
|
28
|
-
String testCardId = "some card ID";
|
|
29
|
-
ConsentDetails consentDetailsStub = new ConsentDetails(testCardId, "", "");
|
|
30
|
-
observer.onCardVerificationStarted(consentDetailsStub);
|
|
31
|
-
assertEquals(testCardId, adaptedConsentDetailsProcessorSpy.dataToProcess.getString("cardId"));
|
|
32
|
-
}
|
|
33
|
-
|
|
34
|
-
@Test
|
|
35
|
-
public void test_WhenCardVerificationStarted_ShouldForwardMapWithCorrectConsentID() {
|
|
36
|
-
String testConsentId = "some consent ID";
|
|
37
|
-
ConsentDetails consentDetailsStub = new ConsentDetails("", testConsentId, "");
|
|
38
|
-
observer.onCardVerificationStarted(consentDetailsStub);
|
|
39
|
-
assertEquals(testConsentId, adaptedConsentDetailsProcessorSpy.dataToProcess.getString("consentId"));
|
|
40
|
-
}
|
|
41
|
-
|
|
42
|
-
@Test
|
|
43
|
-
public void test_WhenCardVerificationStarted_ShouldForwardMapWithCorrectProgramID() {
|
|
44
|
-
String testProgramId = "some program ID";
|
|
45
|
-
ConsentDetails consentDetailsStub = new ConsentDetails("", "", testProgramId);
|
|
46
|
-
observer.onCardVerificationStarted(consentDetailsStub);
|
|
47
|
-
assertEquals(testProgramId, adaptedConsentDetailsProcessorSpy.dataToProcess.getString("programId"));
|
|
48
|
-
}
|
|
49
|
-
}
|
package/android/src/test/java/com/fidelreactlibrary/fakes/VerificationConfigurationAdapterStub.java
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
package com.fidelreactlibrary.fakes;
|
|
2
|
-
|
|
3
|
-
import com.facebook.react.bridge.ReadableMap;
|
|
4
|
-
import com.fidelapi.entities.CardVerificationConfiguration;
|
|
5
|
-
import com.fidelreactlibrary.adapters.abstraction.VerificationConfigurationAdapter;
|
|
6
|
-
|
|
7
|
-
public class VerificationConfigurationAdapterStub implements VerificationConfigurationAdapter {
|
|
8
|
-
|
|
9
|
-
@Override
|
|
10
|
-
public CardVerificationConfiguration adapt(ReadableMap data) {
|
|
11
|
-
return new CardVerificationConfiguration("", "", null);
|
|
12
|
-
}
|
|
13
|
-
}
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// FidelVerificationConfigurationAdapter.swift
|
|
3
|
-
// fidel-react-native
|
|
4
|
-
//
|
|
5
|
-
// Created by Valeria Rogatchevskikh on 07/06/23.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import Foundation
|
|
9
|
-
import Fidel
|
|
10
|
-
|
|
11
|
-
class FidelVerificationConfigurationAdapter: NSObject {
|
|
12
|
-
|
|
13
|
-
func adapt(_ parameters: NSDictionary) -> CardVerificationConfiguration {
|
|
14
|
-
let id = parameters[CardVerificationConfigurationProperties.id.rawValue] as? String ?? ""
|
|
15
|
-
let consentID = parameters[CardVerificationConfigurationProperties.consentID.rawValue] as? String ?? ""
|
|
16
|
-
let last4Digits = parameters[CardVerificationConfigurationProperties.last4Digits.rawValue] as? String ?? nil
|
|
17
|
-
return CardVerificationConfiguration(cardID: id, consentID: consentID, last4Digits: last4Digits)
|
|
18
|
-
}
|
|
19
|
-
}
|
|
@@ -1,17 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// VerificationResultAdapter.swift
|
|
3
|
-
// fidel-react-native
|
|
4
|
-
//
|
|
5
|
-
// Created by Gabriel Godoi on 06/10/22.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import Foundation
|
|
9
|
-
import Fidel
|
|
10
|
-
|
|
11
|
-
extension VerificationResult{
|
|
12
|
-
var dictionary: [String: Any] {
|
|
13
|
-
return [
|
|
14
|
-
"cardId": cardID,
|
|
15
|
-
]
|
|
16
|
-
}
|
|
17
|
-
}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// CardVerificationChoiceConstants.swift
|
|
3
|
-
// fidel-react-native
|
|
4
|
-
//
|
|
5
|
-
// Created by Valeria Rogatchevskikh on 12/6/23.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import Foundation
|
|
9
|
-
import Fidel
|
|
10
|
-
|
|
11
|
-
extension CardVerificationChoice: ConstantsProvider {
|
|
12
|
-
|
|
13
|
-
var constantKey: String {
|
|
14
|
-
switch self {
|
|
15
|
-
case .onTheSpot: return "onTheSpot"
|
|
16
|
-
case .delegatedToThirdParty: return "delegatedToThirdParty"
|
|
17
|
-
@unknown default: return "unexpected"
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
public static var allCases: Set<CardVerificationChoice> = [CardVerificationChoice.onTheSpot, .delegatedToThirdParty]
|
|
22
|
-
static var parentKeyName: String = String(describing: Self.self)
|
|
23
|
-
|
|
24
|
-
}
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// VerificationErrorTypeConstants.swift
|
|
3
|
-
// fidel-react-native
|
|
4
|
-
//
|
|
5
|
-
// Created by Corneliu Chitanu on 08/12/21.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import Foundation
|
|
9
|
-
import Fidel
|
|
10
|
-
|
|
11
|
-
extension VerificationError: ConstantsProvider {
|
|
12
|
-
static var allCases: Set<VerificationError> = [VerificationError.maximumAttemptsReached, .cardAlreadyVerified, .cardNotFound, .verificationNotFound, .genericError, .incorrectAmount, .invalidSDKKey, .unauthorized, .unexpected]
|
|
13
|
-
static var parentKeyName: String = "VerificationErrorType"
|
|
14
|
-
|
|
15
|
-
var constantKey: String {
|
|
16
|
-
switch self {
|
|
17
|
-
case .maximumAttemptsReached: return "maximumAttemptsReached"
|
|
18
|
-
case .cardAlreadyVerified: return "cardAlreadyVerified"
|
|
19
|
-
case .invalidSDKKey: return "invalidSdkKey"
|
|
20
|
-
case .cardNotFound: return "cardNotFound"
|
|
21
|
-
case .verificationNotFound: return "verificationNotFound"
|
|
22
|
-
case .genericError: return "genericError"
|
|
23
|
-
case .incorrectAmount: return "incorrectAmount"
|
|
24
|
-
case .unauthorized: return "unauthorized"
|
|
25
|
-
case .unexpected: return "unexpected"
|
|
26
|
-
@unknown default: return "unexpected"
|
|
27
|
-
}
|
|
28
|
-
}
|
|
29
|
-
}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// CardVerificationChoiceSelectedObserver.swift
|
|
3
|
-
// fidel-react-native
|
|
4
|
-
//
|
|
5
|
-
// Created by Valeria Rogatchevskikh on 8/6/23.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import Foundation
|
|
9
|
-
import Fidel
|
|
10
|
-
|
|
11
|
-
struct CardVerificationChoiceSelectedObserver: EventObserver {
|
|
12
|
-
func startObserving(_ onEvent: @escaping (NSDictionary) -> Void) {
|
|
13
|
-
Fidel.onCardVerificationChoiceSelected = {
|
|
14
|
-
let dictionary: NSMutableDictionary = NSMutableDictionary()
|
|
15
|
-
dictionary["CardVerificationChoice"] = $0.constantKey
|
|
16
|
-
onEvent(dictionary)
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
|
|
20
|
-
func stopObserving() {
|
|
21
|
-
Fidel.onCardVerificationChoiceSelected = nil
|
|
22
|
-
}
|
|
23
|
-
}
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
//
|
|
2
|
-
// CardVerificationStartedObserver.swift
|
|
3
|
-
// fidel-react-native
|
|
4
|
-
//
|
|
5
|
-
// Created by Corneliu Chitanu on 07/06/23.
|
|
6
|
-
//
|
|
7
|
-
|
|
8
|
-
import Foundation
|
|
9
|
-
import Fidel
|
|
10
|
-
|
|
11
|
-
struct CardVerificationStartedObserver: EventObserver {
|
|
12
|
-
func startObserving(_ onEvent: @escaping (NSDictionary) -> Void) {
|
|
13
|
-
Fidel.onCardVerificationStarted = {
|
|
14
|
-
onEvent($0.dictionary as NSDictionary)
|
|
15
|
-
}
|
|
16
|
-
}
|
|
17
|
-
|
|
18
|
-
func stopObserving() {
|
|
19
|
-
Fidel.onCardVerificationStarted = nil
|
|
20
|
-
}
|
|
21
|
-
}
|