diff --git a/ExampleApp/Resources/Main.storyboard b/ExampleApp/Resources/Main.storyboard index ec185662..85c893d5 100644 --- a/ExampleApp/Resources/Main.storyboard +++ b/ExampleApp/Resources/Main.storyboard @@ -1,8 +1,8 @@ - + - + @@ -425,14 +425,14 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + - + - + - + - - + - + - - + @@ -493,7 +493,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + @@ -510,7 +510,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + @@ -527,7 +527,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + @@ -544,7 +544,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + @@ -561,7 +561,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + @@ -578,7 +578,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + @@ -595,7 +595,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + @@ -612,7 +612,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + @@ -629,7 +629,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + @@ -646,13 +646,13 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + @@ -1020,7 +1020,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + @@ -1037,7 +1037,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + @@ -1054,7 +1054,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + @@ -1070,6 +1070,23 @@ You can present via either Storyboard or Code and you can see the code in the Ex + + + + + + + + + + + @@ -1138,6 +1155,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex + @@ -1382,7 +1400,7 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + diff --git a/ExampleApp/Shared/PaymentSettingTableViewController.swift b/ExampleApp/Shared/PaymentSettingTableViewController.swift index afbcb162..3c75f59d 100644 --- a/ExampleApp/Shared/PaymentSettingTableViewController.swift +++ b/ExampleApp/Shared/PaymentSettingTableViewController.swift @@ -116,6 +116,7 @@ class PaymentSettingTableViewController: UITableViewController { @IBOutlet private var promptpayPaymentCell: UITableViewCell! @IBOutlet private var paynowPaymentCell: UITableViewCell! @IBOutlet private var truemoneyPaymentCell: UITableViewCell! + @IBOutlet private var truemoneyJumpAppPaymentCell: UITableViewCell! @IBOutlet private var pointsCitiCell: UITableViewCell! @IBOutlet private var fpxCell: UITableViewCell! @IBOutlet private var rabbitLinepayCell: UITableViewCell! @@ -329,6 +330,8 @@ extension PaymentSettingTableViewController { return .payNow case truemoneyPaymentCell: return .trueMoney + case truemoneyJumpAppPaymentCell: + return .trueMoneyJumpApp case pointsCitiCell: return .pointsCiti case fpxCell: @@ -425,6 +428,8 @@ extension PaymentSettingTableViewController { return payPayPaymentCell case .trueMoney: return truemoneyPaymentCell + case .trueMoneyJumpApp: + return truemoneyJumpAppPaymentCell case .pointsCiti: return pointsCitiCell case .fpx: diff --git a/OmiseSDK/Capability.swift b/OmiseSDK/Capability.swift index 2eb890ed..968ef310 100644 --- a/OmiseSDK/Capability.swift +++ b/OmiseSDK/Capability.swift @@ -74,6 +74,7 @@ extension Capability { case promptpay case paynow case truemoney + case truemoneyJumpApp case points(PaymentInformation.Points) case eContext case fpx @@ -276,6 +277,8 @@ extension Capability.Backend { self.payment = .paynow case .source(.trueMoney): self.payment = .truemoney + case .source(.trueMoneyJumpApp): + self.payment = .truemoneyJumpApp case .source(.pointsCiti): self.payment = .points(.citiPoints) case .source(.billPaymentTescoLotus): @@ -331,12 +334,12 @@ extension Capability.Backend { case .installment(_, availableNumberOfTerms: let availableNumberOfTerms): try container.encode(Array(availableNumberOfTerms), forKey: .allowedInstallmentTerms) try container.encode(Array(supportedCurrencies), forKey: .supportedCurrencies) + case .internetBanking, .alipay, .alipayCN, .alipayHK, .atome, .dana, .gcash, .kakaoPay, .touchNGoAlipayPlus, .touchNGo, .promptpay, .paynow, .truemoney, .truemoneyJumpApp, .points, .billPayment, .eContext, .mobileBanking, .fpx, .rabbitLinepay, .ocbcPao, .ocbcDigital, .grabPay, .grabPayRms, .boost, .shopeePay, .shopeePayJumpApp, .maybankQRPay, .duitNowQR, .duitNowOBW, .payPay: + // swiftlint:disable:previous line_length + try container.encode(Array(supportedCurrencies), forKey: .supportedCurrencies) case .unknownSource(_, configurations: let configurations): try encoder.encodeJSONDictionary(configurations) try container.encode(Array(supportedCurrencies), forKey: .supportedCurrencies) - // swiftlint:disable:next line_length - case .internetBanking, .alipay, .alipayCN, .alipayHK, .atome, .dana, .gcash, .kakaoPay, .touchNGoAlipayPlus, .touchNGo, .promptpay, .paynow, .truemoney, .points, .billPayment, .eContext, .mobileBanking, .fpx, .rabbitLinepay, .ocbcPao, .ocbcDigital, .grabPay, .grabPayRms, .boost, .shopeePay, .shopeePayJumpApp, .maybankQRPay, .duitNowQR, .duitNowOBW, .payPay: - try container.encode(Array(supportedCurrencies), forKey: .supportedCurrencies) } } } @@ -401,14 +404,14 @@ extension Capability.Backend { self = .source(OMSSourceTypeValue(banking.type)) case .billPayment(let billPayment): self = .source(OMSSourceTypeValue(billPayment.type)) - case .unknownSource(let sourceType, configurations: _): - self = .source(.init(sourceType)) case .promptpay: self = .source(.promptPay) case .paynow: self = .source(.payNow) case .truemoney: self = .source(.trueMoney) + case .truemoneyJumpApp: + self = .source(.trueMoneyJumpApp) case .points(let points): self = .source(OMSSourceTypeValue(points.type)) case .eContext: @@ -439,6 +442,8 @@ extension Capability.Backend { self = .source(.duitNowOBW) case .payPay: self = .source(.payPay) + case .unknownSource(let sourceType, configurations: _): + self = .source(.init(sourceType)) } } diff --git a/OmiseSDK/Compatibility/OmiseCapability.swift b/OmiseSDK/Compatibility/OmiseCapability.swift index 1c192b7d..f7a300d9 100644 --- a/OmiseSDK/Compatibility/OmiseCapability.swift +++ b/OmiseSDK/Compatibility/OmiseCapability.swift @@ -88,6 +88,9 @@ public class __OmiseCapabilitySourceBackendPayment: __OmiseCapabilityBackendPaym static let truemoneySourceBackendPayment = __OmiseCapabilitySourceBackendPayment(sourceType: OMSSourceTypeValue.trueMoney) + static let truemoneyJumpAppSourceBackendPayment = + __OmiseCapabilitySourceBackendPayment(sourceType: OMSSourceTypeValue.trueMoneyJumpApp) + static let cityPointsSourceBackendPayment = __OmiseCapabilitySourceBackendPayment(sourceType: OMSSourceTypeValue.pointsCiti) @@ -202,6 +205,8 @@ extension __OmiseCapabilityBackendPayment { return __OmiseCapabilitySourceBackendPayment.paynowSourceBackendPayment case .truemoney: return __OmiseCapabilitySourceBackendPayment.truemoneySourceBackendPayment + case .truemoneyJumpApp: + return __OmiseCapabilitySourceBackendPayment.truemoneyJumpAppSourceBackendPayment case .points(let points): return __OmiseCapabilitySourceBackendPayment(sourceType: OMSSourceTypeValue(points.type)) case .eContext: diff --git a/OmiseSDK/Compatibility/OmiseSource.swift b/OmiseSDK/Compatibility/OmiseSource.swift index a0079a01..57500168 100644 --- a/OmiseSDK/Compatibility/OmiseSource.swift +++ b/OmiseSDK/Compatibility/OmiseSource.swift @@ -110,6 +110,9 @@ public class __SourcePaymentInformation: NSObject { /// Payment Information for a PayPay Payment public static let paypayPayment = __SourcePaymentInformation(type: OMSSourceTypeValue.payPay)! + + /// Payment Information for an Truemoney JumpApp + public static let truemoneyJumpAppPayment = __SourcePaymentInformation(type: OMSSourceTypeValue.trueMoneyJumpApp)! } /// Internet Bankning Source Payment Information @@ -649,6 +652,9 @@ extension __SourcePaymentInformation { case .truemoney(let trueMoney): return __SourceTrueMoneyPayment(phoneNumber: trueMoney.phoneNumber) + case .truemoneyJumpApp: + return __SourcePaymentInformation.truemoneyJumpAppPayment + case .points(let points): switch points { case .citiPoints: diff --git a/OmiseSDK/Globals.swift b/OmiseSDK/Globals.swift index 2a21bbb1..915dccf7 100644 --- a/OmiseSDK/Globals.swift +++ b/OmiseSDK/Globals.swift @@ -122,7 +122,7 @@ extension OMSSourceTypeValue { return "promptpay" case .payNow: return "paynow" - case .trueMoney: + case .trueMoney, .trueMoneyJumpApp: return "truemoney" case .pointsCiti: return "points" diff --git a/OmiseSDK/PaymentChooserViewController.swift b/OmiseSDK/PaymentChooserViewController.swift index 5381dd03..40ec66a7 100644 --- a/OmiseSDK/PaymentChooserViewController.swift +++ b/OmiseSDK/PaymentChooserViewController.swift @@ -22,6 +22,7 @@ enum PaymentChooserOption: CaseIterable, Equatable, CustomStringConvertible { case promptpay case paynow case truemoney + case truemoneyJumpApp case citiPoints case fpx case rabbitLinepay @@ -38,45 +39,6 @@ enum PaymentChooserOption: CaseIterable, Equatable, CustomStringConvertible { case grabPayRms case payPay - static var allCases: [PaymentChooserOption] { - return [ - .creditCard, - .installment, - .truemoney, - .promptpay, - .citiPoints, - .alipay, - .alipayCN, - .alipayHK, - .atome, - .dana, - .gcash, - .kakaoPay, - .touchNGoAlipayPlus, - .internetBanking, - .mobileBanking, - .tescoLotus, - .paynow, - .conbini, - .payEasy, - .netBanking, - .fpx, - .rabbitLinepay, - .ocbcPao, - .ocbcDigital, - .grabPay, - .boost, - .shopeePay, - .shopeePayJumpApp, - .maybankQRPay, - .duitNowQR, - .duitNowOBW, - .touchNGo, - .grabPayRms, - .payPay - ] - } - var description: String { switch self { case .creditCard: @@ -116,6 +78,8 @@ enum PaymentChooserOption: CaseIterable, Equatable, CustomStringConvertible { case .paynow: return "PayNow" case .truemoney: + return "TrueMoney Wallet" + case .truemoneyJumpApp: return "TrueMoney" case .citiPoints: return "CitiPoints" @@ -157,6 +121,8 @@ extension PaymentChooserOption { switch sourceType { case .trueMoney: return [.truemoney] + case .trueMoneyJumpApp: + return [.truemoneyJumpApp] case .installmentFirstChoice, .installmentMBB, .installmentKBank, .installmentKTC, .installmentBBL, .installmentBAY, .installmentSCB, .installmentCiti, .installmentTTB, .installmentUOB: return [.installment] @@ -397,6 +363,8 @@ class PaymentChooserViewController: AdaptableStaticTableViewController - + @@ -1541,6 +1541,35 @@ + + + + + + + + + + + + + + + + + + + + + + + @@ -1591,6 +1620,7 @@ + diff --git a/OmiseSDKObjc/OMSConstants.h b/OmiseSDKObjc/OMSConstants.h index cfea4949..ecf43853 100644 --- a/OmiseSDKObjc/OMSConstants.h +++ b/OmiseSDKObjc/OMSConstants.h @@ -35,6 +35,7 @@ extern OMSSourceTypeValue const _Nonnull OMSSourceTypeValuePayNow; extern OMSSourceTypeValue const _Nonnull OMSSourceTypeValueTouchNGo; extern OMSSourceTypeValue const _Nonnull OMSSourceTypeValueTouchNGoAlipayPlus; extern OMSSourceTypeValue const _Nonnull OMSSourceTypeValueTrueMoney; +extern OMSSourceTypeValue const _Nonnull OMSSourceTypeValueTrueMoneyJumpApp; extern OMSSourceTypeValue const _Nonnull OMSSourceTypeValuePointsCiti; extern OMSSourceTypeValue const _Nonnull OMSSourceTypeValueFpx; extern OMSSourceTypeValue const _Nonnull OMSSourceTypeValueMobileBankingKBank; diff --git a/OmiseSDKObjc/OMSConstants.m b/OmiseSDKObjc/OMSConstants.m index 33fc1bfc..5916d00e 100644 --- a/OmiseSDKObjc/OMSConstants.m +++ b/OmiseSDKObjc/OMSConstants.m @@ -34,6 +34,7 @@ OMSSourceTypeValue const _Nonnull OMSSourceTypeValuePromptPay = @"promptpay"; OMSSourceTypeValue const _Nonnull OMSSourceTypeValuePayNow = @"paynow"; OMSSourceTypeValue const _Nonnull OMSSourceTypeValueTrueMoney = @"truemoney"; +OMSSourceTypeValue const _Nonnull OMSSourceTypeValueTrueMoneyJumpApp = @"truemoney_jumpapp"; OMSSourceTypeValue const _Nonnull OMSSourceTypeValuePointsCiti = @"points_citi"; OMSSourceTypeValue const _Nonnull OMSSourceTypeValueFpx = @"fpx"; OMSSourceTypeValue const _Nonnull OMSSourceTypeValueRabbitLinepay = @"rabbit_linepay"; diff --git a/OmiseSDKTests/PaymentInformationTestCase.swift b/OmiseSDKTests/PaymentInformationTestCase.swift index e4f763d4..95db11e3 100644 --- a/OmiseSDKTests/PaymentInformationTestCase.swift +++ b/OmiseSDKTests/PaymentInformationTestCase.swift @@ -569,6 +569,30 @@ class PaymentInformationTestCase: XCTestCase { } } + func testEncodeTrueMoneyJumpAppSourceParameter() throws { + let encoder = PaymentInformationTestCase.makeJSONEncoder() + + do { + let sourceParameter = Source.CreateParameter(paymentInformation: .truemoneyJumpApp, + amount: 10_000_00, + currency: .thb) + let encodedJSONString = String(data: try encoder.encode(sourceParameter), encoding: .utf8) + XCTAssertEqual( + """ + { + "amount" : 1000000, + "currency" : "THB", + "email" : null, + "items" : null, + "name" : null, + "phone_number" : null, + "platform_type" : "IOS", + "shipping" : null, + "type" : "truemoney_jumpapp" + } + """, encodedJSONString) + } + } func testEncodePointsSourceParameter() throws { let encoder = PaymentInformationTestCase.makeJSONEncoder()