From 106910c76fff8336a464a12e424196837f415599 Mon Sep 17 00:00:00 2001 From: mohammedDehairy Date: Wed, 5 May 2021 10:35:40 +0000 Subject: [PATCH 1/2] chore: format project --- .../StoredPaymentMethodComponent.swift | 6 +-- Adyen/Formatters/NumericFormatter.swift | 2 +- Adyen/Helpers/UIButtonHelpers.swift | 2 +- Adyen/Helpers/UILabelHelpers.swift | 2 +- Adyen/Helpers/UIProgressViewHelpers.swift | 2 +- .../Form/Items/Text/FormTextInputItem.swift | 2 +- .../Abstract/BasePickerInputControl.swift | 2 +- .../View Controllers/ADYViewController.swift | 5 +- Adyen/Utilities/Localization.swift | 8 +-- AdyenActions/Actions/Action.swift | 2 +- .../UI/UI Style/QRCodeComponentStyle.swift | 2 +- .../View Controllers/QR Code/QRCodeView.swift | 4 +- .../Voucher/GenericVoucherViewModel.swift | 12 +++-- .../Components/Card/CardViewController.swift | 4 +- .../Stored Card/StoredCardAlertManager.swift | 4 +- AdyenComponents/BLIK/BLIKComponent.swift | 4 +- .../SEPADirectDebitComponent.swift | 4 +- .../PaymentMethodListComponent.swift | 2 +- .../Components/PreApplePayComponent.swift | 8 +-- .../PreselectedPaymentMethodComponent.swift | 4 +- AdyenDropIn/Utilities/ComponentManager.swift | 3 +- AdyenDropIn/Views/PreApplePayView.swift | 4 +- AdyenEncryption/CardEncryptor.swift | 10 ++-- Demo/Common/Models/ComponentsItem.swift | 2 +- Demo/UIKit/ComponentsView.swift | 2 +- Scripts/generate_localization_keys.swift | 50 ++++++++++--------- .../Apple Pay/PreApplePayComponentTests.swift | 11 ++-- .../Await Component/AwaitComponentTests.swift | 3 +- .../Components/PIX/QRCodeComponentTests.swift | 12 +++-- .../QiwiWalletComponentTests.swift | 2 +- .../Redirect Tests/RedirectListnerTests.swift | 2 +- .../BasicPersonalInfoFormComponentTests.swift | 2 +- .../Components/XCTestCaseExtension.swift | 2 +- .../Items/Error Item/FormErrorItemTests.swift | 2 +- .../Items/Text/FormTextItemViewTests.swift | 2 +- .../Adyen Tests/Utilities/AssertsTests.swift | 18 +++---- .../Utilities/ComponentManagerTests.swift | 6 +-- .../Utilities/ObservableTests.swift | 1 - .../Utilities/RegionRepositoryTest.swift | 18 +++---- .../Card Tests/BCMCComponentTests.swift | 2 +- .../Card Tests/CardComponentTests.swift | 6 +-- .../Card Tests/CardDetailsTests.swift | 3 +- 42 files changed, 129 insertions(+), 115 deletions(-) diff --git a/Adyen/Components/Stored Payment Method/StoredPaymentMethodComponent.swift b/Adyen/Components/Stored Payment Method/StoredPaymentMethodComponent.swift index b8af2d0724..fe6dd4e3ec 100644 --- a/Adyen/Components/Stored Payment Method/StoredPaymentMethodComponent.swift +++ b/Adyen/Components/Stored Payment Method/StoredPaymentMethodComponent.swift @@ -31,7 +31,7 @@ public final class StoredPaymentMethodComponent: PaymentComponent, PresentableCo let displayInformation = storedPaymentMethod.localizedDisplayInformation(using: localizationParameters) let alertController = UIAlertController(title: localizedString(.dropInStoredTitle, - localizationParameters, storedPaymentMethod.name), + localizationParameters, storedPaymentMethod.name), message: displayInformation.title, preferredStyle: .alert) @@ -41,8 +41,8 @@ public final class StoredPaymentMethodComponent: PaymentComponent, PresentableCo alertController.addAction(cancelAction) let submitActionTitle = localizedSubmitButtonTitle(with: payment?.amount, - style: .immediate, - localizationParameters) + style: .immediate, + localizationParameters) let submitAction = UIAlertAction(title: submitActionTitle, style: .default) { _ in let details = StoredPaymentDetails(paymentMethod: self.storedPaymentMethod) self.submit(data: PaymentComponentData(paymentMethodDetails: details)) diff --git a/Adyen/Formatters/NumericFormatter.swift b/Adyen/Formatters/NumericFormatter.swift index b97c2db54e..267e84b024 100644 --- a/Adyen/Formatters/NumericFormatter.swift +++ b/Adyen/Formatters/NumericFormatter.swift @@ -19,7 +19,7 @@ open class NumericFormatter: Adyen.Formatter { /// :nodoc: open func sanitizedValue(for value: String) -> String { - let sanitizedString = value.filter { $0.isNumber } + let sanitizedString = value.filter(\.isNumber) // Converts all non-latin digits to latin digits let latinString = sanitizedString.applyingTransform(StringTransform.toLatin, reverse: false) ?? sanitizedString diff --git a/Adyen/Helpers/UIButtonHelpers.swift b/Adyen/Helpers/UIButtonHelpers.swift index e5be6bd5b6..ba83878ebe 100644 --- a/Adyen/Helpers/UIButtonHelpers.swift +++ b/Adyen/Helpers/UIButtonHelpers.swift @@ -12,7 +12,7 @@ extension UIButton { /// Sets `translatesAutoresizingMaskIntoConstraints` to `false` /// Sets `adjustsFontForContentSizeCategory` to the `titleLabel` to `true` /// - Parameter style: `ButtonStyle` to be applied - convenience public init(style: ButtonStyle) { + public convenience init(style: ButtonStyle) { self.init() translatesAutoresizingMaskIntoConstraints = false adyen.apply(style) diff --git a/Adyen/Helpers/UILabelHelpers.swift b/Adyen/Helpers/UILabelHelpers.swift index b4a4b967bb..000afbda3f 100644 --- a/Adyen/Helpers/UILabelHelpers.swift +++ b/Adyen/Helpers/UILabelHelpers.swift @@ -12,7 +12,7 @@ extension UILabel { /// Sets `translatesAutoresizingMaskIntoConstraints` to `false` /// Sets `adjustsFontForContentSizeCategory` to `true` /// - Parameter style: `TextStyle` to be applied - convenience public init(style: TextStyle) { + public convenience init(style: TextStyle) { self.init() translatesAutoresizingMaskIntoConstraints = false adyen.apply(style) diff --git a/Adyen/Helpers/UIProgressViewHelpers.swift b/Adyen/Helpers/UIProgressViewHelpers.swift index c0ff3e6da9..1eeb960c12 100644 --- a/Adyen/Helpers/UIProgressViewHelpers.swift +++ b/Adyen/Helpers/UIProgressViewHelpers.swift @@ -7,7 +7,7 @@ import UIKit extension UIProgressView { - convenience public init(style: ProgressViewStyle) { + public convenience init(style: ProgressViewStyle) { self.init() backgroundColor = style.backgroundColor diff --git a/Adyen/UI/Form/Items/Text/FormTextInputItem.swift b/Adyen/UI/Form/Items/Text/FormTextInputItem.swift index 8975420089..7530414fdb 100644 --- a/Adyen/UI/Form/Items/Text/FormTextInputItem.swift +++ b/Adyen/UI/Form/Items/Text/FormTextInputItem.swift @@ -11,7 +11,7 @@ import Foundation public final class FormTextInputItem: FormTextItem { /// :nodoc: - public override init(style: FormTextItemStyle = .init()) { + override public init(style: FormTextItemStyle = .init()) { super.init(style: style) } diff --git a/Adyen/UI/Form/Items/Value Pickers/Abstract/BasePickerInputControl.swift b/Adyen/UI/Form/Items/Value Pickers/Abstract/BasePickerInputControl.swift index 84b5baf9e6..38c2fdd0a4 100644 --- a/Adyen/UI/Form/Items/Value Pickers/Abstract/BasePickerInputControl.swift +++ b/Adyen/UI/Form/Items/Value Pickers/Abstract/BasePickerInputControl.swift @@ -61,7 +61,7 @@ internal class BasePickerInputControl: UIControl, PickerTextInputControl { } /// The phone code label. - internal lazy var valueLabel: UILabel = UILabel(style: style) + internal lazy var valueLabel = UILabel(style: style) override internal var accessibilityIdentifier: String? { didSet { diff --git a/Adyen/UI/View Controllers/ADYViewController.swift b/Adyen/UI/View Controllers/ADYViewController.swift index e7ecd6cf2f..347f4bf88a 100644 --- a/Adyen/UI/View Controllers/ADYViewController.swift +++ b/Adyen/UI/View Controllers/ADYViewController.swift @@ -8,7 +8,7 @@ import UIKit /// :nodoc: /// `ADYViewController` serves as a height-aware `UIViewController` -final public class ADYViewController: UIViewController { +public final class ADYViewController: UIViewController { /// :nodoc: private let contentView: UIView @@ -39,7 +39,8 @@ final public class ADYViewController: UIViewController { return view.systemLayoutSizeFitting( targetSize, withHorizontalFittingPriority: .required, - verticalFittingPriority: .fittingSizeLevel) + verticalFittingPriority: .fittingSizeLevel + ) } // swiftlint:disable:next unused_setter_value diff --git a/Adyen/Utilities/Localization.swift b/Adyen/Utilities/Localization.swift index a4db5fe2b3..040478fdee 100644 --- a/Adyen/Utilities/Localization.swift +++ b/Adyen/Utilities/Localization.swift @@ -44,12 +44,12 @@ public func localizedString(_ key: LocalizationKey, _ parameters: LocalizationPa private func fallbackLocalizedString(key: String) -> String { let localizedFallback = NSLocalizedString(key, tableName: nil, bundle: Bundle.coreInternalResources, comment: "") - if localizedFallback != key && localizedFallback.isEmpty == false { + if localizedFallback != key, localizedFallback.isEmpty == false { return localizedFallback } else { - // Fallback to en-US + // Fallback to en-US return Bundle.coreInternalResources.path(forResource: "en-US", ofType: "lproj") - .flatMap(Bundle.init(path: )) + .flatMap(Bundle.init(path:)) .map { NSLocalizedString(key, tableName: nil, bundle: $0, comment: "") } ?? key } } @@ -118,7 +118,7 @@ public func localizedSubmitButtonTitle(with amount: Payment.Amount?, _ parameters: LocalizationParameters?) -> String { if let amount = amount, amount.value == 0 { return localizedZeroPaymentAuthorisationButtonTitle(style: style, - parameters) + parameters) } guard let formattedAmount = amount?.formatted else { return localizedString(.submitButton, parameters) diff --git a/AdyenActions/Actions/Action.swift b/AdyenActions/Actions/Action.swift index 34d6da05f7..9e70a34ea4 100644 --- a/AdyenActions/Actions/Action.swift +++ b/AdyenActions/Actions/Action.swift @@ -79,7 +79,7 @@ public enum Action: Decodable { case sdk case qrCode case await - case voucher + case voucher } private enum CodingKeys: String, CodingKey { diff --git a/AdyenActions/UI/UI Style/QRCodeComponentStyle.swift b/AdyenActions/UI/UI Style/QRCodeComponentStyle.swift index 5481b067f7..94ea2868a4 100644 --- a/AdyenActions/UI/UI Style/QRCodeComponentStyle.swift +++ b/AdyenActions/UI/UI Style/QRCodeComponentStyle.swift @@ -33,7 +33,7 @@ public struct QRCodeComponentStyle: ViewStyle { public var logoCornerRounding: CornerRounding = .fixed(5) /// :nodoc: - public var backgroundColor: UIColor = UIColor.Adyen.componentBackground + public var backgroundColor = UIColor.Adyen.componentBackground /// Initializes the QR code component style with the default style public init() {} diff --git a/AdyenActions/UI/View Controllers/QR Code/QRCodeView.swift b/AdyenActions/UI/View Controllers/QR Code/QRCodeView.swift index 66d5bc76dd..a6b98f1e76 100644 --- a/AdyenActions/UI/View Controllers/QR Code/QRCodeView.swift +++ b/AdyenActions/UI/View Controllers/QR Code/QRCodeView.swift @@ -7,7 +7,7 @@ import Adyen import UIKit -internal protocol QRCodeViewDelegate: class { +internal protocol QRCodeViewDelegate: AnyObject { func copyToPasteboard() } @@ -44,7 +44,7 @@ internal final class QRCodeView: UIView, Localizable, Observer { addCopyButton() } - internal override func layoutSubviews() { + override internal func layoutSubviews() { super.layoutSubviews() copyButton.adyen.round(using: model.style.copyButton.cornerRounding) diff --git a/AdyenActions/UI/View Controllers/Voucher/GenericVoucherViewModel.swift b/AdyenActions/UI/View Controllers/Voucher/GenericVoucherViewModel.swift index cb8af94239..8a903a6fea 100644 --- a/AdyenActions/UI/View Controllers/Voucher/GenericVoucherViewModel.swift +++ b/AdyenActions/UI/View Controllers/Voucher/GenericVoucherViewModel.swift @@ -61,22 +61,26 @@ extension GenericVoucherView { internal var text = TextStyle( font: .preferredFont(forTextStyle: .footnote), color: UIColor.Adyen.componentLabel, - textAlignment: .center) + textAlignment: .center + ) internal var amount = TextStyle( font: UIFont.preferredFont(forTextStyle: .callout).adyen.font(with: .bold), color: UIColor.Adyen.componentLabel, - textAlignment: .center) + textAlignment: .center + ) internal var codeText = TextStyle( font: UIFont.preferredFont(forTextStyle: .title1).adyen.font(with: .bold), color: UIColor.Adyen.componentLabel, - textAlignment: .center) + textAlignment: .center + ) internal var fieldValueText = TextStyle( font: UIFont.preferredFont(forTextStyle: .footnote).adyen.font(with: .semibold), color: UIColor.Adyen.componentLabel, - textAlignment: .center) + textAlignment: .center + ) internal var mainButton: ButtonStyle diff --git a/AdyenCard/Components/Card/CardViewController.swift b/AdyenCard/Components/Card/CardViewController.swift index af4f4578a8..6cbe4e52f2 100644 --- a/AdyenCard/Components/Card/CardViewController.swift +++ b/AdyenCard/Components/Card/CardViewController.swift @@ -215,8 +215,8 @@ internal class CardViewController: FormViewController { let item = FormButtonItem(style: formStyle.mainButtonItem) item.identifier = ViewIdentifierBuilder.build(scopeInstance: scope, postfix: "payButtonItem") item.title = localizedSubmitButtonTitle(with: payment?.amount, - style: .immediate, - localizationParameters) + style: .immediate, + localizationParameters) item.buttonSelectionHandler = { [weak self] in self?.cardDelegate?.didSelectSubmitButton() } diff --git a/AdyenCard/Components/Stored Card/StoredCardAlertManager.swift b/AdyenCard/Components/Stored Card/StoredCardAlertManager.swift index f72f3aa59b..e68b6d82f4 100644 --- a/AdyenCard/Components/Stored Card/StoredCardAlertManager.swift +++ b/AdyenCard/Components/Stored Card/StoredCardAlertManager.swift @@ -85,8 +85,8 @@ internal final class StoredCardAlertManager: NSObject, UITextFieldDelegate, Loca private lazy var submitAction: UIAlertAction = { let actionTitle = localizedSubmitButtonTitle(with: amount, - style: .immediate, - localizationParameters) + style: .immediate, + localizationParameters) let action = UIAlertAction(title: actionTitle, style: .default) { [unowned self] _ in self.submit() } diff --git a/AdyenComponents/BLIK/BLIKComponent.swift b/AdyenComponents/BLIK/BLIKComponent.swift index 8c40503e64..cc15aa1ff9 100644 --- a/AdyenComponents/BLIK/BLIKComponent.swift +++ b/AdyenComponents/BLIK/BLIKComponent.swift @@ -85,8 +85,8 @@ public final class BLIKComponent: PaymentComponent, PresentableComponent, Locali let item = FormButtonItem(style: style.mainButtonItem) item.identifier = ViewIdentifierBuilder.build(scopeInstance: self, postfix: "payButtonItem") item.title = localizedSubmitButtonTitle(with: payment?.amount, - style: .immediate, - localizationParameters) + style: .immediate, + localizationParameters) item.buttonSelectionHandler = { [weak self] in self?.didSelectSubmitButton() } diff --git a/AdyenComponents/SEPA Direct Debit/SEPADirectDebitComponent.swift b/AdyenComponents/SEPA Direct Debit/SEPADirectDebitComponent.swift index ce241fcb00..6c9f0ea46d 100644 --- a/AdyenComponents/SEPA Direct Debit/SEPADirectDebitComponent.swift +++ b/AdyenComponents/SEPA Direct Debit/SEPADirectDebitComponent.swift @@ -119,8 +119,8 @@ public final class SEPADirectDebitComponent: PaymentComponent, PresentableCompon let item = FormButtonItem(style: style.mainButtonItem) item.identifier = ViewIdentifierBuilder.build(scopeInstance: self, postfix: "payButtonItem") item.title = localizedSubmitButtonTitle(with: payment?.amount, - style: .immediate, - localizationParameters) + style: .immediate, + localizationParameters) item.buttonSelectionHandler = { [weak self] in self?.didSelectSubmitButton() } diff --git a/AdyenDropIn/Components/PaymentMethodListComponent.swift b/AdyenDropIn/Components/PaymentMethodListComponent.swift index ee666bdc57..d1c34c46e7 100644 --- a/AdyenDropIn/Components/PaymentMethodListComponent.swift +++ b/AdyenDropIn/Components/PaymentMethodListComponent.swift @@ -58,7 +58,7 @@ internal final class PaymentMethodListComponent: ComponentLoader, PresentableCom let storedSection = ListSection(items: components.stored.map(item(for:))) let regularSectionTitle = components.stored.isEmpty ? nil : localizedString(.paymentMethodsOtherMethods, - localizationParameters) + localizationParameters) let regularSection = ListSection(title: regularSectionTitle, items: components.regular.map(item(for:))) diff --git a/AdyenDropIn/Components/PreApplePayComponent.swift b/AdyenDropIn/Components/PreApplePayComponent.swift index f80e6a6e3c..5c029cd78b 100644 --- a/AdyenDropIn/Components/PreApplePayComponent.swift +++ b/AdyenDropIn/Components/PreApplePayComponent.swift @@ -4,8 +4,8 @@ // This file is open source and available under the MIT license. See the LICENSE file for more info. // -import UIKit import Adyen +import UIKit #if canImport(AdyenComponents) import AdyenComponents #endif @@ -47,7 +47,7 @@ internal final class PreApplePayComponent: Localizable, PresentableComponent, Fi internal let requiresModalPresentation: Bool = true /// :nodoc: - internal init (configuration: ApplePayComponent.Configuration) throws { + internal init(configuration: ApplePayComponent.Configuration) throws { self._payment = configuration.payment self.paymentMethod = configuration.paymentMethod @@ -66,7 +66,9 @@ internal final class PreApplePayComponent: Localizable, PresentableComponent, Fi hint: amount.formatted, style: PreApplePayView.Model.Style( hintLabel: TextStyle(font: .preferredFont(forTextStyle: .footnote), color: UIColor.Adyen.componentSecondaryLabel), - backgroundColor: UIColor.Adyen.componentBackground)) + backgroundColor: UIColor.Adyen.componentBackground + ) + ) } } diff --git a/AdyenDropIn/Components/PreselectedPaymentMethodComponent.swift b/AdyenDropIn/Components/PreselectedPaymentMethodComponent.swift index c97b0d48c6..cbbcf11880 100644 --- a/AdyenDropIn/Components/PreselectedPaymentMethodComponent.swift +++ b/AdyenDropIn/Components/PreselectedPaymentMethodComponent.swift @@ -85,8 +85,8 @@ internal final class PreselectedPaymentMethodComponent: ComponentLoader, private lazy var submitButtonItem: FormButtonItem = { let item = FormButtonItem(style: style.mainButtonItem) item.title = localizedSubmitButtonTitle(with: payment?.amount, - style: .immediate, - localizationParameters) + style: .immediate, + localizationParameters) item.identifier = ViewIdentifierBuilder.build(scopeInstance: self, postfix: "submitButton") let component = self.defaultComponent item.buttonSelectionHandler = { [weak self] in diff --git a/AdyenDropIn/Utilities/ComponentManager.swift b/AdyenDropIn/Utilities/ComponentManager.swift index 33a98255ee..af23b37d1e 100644 --- a/AdyenDropIn/Utilities/ComponentManager.swift +++ b/AdyenDropIn/Utilities/ComponentManager.swift @@ -121,7 +121,8 @@ internal final class ComponentManager { summaryItems: applePay.summaryItems, merchantIdentifier: applePay.merchantIdentifier, requiredBillingContactFields: applePay.requiredBillingContactFields, - requiredShippingContactFields: applePay.requiredShippingContactFields) + requiredShippingContactFields: applePay.requiredShippingContactFields + ) do { return try PreApplePayComponent(configuration: configuration) diff --git a/AdyenDropIn/Views/PreApplePayView.swift b/AdyenDropIn/Views/PreApplePayView.swift index 1ed1ad0348..3449626223 100644 --- a/AdyenDropIn/Views/PreApplePayView.swift +++ b/AdyenDropIn/Views/PreApplePayView.swift @@ -4,12 +4,12 @@ // This file is open source and available under the MIT license. See the LICENSE file for more info. // -import UIKit import Adyen import PassKit +import UIKit /// :nodoc -internal protocol PreApplePayViewDelegate: class { +internal protocol PreApplePayViewDelegate: AnyObject { func pay() diff --git a/AdyenEncryption/CardEncryptor.swift b/AdyenEncryption/CardEncryptor.swift index ee71243b8c..abcc049104 100644 --- a/AdyenEncryption/CardEncryptor.swift +++ b/AdyenEncryption/CardEncryptor.swift @@ -59,7 +59,7 @@ public enum CardEncryptor { /// - Throws: `CardEncryptor.Error.invalidEncryptionArguments` when trying to encrypt a card with card number, securityCode, /// expiryMonth, and expiryYear, all of them are nil. public static func encrypt(number: String, with publicKey: String) throws -> String { - guard !number.isEmpty, number.allSatisfy({ $0.isNumber }) else { + guard !number.isEmpty, number.allSatisfy(\.isNumber) else { throw Error.invalidNumber } let payload = CardPayload().add(number: number) @@ -77,7 +77,7 @@ public enum CardEncryptor { /// - Throws: `CardEncryptor.Error.invalidEncryptionArguments` when trying to encrypt a card with card number, securityCode, /// expiryMonth, and expiryYear, all of them are nil. public static func encrypt(securityCode: String, with publicKey: String) throws -> String { - guard !securityCode.isEmpty, securityCode.allSatisfy({ $0.isNumber }) else { + guard !securityCode.isEmpty, securityCode.allSatisfy(\.isNumber) else { throw Error.invalidSecureCode } let payload = CardPayload().add(securityCode: securityCode) @@ -95,7 +95,7 @@ public enum CardEncryptor { /// - Throws: `CardEncryptor.Error.invalidEncryptionArguments` when trying to encrypt a card with card number, securityCode, /// expiryMonth, and expiryYear, all of them are nil. public static func encrypt(expirationMonth: String, with publicKey: String) throws -> String { - guard !expirationMonth.isEmpty, expirationMonth.allSatisfy({ $0.isNumber }) else { + guard !expirationMonth.isEmpty, expirationMonth.allSatisfy(\.isNumber) else { throw Error.invalidExpiryMonth } let payload = CardPayload().add(expiryMonth: expirationMonth) @@ -113,7 +113,7 @@ public enum CardEncryptor { /// - Throws: `CardEncryptor.Error.invalidEncryptionArguments` when trying to encrypt a card with card number, securityCode, /// expiryMonth, and expiryYear, all of them are nil. public static func encrypt(expirationYear: String, with publicKey: String) throws -> String { - guard !expirationYear.isEmpty, expirationYear.allSatisfy({ $0.isNumber }) else { + guard !expirationYear.isEmpty, expirationYear.allSatisfy(\.isNumber) else { throw Error.invalidExpiryYear } let payload = CardPayload().add(expiryYear: expirationYear) @@ -130,7 +130,7 @@ public enum CardEncryptor { /// - Throws: `CardEncryptor.Error.invalidEncryptionArguments` when trying to encrypt a card with card number, securityCode, /// expiryMonth, and expiryYear, all of them are nil. public static func encrypt(bin: String, with publicKey: String) throws -> String { - guard !bin.isEmpty, bin.allSatisfy({ $0.isNumber }) else { + guard !bin.isEmpty, bin.allSatisfy(\.isNumber) else { throw Error.invalidBin } let payload = BinPayload().add(bin: bin) diff --git a/Demo/Common/Models/ComponentsItem.swift b/Demo/Common/Models/ComponentsItem.swift index 5dc06f16f3..5b6b8bd6ce 100644 --- a/Demo/Common/Models/ComponentsItem.swift +++ b/Demo/Common/Models/ComponentsItem.swift @@ -12,7 +12,7 @@ internal struct ComponentsItem: Hashable { internal var isApplePay: Bool { title == "Apple Pay" } - internal let selectionHandler: (() -> Void) + internal let selectionHandler: () -> Void internal init(title: String, selectionHandler: @escaping (() -> Void)) { self.title = title diff --git a/Demo/UIKit/ComponentsView.swift b/Demo/UIKit/ComponentsView.swift index 2c8682276c..01eca967a7 100644 --- a/Demo/UIKit/ComponentsView.swift +++ b/Demo/UIKit/ComponentsView.swift @@ -4,8 +4,8 @@ // This file is open source and available under the MIT license. See the LICENSE file for more info. // -import UIKit import PassKit +import UIKit internal final class ComponentsView: UIView { diff --git a/Scripts/generate_localization_keys.swift b/Scripts/generate_localization_keys.swift index 83473c849c..00df9244ce 100755 --- a/Scripts/generate_localization_keys.swift +++ b/Scripts/generate_localization_keys.swift @@ -4,32 +4,32 @@ import Foundation if CommandLine.arguments[1] == "--help" || CommandLine.arguments[1] == "-h" { print( -""" -OVERVIEW: Generates localization keys as constants. + """ + OVERVIEW: Generates localization keys as constants. -USAGE: ./generate_localization_keys.swift + USAGE: ./generate_localization_keys.swift -ARGUMENTS: - Relative path to Localizable.strings. - Relative path to the result swift file. + ARGUMENTS: + Relative path to Localizable.strings. + Relative path to the result swift file. -OPTIONS: - -h, --help Show help information. -""" + OPTIONS: + -h, --help Show help information. + """ ) exit(0) } let header = -""" -// -// Copyright (c) 2021 Adyen N.V. -// -// This file is open source and available under the MIT license. See the LICENSE file for more info. -// This file is autogenerated. Please do not modify it. + """ + // + // Copyright (c) 2021 Adyen N.V. + // + // This file is open source and available under the MIT license. See the LICENSE file for more info. + // This file is autogenerated. Please do not modify it. -""" + """ let structName = "LocalizationKey" let indent = " " @@ -43,7 +43,7 @@ func capitalizeFirstLetter(_ string: String) -> String { string.prefix(1).capitalized + string.dropFirst() } -func indentLines(_ lines: Array, with indent: String) -> Array { +func indentLines(_ lines: [String], with indent: String) -> [String] { lines.map { indent.appending($0) } } @@ -59,9 +59,10 @@ func generate(_ name: String, _ key: String) -> String { } func generateStruct( - _ lines: Array, - indent: String = indent) -> String { - let generatedLines: Array> = [ + _ lines: [String], + indent: String = indent +) -> String { + let generatedLines: [[String]] = [ ["/// :nodoc:", "public struct \(structName) {", ""], indentLines(lines, with: indent), indentLines(["", "internal let key: String", ""], with: indent), @@ -73,11 +74,11 @@ func generateStruct( .joined(separator: "\n") } -func generateInit(indent: String = indent) -> Array { +func generateInit(indent: String = indent) -> [String] { [ "public init(key: String) {", "\(indent)self.key = key", - "}", + "}" ] } @@ -110,13 +111,14 @@ guard let data = finalResult.data(using: .utf8) else { let outputURL = URL( fileURLWithPath: outputPath, - relativeTo: URL(fileURLWithPath: cwd, isDirectory: true)) + relativeTo: URL(fileURLWithPath: cwd, isDirectory: true) +) if fm.fileExists(atPath: outputURL.relativePath) { print("Output file already exists at \(outputURL.absoluteString). Replacing the contents") do { try data.write(to: outputURL) - } catch (let error) { + } catch { print("File writing to \(outputURL.relativePath) failed with \(error)") } } else { diff --git a/Tests/AdyenTests/Adyen Tests/Components/Apple Pay/PreApplePayComponentTests.swift b/Tests/AdyenTests/Adyen Tests/Components/Apple Pay/PreApplePayComponentTests.swift index f097089670..228dfb10ba 100644 --- a/Tests/AdyenTests/Adyen Tests/Components/Apple Pay/PreApplePayComponentTests.swift +++ b/Tests/AdyenTests/Adyen Tests/Components/Apple Pay/PreApplePayComponentTests.swift @@ -5,10 +5,10 @@ // @testable import Adyen -@testable import AdyenDropIn @testable import AdyenComponents -import XCTest +@testable import AdyenDropIn import PassKit +import XCTest class PreApplePayComponentTests: XCTestCase { @@ -21,7 +21,8 @@ class PreApplePayComponentTests: XCTestCase { payment: payment, paymentMethod: ApplePayPaymentMethod(type: "test_type", name: "test_name", brands: nil), summaryItems: createTestSummaryItems(), - merchantIdentifier: "test_id") + merchantIdentifier: "test_id" + ) sut = try! PreApplePayComponent(configuration: configuration) } @@ -33,7 +34,9 @@ class PreApplePayComponentTests: XCTestCase { let model = PreApplePayView.Model( hint: amount.formatted, style: PreApplePayView.Model.Style( - hintLabel: hintStyle, backgroundColor: .cyan)) + hintLabel: hintStyle, backgroundColor: .cyan + ) + ) let sut = PreApplePayView(model: model) let viewController = UIViewController() diff --git a/Tests/AdyenTests/Adyen Tests/Components/Await Component/AwaitComponentTests.swift b/Tests/AdyenTests/Adyen Tests/Components/Await Component/AwaitComponentTests.swift index 0bb7f4f9e1..c9371d644d 100644 --- a/Tests/AdyenTests/Adyen Tests/Components/Await Component/AwaitComponentTests.swift +++ b/Tests/AdyenTests/Adyen Tests/Components/Await Component/AwaitComponentTests.swift @@ -101,7 +101,8 @@ class AwaitComponentTests: XCTestCase { } return handler - }, onQRHandler: nil) + }, onQRHandler: nil + ) let sut = AwaitComponent(awaitComponentBuilder: handlerProvider, style: style) sut.localizationParameters = LocalizationParameters(tableName: "AdyenUIHost", keySeparator: nil) diff --git a/Tests/AdyenTests/Adyen Tests/Components/PIX/QRCodeComponentTests.swift b/Tests/AdyenTests/Adyen Tests/Components/PIX/QRCodeComponentTests.swift index 8e2b0e6464..2b4872c137 100644 --- a/Tests/AdyenTests/Adyen Tests/Components/PIX/QRCodeComponentTests.swift +++ b/Tests/AdyenTests/Adyen Tests/Components/PIX/QRCodeComponentTests.swift @@ -110,7 +110,7 @@ class QRCodeComponentTests: XCTestCase { let sut = QRCodeComponent(style: QRCodeComponentStyle(), pollingComponentBuilder: builder, timeoutInterval: 2.0) let componentDelegate = ActionComponentDelegateMock() - componentDelegate.onDidFail = { (error, component) in + componentDelegate.onDidFail = { error, component in if let qrError = error as? QRCodeComponentError, case QRCodeComponentError.qrCodeExpired = qrError { } else { @@ -145,7 +145,8 @@ class QRCodeComponentTests: XCTestCase { onQRHandler: { type in XCTAssertEqual(type, QRCodePaymentMethod.pix) return handler - }) + } + ) let sut = QRCodeComponent(style: QRCodeComponentStyle(), pollingComponentBuilder: builder, @@ -160,7 +161,7 @@ class QRCodeComponentTests: XCTestCase { } let componentDelegate = ActionComponentDelegateMock() - componentDelegate.onDidProvide = { (data, component) in + componentDelegate.onDidProvide = { data, component in XCTAssertEqual(data.paymentData, self.componentData.paymentData) XCTAssertTrue(component === sut) expectationForDidProvide.fulfill() @@ -191,7 +192,8 @@ class QRCodeComponentTests: XCTestCase { onQRHandler: { type in XCTAssertEqual(type, QRCodePaymentMethod.pix) return handler - }) + } + ) let sut = QRCodeComponent(style: QRCodeComponentStyle(), pollingComponentBuilder: builder, @@ -206,7 +208,7 @@ class QRCodeComponentTests: XCTestCase { } let componentDelegate = ActionComponentDelegateMock() - componentDelegate.onDidFail = { (error, component) in + componentDelegate.onDidFail = { error, component in XCTAssertTrue(error is UnknownError) XCTAssertTrue(component === sut) expectationForDidFail.fulfill() diff --git a/Tests/AdyenTests/Adyen Tests/Components/Qiwi Wallet/QiwiWalletComponentTests.swift b/Tests/AdyenTests/Adyen Tests/Components/Qiwi Wallet/QiwiWalletComponentTests.swift index 7b7d778054..d32c1fb818 100644 --- a/Tests/AdyenTests/Adyen Tests/Components/Qiwi Wallet/QiwiWalletComponentTests.swift +++ b/Tests/AdyenTests/Adyen Tests/Components/Qiwi Wallet/QiwiWalletComponentTests.swift @@ -22,7 +22,7 @@ class QiwiWalletComponentTests: XCTestCase { let expectedSelectableValues = phoneExtensions.map { PhoneExtensionPickerItem(identifier: $0.countryCode, element: .init(title: "\($0.countryDisplayName) (\($0.value))", - phoneExtension: $0.value)) + phoneExtension: $0.value)) } XCTAssertEqual(sut.phoneItem?.phonePrefixItem.selectableValues, expectedSelectableValues) diff --git a/Tests/AdyenTests/Adyen Tests/Components/Redirect Tests/RedirectListnerTests.swift b/Tests/AdyenTests/Adyen Tests/Components/Redirect Tests/RedirectListnerTests.swift index 070e95483c..f90d95c80d 100644 --- a/Tests/AdyenTests/Adyen Tests/Components/Redirect Tests/RedirectListnerTests.swift +++ b/Tests/AdyenTests/Adyen Tests/Components/Redirect Tests/RedirectListnerTests.swift @@ -12,7 +12,7 @@ class RedirectListnerTests: XCTestCase { func testRedirectListner() { let dummyExpectation = expectation(description: "Dummy Expectation") let sampleUrl = URL(string: "www.google.com")! - RedirectListener.registerForURL { (url) in + RedirectListener.registerForURL { url in XCTAssertEqual(url, sampleUrl) dummyExpectation.fulfill() diff --git a/Tests/AdyenTests/Adyen Tests/Components/Seven Eleven Component/BasicPersonalInfoFormComponentTests.swift b/Tests/AdyenTests/Adyen Tests/Components/Seven Eleven Component/BasicPersonalInfoFormComponentTests.swift index 7342987d6d..e3a46e884c 100644 --- a/Tests/AdyenTests/Adyen Tests/Components/Seven Eleven Component/BasicPersonalInfoFormComponentTests.swift +++ b/Tests/AdyenTests/Adyen Tests/Components/Seven Eleven Component/BasicPersonalInfoFormComponentTests.swift @@ -6,9 +6,9 @@ // Copyright © 2021 Adyen. All rights reserved. // -import XCTest @testable import Adyen @testable import AdyenComponents +import XCTest class BasicPersonalInfoFormComponentTests: XCTestCase { diff --git a/Tests/AdyenTests/Adyen Tests/Components/XCTestCaseExtension.swift b/Tests/AdyenTests/Adyen Tests/Components/XCTestCaseExtension.swift index 7bc2a8189e..8f1fd1f06f 100644 --- a/Tests/AdyenTests/Adyen Tests/Components/XCTestCaseExtension.swift +++ b/Tests/AdyenTests/Adyen Tests/Components/XCTestCaseExtension.swift @@ -6,8 +6,8 @@ // Copyright © 2021 Adyen. All rights reserved. // -import XCTest @testable import Adyen +import XCTest extension XCTestCase { internal func populate>(textItemView: U, with text: String) { diff --git a/Tests/AdyenTests/Adyen Tests/UI/Form/Items/Error Item/FormErrorItemTests.swift b/Tests/AdyenTests/Adyen Tests/UI/Form/Items/Error Item/FormErrorItemTests.swift index 31c4b276b4..c2b778065b 100644 --- a/Tests/AdyenTests/Adyen Tests/UI/Form/Items/Error Item/FormErrorItemTests.swift +++ b/Tests/AdyenTests/Adyen Tests/UI/Form/Items/Error Item/FormErrorItemTests.swift @@ -6,8 +6,8 @@ // Copyright © 2021 Adyen. All rights reserved. // -import XCTest @testable import Adyen +import XCTest class FormErrorItemTests: XCTestCase { diff --git a/Tests/AdyenTests/Adyen Tests/UI/Form/Items/Text/FormTextItemViewTests.swift b/Tests/AdyenTests/Adyen Tests/UI/Form/Items/Text/FormTextItemViewTests.swift index bec7f6a629..a3ae8ea5e3 100644 --- a/Tests/AdyenTests/Adyen Tests/UI/Form/Items/Text/FormTextItemViewTests.swift +++ b/Tests/AdyenTests/Adyen Tests/UI/Form/Items/Text/FormTextItemViewTests.swift @@ -45,7 +45,7 @@ class FormTextItemViewTests: XCTestCase { } let didChangeValueExpectation = XCTestExpectation(description: "Expect delegate.didChangeValue() to be called.") - let _ = sut.item.publisher.addEventHandler { event in + _ = sut.item.publisher.addEventHandler { event in didChangeValueExpectation.fulfill() } diff --git a/Tests/AdyenTests/Adyen Tests/Utilities/AssertsTests.swift b/Tests/AdyenTests/Adyen Tests/Utilities/AssertsTests.swift index def4ea1cfa..d1e7facfc0 100644 --- a/Tests/AdyenTests/Adyen Tests/Utilities/AssertsTests.swift +++ b/Tests/AdyenTests/Adyen Tests/Utilities/AssertsTests.swift @@ -115,14 +115,14 @@ class AssertsTests: XCTestCase { } sut.handle(VoucherAction.dokuAlfamart(DokuVoucherAction(paymentMethodType: .dokuAlfamart, - initialAmount: Payment.Amount(value: 100, currencyCode: ""), - totalAmount: Payment.Amount(value: 100, currencyCode: ""), - reference: "", - shopperEmail: "", - expiresAt: .distantFuture, - merchantName: "", - shopperName: "", - instructionsUrl: ""))) + initialAmount: Payment.Amount(value: 100, currencyCode: ""), + totalAmount: Payment.Amount(value: 100, currencyCode: ""), + reference: "", + shopperEmail: "", + expiresAt: .distantFuture, + merchantName: "", + shopperName: "", + instructionsUrl: ""))) wait(for: [expectation], timeout: 2) @@ -173,6 +173,6 @@ class AssertsTests: XCTestCase { } - class MockComponent: Component { } + class MockComponent: Component {} } diff --git a/Tests/AdyenTests/Adyen Tests/Utilities/ComponentManagerTests.swift b/Tests/AdyenTests/Adyen Tests/Utilities/ComponentManagerTests.swift index 95dbe35fda..c4d88869a5 100644 --- a/Tests/AdyenTests/Adyen Tests/Utilities/ComponentManagerTests.swift +++ b/Tests/AdyenTests/Adyen Tests/Utilities/ComponentManagerTests.swift @@ -49,7 +49,7 @@ class ComponentManagerTests: XCTestCase { let config = DropInComponent.PaymentMethodsConfiguration(clientKey: Dummy.dummyClientKey) config.localizationParameters = LocalizationParameters(tableName: "AdyenUIHost", keySeparator: nil) let merchantIdentifier = "applePayMerchantIdentifier" - let summaryItems = [ PKPaymentSummaryItem(label: "Total", amount: NSDecimalNumber(string: "174.08"), type: .final) ] + let summaryItems = [PKPaymentSummaryItem(label: "Total", amount: NSDecimalNumber(string: "174.08"), type: .final)] config.applePay = .init(summaryItems: summaryItems, merchantIdentifier: merchantIdentifier) config.payment = Payment(amount: Payment.Amount(value: 20, currencyCode: "EUR"), countryCode: "NL") let sut = ComponentManager(paymentMethods: paymentMethods, @@ -73,7 +73,7 @@ class ComponentManagerTests: XCTestCase { config.payment = Payment(amount: Payment.Amount(value: 20, currencyCode: "EUR"), countryCode: "NL") config.localizationParameters = LocalizationParameters(tableName: "AdyenUIHost", keySeparator: nil) let merchantIdentifier = "applePayMerchantIdentifier" - let summaryItems = [ PKPaymentSummaryItem(label: "Total", amount: NSDecimalNumber(string: "174.08"), type: .final) ] + let summaryItems = [PKPaymentSummaryItem(label: "Total", amount: NSDecimalNumber(string: "174.08"), type: .final)] config.applePay = .init(summaryItems: summaryItems, merchantIdentifier: merchantIdentifier) let sut = ComponentManager(paymentMethods: paymentMethods, @@ -92,7 +92,7 @@ class ComponentManagerTests: XCTestCase { let config = DropInComponent.PaymentMethodsConfiguration(clientKey: Dummy.dummyClientKey) config.localizationParameters = LocalizationParameters(tableName: "AdyenUIHostCustomSeparator", keySeparator: "_") let merchantIdentifier = "applePayMerchantIdentifier" - let summaryItems = [ PKPaymentSummaryItem(label: "Total", amount: NSDecimalNumber(string: "174.08"), type: .final) ] + let summaryItems = [PKPaymentSummaryItem(label: "Total", amount: NSDecimalNumber(string: "174.08"), type: .final)] config.applePay = .init(summaryItems: summaryItems, merchantIdentifier: merchantIdentifier) config.payment = Payment(amount: Payment.Amount(value: 20, currencyCode: "EUR"), countryCode: "NL") diff --git a/Tests/AdyenTests/Adyen Tests/Utilities/ObservableTests.swift b/Tests/AdyenTests/Adyen Tests/Utilities/ObservableTests.swift index fd583c420d..6728ebe6b7 100644 --- a/Tests/AdyenTests/Adyen Tests/Utilities/ObservableTests.swift +++ b/Tests/AdyenTests/Adyen Tests/Utilities/ObservableTests.swift @@ -149,7 +149,6 @@ class ObservableTests: XCTestCase, Observer { XCTAssertTrue(receiver.observableObject.boolValue) } - class TestObserver: Observer { var stringValue: String = "" var optionalStringValue: String? diff --git a/Tests/AdyenTests/Adyen Tests/Utilities/RegionRepositoryTest.swift b/Tests/AdyenTests/Adyen Tests/Utilities/RegionRepositoryTest.swift index 15bce6fec9..d364a86b15 100644 --- a/Tests/AdyenTests/Adyen Tests/Utilities/RegionRepositoryTest.swift +++ b/Tests/AdyenTests/Adyen Tests/Utilities/RegionRepositoryTest.swift @@ -9,14 +9,14 @@ @testable import Adyen import XCTest -class RegionRepositoryTest: XCTestCase { +class RegionRepositoryTest: XCTestCase { let local = Environment(baseURL: Bundle(for: RegionRepositoryTest.self).url(forResource: "JSON", withExtension: nil)!) func testGettingListOfCountriesEN() { let sut = RegionRepository(environment: local) let expectation = XCTestExpectation(description: "Dummy Expectation") - sut.getCountries(locale: "en-US") { (regions) in + sut.getCountries(locale: "en-US") { regions in XCTAssertEqual(regions.count, 245) XCTAssertEqual(regions[15].name, "Azerbaijan") @@ -29,7 +29,7 @@ class RegionRepositoryTest: XCTestCase { func testGettingListOfCountriesRU() { let sut = RegionRepository(environment: local) let expectation = XCTestExpectation(description: "Dummy Expectation") - sut.getCountries(locale: "es-ES") { (regions) in + sut.getCountries(locale: "es-ES") { regions in XCTAssertEqual(regions.count, 245) XCTAssertEqual(regions[15].name, "Azerbaiyán") @@ -42,7 +42,7 @@ class RegionRepositoryTest: XCTestCase { func testGettingListOfStatesUS() { let sut = RegionRepository(environment: local) let expectation = XCTestExpectation(description: "Dummy Expectation") - sut.getSubRegions(for: "US", locale: "en-US") { (regions) in + sut.getSubRegions(for: "US", locale: "en-US") { regions in XCTAssertEqual(regions.count, 51) XCTAssertEqual(regions[15].name, "Iowa") @@ -55,7 +55,7 @@ class RegionRepositoryTest: XCTestCase { func testGettingListOfStatesCA() { let sut = RegionRepository(environment: local) let expectation = XCTestExpectation(description: "Dummy Expectation") - sut.getSubRegions(for: "CA", locale: "en-CA") { (regions) in + sut.getSubRegions(for: "CA", locale: "en-CA") { regions in XCTAssertEqual(regions.count, 13) XCTAssertEqual(regions[2].name, "Manitoba") @@ -68,7 +68,7 @@ class RegionRepositoryTest: XCTestCase { func testGettingListOfCountriesFallback() { let sut = RegionRepository(environment: local) let expectation = XCTestExpectation(description: "Dummy Expectation") - sut.getCountries(locale: "something") { (regions) in + sut.getCountries(locale: "something") { regions in XCTAssertEqual(regions.count, 256) XCTAssertEqual(regions[16].name, "Azerbaijan") @@ -81,7 +81,7 @@ class RegionRepositoryTest: XCTestCase { func testGettingListOfCountriesFallbackWithTranslation() { let sut = RegionRepository(environment: local) let expectation = XCTestExpectation(description: "Dummy Expectation") - sut.getCountries(locale: "ru-RU") { (regions) in + sut.getCountries(locale: "ru-RU") { regions in XCTAssertEqual(regions.count, 256) XCTAssertEqual(regions[16].name, "Азербайджан") @@ -94,7 +94,7 @@ class RegionRepositoryTest: XCTestCase { func testGettingListOfStatesNothingFound() { let sut = RegionRepository(environment: local) let expectation = XCTestExpectation(description: "Dummy Expectation") - sut.getSubRegions(for: "something", locale: "us-EN") { (regions) in + sut.getSubRegions(for: "something", locale: "us-EN") { regions in XCTAssertEqual(regions.count, 0) expectation.fulfill() @@ -106,7 +106,7 @@ class RegionRepositoryTest: XCTestCase { func testGettingListOfStatesBRFallback() { let sut = RegionRepository(environment: local) let expectation = XCTestExpectation(description: "Dummy Expectation") - sut.getSubRegions(for: "BR", locale: "us-EN") { (regions) in + sut.getSubRegions(for: "BR", locale: "us-EN") { regions in XCTAssertEqual(regions.count, 27) expectation.fulfill() diff --git a/Tests/AdyenTests/Card Tests/BCMCComponentTests.swift b/Tests/AdyenTests/Card Tests/BCMCComponentTests.swift index 47c1291840..fbbcb26fc8 100644 --- a/Tests/AdyenTests/Card Tests/BCMCComponentTests.swift +++ b/Tests/AdyenTests/Card Tests/BCMCComponentTests.swift @@ -144,7 +144,7 @@ class BCMCComponentTests: XCTestCase { self.populate(textItemView: cardNumberItemView!, with: "00000") DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + .seconds(1)) { - XCTAssertTrue(cardNumberItem.cardTypeLogos.allSatisfy { $0.isHidden }) + XCTAssertTrue(cardNumberItem.cardTypeLogos.allSatisfy(\.isHidden)) expectation.fulfill() } diff --git a/Tests/AdyenTests/Card Tests/CardComponentTests.swift b/Tests/AdyenTests/Card Tests/CardComponentTests.swift index 403c7940e5..b87087d20d 100644 --- a/Tests/AdyenTests/Card Tests/CardComponentTests.swift +++ b/Tests/AdyenTests/Card Tests/CardComponentTests.swift @@ -612,7 +612,7 @@ class CardComponentTests: XCTestCase { DispatchQueue.main.asyncAfter(deadline: DispatchTime.now() + .seconds(1)) { XCTAssertEqual(cardNumberItem.cardTypeLogos.count, 3) XCTAssertEqual(cardLogoView.subviews.count, 3) - XCTAssertTrue(cardLogoView.arrangedSubviews.allSatisfy { $0.isHidden }) + XCTAssertTrue(cardLogoView.arrangedSubviews.allSatisfy(\.isHidden)) expectation.fulfill() } @@ -750,7 +750,8 @@ class CardComponentTests: XCTestCase { expectation.fulfill() } - }} + } + } wait(for: [expectation], timeout: 10) } @@ -998,4 +999,3 @@ extension UIView { } } - diff --git a/Tests/AdyenTests/Card Tests/CardDetailsTests.swift b/Tests/AdyenTests/Card Tests/CardDetailsTests.swift index 966479e061..e5c2b8d583 100644 --- a/Tests/AdyenTests/Card Tests/CardDetailsTests.swift +++ b/Tests/AdyenTests/Card Tests/CardDetailsTests.swift @@ -46,8 +46,7 @@ class CardDetailsTests: XCTestCase { let paymenthMethod = CardPaymentMethodMock(fundingSource: .debit, type: "test_type", name: "test name", brands: ["barnd_1", "barnd_2"]) let sut = CardDetails(paymentMethod: paymenthMethod, encryptedCard: EncryptedCard(number: "number", securityCode: "code", expiryMonth: "month", expiryYear: "year"), - billingAddress: AddressInfo(postalCode: "postal") - ) + billingAddress: AddressInfo(postalCode: "postal")) let data = try JSONEncoder().encode(sut) let dictionary = try JSONSerialization.jsonObject(with: data, options: []) as! [String: Any] From 33fb59264fe5aafee66e432e462bf85149f3c3c1 Mon Sep 17 00:00:00 2001 From: mohamede Date: Wed, 5 May 2021 12:48:26 +0200 Subject: [PATCH 2/2] chore: small fix to formatting --- AdyenActions/Actions/Action.swift | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/AdyenActions/Actions/Action.swift b/AdyenActions/Actions/Action.swift index 9e70a34ea4..34d6da05f7 100644 --- a/AdyenActions/Actions/Action.swift +++ b/AdyenActions/Actions/Action.swift @@ -79,7 +79,7 @@ public enum Action: Decodable { case sdk case qrCode case await - case voucher + case voucher } private enum CodingKeys: String, CodingKey {