Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

COIOS-774: Pay by Bank #1878

Draft
wants to merge 14 commits into
base: develop
Choose a base branch
from
46 changes: 46 additions & 0 deletions Adyen.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -150,8 +150,12 @@
81129AE62A4EEF8600E63EBE /* SearchViewController+InterfaceState.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81129AE52A4EEF8600E63EBE /* SearchViewController+InterfaceState.swift */; };
81135C922C903DA4008AC8E4 /* JSONEncoder+SortedKeys.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81135C912C903DA4008AC8E4 /* JSONEncoder+SortedKeys.swift */; };
8122B9BD2B9A0FF3002FC4D6 /* ErrorMock.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8122B9BC2B9A0FF3002FC4D6 /* ErrorMock.swift */; };
81272F182CC7E1DD00D8773A /* PayByBankUSComponent+ConfirmationViewController.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81272F172CC7E1CF00D8773A /* PayByBankUSComponent+ConfirmationViewController.swift */; };
81272F1A2CC8FD4600D8773A /* PayByBankUSComponent+Style.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81272F192CC8FD4600D8773A /* PayByBankUSComponent+Style.swift */; };
8128977B2CC93CB100275487 /* SupportedPaymentMethodsView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8128977A2CC93CB000275487 /* SupportedPaymentMethodsView.swift */; };
8128977C2CCA660A00275487 /* StoredPayByBankUSPaymentMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 812897752CC8FEC100275487 /* StoredPayByBankUSPaymentMethod.swift */; };
8128977E2CCA6FE900275487 /* SupportedPaymentMethodLogosViewTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8128977D2CCA6FE400275487 /* SupportedPaymentMethodLogosViewTests.swift */; };
812B24872CDE56D90074A5D9 /* PayByBankUSComponent+ConfirmationViewController+Model.swift in Sources */ = {isa = PBXBuildFile; fileRef = 812B24862CDE56D90074A5D9 /* PayByBankUSComponent+ConfirmationViewController+Model.swift */; };
8136619E2BE0F6F7009AA0CD /* Adyen3DS2 in Frameworks */ = {isa = PBXBuildFile; productRef = 8136619D2BE0F6F7009AA0CD /* Adyen3DS2 */; };
813BF1122B2365400096940E /* XCTestCase+FirstResponder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 813BF1102B2364E00096940E /* XCTestCase+FirstResponder.swift */; };
813BF1132B2365400096940E /* XCTestCase+FirstResponder.swift in Sources */ = {isa = PBXBuildFile; fileRef = 813BF1102B2364E00096940E /* XCTestCase+FirstResponder.swift */; };
Expand Down Expand Up @@ -250,6 +254,9 @@
81C5D0CE2AC4170A002E918F /* IssuerListComponentExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C5D0CC2AC4170A002E918F /* IssuerListComponentExample.swift */; };
81C5D0D02AC428CB002E918F /* IssuerListComponentAdvancedFlowExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C5D0CF2AC428CB002E918F /* IssuerListComponentAdvancedFlowExample.swift */; };
81C5D0D12AC428CB002E918F /* IssuerListComponentAdvancedFlowExample.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81C5D0CF2AC428CB002E918F /* IssuerListComponentAdvancedFlowExample.swift */; };
81D218682CC7D23A00B7FC4C /* PayByBankUSPaymentMethod.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81D218672CC7D23400B7FC4C /* PayByBankUSPaymentMethod.swift */; };
81D2186D2CC7D57700B7FC4C /* PayByBankUSComponent.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81D2186C2CC7D57100B7FC4C /* PayByBankUSComponent.swift */; };
81D2186F2CC7D7FE00B7FC4C /* PayByBankUSComponent+Configuration.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81D2186E2CC7D7F900B7FC4C /* PayByBankUSComponent+Configuration.swift */; };
81D7EC902CD24147005159F6 /* FormViewControllerTests.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81D7EC8F2CD24143005159F6 /* FormViewControllerTests.swift */; };
81DA70812BDA5F66006CE5D5 /* PaymentMethods+Equatable.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81DA70802BDA5F66006CE5D5 /* PaymentMethods+Equatable.swift */; };
81DA70872BDA6075006CE5D5 /* Twint+Spy.swift in Sources */ = {isa = PBXBuildFile; fileRef = 81DA70822BDA6075006CE5D5 /* Twint+Spy.swift */; };
Expand Down Expand Up @@ -1611,8 +1618,12 @@
81129AE52A4EEF8600E63EBE /* SearchViewController+InterfaceState.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "SearchViewController+InterfaceState.swift"; sourceTree = "<group>"; };
81135C912C903DA4008AC8E4 /* JSONEncoder+SortedKeys.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "JSONEncoder+SortedKeys.swift"; sourceTree = "<group>"; };
8122B9BC2B9A0FF3002FC4D6 /* ErrorMock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = ErrorMock.swift; sourceTree = "<group>"; };
81272F172CC7E1CF00D8773A /* PayByBankUSComponent+ConfirmationViewController.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PayByBankUSComponent+ConfirmationViewController.swift"; sourceTree = "<group>"; };
81272F192CC8FD4600D8773A /* PayByBankUSComponent+Style.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PayByBankUSComponent+Style.swift"; sourceTree = "<group>"; };
812897752CC8FEC100275487 /* StoredPayByBankUSPaymentMethod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoredPayByBankUSPaymentMethod.swift; sourceTree = "<group>"; };
8128977A2CC93CB000275487 /* SupportedPaymentMethodsView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupportedPaymentMethodsView.swift; sourceTree = "<group>"; };
8128977D2CCA6FE400275487 /* SupportedPaymentMethodLogosViewTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = SupportedPaymentMethodLogosViewTests.swift; sourceTree = "<group>"; };
812B24862CDE56D90074A5D9 /* PayByBankUSComponent+ConfirmationViewController+Model.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PayByBankUSComponent+ConfirmationViewController+Model.swift"; sourceTree = "<group>"; };
813BF1102B2364E00096940E /* XCTestCase+FirstResponder.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "XCTestCase+FirstResponder.swift"; sourceTree = "<group>"; };
813EF9DD2A5DA0BC00C65D15 /* FormPickerItem.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormPickerItem.swift; sourceTree = "<group>"; };
813EF9E12A5DA2D400C65D15 /* FormPickerItemView.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormPickerItemView.swift; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1651,6 +1662,7 @@
81A6B4E22AD53E3300A089A1 /* OpenExternalAppDetector.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenExternalAppDetector.swift; sourceTree = "<group>"; };
81A6B4E52AD54F4F00A089A1 /* OpenExternalAppDetector+Mock.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "OpenExternalAppDetector+Mock.swift"; sourceTree = "<group>"; };
81A6B4EA2AD5546500A089A1 /* AdyenDependencies.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = AdyenDependencies.swift; sourceTree = "<group>"; };
81A741202C8B1E5700EB393D /* StoredPayByBankPaymentMethod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = StoredPayByBankPaymentMethod.swift; sourceTree = "<group>"; };
81A91AB62BEBEA21001E00C8 /* OpenExternalAppDetectorTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = OpenExternalAppDetectorTests.swift; sourceTree = "<group>"; };
81AA3B332ACD9CE800F5719D /* AddressLookupProvider.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AddressLookupProvider.swift; sourceTree = "<group>"; };
81AA3B352AD02EAE00F5719D /* AddressLookupSearchViewController+ViewModel.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "AddressLookupSearchViewController+ViewModel.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -1681,6 +1693,9 @@
81C4006F2A4347FD007EC51C /* FormErrorItemTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormErrorItemTests.swift; sourceTree = "<group>"; };
81C5D0CC2AC4170A002E918F /* IssuerListComponentExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssuerListComponentExample.swift; sourceTree = "<group>"; };
81C5D0CF2AC428CB002E918F /* IssuerListComponentAdvancedFlowExample.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = IssuerListComponentAdvancedFlowExample.swift; sourceTree = "<group>"; };
81D218672CC7D23400B7FC4C /* PayByBankUSPaymentMethod.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayByBankUSPaymentMethod.swift; sourceTree = "<group>"; };
81D2186C2CC7D57100B7FC4C /* PayByBankUSComponent.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = PayByBankUSComponent.swift; sourceTree = "<group>"; };
81D2186E2CC7D7F900B7FC4C /* PayByBankUSComponent+Configuration.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "PayByBankUSComponent+Configuration.swift"; sourceTree = "<group>"; };
81D7EC8F2CD24143005159F6 /* FormViewControllerTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = FormViewControllerTests.swift; sourceTree = "<group>"; };
81D8E2E82A5C06AC00BC12FD /* KeyboardObserverTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = KeyboardObserverTests.swift; sourceTree = "<group>"; };
81DA70802BDA5F66006CE5D5 /* PaymentMethods+Equatable.swift */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.swift; path = "PaymentMethods+Equatable.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -2868,6 +2883,7 @@
210CC97D2A5FC11900F8F672 /* Recovered References */ = {
isa = PBXGroup;
children = (
81A741202C8B1E5700EB393D /* StoredPayByBankPaymentMethod.swift */,
);
name = "Recovered References";
sourceTree = "<group>";
Expand Down Expand Up @@ -3134,6 +3150,26 @@
path = Address;
sourceTree = "<group>";
};
81D2186B2CC7D54F00B7FC4C /* PayByBank */ = {
isa = PBXGroup;
children = (
81D218702CC7D85900B7FC4C /* US */,
);
path = PayByBank;
sourceTree = "<group>";
};
81D218702CC7D85900B7FC4C /* US */ = {
isa = PBXGroup;
children = (
81D2186C2CC7D57100B7FC4C /* PayByBankUSComponent.swift */,
81272F172CC7E1CF00D8773A /* PayByBankUSComponent+ConfirmationViewController.swift */,
812B24862CDE56D90074A5D9 /* PayByBankUSComponent+ConfirmationViewController+Model.swift */,
81272F192CC8FD4600D8773A /* PayByBankUSComponent+Style.swift */,
81D2186E2CC7D7F900B7FC4C /* PayByBankUSComponent+Configuration.swift */,
);
path = US;
sourceTree = "<group>";
};
81DA70862BDA6075006CE5D5 /* Twint */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -3726,6 +3762,8 @@
E224088622AFA3A80058923E /* StoredInstantPaymentMethod.swift */,
F9D57529237C6084009C18B5 /* StoredBCMCPaymentMethod.swift */,
E71E8F3D257921D10054B03D /* StoredBLIKPaymentMethod.swift */,
812897752CC8FEC100275487 /* StoredPayByBankUSPaymentMethod.swift */,
81D218672CC7D23400B7FC4C /* PayByBankUSPaymentMethod.swift */,
E224088C22B0FD220058923E /* StoredPayPalPaymentMethod.swift */,
F9620D9E23C7457F005209FC /* WeChatPayPaymentMethod.swift */,
F926D52B23F59ABE00D058D3 /* QiwiWalletPaymentMethod.swift */,
Expand Down Expand Up @@ -4762,6 +4800,7 @@
children = (
F9175E57259393E800D653BE /* AdyenComponents.h */,
F9175E58259393E800D653BE /* Info.plist */,
81D2186B2CC7D54F00B7FC4C /* PayByBank */,
A0414C1B27888BF300DF3FE9 /* ACH Direct Debit */,
00EACBAA2872E8CA0082B360 /* OnlineBanking */,
C982FFD626945FCE00AED849 /* Affirm */,
Expand Down Expand Up @@ -6923,6 +6962,7 @@
F9354BE723A7B4E200A6760B /* TextStyle.swift in Sources */,
F9A6C41D26550B7100D8CD3E /* AlreadyPaidPaymentComponent.swift in Sources */,
F9D644E024D2E4210059CBE3 /* EmailValidator.swift in Sources */,
8128977C2CCA660A00275487 /* StoredPayByBankUSPaymentMethod.swift in Sources */,
F9639B3324DD96990073F38A /* PaymentStatusRequest.swift in Sources */,
A0DB48662AFD020400348C83 /* AnalyticsRequest.swift in Sources */,
5AD40E75262F04440090E01C /* UIProgressViewHelpers.swift in Sources */,
Expand Down Expand Up @@ -6992,6 +7032,7 @@
A0DE8F6D26CEA04500F2F1E8 /* Installments.swift in Sources */,
F939CD7725EE56BA00018DEC /* LoadingComponent.swift in Sources */,
E7806EBD26147AB700101DBB /* ViewControllerDelegate.swift in Sources */,
81D218682CC7D23A00B7FC4C /* PayByBankUSPaymentMethod.swift in Sources */,
E749FD1E23CF4998000D18BA /* NavigationStyle.swift in Sources */,
81A6B4EB2AD5546500A089A1 /* AdyenDependencies.swift in Sources */,
F9354BED23A7C34D00A6760B /* ButtonStyle.swift in Sources */,
Expand Down Expand Up @@ -7433,6 +7474,7 @@
F9175EAC259394FF00D653BE /* ApplePayComponent.swift in Sources */,
F97C838425BF053F00D7F85C /* DokuComponent.swift in Sources */,
C9D8EB9E27452D3B006D8CA1 /* BACSItemsFactory.swift in Sources */,
81D2186D2CC7D57700B7FC4C /* PayByBankUSComponent.swift in Sources */,
F9175ED32593951900D653BE /* MBWayDetails.swift in Sources */,
F9175EAB259394FF00D653BE /* ApplePayDetails.swift in Sources */,
F9175EE22593952600D653BE /* BLIKComponent.swift in Sources */,
Expand All @@ -7444,6 +7486,7 @@
F9175E8A259394E100D653BE /* SEPADirectDebitDetails.swift in Sources */,
F9175EAA259394FF00D653BE /* ApplePayComponentExtensions.swift in Sources */,
E746E67127B3FA700076BB71 /* InstantComponents.swift in Sources */,
81D2186F2CC7D7FE00B7FC4C /* PayByBankUSComponent+Configuration.swift in Sources */,
C982FFD826946F0800AED849 /* AffirmComponent.swift in Sources */,
002B92F5294B6987000B93F4 /* UPIComponentDetails.swift in Sources */,
E7D874F727E0E2DE00D3C00A /* ApplePayPayment.swift in Sources */,
Expand All @@ -7452,6 +7495,7 @@
F9175E9B259394F200D653BE /* IssuerListComponent.swift in Sources */,
A0414C21278C2AE400DF3FE9 /* ACHDirectDebitDetails.swift in Sources */,
00EACBAE2872EDEC0082B360 /* OnlineBankingDetails.swift in Sources */,
812B24872CDE56D90074A5D9 /* PayByBankUSComponent+ConfirmationViewController+Model.swift in Sources */,
C933801E276A06E1005B66CD /* BACSDirectDebitComponentTracker.swift in Sources */,
5A9889C8264E71210007F4C0 /* BoletoDetails.swift in Sources */,
C9F468E227465FCF00500FF5 /* BACSDirectDebitData.swift in Sources */,
Expand All @@ -7463,6 +7507,7 @@
5A54603F264A5CEC00724A87 /* BoletoComponent.swift in Sources */,
C93B01B72760B03400D311A1 /* BACSConfirmationViewController.swift in Sources */,
C9D8EB9927452355006D8CA1 /* BACSInputFormViewController.swift in Sources */,
81272F1A2CC8FD4600D8773A /* PayByBankUSComponent+Style.swift in Sources */,
C93B01B92760B06300D311A1 /* BACSConfirmationPresenter.swift in Sources */,
A0414C1D278C275C00DF3FE9 /* ACHDirectDebitComponent.swift in Sources */,
00EA4ED7280590050053D938 /* AtomeAddressViewModelBuilder.swift in Sources */,
Expand All @@ -7472,6 +7517,7 @@
8108315D2A4D8C7B0092FAF7 /* IssuerListEmptyView.swift in Sources */,
F9B016F92604F3FF001F23FC /* BasicPersonalInfoFormComponent.swift in Sources */,
C9D8EB9B2745282E006D8CA1 /* BACSInputPresenter.swift in Sources */,
81272F182CC7E1DD00D8773A /* PayByBankUSComponent+ConfirmationViewController.swift in Sources */,
F9175EC32593950D00D653BE /* QiwiWalletDetails.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down
8 changes: 8 additions & 0 deletions Adyen/Assets/Generated/LocalizationKey.swift
Original file line number Diff line number Diff line change
Expand Up @@ -356,6 +356,14 @@ public struct LocalizationKey {
public static let paybybankTitle = LocalizationKey(key: "adyen.paybybank.title")
/// Search…
public static let searchPlaceholder = LocalizationKey(key: "adyen.search.placeholder")
/// Use Pay by Bank to pay instantly from any bank account.
public static let payByBankAISDDDisclaimerHeader = LocalizationKey(key: "adyen.payByBankAISDD.disclaimer.header")
/// By connecting your bank account you are authorizing debits to your account for any amount owed for use of our services and/or purchase of our products, until this authorization is revoked.
public static let payByBankAISDDDisclaimerBody = LocalizationKey(key: "adyen.payByBankAISDD.disclaimer.body")
/// Continue to Pay by Bank
public static let payByBankAISDDSubmit = LocalizationKey(key: "adyen.payByBankAISDD.submit")
/// + more
public static let payByBankAISDDMore = LocalizationKey(key: "adyen.payByBankAISDD.more")
/// How would you like to use UPI?
public static let upiModeSelection = LocalizationKey(key: "adyen.upi.modeSelection")
/// Enter a correct virtual payment address
Expand Down
3 changes: 3 additions & 0 deletions Adyen/Core/Core Protocols/PaymentComponentBuilder.swift
Original file line number Diff line number Diff line change
Expand Up @@ -93,6 +93,9 @@ public protocol PaymentComponentBuilder: AdyenContextAware {

/// Builds a certain `PaymentComponent` based on a `StoredTwintPaymentMethod`.
func build(paymentMethod: StoredTwintPaymentMethod) -> PaymentComponent?

/// Builds a certain `PaymentComponent` based on a `PayByBankUSPaymentMethod`.
func build(paymentMethod: PayByBankUSPaymentMethod) -> PaymentComponent?

/// Builds a certain `PaymentComponent` based on any `PaymentMethod`, as a default case.
func build(paymentMethod: PaymentMethod) -> PaymentComponent?
Expand Down
6 changes: 5 additions & 1 deletion Adyen/Core/Payment Methods/Abstract/AnyPaymentMethod.swift
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,7 @@ internal enum AnyPaymentMethod: Codable {
case storedPayPal(StoredPayPalPaymentMethod)
case storedBCMC(StoredBCMCPaymentMethod)
case storedBlik(StoredBLIKPaymentMethod)
case storedPayByBankUS(StoredPayByBankUSPaymentMethod)
case storedAchDirectDebit(StoredACHDirectDebitPaymentMethod)
case storedCashAppPay(StoredCashAppPayPaymentMethod)
case storedTwint(StoredTwintPaymentMethod)
Expand Down Expand Up @@ -41,6 +42,7 @@ internal enum AnyPaymentMethod: Codable {
case upi(UPIPaymentMethod)
case cashAppPay(CashAppPayPaymentMethod)
case twint(TwintPaymentMethod)
case payByBankUS(PayByBankUSPaymentMethod)

case none

Expand Down Expand Up @@ -79,12 +81,14 @@ internal enum AnyPaymentMethod: Codable {
case let .upi(paymentMethod): return paymentMethod
case let .cashAppPay(paymentMethod): return paymentMethod
case let .twint(paymentMethod): return paymentMethod
case let .storedPayByBankUS(paymentMethod): return paymentMethod
case let .payByBankUS(paymentMethod): return paymentMethod
case .none: return nil
}
}

// MARK: - Decoding

internal init(from decoder: Decoder) throws {
self = AnyPaymentMethodDecoder.decode(from: decoder)
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -86,7 +86,8 @@ internal enum AnyPaymentMethodDecoder {
.onlineBankingSK: OnlineBankingPaymentMethodDecoder(),
.upi: UPIPaymentMethodDecoder(),
.cashAppPay: CashAppPayPaymentMethodDecoder(),
.twint: TwintPaymentMethodDecoder()
.twint: TwintPaymentMethodDecoder(),
.payByBankAISDD: PayByBankUSPaymentMethodDecoder()
]

private static var defaultDecoder: PaymentMethodDecoder = InstantPaymentMethodDecoder()
Expand Down Expand Up @@ -341,6 +342,26 @@ private struct BLIKPaymentMethodDecoder: PaymentMethodDecoder {
}
}

private struct PayByBankUSPaymentMethodDecoder: PaymentMethodDecoder {
func decode(from decoder: Decoder, isStored: Bool) throws -> AnyPaymentMethod {
if isStored {
return try .storedPayByBankUS(.init(from: decoder))
} else {
return try .payByBankUS(.init(from: decoder))
}
}

func anyPaymentMethod(from paymentMethod: any PaymentMethod) -> AnyPaymentMethod? {
if let method = paymentMethod as? StoredPayByBankUSPaymentMethod {
return .storedPayByBankUS(method)
}
if let method = paymentMethod as? PayByBankUSPaymentMethod {
return .payByBankUS(method)
}
return nil
}
}

private struct DokuPaymentMethodDecoder: PaymentMethodDecoder {
func decode(from decoder: Decoder, isStored: Bool) throws -> AnyPaymentMethod {
try .doku(DokuPaymentMethod(from: decoder))
Expand Down
Loading
Loading