From df699205c840c9e6f4112855f31031f306b7fb72 Mon Sep 17 00:00:00 2001 From: Andrei Solovev Date: Mon, 20 May 2024 15:08:40 +0700 Subject: [PATCH 1/3] Whitelabel installments were added --- .../Source/Source.Payment.Installment.swift | 28 +++++++++---------- .../SourceType/SourceType+Installments.swift | 14 +++++----- .../OmiseAPI/SourceType/SourceType.swift | 28 +++++++++---------- .../ChoosePaymentCoordinator.swift | 26 ++++++++--------- .../SourceType+ViewPresentable.swift | 14 +++++----- 5 files changed, 55 insertions(+), 55 deletions(-) diff --git a/OmiseSDK/Sources/OmiseAPI/JSON Models/Source/Source.Payment.Installment.swift b/OmiseSDK/Sources/OmiseAPI/JSON Models/Source/Source.Payment.Installment.swift index cedd0175..ca341323 100644 --- a/OmiseSDK/Sources/OmiseAPI/JSON Models/Source/Source.Payment.Installment.swift +++ b/OmiseSDK/Sources/OmiseAPI/JSON Models/Source/Source.Payment.Installment.swift @@ -45,20 +45,20 @@ extension Source.Payment.Installment { return [ 3, 4, 6, 10, 12 ] case .installmentUOB: return [ 3, 4, 6, 10 ] -// case .installmentWhiteLabelBAY: -// return [ 3, 4, 6, 9, 10 ] -// case .installmentWhiteLabelFirstChoice: -// return [ 3, 4, 6, 9, 10, 12, 18, 24, 36 ] -// case .installmentWhiteLabelBBL: -// return [ 4, 6, 8, 10 ] -// case .installmentWhiteLabelKTC: -// return [ 3, 4, 5, 6, 7, 8, 9, 10 ] -// case .installmentWhiteLabelSCB: -// return [ 3, 4, 6, 9, 10 ] -// case .installmentWhiteLabelKBank: -// return [ 3, 6, 10 ] -// case .installmentWhiteLabelTTB: -// return [ 4, 6, 10 ] + case .installmentWhiteLabelBAY: + return [ 3, 4, 6, 9, 10 ] + case .installmentWhiteLabelFirstChoice: + return [ 3, 4, 6, 9, 10, 12, 18, 24, 36 ] + case .installmentWhiteLabelBBL: + return [ 4, 6, 8, 10 ] + case .installmentWhiteLabelKTC: + return [ 3, 4, 5, 6, 7, 8, 9, 10 ] + case .installmentWhiteLabelSCB: + return [ 3, 4, 6, 9, 10 ] + case .installmentWhiteLabelKBank: + return [ 3, 6, 10 ] + case .installmentWhiteLabelTTB: + return [ 4, 6, 10 ] default: return [] } diff --git a/OmiseSDK/Sources/OmiseAPI/SourceType/SourceType+Installments.swift b/OmiseSDK/Sources/OmiseAPI/SourceType/SourceType+Installments.swift index 84301096..4c1598ab 100644 --- a/OmiseSDK/Sources/OmiseAPI/SourceType/SourceType+Installments.swift +++ b/OmiseSDK/Sources/OmiseAPI/SourceType/SourceType+Installments.swift @@ -17,13 +17,13 @@ extension SourceType { public static var whiteLabelInstallments: [SourceType] { [ -// .installmentWhiteLabelKTC, -// .installmentWhiteLabelKBank, -// .installmentWhiteLabelSCB, -// .installmentWhiteLabelBBL, -// .installmentWhiteLabelBAY, -// .installmentWhiteLabelFirstChoice, -// .installmentWhiteLabelTTB + .installmentWhiteLabelKTC, + .installmentWhiteLabelKBank, + .installmentWhiteLabelSCB, + .installmentWhiteLabelBBL, + .installmentWhiteLabelBAY, + .installmentWhiteLabelFirstChoice, + .installmentWhiteLabelTTB ] } diff --git a/OmiseSDK/Sources/OmiseAPI/SourceType/SourceType.swift b/OmiseSDK/Sources/OmiseAPI/SourceType/SourceType.swift index 7b1b271d..3f043a5e 100644 --- a/OmiseSDK/Sources/OmiseAPI/SourceType/SourceType.swift +++ b/OmiseSDK/Sources/OmiseAPI/SourceType/SourceType.swift @@ -50,20 +50,20 @@ public enum SourceType: String, Codable, CaseIterable { case installmentTTB = "installment_ttb" /// United Overseas Bank (UOB) https://docs.opn.ooo/installment-payments case installmentUOB = "installment_uob" -// /// Krungthai Card (KTC) https://docs.opn.ooo/installment-white-label-payments -// case installmentWhiteLabelKTC = "installment_wlb_ktc" -// /// Kasikorn Bank https://docs.opn.ooo/installment-white-label-payments -// case installmentWhiteLabelKBank = "installment_wlb_kbank" -// /// Siam Commercial Bank https://docs.opn.ooo/installment-white-label-payments -// case installmentWhiteLabelSCB = "installment_wlb_scb" -// /// Bangkok Bank https://docs.opn.ooo/installment-white-label-payments -// case installmentWhiteLabelBBL = "installment_wlb_bbl" -// /// Krungsri https://docs.opn.ooo/installment-white-label-payments -// case installmentWhiteLabelBAY = "installment_wlb_bay" -// /// Krungsri First Choice https://docs.opn.ooo/installment-white-label-payments -// case installmentWhiteLabelFirstChoice = "installment_wlb_first_choice" -// /// TMBThanachart Bank https://docs.opn.ooo/installment-white-label-payments -// case installmentWhiteLabelTTB = "installment_wlb_ttb" + /// Krungthai Card (KTC) https://docs.opn.ooo/installment-white-label-payments + case installmentWhiteLabelKTC = "installment_wlb_ktc" + /// Kasikorn Bank https://docs.opn.ooo/installment-white-label-payments + case installmentWhiteLabelKBank = "installment_wlb_kbank" + /// Siam Commercial Bank https://docs.opn.ooo/installment-white-label-payments + case installmentWhiteLabelSCB = "installment_wlb_scb" + /// Bangkok Bank https://docs.opn.ooo/installment-white-label-payments + case installmentWhiteLabelBBL = "installment_wlb_bbl" + /// Krungsri https://docs.opn.ooo/installment-white-label-payments + case installmentWhiteLabelBAY = "installment_wlb_bay" + /// Krungsri First Choice https://docs.opn.ooo/installment-white-label-payments + case installmentWhiteLabelFirstChoice = "installment_wlb_first_choice" + /// TMBThanachart Bank https://docs.opn.ooo/installment-white-label-payments + case installmentWhiteLabelTTB = "installment_wlb_ttb" /// Bank of Ayudhya (Krungsri) https://docs.opn.ooo/internet-banking case internetBankingBAY = "internet_banking_bay" /// Bangkok Bank https://docs.opn.ooo/internet-banking diff --git a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/ChoosePaymentCoordinator.swift b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/ChoosePaymentCoordinator.swift index efeda087..28aaf377 100644 --- a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/ChoosePaymentCoordinator.swift +++ b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/ChoosePaymentCoordinator.swift @@ -107,20 +107,20 @@ class ChoosePaymentCoordinator: NSObject, ViewAttachable { func createInstallmentController() -> SelectPaymentController { var sourceTypes = client.latestLoadedCapability?.availableSourceTypes(SourceType.installments) ?? [] -// let filter: [SourceType: SourceType] = [ -// .installmentWhiteLabelKTC: .installmentKTC, -// .installmentWhiteLabelKBank: .installmentKBank, -// .installmentWhiteLabelSCB: .installmentSCB, -// .installmentWhiteLabelBBL: .installmentBBL, -// .installmentWhiteLabelBAY: .installmentBAY, -// .installmentWhiteLabelFirstChoice: .installmentFirstChoice, -// .installmentWhiteLabelTTB: .installmentTTB -// ] + let filter: [SourceType: SourceType] = [ + .installmentWhiteLabelKTC: .installmentKTC, + .installmentWhiteLabelKBank: .installmentKBank, + .installmentWhiteLabelSCB: .installmentSCB, + .installmentWhiteLabelBBL: .installmentBBL, + .installmentWhiteLabelBAY: .installmentBAY, + .installmentWhiteLabelFirstChoice: .installmentFirstChoice, + .installmentWhiteLabelTTB: .installmentTTB + ] -// for (keepingSourceType, removingSourceType) in filter -// where sourceTypes.contains(keepingSourceType) { -// sourceTypes.removeAll { $0 == removingSourceType } -// } + for (keepingSourceType, removingSourceType) in filter + where sourceTypes.contains(keepingSourceType) { + sourceTypes.removeAll { $0 == removingSourceType } + } let viewModel = SelectSourceTypePaymentViewModel( title: PaymentMethod.installment.localizedTitle, diff --git a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/ViewPresentable/SourceType+ViewPresentable.swift b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/ViewPresentable/SourceType+ViewPresentable.swift index f8397bae..a839ba24 100644 --- a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/ViewPresentable/SourceType+ViewPresentable.swift +++ b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/ViewPresentable/SourceType+ViewPresentable.swift @@ -46,21 +46,21 @@ extension SourceType: ViewPresentable { return "Grab" case .grabPayRms: return "Grab" - case .installmentBAY: // , .installmentWhiteLabelBAY: + case .installmentBAY, .installmentWhiteLabelBAY: return "BAY" - case .installmentBBL: // , .installmentWhiteLabelBBL: + case .installmentBBL, .installmentWhiteLabelBBL: return "BBL" - case .installmentFirstChoice: // , .installmentWhiteLabelFirstChoice: + case .installmentFirstChoice, .installmentWhiteLabelFirstChoice: return "First Choice" - case .installmentKBank: // , .installmentWhiteLabelKBank: + case .installmentKBank, .installmentWhiteLabelKBank: return "KBANK" - case .installmentKTC: // , .installmentWhiteLabelKTC: + case .installmentKTC, .installmentWhiteLabelKTC: return "KTC" case .installmentMBB: return "FPX/maybank" - case .installmentSCB: // , .installmentWhiteLabelSCB: + case .installmentSCB, .installmentWhiteLabelSCB: return "SCB" - case .installmentTTB: // , .installmentWhiteLabelTTB: + case .installmentTTB, .installmentWhiteLabelTTB: return "ttb" case .installmentUOB: return "uob" From e8253d3f3b36fd0071dc2b95f23a148ad34a10ca Mon Sep 17 00:00:00 2001 From: Andrei Solovev Date: Thu, 23 May 2024 13:06:25 +0700 Subject: [PATCH 2/3] Fix Whitelabel progess indicator --- .../ChoosePaymentCoordinator+Helpers.swift | 11 ++++++----- 1 file changed, 6 insertions(+), 5 deletions(-) diff --git a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/ChoosePaymentCoordinator+Helpers.swift b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/ChoosePaymentCoordinator+Helpers.swift index 2d26f257..86e136cc 100644 --- a/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/ChoosePaymentCoordinator+Helpers.swift +++ b/OmiseSDK/Sources/Views/Screens/Choose Payment Methods/ChoosePaymentCoordinator+Helpers.swift @@ -81,6 +81,9 @@ extension ChoosePaymentCoordinator { switch result { case .failure(let error): self.processError(error) + DispatchQueue.main.async { + completion() + } case .success(let source): self.client.createToken(payload: tokenPayload) { [weak self, weak delegate] result in switch result { @@ -88,14 +91,12 @@ extension ChoosePaymentCoordinator { delegate?.choosePaymentMethodDidComplete(with: source, token: token) case .failure(let error): self?.processError(error) + DispatchQueue.main.async { + completion() + } } } } - - DispatchQueue.main.async { - completion() - } - } } } From bd25e823947ea4f8daa9eeeba7e4885f6f7ed3ac Mon Sep 17 00:00:00 2001 From: Andrei Solovev Date: Thu, 23 May 2024 13:09:11 +0700 Subject: [PATCH 3/3] Change OmiseSDK internal version number --- OmiseSDK/Sources/OmiseSDK.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/OmiseSDK/Sources/OmiseSDK.swift b/OmiseSDK/Sources/OmiseSDK.swift index 493e064b..172db936 100644 --- a/OmiseSDK/Sources/OmiseSDK.swift +++ b/OmiseSDK/Sources/OmiseSDK.swift @@ -6,7 +6,7 @@ public class OmiseSDK { public static var shared = OmiseSDK(publicKey: "pkey_") /// OmiseSDK version - public let version: String = "5.0.0" + public let version: String = "5.2.0" /// Public Key associated with this instance of OmiseSDK public let publicKey: String