From 926f85be8f34df0381e5e541dcc93e3675f6a0e3 Mon Sep 17 00:00:00 2001 From: Naufal Aros Date: Thu, 31 Oct 2024 13:17:33 +0100 Subject: [PATCH 1/9] Add support for boletobancario, primeiro_boleto txvariants --- Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift | 2 ++ 1 file changed, 2 insertions(+) diff --git a/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift b/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift index ff67a87f4c..b056357727 100644 --- a/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift +++ b/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift @@ -111,6 +111,8 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable { case "econtext_atm": self = .econtextATM case "econtext_online": self = .econtextOnline case "boletobancario_santander": self = .boleto + case "boletobancario": self = .boleto + case "primeiropay_boleto": self = .boleto case "affirm": self = .affirm case "oxxo": self = .oxxo case "directdebit_GB": self = .bacsDirectDebit From 1979bfaf74f879207ceb49eeb8a4fb8972fcdf81 Mon Sep 17 00:00:00 2001 From: Naufal Aros Date: Thu, 31 Oct 2024 14:12:32 +0100 Subject: [PATCH 2/9] Add voucher support for new boleto tx variants --- .../Abstract/AnyPaymentMethodDecoder.swift | 3 ++ .../Abstract/PaymentMethodType.swift | 16 +++++++-- AdyenActions/Actions/VoucherAction.swift | 34 +++++++++++++++++-- .../VoucherShareableViewProvider.swift | 6 ++++ 4 files changed, 54 insertions(+), 5 deletions(-) diff --git a/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethodDecoder.swift b/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethodDecoder.swift index 80f10d25a1..20f838b57e 100644 --- a/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethodDecoder.swift +++ b/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethodDecoder.swift @@ -79,7 +79,10 @@ internal enum AnyPaymentMethodDecoder { .econtextStores: EContextStoresPaymentMethodDecoder(), .econtextATM: EContextATMPaymentMethodDecoder(), .econtextOnline: EContextOnlinePaymentMethodDecoder(), + .boletoBancario: BoletoPaymentMethodDecoder(), .boleto: BoletoPaymentMethodDecoder(), + .boletoBancarioItau: BoletoPaymentMethodDecoder(), + .primeiroPayBoleto: BoletoPaymentMethodDecoder(), .affirm: AffirmPaymentMethodDecoder(), .atome: AtomePaymentMethodDecoder(), .onlineBankingCZ: OnlineBankingPaymentMethodDecoder(), diff --git a/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift b/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift index b056357727..240d0d1d6e 100644 --- a/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift +++ b/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift @@ -37,7 +37,10 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable { case econtextStores case econtextATM case econtextOnline + case boletoBancario case boleto + case boletoBancarioItau + case primeiroPayBoleto case affirm case oxxo case bacsDirectDebit @@ -110,9 +113,10 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable { case "econtext_stores": self = .econtextStores case "econtext_atm": self = .econtextATM case "econtext_online": self = .econtextOnline + case "boletobancario": self = .boletoBancario + case "boletobancario_itau": self = .boletoBancarioItau case "boletobancario_santander": self = .boleto - case "boletobancario": self = .boleto - case "primeiropay_boleto": self = .boleto + case "primeiropay_boleto": self = .primeiroPayBoleto case "affirm": self = .affirm case "oxxo": self = .oxxo case "directdebit_GB": self = .bacsDirectDebit @@ -174,7 +178,10 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable { case .econtextStores: return "econtext_stores" case .econtextATM: return "econtext_atm" case .econtextOnline: return "econtext_online" + case .boletoBancario: return "boletobancario" case .boleto: return "boletobancario_santander" + case .boletoBancarioItau: return "boletobancario_itau" + case .primeiroPayBoleto: return "primeiropay_boleto" case .affirm: return "affirm" case .oxxo: return "oxxo" case .bacsDirectDebit: return "directdebit_GB" @@ -243,7 +250,10 @@ extension PaymentMethodType { case .econtextStores: return "econtext stores" case .econtextATM: return "econtext ATM" case .econtextOnline: return "econtext online" - case .boleto: return "boleto" + case .boletoBancario: return "boleto bancario" + case .boleto: return "boleto bancario santander" + case .boletoBancarioItau: return "boleto bancario itau" + case .primeiroPayBoleto: return "primeiro pay boleto" case .affirm: return "affirm" case .oxxo: return "OXXO" case .bacsDirectDebit: return "BACS direct debit" diff --git a/AdyenActions/Actions/VoucherAction.swift b/AdyenActions/Actions/VoucherAction.swift index b9b2f2410d..c1e2a5ce48 100644 --- a/AdyenActions/Actions/VoucherAction.swift +++ b/AdyenActions/Actions/VoucherAction.swift @@ -24,7 +24,16 @@ public enum VoucherPaymentMethod: String, Codable, CaseIterable { /// Boleto Bancairo Santander case boletoBancairoSantander = "boletobancario_santander" - + + /// Boleto Bancario + case boletoBancario = "boletobancario" + + /// Boleto Bancario Itau + case boletoBancarioItau = "boletobancario_itau" + + /// Primeiro Pay Boleto + case primeiroPayBoleto = "primeiropay_boleto" + /// OXXO case oxxo @@ -49,7 +58,16 @@ public enum VoucherAction: Decodable { /// Indicates a Boleto Bancairo Santander Voucher type. case boletoBancairoSantander(BoletoVoucherAction) - + + /// Indicates a Boleto Bancario Voucher type. + case boletoBancario(BoletoVoucherAction) + + /// Indicates a Boleto Bancario Itau Voucher type. + case boletoBancarioItau(BoletoVoucherAction) + + /// Indicates a Primeiro Pay Boleto Voucher type. + case primeiroPayBoleto(BoletoVoucherAction) + /// Indicates an OXXO voucher type case oxxo(OXXOVoucherAction) @@ -71,6 +89,12 @@ public enum VoucherAction: Decodable { self = try .econtextATM(EContextATMVoucherAction(from: decoder)) case .boletoBancairoSantander: self = try .boletoBancairoSantander(BoletoVoucherAction(from: decoder)) + case .boletoBancario: + self = try .boletoBancario(BoletoVoucherAction(from: decoder)) + case .boletoBancarioItau: + self = try .boletoBancarioItau(BoletoVoucherAction(from: decoder)) + case .primeiroPayBoleto: + self = try .primeiroPayBoleto(BoletoVoucherAction(from: decoder)) case .oxxo: self = try .oxxo(OXXOVoucherAction(from: decoder)) case .multibanco: @@ -87,6 +111,12 @@ public enum VoucherAction: Decodable { switch self { case let .boletoBancairoSantander(action): return action + case let .boletoBancario(action): + return action + case let .boletoBancarioItau(action): + return action + case let .primeiroPayBoleto(action): + return action case let .dokuAlfamart(action): return action case let .dokuIndomaret(action): diff --git a/AdyenActions/Components/Voucher/VoucherShareableViewProvider.swift b/AdyenActions/Components/Voucher/VoucherShareableViewProvider.swift index 94ec32a765..09828a37ce 100644 --- a/AdyenActions/Components/Voucher/VoucherShareableViewProvider.swift +++ b/AdyenActions/Components/Voucher/VoucherShareableViewProvider.swift @@ -48,6 +48,12 @@ internal final class VoucherShareableViewProvider: AnyVoucherShareableViewProvid view = createGenericView(with: action, fields: createOXXOVoucherFields(for: action)) case let .boletoBancairoSantander(action): view = createBoletoView(with: action) + case let .boletoBancario(action): + view = createBoletoView(with: action) + case let .boletoBancarioItau(action): + view = createBoletoView(with: action) + case let .primeiroPayBoleto(action): + view = createBoletoView(with: action) case let .multibanco(action): view = createGenericView(with: action, fields: createMultibancoVoucherFields(for: action)) } From 729104451c0382767ddbb314dd61049ec25f1d72 Mon Sep 17 00:00:00 2001 From: Naufal Aros Date: Thu, 31 Oct 2024 14:21:44 +0100 Subject: [PATCH 3/9] Add new boleto variants to AnyPaymentMethod --- .../Payment Methods/Abstract/AnyPaymentMethod.swift | 10 ++++++++-- .../Abstract/AnyPaymentMethodDecoder.swift | 6 +++--- .../Payment Methods/Abstract/PaymentMethodType.swift | 8 ++++---- .../Components Tests/Boleto/BoletoComponentTests.swift | 2 +- .../DropIn Tests/ComponentManagerTests.swift | 2 +- .../Components/BoletoComponentUITests.swift | 2 +- 6 files changed, 18 insertions(+), 12 deletions(-) diff --git a/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethod.swift b/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethod.swift index 84358586df..3f8d18d9b3 100644 --- a/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethod.swift +++ b/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethod.swift @@ -34,7 +34,10 @@ internal enum AnyPaymentMethod: Codable { case econtextStores(EContextPaymentMethod) case econtextATM(EContextPaymentMethod) case econtextOnline(EContextPaymentMethod) - case boleto(BoletoPaymentMethod) + case boletoBancario(BoletoPaymentMethod) + case boletoBancarioSantander(BoletoPaymentMethod) + case boletoBancarioItau(BoletoPaymentMethod) + case primeiroPayBoleto(BoletoPaymentMethod) case affirm(AffirmPaymentMethod) case atome(AtomePaymentMethod) case onlineBanking(OnlineBankingPaymentMethod) @@ -72,7 +75,10 @@ internal enum AnyPaymentMethod: Codable { case let .econtextStores(paymentMethod): return paymentMethod case let .econtextATM(paymentMethod): return paymentMethod case let .econtextOnline(paymentMethod): return paymentMethod - case let .boleto(paymentMethod): return paymentMethod + case let .boletoBancario(paymentMethod): return paymentMethod + case let .boletoBancarioSantander(paymentMethod): return paymentMethod + case let .boletoBancarioItau(paymentMethod): return paymentMethod + case let .primeiroPayBoleto(paymentMethod): return paymentMethod case let .affirm(paymentMethod): return paymentMethod case let .atome(paymentMethod): return paymentMethod case let .onlineBanking(paymentMethod): return paymentMethod diff --git a/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethodDecoder.swift b/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethodDecoder.swift index 20f838b57e..876c505922 100644 --- a/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethodDecoder.swift +++ b/Adyen/Core/Payment Methods/Abstract/AnyPaymentMethodDecoder.swift @@ -80,7 +80,7 @@ internal enum AnyPaymentMethodDecoder { .econtextATM: EContextATMPaymentMethodDecoder(), .econtextOnline: EContextOnlinePaymentMethodDecoder(), .boletoBancario: BoletoPaymentMethodDecoder(), - .boleto: BoletoPaymentMethodDecoder(), + .boletoBancarioSantander: BoletoPaymentMethodDecoder(), .boletoBancarioItau: BoletoPaymentMethodDecoder(), .primeiroPayBoleto: BoletoPaymentMethodDecoder(), .affirm: AffirmPaymentMethodDecoder(), @@ -416,11 +416,11 @@ private struct EContextOnlinePaymentMethodDecoder: PaymentMethodDecoder { private struct BoletoPaymentMethodDecoder: PaymentMethodDecoder { func decode(from decoder: Decoder, isStored: Bool) throws -> AnyPaymentMethod { - try .boleto(BoletoPaymentMethod(from: decoder)) + try .boletoBancarioSantander(BoletoPaymentMethod(from: decoder)) } func anyPaymentMethod(from paymentMethod: any PaymentMethod) -> AnyPaymentMethod? { - (paymentMethod as? BoletoPaymentMethod).map { .boleto($0) } + (paymentMethod as? BoletoPaymentMethod).map { .boletoBancarioSantander($0) } } } diff --git a/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift b/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift index 240d0d1d6e..337673c6d8 100644 --- a/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift +++ b/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift @@ -38,7 +38,7 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable { case econtextATM case econtextOnline case boletoBancario - case boleto + case boletoBancarioSantander case boletoBancarioItau case primeiroPayBoleto case affirm @@ -115,7 +115,7 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable { case "econtext_online": self = .econtextOnline case "boletobancario": self = .boletoBancario case "boletobancario_itau": self = .boletoBancarioItau - case "boletobancario_santander": self = .boleto + case "boletobancario_santander": self = .boletoBancarioSantander case "primeiropay_boleto": self = .primeiroPayBoleto case "affirm": self = .affirm case "oxxo": self = .oxxo @@ -179,7 +179,7 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable { case .econtextATM: return "econtext_atm" case .econtextOnline: return "econtext_online" case .boletoBancario: return "boletobancario" - case .boleto: return "boletobancario_santander" + case .boletoBancarioSantander: return "boletobancario_santander" case .boletoBancarioItau: return "boletobancario_itau" case .primeiroPayBoleto: return "primeiropay_boleto" case .affirm: return "affirm" @@ -251,7 +251,7 @@ extension PaymentMethodType { case .econtextATM: return "econtext ATM" case .econtextOnline: return "econtext online" case .boletoBancario: return "boleto bancario" - case .boleto: return "boleto bancario santander" + case .boletoBancarioSantander: return "boleto bancario santander" case .boletoBancarioItau: return "boleto bancario itau" case .primeiroPayBoleto: return "primeiro pay boleto" case .affirm: return "affirm" diff --git a/Tests/IntegrationTests/Components Tests/Boleto/BoletoComponentTests.swift b/Tests/IntegrationTests/Components Tests/Boleto/BoletoComponentTests.swift index fdc0bd1479..aca2b5f637 100644 --- a/Tests/IntegrationTests/Components Tests/Boleto/BoletoComponentTests.swift +++ b/Tests/IntegrationTests/Components Tests/Boleto/BoletoComponentTests.swift @@ -11,7 +11,7 @@ import XCTest class BoletoComponentTests: XCTestCase { - private var method = BoletoPaymentMethod(type: .boleto, name: "Boleto Bancario") + private var method = BoletoPaymentMethod(type: .boletoBancarioSantander, name: "Boleto Bancario") func testFullPrefilledInfo() throws { // Given diff --git a/Tests/IntegrationTests/DropIn Tests/ComponentManagerTests.swift b/Tests/IntegrationTests/DropIn Tests/ComponentManagerTests.swift index 8710029843..511023ff61 100644 --- a/Tests/IntegrationTests/DropIn Tests/ComponentManagerTests.swift +++ b/Tests/IntegrationTests/DropIn Tests/ComponentManagerTests.swift @@ -452,7 +452,7 @@ class ComponentManagerTests: XCTestCase { ) // When - let paymentComponent = try XCTUnwrap(sut.regularComponents.first { $0.paymentMethod.type == .boleto }) + let paymentComponent = try XCTUnwrap(sut.regularComponents.first { $0.paymentMethod.type == .boletoBancarioSantander }) // Then let boletoComponent = try XCTUnwrap(paymentComponent as? BoletoComponent) diff --git a/Tests/SnapshotTests/Components/BoletoComponentUITests.swift b/Tests/SnapshotTests/Components/BoletoComponentUITests.swift index 34b25c160b..b2694e23d3 100644 --- a/Tests/SnapshotTests/Components/BoletoComponentUITests.swift +++ b/Tests/SnapshotTests/Components/BoletoComponentUITests.swift @@ -20,7 +20,7 @@ final class BoletoComponentUITests: XCTestCase { } private var paymentMethod: BoletoPaymentMethod { - .init(type: .boleto, name: "Boleto Bancario") + .init(type: .boletoBancarioSantander, name: "Boleto Bancario") } func testUIConfiguration() { From 2b3ca3e9707ac2b1c42f0e0889b1ae6f06e47dc7 Mon Sep 17 00:00:00 2001 From: Naufal Aros Date: Thu, 14 Nov 2024 17:03:42 +0100 Subject: [PATCH 4/9] Update ComponentManagerTests --- .../DropIn Tests/ComponentManagerTests.swift | 15 +++++++++------ Tests/UnitTests/Core/PaymentMethodTests.swift | 4 ++-- .../Mocks/DummyData/DummyPaymentMethods.swift | 17 ++++++++++++++++- 3 files changed, 27 insertions(+), 9 deletions(-) diff --git a/Tests/IntegrationTests/DropIn Tests/ComponentManagerTests.swift b/Tests/IntegrationTests/DropIn Tests/ComponentManagerTests.swift index 511023ff61..0cf79c5a30 100644 --- a/Tests/IntegrationTests/DropIn Tests/ComponentManagerTests.swift +++ b/Tests/IntegrationTests/DropIn Tests/ComponentManagerTests.swift @@ -57,7 +57,10 @@ class ComponentManagerTests: XCTestCase { econtextOnline, oxxo, multibanco, - boleto, + boletoBancario, + boletoBancarioSantander, + primeiroPayBoleto, + boletoBancarioItau, affirm, atome, achDirectDebit, @@ -69,7 +72,7 @@ class ComponentManagerTests: XCTestCase { ] ] - let numberOfExpectedRegularComponents = 24 + let numberOfExpectedRegularComponents = 27 var presentationDelegate: PresentationDelegateMock! var context: AdyenContext! @@ -105,8 +108,8 @@ class ComponentManagerTests: XCTestCase { XCTAssertEqual(sut.storedComponents.filter { $0.context.apiContext.clientKey == Dummy.apiContext.clientKey }.count, 6) XCTAssertEqual(sut.regularComponents.filter { $0.context.apiContext.clientKey == Dummy.apiContext.clientKey }.count, numberOfExpectedRegularComponents) - XCTAssertEqual(sut.regularComponents.filter { $0 is LoadingComponent }.count, 19) - XCTAssertEqual(sut.regularComponents.filter { $0 is PresentableComponent }.count, 19) + XCTAssertEqual(sut.regularComponents.filter { $0 is LoadingComponent }.count, 22) + XCTAssertEqual(sut.regularComponents.filter { $0 is PresentableComponent }.count, 22) XCTAssertEqual(sut.regularComponents.filter { $0 is FinalizableComponent }.count, 0) } @@ -123,8 +126,8 @@ class ComponentManagerTests: XCTestCase { XCTAssertEqual(sut.storedComponents.count, 6) XCTAssertEqual(sut.regularComponents.count, numberOfExpectedRegularComponents + 1) - XCTAssertEqual(sut.regularComponents.filter { $0 is LoadingComponent }.count, 19) - XCTAssertEqual(sut.regularComponents.filter { $0 is PresentableComponent }.count, 20) + XCTAssertEqual(sut.regularComponents.filter { $0 is LoadingComponent }.count, 22) + XCTAssertEqual(sut.regularComponents.filter { $0 is PresentableComponent }.count, 23) XCTAssertEqual(sut.regularComponents.filter { $0 is FinalizableComponent }.count, 1) } diff --git a/Tests/UnitTests/Core/PaymentMethodTests.swift b/Tests/UnitTests/Core/PaymentMethodTests.swift index 9b93916ad5..7ada5f3bb2 100644 --- a/Tests/UnitTests/Core/PaymentMethodTests.swift +++ b/Tests/UnitTests/Core/PaymentMethodTests.swift @@ -74,7 +74,7 @@ class PaymentMethodTests: XCTestCase { givexGiftCard, mealVoucherSodexo, bizum, - boleto, + boletoBancarioSantander, affirm, atome, upi, @@ -1060,7 +1060,7 @@ class PaymentMethodTests: XCTestCase { // MARK: - Boleto func testDecodingBoletoPaymentMethod() throws { - let paymentMethod = try AdyenCoder.decode(boleto) as BoletoPaymentMethod + let paymentMethod = try AdyenCoder.decode(boletoBancarioSantander) as BoletoPaymentMethod XCTAssertEqual(paymentMethod.type.rawValue, "boletobancario_santander") XCTAssertEqual(paymentMethod.name, "Boleto Bancario") XCTAssertEqual(paymentMethod.displayInformation(using: nil).title, "Boleto Bancario") diff --git a/Tests/UnitTests/Mocks/DummyData/DummyPaymentMethods.swift b/Tests/UnitTests/Mocks/DummyData/DummyPaymentMethods.swift index 406b034f77..f385698985 100644 --- a/Tests/UnitTests/Mocks/DummyData/DummyPaymentMethods.swift +++ b/Tests/UnitTests/Mocks/DummyData/DummyPaymentMethods.swift @@ -504,11 +504,26 @@ let mealVoucherSodexo = [ "type": "mealVoucher_FR_sodexo" ] as [String: Any] -let boleto = [ +let boletoBancarioSantander = [ "name": "Boleto Bancario", "type": "boletobancario_santander" ] +let primeiroPayBoleto = [ + "name": "Boleto Bancario", + "type": "primeiropay_boleto" +] + +let boletoBancario = [ + "name": "Boleto Bancario", + "type": "boletobancario" +] + +let boletoBancarioItau = [ + "name": "Boleto Bancario", + "type": "boletobancario_itau" +] + let bacsDirectDebit = [ "name": "BACS Direct Debit", "type": "directdebit_GB" From 770f310d12901b66237205397b7824cfce6b360b Mon Sep 17 00:00:00 2001 From: Naufal Aros Date: Thu, 14 Nov 2024 17:18:56 +0100 Subject: [PATCH 5/9] Test new Boleto txvariants decoding --- Tests/UnitTests/Core/PaymentMethodTests.swift | 86 ++++++++++++++----- 1 file changed, 64 insertions(+), 22 deletions(-) diff --git a/Tests/UnitTests/Core/PaymentMethodTests.swift b/Tests/UnitTests/Core/PaymentMethodTests.swift index 7ada5f3bb2..a96d451472 100644 --- a/Tests/UnitTests/Core/PaymentMethodTests.swift +++ b/Tests/UnitTests/Core/PaymentMethodTests.swift @@ -74,7 +74,10 @@ class PaymentMethodTests: XCTestCase { givexGiftCard, mealVoucherSodexo, bizum, + boletoBancario, boletoBancarioSantander, + primeiroPayBoleto, + boletoBancarioItau, affirm, atome, upi, @@ -175,8 +178,8 @@ class PaymentMethodTests: XCTestCase { // Regular payment methods - XCTAssertEqual(paymentMethods.regular.count, 32) - + XCTAssertEqual(paymentMethods.regular.count, 35) + let creditCardPaymentMethod = try XCTUnwrap(paymentMethods.regular[0] as? CardPaymentMethod) XCTAssertEqual(creditCardPaymentMethod.fundingSource, .credit) @@ -295,29 +298,41 @@ class PaymentMethodTests: XCTestCase { XCTAssertTrue(paymentMethods.regular[26] is BoletoPaymentMethod) XCTAssertEqual(paymentMethods.regular[26].name, "Boleto Bancario") - XCTAssertEqual(paymentMethods.regular[26].type.rawValue, "boletobancario_santander") - - XCTAssertTrue(paymentMethods.regular[27] is AffirmPaymentMethod) - XCTAssertEqual(paymentMethods.regular[27].name, "Affirm") - XCTAssertEqual(paymentMethods.regular[27].type.rawValue, "affirm") - - XCTAssertTrue(paymentMethods.regular[28] is AtomePaymentMethod) - XCTAssertEqual(paymentMethods.regular[28].name, "Atome") - XCTAssertEqual(paymentMethods.regular[28].type.rawValue, "atome") - - XCTAssertTrue(paymentMethods.regular[29] is UPIPaymentMethod) - XCTAssertEqual(paymentMethods.regular[29].name, "UPI") - XCTAssertEqual(paymentMethods.regular[29].type.rawValue, "upi") - - let cashAppPay = try XCTUnwrap(paymentMethods.regular[30] as? CashAppPayPaymentMethod) + XCTAssertEqual(paymentMethods.regular[26].type.rawValue, "boletobancario") + + XCTAssertTrue(paymentMethods.regular[27] is BoletoPaymentMethod) + XCTAssertEqual(paymentMethods.regular[27].name, "Boleto Bancario") + XCTAssertEqual(paymentMethods.regular[27].type.rawValue, "boletobancario_santander") + + XCTAssertTrue(paymentMethods.regular[28] is BoletoPaymentMethod) + XCTAssertEqual(paymentMethods.regular[28].name, "Boleto Bancario") + XCTAssertEqual(paymentMethods.regular[28].type.rawValue, "primeiropay_boleto") + + XCTAssertTrue(paymentMethods.regular[29] is BoletoPaymentMethod) + XCTAssertEqual(paymentMethods.regular[29].name, "Boleto Bancario") + XCTAssertEqual(paymentMethods.regular[29].type.rawValue, "boletobancario_itau") + + XCTAssertTrue(paymentMethods.regular[30] is AffirmPaymentMethod) + XCTAssertEqual(paymentMethods.regular[30].name, "Affirm") + XCTAssertEqual(paymentMethods.regular[30].type.rawValue, "affirm") + + XCTAssertTrue(paymentMethods.regular[31] is AtomePaymentMethod) + XCTAssertEqual(paymentMethods.regular[31].name, "Atome") + XCTAssertEqual(paymentMethods.regular[31].type.rawValue, "atome") + + XCTAssertTrue(paymentMethods.regular[32] is UPIPaymentMethod) + XCTAssertEqual(paymentMethods.regular[32].name, "UPI") + XCTAssertEqual(paymentMethods.regular[32].type.rawValue, "upi") + + let cashAppPay = try XCTUnwrap(paymentMethods.regular[33] as? CashAppPayPaymentMethod) XCTAssertEqual(cashAppPay.name, "Cash App Pay") XCTAssertEqual(cashAppPay.type.rawValue, "cashapp") XCTAssertEqual(cashAppPay.clientId, "testClient") XCTAssertEqual(cashAppPay.scopeId, "testScope") - XCTAssertTrue(paymentMethods.regular[31] is InstantPaymentMethod) - XCTAssertEqual(paymentMethods.regular[31].type.rawValue, "ideal") - XCTAssertEqual(paymentMethods.regular[31].name, "iDeal") + XCTAssertTrue(paymentMethods.regular[34] is InstantPaymentMethod) + XCTAssertEqual(paymentMethods.regular[34].type.rawValue, "ideal") + XCTAssertEqual(paymentMethods.regular[34].name, "iDeal") } // MARK: - Display Information Override @@ -1058,8 +1073,17 @@ class PaymentMethodTests: XCTestCase { } // MARK: - Boleto - - func testDecodingBoletoPaymentMethod() throws { + + func testDecodingBoletoBancarioPaymentMethod() throws { + let paymentMethod = try AdyenCoder.decode(boletoBancario) as BoletoPaymentMethod + XCTAssertEqual(paymentMethod.type.rawValue, "boletobancario") + XCTAssertEqual(paymentMethod.name, "Boleto Bancario") + XCTAssertEqual(paymentMethod.displayInformation(using: nil).title, "Boleto Bancario") + XCTAssertEqual(paymentMethod.displayInformation(using: nil).logoName, "boletobancario") + testCoding(paymentMethod) + } + + func testDecodingBoletoBancarioSantanderPaymentMethod() throws { let paymentMethod = try AdyenCoder.decode(boletoBancarioSantander) as BoletoPaymentMethod XCTAssertEqual(paymentMethod.type.rawValue, "boletobancario_santander") XCTAssertEqual(paymentMethod.name, "Boleto Bancario") @@ -1068,6 +1092,24 @@ class PaymentMethodTests: XCTestCase { testCoding(paymentMethod) } + func testDecodingBoletoBancarioItauPaymentMethod() throws { + let paymentMethod = try AdyenCoder.decode(boletoBancarioItau) as BoletoPaymentMethod + XCTAssertEqual(paymentMethod.type.rawValue, "boletobancario_itau") + XCTAssertEqual(paymentMethod.name, "Boleto Bancario") + XCTAssertEqual(paymentMethod.displayInformation(using: nil).title, "Boleto Bancario") + XCTAssertEqual(paymentMethod.displayInformation(using: nil).logoName, "boletobancario_itau") + testCoding(paymentMethod) + } + + func testDecodingPrimeiroPayBoletoPaymentMethod() throws { + let paymentMethod = try AdyenCoder.decode(primeiroPayBoleto) as BoletoPaymentMethod + XCTAssertEqual(paymentMethod.type.rawValue, "primeiropay_boleto") + XCTAssertEqual(paymentMethod.name, "Boleto Bancario") + XCTAssertEqual(paymentMethod.displayInformation(using: nil).title, "Boleto Bancario") + XCTAssertEqual(paymentMethod.displayInformation(using: nil).logoName, "primeiropay_boleto") + testCoding(paymentMethod) + } + // MARK: - BACS Direct Debit func testDecodingBACSDirectDebitPaymentMethod() throws { From 422f14da0733b306fda2daedb5e1d6c789a1a6b5 Mon Sep 17 00:00:00 2001 From: Naufal Aros Date: Wed, 20 Nov 2024 14:27:17 +0100 Subject: [PATCH 6/9] Add deprecation message for boleto case --- .../Payment Methods/Abstract/PaymentMethodType.swift | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift b/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift index 337673c6d8..224909cb69 100644 --- a/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift +++ b/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift @@ -38,6 +38,13 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable { case econtextATM case econtextOnline case boletoBancario + @available( + *, + deprecated, + renamed: "boletoBancarioSantander", + message: "Use 'boletoBancarioSantander' instead." + ) + case boleto case boletoBancarioSantander case boletoBancarioItau case primeiroPayBoleto @@ -179,6 +186,7 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable { case .econtextATM: return "econtext_atm" case .econtextOnline: return "econtext_online" case .boletoBancario: return "boletobancario" + case .boleto: return "boletobancario_santander" case .boletoBancarioSantander: return "boletobancario_santander" case .boletoBancarioItau: return "boletobancario_itau" case .primeiroPayBoleto: return "primeiropay_boleto" @@ -251,6 +259,7 @@ extension PaymentMethodType { case .econtextATM: return "econtext ATM" case .econtextOnline: return "econtext online" case .boletoBancario: return "boleto bancario" + case .boleto: return "boleto bancario santander" case .boletoBancarioSantander: return "boleto bancario santander" case .boletoBancarioItau: return "boleto bancario itau" case .primeiroPayBoleto: return "primeiro pay boleto" From 4cd6a35c4f460ed510159732afba0083e54daf74 Mon Sep 17 00:00:00 2001 From: Naufal Aros Date: Wed, 20 Nov 2024 14:35:57 +0100 Subject: [PATCH 7/9] Add boletoBancarioItau to allowed spell-checked list --- spell-check-word-allow-list.yaml | 1 + 1 file changed, 1 insertion(+) diff --git a/spell-check-word-allow-list.yaml b/spell-check-word-allow-list.yaml index c22b54f922..fa61eda747 100644 --- a/spell-check-word-allow-list.yaml +++ b/spell-check-word-allow-list.yaml @@ -39,6 +39,7 @@ whiteList: - qiwi - qiwiwallet - boletobancario + - boletoBancarioItau - applepay - wechatpay - mbway From e5e4228365bf929ae52bf0f07f2f3fa0189a76ca Mon Sep 17 00:00:00 2001 From: Naufal Aros Date: Fri, 22 Nov 2024 11:18:42 +0100 Subject: [PATCH 8/9] Update spell-check-word-allow-list --- spell-check-word-allow-list.yaml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/spell-check-word-allow-list.yaml b/spell-check-word-allow-list.yaml index fa61eda747..4538060f76 100644 --- a/spell-check-word-allow-list.yaml +++ b/spell-check-word-allow-list.yaml @@ -205,3 +205,5 @@ whiteList: - appslist - unfocus - youtrack + - itau + - primeiropay From 7f179269c6bb2d96d6dcb32c6f876c1d099fc4b3 Mon Sep 17 00:00:00 2001 From: Naufal Aros Date: Fri, 22 Nov 2024 15:32:06 +0100 Subject: [PATCH 9/9] Add message to recommend merchants to use boletoBancario as the default payment method --- Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift b/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift index 224909cb69..6cc113a4a9 100644 --- a/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift +++ b/Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift @@ -42,7 +42,7 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable { *, deprecated, renamed: "boletoBancarioSantander", - message: "Use 'boletoBancarioSantander' instead." + message: "Use 'boletoBancarioSantander' instead. Consider 'boletoBancario' as the default payment method for Boleto Bancario." ) case boleto case boletoBancarioSantander