Skip to content

Commit

Permalink
Merge pull request #291 from omise/develop
Browse files Browse the repository at this point in the history
[Dev -> Master] v5.2.0 (White-label installments)
  • Loading branch information
Andrei Solovev authored May 23, 2024
2 parents 6fc6dbe + bd25e82 commit c54d16b
Show file tree
Hide file tree
Showing 7 changed files with 62 additions and 61 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -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 []
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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
]
}

Expand Down
28 changes: 14 additions & 14 deletions OmiseSDK/Sources/OmiseAPI/SourceType/SourceType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
2 changes: 1 addition & 1 deletion OmiseSDK/Sources/OmiseSDK.swift
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -81,21 +81,22 @@ 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 {
case .success(let token):
delegate?.choosePaymentMethodDidComplete(with: source, token: token)
case .failure(let error):
self?.processError(error)
DispatchQueue.main.async {
completion()
}
}
}
}

DispatchQueue.main.async {
completion()
}

}
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand Down

0 comments on commit c54d16b

Please sign in to comment.