Skip to content

Commit

Permalink
feat: Klarna Headless (#789)
Browse files Browse the repository at this point in the history
* chore: check bstack modification on appium tests

* chore: revert ui-tests file change

* chore: clean and nits

* chore: Klarna Headless classes + refactor only

* chore: update event

* chore: added merchant vc logic

* chore: enabled validate functionality to be called

* chore: added unit tests to conform with new refactorization

* chore: Hide the components logic and expose only KlarnaHeadlessManager to the merchant

* chore: update logic to use validate method

* chore: Refactored merchant vc

* chore: updated some more unit tests

* chore: refactor Klarna request and response bodies

* chore: added values for CreatePaymentSession needed for one-time payment session

* chore: hide unnecessary UI and logic for checkout intent

* chore: update payment intent from MerchantHeadlessCheckoutAvailablePaymentMethodsViewController

* chore: some more refactoring and alignment with android objects

* chore: added MerchantHelpers with MerchantMockDataManager

* chore: added client-session/actions request and refactor KlarnaTokenizationComponent

* chore: KlarnaHelpers refactor

* chore: Added Finalization logic for KlarnaTokenizationComponent

* chore: update unit tests

* chore: Finalization request and payment instruments logic

* chore: fixed failing unit tests

* chore: added KlarnaTokenizationComponentTests

* chore: added KlarnaHeadlessManager unit tests

* chore: moved KlarnaTestsMocks

* chore: updated unit tests and added KlarnaTokenizationManagerTests

* chore: update failing test

* chore: refactor async methods to use Promise kit

* chore: updated unit tests for Promise

* chore: update unit test

* chore: added switch button to be able to switch between generic and klarna session

* chore: resolve conflicts

* chore: added description comments to the KlarnaHeadlessManager methods

* chore: fixed unit test

* chore: removed the tokenization logic from PaymentMethod and PrimerConfiguration

* chore: changed clientSession setup logic for MerchantSessionAndSettingsViewController

* chore: updated one time payment option UI

* chore: update failing test tests and pods

* chore: fixed merge errors

* chore: remove shared intent public exposure and implement it in klarna manager

* chore: update KlarnaHeadlessManager re-order the properties

* chore: updated unit test

* chore: refactor KlarnaPaymentSessionCreationComponent to remove unused logic

* chore: refactor Create Payment Session

* chore: refactored authorization and creation components

* chore: refactor KlarnaPaymentViewHandlingComponent and FinalizationComponent

* chore: nits

* chore: added nits and comments to Authorization and Creation components

* chore: added /payments call after tokenize for checkoutData

* chore: update KlarnaAuthorizationTokenPaymentInstrument

* chore: added loader for merchant page

* chore: refactor to align with Android

* chore: updated unit tests

* chore: Alignment feedback on merchant page side

* chore: update merchant vc

* chore: update alignment with android feedback

* chore: update Android alignment

* chore: finalize alignment with android

* chore: refactored klarna manager

* chore: change naming protocols and internal logic for KlarnaComponent

* chore: update analytics vars and unit tests

* chore: update regarding public api's

* chore: android documentation alignment

* chore: update unit tests

* chore: update comments nits

* chore: fix swift lint warnings

* chore: fix lint issues

* chore: update with identifiers for E2E tests

* chore: update authorize method for E2E tests

* chore: update SPM

* chore: alignment with android

Validation, Error and Event tracking alignment

* chore: fix lint issues and fix unit tests

* chore: update swift lint errors

* chore: more lint issues fixed

* feat: Klarna Headless Extra Merchant Data (#809)

* chore: adding emd serializing and deserializing logic

* chore: removed attachment logic from createSession

* chore: update Klarna payment method options

* chore: update session EMD hardcoded value

* chore: rebase

* chore: refactor PaymentMethodOptions decoder keeping polymorphism

* chore: added unit test for emd

* chore: fix lint issues

* chore: PR review updates

* chore: fix more lint issues

* chore: fix for pod lint

* chore: fix conflicts
  • Loading branch information
StefanV-PRIMERIO authored Mar 6, 2024
1 parent e5ed613 commit 63a5f19
Show file tree
Hide file tree
Showing 66 changed files with 4,409 additions and 3,940 deletions.
2 changes: 1 addition & 1 deletion Debug App/Podfile
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@ target 'Debug App' do

# Pods for Debug App
pod 'PrimerSDK', :path => '../'
pod 'Primer3DS', '~> 2.2.0'
pod 'Primer3DS', "2.2.0"
pod 'PrimerKlarnaSDK'
pod 'PrimerIPay88MYSDK'
pod 'PrimerNolPaySDK'
Expand Down
8 changes: 4 additions & 4 deletions Debug App/Podfile.lock
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
PODS:
- IQKeyboardManagerSwift (6.5.16)
- IQKeyboardManagerSwift (7.0.1)
- Primer3DS (2.2.0)
- PrimerIPay88MYSDK (0.1.7)
- PrimerKlarnaSDK (1.1.0)
Expand All @@ -10,7 +10,7 @@ PODS:

DEPENDENCIES:
- IQKeyboardManagerSwift
- Primer3DS (~> 2.2.0)
- Primer3DS (= 2.2.0)
- PrimerIPay88MYSDK
- PrimerKlarnaSDK
- PrimerNolPaySDK
Expand All @@ -29,13 +29,13 @@ EXTERNAL SOURCES:
:path: "../"

SPEC CHECKSUMS:
IQKeyboardManagerSwift: 12d89768845bb77b55cc092ecc2b1f9370f06b76
IQKeyboardManagerSwift: 7f6b1b1d1497855d2beea7f2f10ffcc6978525b1
Primer3DS: affa70b17e4b7f8f3bd6110fa88dce24cb5ac4c0
PrimerIPay88MYSDK: 436ee0be7e2c97e4e81456ccddee20175e9e3c4d
PrimerKlarnaSDK: 83e9a1357a7247bf8fa2836fc945cf97644d601d
PrimerNolPaySDK: 08b140ed39b378a0b33b4f8746544a402175c0cc
PrimerSDK: d55edddd664eafe88f545733b5ce4c9af7a13f5e

PODFILE CHECKSUM: 2165f25bdca4c31e764947a29b616b0ebe1a5034
PODFILE CHECKSUM: 0338ba968079466f92e90a37e90d263807adbb7f

COCOAPODS: 1.15.2
41 changes: 41 additions & 0 deletions Debug App/Primer.io Debug App SPM.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,12 @@
/* Begin PBXBuildFile section */
0442C4072B7CE1E900EAD8EE /* TapGestureRecognizer.swift in Sources */ = {isa = PBXBuildFile; fileRef = 0442C4062B7CE1E900EAD8EE /* TapGestureRecognizer.swift */; };
049A055C2B4BF044002CEEBA /* MerchantHeadlessVaultManagerViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 049A055B2B4BF044002CEEBA /* MerchantHeadlessVaultManagerViewController.swift */; };
8723ADDD2B8E0F5100A5FE23 /* MerchantHelpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8723ADDC2B8E0F5100A5FE23 /* MerchantHelpers.swift */; };
8723ADE42B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8723ADDF2B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView.swift */; };
8723ADE52B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8723ADE02B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationViewModel.swift */; };
8723ADE62B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView+Elements.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8723ADE12B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView+Elements.swift */; };
8723ADE72B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController+Klarna.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8723ADE22B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController+Klarna.swift */; };
8723ADE82B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8723ADE32B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController.swift */; };
E11F475C2B06C5A40091C31F /* MerchantHeadlessCheckoutBankViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = E11F47582B06C5A40091C31F /* MerchantHeadlessCheckoutBankViewController.swift */; };
E11F475D2B06C5A40091C31F /* BanksListView.swift in Sources */ = {isa = PBXBuildFile; fileRef = E11F47592B06C5A40091C31F /* BanksListView.swift */; };
E11F475E2B06C5A40091C31F /* BanksListModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = E11F475A2B06C5A40091C31F /* BanksListModel.swift */; };
Expand Down Expand Up @@ -113,6 +119,12 @@
7A3E75CD834937EF85DE1C14 /* MockVaultCheckoutViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockVaultCheckoutViewModel.swift; sourceTree = "<group>"; };
7A5E6F7A9C12C69CB66032E3 /* IPay88Tests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IPay88Tests.swift; sourceTree = "<group>"; };
7EA7D2BB0AC0A1877DB2E6CE /* MockModule.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockModule.swift; sourceTree = "<group>"; };
8723ADDC2B8E0F5100A5FE23 /* MerchantHelpers.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MerchantHelpers.swift; sourceTree = "<group>"; };
8723ADDF2B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MerchantHeadlessKlarnaInitializationView.swift; sourceTree = "<group>"; };
8723ADE02B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationViewModel.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MerchantHeadlessKlarnaInitializationViewModel.swift; sourceTree = "<group>"; };
8723ADE12B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView+Elements.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MerchantHeadlessKlarnaInitializationView+Elements.swift"; sourceTree = "<group>"; };
8723ADE22B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController+Klarna.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "MerchantHeadlessCheckoutKlarnaViewController+Klarna.swift"; sourceTree = "<group>"; };
8723ADE32B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = MerchantHeadlessCheckoutKlarnaViewController.swift; sourceTree = "<group>"; };
872A0647D4136E27365FB7F8 /* StringTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StringTests.swift; sourceTree = "<group>"; };
8A23886804B13FA754E775D0 /* MockPaymentMethodTokenizationViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = MockPaymentMethodTokenizationViewModel.swift; sourceTree = "<group>"; };
8A3FDC6FE0EB5AB5828D4D80 /* el */ = {isa = PBXFileReference; lastKnownFileType = text.plist.strings; name = el; path = el.lproj/LaunchScreen.strings; sourceTree = "<group>"; };
Expand Down Expand Up @@ -212,6 +224,7 @@
0E5CB4D963647832FF985B29 /* View Controllers */ = {
isa = PBXGroup;
children = (
8723ADDB2B8E0F5100A5FE23 /* Merchant Helpers */,
EF5FBE3673FBCB40F55F4DC0 /* New UI */,
9874F439DA3EA5854A454687 /* MerchantDropInUIViewController.swift */,
72E691B9A6A8EBB9F6A6B266 /* MerchantHeadlessCheckoutAvailablePaymentMethodsViewController.swift */,
Expand Down Expand Up @@ -340,6 +353,27 @@
path = Network;
sourceTree = "<group>";
};
8723ADDB2B8E0F5100A5FE23 /* Merchant Helpers */ = {
isa = PBXGroup;
children = (
8723ADDC2B8E0F5100A5FE23 /* MerchantHelpers.swift */,
);
name = "Merchant Helpers";
path = "Sources/View Controllers/Merchant Helpers";
sourceTree = SOURCE_ROOT;
};
8723ADDE2B8E0FAB00A5FE23 /* KlarnaHeadless */ = {
isa = PBXGroup;
children = (
8723ADDF2B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView.swift */,
8723ADE02B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationViewModel.swift */,
8723ADE12B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView+Elements.swift */,
8723ADE22B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController+Klarna.swift */,
8723ADE32B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController.swift */,
);
path = KlarnaHeadless;
sourceTree = "<group>";
};
9EE81958BB2BB34183F6C0AB /* Modules */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -500,6 +534,7 @@
EF5FBE3673FBCB40F55F4DC0 /* New UI */ = {
isa = PBXGroup;
children = (
8723ADDE2B8E0FAB00A5FE23 /* KlarnaHeadless */,
E11F47572B06C5A40091C31F /* FormWithRedirect */,
0ED746F8924E70AD868BC0F4 /* MerchantNewLineItemViewController.swift */,
);
Expand Down Expand Up @@ -616,9 +651,11 @@
isa = PBXSourcesBuildPhase;
buildActionMask = 2147483647;
files = (
8723ADE42B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView.swift in Sources */,
F00C65F82ACC67FA00187028 /* AppDelegate.swift in Sources */,
F00C65F92ACC67FA00187028 /* Data+Extensions.swift in Sources */,
F00C65FA2ACC67FA00187028 /* Range+Extensions.swift in Sources */,
8723ADE72B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController+Klarna.swift in Sources */,
F00C65FB2ACC67FA00187028 /* String+Extensions.swift in Sources */,
049A055C2B4BF044002CEEBA /* MerchantHeadlessVaultManagerViewController.swift in Sources */,
F00C65FC2ACC67FA00187028 /* UIStackViewExtensions.swift in Sources */,
Expand All @@ -627,19 +664,23 @@
F00C65FF2ACC67FA00187028 /* ViewController+PrimerUIHelpers.swift in Sources */,
F00C66002ACC67FA00187028 /* CheckoutTheme.swift in Sources */,
F00C66012ACC67FA00187028 /* CreateClientToken.swift in Sources */,
8723ADDD2B8E0F5100A5FE23 /* MerchantHelpers.swift in Sources */,
F00C66022ACC67FA00187028 /* TestScenario.swift in Sources */,
F00C66032ACC67FA00187028 /* TransactionResponse.swift in Sources */,
E1AB44D02AFE139600639DC5 /* URL+NetworkHeaders.swift in Sources */,
E11F475D2B06C5A40091C31F /* BanksListView.swift in Sources */,
F00C66052ACC67FA00187028 /* Networking.swift in Sources */,
F00C66062ACC67FA00187028 /* MerchantDropInUIViewController.swift in Sources */,
0442C4072B7CE1E900EAD8EE /* TapGestureRecognizer.swift in Sources */,
8723ADE52B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationViewModel.swift in Sources */,
8723ADE82B8E0FAB00A5FE23 /* MerchantHeadlessCheckoutKlarnaViewController.swift in Sources */,
F00C66082ACC67FA00187028 /* MerchantHeadlessCheckoutAvailablePaymentMethodsViewController.swift in Sources */,
E11F475C2B06C5A40091C31F /* MerchantHeadlessCheckoutBankViewController.swift in Sources */,
E11F475E2B06C5A40091C31F /* BanksListModel.swift in Sources */,
F00C660A2ACC67FA00187028 /* MerchantHeadlessCheckoutRawDataViewController.swift in Sources */,
F00C660B2ACC67FA00187028 /* MerchantHeadlessCheckoutRawPhoneNumberDataViewController.swift in Sources */,
E11F475F2B06C5A40091C31F /* ImageViewWithUrl.swift in Sources */,
8723ADE62B8E0FAB00A5FE23 /* MerchantHeadlessKlarnaInitializationView+Elements.swift in Sources */,
F00C660C2ACC67FA00187028 /* MerchantHeadlessCheckoutRawRetailDataViewController.swift in Sources */,
F00C660D2ACC67FA00187028 /* MerchantResultViewController.swift in Sources */,
F00C660E2ACC67FA00187028 /* MerchantSessionAndSettingsViewController.swift in Sources */,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,17 +6,17 @@
"repositoryURL": "https://github.com/primer-io/primer-klarna-sdk-ios",
"state": {
"branch": null,
"revision": "f13260c24a900f28e21bafd213c22191e6280e86",
"version": "1.0.4"
"revision": "146d9ae8f7accc1ad7b64b2a455106d54914edef",
"version": "1.1.0"
}
},
{
"package": "Primer3DS",
"repositoryURL": "https://github.com/primer-io/primer-sdk-3ds-ios",
"state": {
"branch": null,
"revision": "56e39e0778b1abdb5d5abe20d96ea96e803b07a9",
"version": "2.0.0"
"revision": "9904050b5d7f9b9814a6a49bbd617945875bfc41",
"version": "2.2.1"
}
}
]
Expand Down
Loading

0 comments on commit 63a5f19

Please sign in to comment.