Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
…t-native into feat/ACC-3019-ACC-3020-ACC-3022/ACH-react-native-android-and-shared-code
  • Loading branch information
FlaviuExtPrimer committed Jun 13, 2024
2 parents 37fe91e + 080e106 commit ff731d4
Show file tree
Hide file tree
Showing 36 changed files with 1,740 additions and 158 deletions.
19 changes: 9 additions & 10 deletions Gemfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ GEM
base64
nkf
rexml
activesupport (7.1.2)
activesupport (7.1.3.3)
base64
bigdecimal
concurrent-ruby (~> 1.0, >= 1.0.2)
Expand Down Expand Up @@ -40,12 +40,12 @@ GEM
aws-eventstream (~> 1, >= 1.0.2)
babosa (1.0.4)
base64 (0.2.0)
bigdecimal (3.1.4)
bigdecimal (3.1.8)
claide (1.1.0)
cocoapods (1.14.3)
cocoapods (1.15.2)
addressable (~> 2.8)
claide (>= 1.0.2, < 2.0)
cocoapods-core (= 1.14.3)
cocoapods-core (= 1.15.2)
cocoapods-deintegrate (>= 1.0.3, < 2.0)
cocoapods-downloader (>= 2.1, < 3.0)
cocoapods-plugins (>= 1.0.0, < 2.0)
Expand All @@ -60,7 +60,7 @@ GEM
nap (~> 1.0)
ruby-macho (>= 2.3.0, < 3.0)
xcodeproj (>= 1.23.0, < 2.0)
cocoapods-core (1.14.3)
cocoapods-core (1.15.2)
activesupport (>= 5.0, < 8)
addressable (~> 2.8)
algoliasearch (~> 1.0)
Expand All @@ -83,15 +83,14 @@ GEM
colored2 (3.1.2)
commander (4.6.0)
highline (~> 2.0.0)
concurrent-ruby (1.2.2)
concurrent-ruby (1.2.3)
connection_pool (2.4.1)
declarative (0.0.20)
digest-crc (0.6.5)
rake (>= 12.0.0, < 14.0.0)
domain_name (0.6.20240107)
dotenv (2.8.1)
drb (2.2.0)
ruby2_keywords
drb (2.2.1)
emoji_regex (3.2.3)
escape (0.0.4)
ethon (0.16.0)
Expand Down Expand Up @@ -221,7 +220,7 @@ GEM
http-cookie (1.0.5)
domain_name (~> 0.5)
httpclient (2.8.3)
i18n (1.14.1)
i18n (1.14.5)
concurrent-ruby (~> 1.0)
jmespath (1.6.2)
json (2.7.2)
Expand All @@ -232,7 +231,7 @@ GEM
mime-types-data (3.2024.0507)
mini_magick (4.12.0)
mini_mime (1.1.5)
minitest (5.20.0)
minitest (5.23.1)
molinillo (0.8.0)
multi_json (1.15.0)
multipart-post (2.4.1)
Expand Down
2 changes: 1 addition & 1 deletion packages/example/ios/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ target 'example_0_70_6' do
if target.name == "primer-io-react-native" || target.name == "PrimerSDK"
target.build_configurations.each do |config|
config.build_settings['SWIFT_INCLUDE_PATHS'] = "$(inherited) ${PODS_CONFIGURATION_BUILD_DIR}/Primer3DS ${PODS_CONFIGURATION_BUILD_DIR}/PrimerKlarnaSDK ${PODS_CONFIGURATION_BUILD_DIR}/PrimerIPay88MYSDK"
config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -Xcc -fmodule-map-file="${PODS_CONFIGURATION_BUILD_DIR}/Primer3DS/Primer3DS.modulemap" -Xcc -fmodule-map-file="${PODS_CONFIGURATION_BUILD_DIR}/PrimerIPay88MYSDK/PrimerIPay88MYSDK.modulemap"'
config.build_settings['OTHER_SWIFT_FLAGS'] = '$(inherited) -Xcc -fmodule-map-file="${PODS_CONFIGURATION_BUILD_DIR}/Primer3DS/Primer3DS.modulemap" -Xcc -fmodule-map-file="${PODS_CONFIGURATION_BUILD_DIR}/PrimerIPay88MYSDK/PrimerIPay88MYSDK.modulemap"'

config.build_settings['OTHER_LDFLAGS'] = '$(inherited) -weak_library -l"Primer3DS" -l"PrimerKlarnaSDK" -l"PrimerIPay88MYSDK"'
end
Expand Down
8 changes: 4 additions & 4 deletions packages/example/ios/Podfile.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ PODS:
- ReactCommon/turbomodule/core (= 0.72.0)
- fmt (6.2.1)
- glog (0.3.5)
- primer-io-react-native (2.21.1):
- primer-io-react-native (2.22.0):
- PrimerSDK (= 2.26.0)
- React-Core
- Primer3DS (2.3.2)
Expand Down Expand Up @@ -418,7 +418,7 @@ DEPENDENCIES:
- primer-io-react-native (from `../../sdk`)
- Primer3DS
- PrimerIPay88MYSDK
- PrimerKlarnaSDK
- PrimerKlarnaSDK (= 1.1.0)
- PrimerSDK
- RCT-Folly (from `../node_modules/react-native/third-party-podspecs/RCT-Folly.podspec`)
- RCTRequired (from `../node_modules/react-native/Libraries/RCTRequired`)
Expand Down Expand Up @@ -566,7 +566,7 @@ SPEC CHECKSUMS:
FBReactNativeSpec: 6e7e74b1ed7f0a1a469a82a67521b33285f5fef3
fmt: ff9d55029c625d3757ed641535fd4a75fedc7ce9
glog: 04b94705f318337d7ead9e6d17c019bd9b1f6b1b
primer-io-react-native: 01b45d80b85c286c800133a94ffb86cbb45d231a
primer-io-react-native: d6e2800366bda4069ec31d6d7fcbeee45e9d3704
Primer3DS: 81e7969033230c7346a517cd609be956914738bb
PrimerIPay88MYSDK: 436ee0be7e2c97e4e81456ccddee20175e9e3c4d
PrimerKlarnaSDK: 83e9a1357a7247bf8fa2836fc945cf97644d601d
Expand Down Expand Up @@ -611,6 +611,6 @@ SPEC CHECKSUMS:
SocketRocket: fccef3f9c5cedea1353a9ef6ada904fde10d6608
Yoga: 1d6727ed193122f6adaf435c3de1a768326ff83b

PODFILE CHECKSUM: fd89a66fa0d850b0f330025172d1f42e4f16a3f5
PODFILE CHECKSUM: 270edb26d82f133812cb878b53aafd50106f3662

COCOAPODS: 1.15.2
224 changes: 155 additions & 69 deletions packages/example/ios/example_0_70_6.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<Scheme
LastUpgradeVersion = "1530"
version = "1.8">
version = "1.7">
<BuildAction
parallelizeBuildables = "YES"
buildImplicitDependencies = "YES"
Expand Down
6 changes: 3 additions & 3 deletions packages/example/ios/example_0_70_6/Project.swift
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,8 @@ let project = Project(
LaunchArgument(name: "-PrimerDebugEnabled", isEnabled: true),
LaunchArgument(name: "-PrimerAnalyticsDebugEnabled", isEnabled: true)
]
)
)
)
)
)
)
]
)
Original file line number Diff line number Diff line change
@@ -0,0 +1,91 @@
//
// RNTBanksCollectableDataTests.swift
// example_0_70_6Tests
//
// Created by Boris on 23.5.24..
//

import XCTest
@testable import primer_io_react_native
import PrimerSDK

class BanksCollectableDataRNTests: XCTestCase {

func testFilterRNInitialization() {
let filter = FilterRN(text: "filterText")
XCTAssertEqual(filter.validatableDataName, "bankListFilter")
XCTAssertEqual(filter.text, "filterText")
}

func testBankIdRNInitialization() {
let bankId = BankIdRN(id: "bankId123")
XCTAssertEqual(bankId.validatableDataName, "bankId")
XCTAssertEqual(bankId.id, "bankId123")
}

func testBanksCollectableDataToBankIdRN() {
let bankData = BanksCollectableData.bankId(bankId: "bankId123")

if case let .bankId(bankId) = bankData {
let bankIdRN = BankIdRN(id: bankId)
XCTAssertEqual(bankIdRN.validatableDataName, "bankId")
XCTAssertEqual(bankIdRN.id, "bankId123")
} else {
XCTFail("Conversion to BankIdRN failed")
}
}

func testBanksCollectableDataToFilterRN() {
let filterData = BanksCollectableData.bankFilterText(text: "filterText")

if case let .bankFilterText(text) = filterData {
let filterRN = FilterRN(text: text)
XCTAssertEqual(filterRN.validatableDataName, "bankListFilter")
XCTAssertEqual(filterRN.text, "filterText")
} else {
XCTFail("Conversion to FilterRN failed")
}
}

func testFilterRNEncoding() {
let filter = FilterRN(text: "filterText")
let encoder = JSONEncoder()
do {
let data = try encoder.encode(filter)
let jsonString = String(data: data, encoding: .utf8)
XCTAssertNotNil(jsonString)
} catch {
XCTFail("Encoding failed: \(error)")
}
}

func testBankIdRNEncoding() {
let bankId = BankIdRN(id: "bankId123")
let encoder = JSONEncoder()
do {
let data = try encoder.encode(bankId)
let jsonString = String(data: data, encoding: .utf8)
XCTAssertNotNil(jsonString)
} catch {
XCTFail("Encoding failed: \(error)")
}
}

func testBanksCollectableDataEncoding() {
let bankIdData = BanksCollectableData.bankId(bankId: "bankId123")
let filterData = BanksCollectableData.bankFilterText(text: "filterText")
let encoder = JSONEncoder()

do {
let bankIdDataEncoded = try encoder.encode(bankIdData)
let bankIdJsonString = String(data: bankIdDataEncoded, encoding: .utf8)
XCTAssertNotNil(bankIdJsonString)

let filterDataEncoded = try encoder.encode(filterData)
let filterJsonString = String(data: filterDataEncoded, encoding: .utf8)
XCTAssertNotNil(filterJsonString)
} catch {
XCTFail("Encoding failed: \(error)")
}
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,116 @@
//
// ImplementedRNCallbacksTests.swift
// example_0_70_6Tests
//
// Created by Boris on 20.5.24..
//

import XCTest
@testable import primer_io_react_native

class ImplementedRNCallbacksTests: XCTestCase {

func testDecodingWithAllFields() {
let jsonString = """
{
"onAvailablePaymentMethodsLoad": true,
"onTokenizationStart": true,
"onTokenizationSuccess": true,
"onCheckoutResume": true,
"onCheckoutPending": true,
"onCheckoutAdditionalInfo": true,
"onError": true,
"onCheckoutComplete": true,
"onBeforeClientSessionUpdate": true,
"onClientSessionUpdate": true,
"onBeforePaymentCreate": true,
"onPreparationStart": true,
"onPaymentMethodShow": true,
"onDismiss": true
}
"""
let jsonData = jsonString.data(using: .utf8)!
let decoder = JSONDecoder()

do {
let callbacks = try decoder.decode(ImplementedRNCallbacks.self, from: jsonData)

XCTAssertTrue(callbacks.isOnAvailablePaymentMethodsLoadImplemented)
XCTAssertTrue(callbacks.isOnTokenizationStartImplemented)
XCTAssertTrue(callbacks.isOnTokenizationSuccessImplemented)
XCTAssertTrue(callbacks.isOnCheckoutResumeImplemented)
XCTAssertTrue(callbacks.isOnCheckoutPendingImplemented)
XCTAssertTrue(callbacks.isOnCheckoutAdditionalInfoImplemented)
XCTAssertTrue(callbacks.isOnErrorImplemented)
XCTAssertTrue(callbacks.isOnCheckoutCompleteImplemented)
XCTAssertTrue(callbacks.isOnBeforeClientSessionUpdateImplemented)
XCTAssertTrue(callbacks.isOnClientSessionUpdateImplemented)
XCTAssertTrue(callbacks.isOnBeforePaymentCreateImplemented)
XCTAssertTrue(callbacks.isOnPreparationStartImplemented)
XCTAssertTrue(callbacks.isOnPaymentMethodShowImplemented)
XCTAssertTrue(callbacks.isOnDismissImplemented)
} catch {
XCTFail("Decoding failed: \(error)")
}
}

func testDecodingWithMissingFields() {
let jsonString = """
{
"onTokenizationSuccess": true,
"onCheckoutComplete": true,
"onBeforeClientSessionUpdate": true
}
"""
let jsonData = jsonString.data(using: .utf8)!
let decoder = JSONDecoder()

do {
let callbacks = try decoder.decode(ImplementedRNCallbacks.self, from: jsonData)

XCTAssertFalse(callbacks.isOnAvailablePaymentMethodsLoadImplemented)
XCTAssertFalse(callbacks.isOnTokenizationStartImplemented)
XCTAssertTrue(callbacks.isOnTokenizationSuccessImplemented)
XCTAssertFalse(callbacks.isOnCheckoutResumeImplemented)
XCTAssertFalse(callbacks.isOnCheckoutPendingImplemented)
XCTAssertFalse(callbacks.isOnCheckoutAdditionalInfoImplemented)
XCTAssertFalse(callbacks.isOnErrorImplemented)
XCTAssertTrue(callbacks.isOnCheckoutCompleteImplemented)
XCTAssertTrue(callbacks.isOnBeforeClientSessionUpdateImplemented)
XCTAssertFalse(callbacks.isOnClientSessionUpdateImplemented)
XCTAssertFalse(callbacks.isOnBeforePaymentCreateImplemented)
XCTAssertFalse(callbacks.isOnPreparationStartImplemented)
XCTAssertFalse(callbacks.isOnPaymentMethodShowImplemented)
XCTAssertFalse(callbacks.isOnDismissImplemented)
} catch {
XCTFail("Decoding failed: \(error)")
}
}

func testDecodingWithEmptyJSON() {
let jsonString = "{}"
let jsonData = jsonString.data(using: .utf8)!
let decoder = JSONDecoder()

do {
let callbacks = try decoder.decode(ImplementedRNCallbacks.self, from: jsonData)

XCTAssertFalse(callbacks.isOnAvailablePaymentMethodsLoadImplemented)
XCTAssertFalse(callbacks.isOnTokenizationStartImplemented)
XCTAssertFalse(callbacks.isOnTokenizationSuccessImplemented)
XCTAssertFalse(callbacks.isOnCheckoutResumeImplemented)
XCTAssertFalse(callbacks.isOnCheckoutPendingImplemented)
XCTAssertFalse(callbacks.isOnCheckoutAdditionalInfoImplemented)
XCTAssertFalse(callbacks.isOnErrorImplemented)
XCTAssertFalse(callbacks.isOnCheckoutCompleteImplemented)
XCTAssertFalse(callbacks.isOnBeforeClientSessionUpdateImplemented)
XCTAssertFalse(callbacks.isOnClientSessionUpdateImplemented)
XCTAssertFalse(callbacks.isOnBeforePaymentCreateImplemented)
XCTAssertFalse(callbacks.isOnPreparationStartImplemented)
XCTAssertFalse(callbacks.isOnPaymentMethodShowImplemented)
XCTAssertFalse(callbacks.isOnDismissImplemented)
} catch {
XCTFail("Decoding failed: \(error)")
}
}
}
Loading

0 comments on commit ff731d4

Please sign in to comment.