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/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 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() - } - } } } 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"