From d1b9bc173b30e732b6ce1e4e39b21e8428d0ff96 Mon Sep 17 00:00:00 2001 From: Alex Guretzki Date: Mon, 28 Oct 2024 11:20:02 +0100 Subject: [PATCH] Some refactoring --- Adyen/Assets/Generated/LocalizationKey.swift | 8 ++++++++ .../PayByBankUSPaymentMethod.swift | 2 +- .../StoredPayByBankUSPaymentMethod.swift | 2 +- AdyenCard/Form/FormCardLogosItemView.swift | 4 ++-- ...nkUSComponent+ConfirmationViewController.swift | 15 +++++---------- .../PayByBank/US/PayByBankUSComponent.swift | 3 ++- 6 files changed, 19 insertions(+), 15 deletions(-) diff --git a/Adyen/Assets/Generated/LocalizationKey.swift b/Adyen/Assets/Generated/LocalizationKey.swift index 86586005f5..2ef2e40f3c 100644 --- a/Adyen/Assets/Generated/LocalizationKey.swift +++ b/Adyen/Assets/Generated/LocalizationKey.swift @@ -473,6 +473,14 @@ public struct LocalizationKey { /// Last 4 digits public static let accessibilityLastFourDigits = LocalizationKey(key: "adyen.accessibility.lastFourDigits") + public static let payByBankConfirmationSheetTitle = LocalizationKey(key: "adyen.payByBank.confirmationSheet.title") + + public static let payByBankConfirmationSheetSubtitle = LocalizationKey(key: "adyen.payByBank.confirmationSheet.subtitle") + + public static let payByBankConfirmationSheetMessage = LocalizationKey(key: "adyen.payByBank.confirmationSheet.message") + + public static let payByBankConfirmationSheetButtonTitle = LocalizationKey(key: "adyen.payByBank.confirmationSheet.buttonTitle") + internal let key: String /// :nodoc: diff --git a/Adyen/Core/Payment Methods/PayByBankUSPaymentMethod.swift b/Adyen/Core/Payment Methods/PayByBankUSPaymentMethod.swift index 1f1d3c957c..22e3425565 100644 --- a/Adyen/Core/Payment Methods/PayByBankUSPaymentMethod.swift +++ b/Adyen/Core/Payment Methods/PayByBankUSPaymentMethod.swift @@ -6,7 +6,7 @@ import Foundation -/// PayByBank US payment. +/// PayByBank US payment method. public struct PayByBankUSPaymentMethod: PaymentMethod { public let type: PaymentMethodType diff --git a/Adyen/Core/Payment Methods/StoredPayByBankUSPaymentMethod.swift b/Adyen/Core/Payment Methods/StoredPayByBankUSPaymentMethod.swift index 58465835db..42b1cb602a 100644 --- a/Adyen/Core/Payment Methods/StoredPayByBankUSPaymentMethod.swift +++ b/Adyen/Core/Payment Methods/StoredPayByBankUSPaymentMethod.swift @@ -6,7 +6,7 @@ import Foundation -/// Stored PayByBank US payment. +/// Stored PayByBank US payment method. public struct StoredPayByBankUSPaymentMethod: StoredPaymentMethod { public let type: PaymentMethodType diff --git a/AdyenCard/Form/FormCardLogosItemView.swift b/AdyenCard/Form/FormCardLogosItemView.swift index b675125d49..0b4d8ed163 100644 --- a/AdyenCard/Form/FormCardLogosItemView.swift +++ b/AdyenCard/Form/FormCardLogosItemView.swift @@ -36,11 +36,11 @@ internal final class FormCardLogosItemView: FormItemView, UIC collectionView.dataSource = self } - func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { + public func collectionView(_ collectionView: UICollectionView, numberOfItemsInSection section: Int) -> Int { item.cardLogos.count } - func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { + public func collectionView(_ collectionView: UICollectionView, cellForItemAt indexPath: IndexPath) -> UICollectionViewCell { let cell = collectionView.dequeueReusableCell(withReuseIdentifier: CardLogoCell.reuseIdentifier, for: indexPath) if let cell = cell as? CardLogoCell, let logo = item.cardLogos.adyen[safeIndex: indexPath.row] { cell.update( diff --git a/AdyenComponents/PayByBank/US/PayByBankUSComponent+ConfirmationViewController.swift b/AdyenComponents/PayByBank/US/PayByBankUSComponent+ConfirmationViewController.swift index b7389a32b3..3bfb81a7cd 100644 --- a/AdyenComponents/PayByBank/US/PayByBankUSComponent+ConfirmationViewController.swift +++ b/AdyenComponents/PayByBank/US/PayByBankUSComponent+ConfirmationViewController.swift @@ -164,19 +164,14 @@ extension PayByBankUSComponent.ConfirmationViewController { internal init( headerImageUrl: URL, style: PayByBankUSComponent.Style, + localizationParameters: LocalizationParameters?, continueHandler: @escaping () -> Void ) { - let message: [String] = [ - "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." - ] - self.headerImageUrl = headerImageUrl - self.title = "Pay by Bank" - self.subtitle = "Use Pay by Bank to pay instantly from any bank account." - self.message = message.joined(separator: " ") - self.submitTitle = "Continue to Pay by Bank" + self.title = localizedString(.payByBankConfirmationSheetTitle, localizationParameters) + self.subtitle = localizedString(.payByBankConfirmationSheetSubtitle, localizationParameters) + self.message = localizedString(.payByBankConfirmationSheetMessage, localizationParameters) + self.submitTitle = localizedString(.payByBankConfirmationSheetButtonTitle, localizationParameters) self.style = style self.continueHandler = continueHandler } diff --git a/AdyenComponents/PayByBank/US/PayByBankUSComponent.swift b/AdyenComponents/PayByBank/US/PayByBankUSComponent.swift index fc096d8b13..b9e93e49cc 100644 --- a/AdyenComponents/PayByBank/US/PayByBankUSComponent.swift +++ b/AdyenComponents/PayByBank/US/PayByBankUSComponent.swift @@ -5,8 +5,8 @@ // @_spi(AdyenInternal) import Adyen -import UIKit import Foundation +import UIKit /// A component that handles a Twint payment. public final class PayByBankUSComponent: PaymentComponent, PresentableComponent { @@ -51,6 +51,7 @@ public final class PayByBankUSComponent: PaymentComponent, PresentableComponent return .init(model: .init( headerImageUrl: headerImageUrl, style: configuration.style, + localizationParameters: configuration.localizationParameters, continueHandler: { [weak self] in self?.initiatePayment() }