Skip to content

Commit

Permalink
Merge branch 'develop' into release/5.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
goergisn committed Nov 9, 2023
2 parents 224c8b0 + 8adacfc commit b3d1a06
Show file tree
Hide file tree
Showing 8 changed files with 29 additions and 24 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ internal enum AnyPaymentMethodDecoder {
.afterpay: UnsupportedPaymentMethodDecoder(),
.androidPay: UnsupportedPaymentMethodDecoder(),
.amazonPay: UnsupportedPaymentMethodDecoder(),

.bizum: UnsupportedPaymentMethodDecoder(),

// Supported payment methods
.card: CardPaymentMethodDecoder(),
.scheme: CardPaymentMethodDecoder(),
Expand Down
6 changes: 4 additions & 2 deletions Adyen/Core/Payment Methods/Abstract/PaymentMethodType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,7 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable {
case mealVoucherSodexo
case upi
case cashAppPay
case bizum
case other(String)

// swiftlint:disable cyclomatic_complexity function_body_length
Expand Down Expand Up @@ -117,6 +118,7 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable {
case "mealVoucher_FR_sodexo": self = .mealVoucherSodexo
case "upi": self = .upi
case "cashapp": self = .cashAppPay
case "bizum": self = .bizum
default: self = .other(rawValue)
}
}
Expand Down Expand Up @@ -174,6 +176,7 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable {
case .mealVoucherSodexo: return "mealVoucher_FR_sodexo"
case .upi: return "upi"
case .cashAppPay: return "cashapp"
case .bizum: return "bizum"
case let .other(value): return value
}
}
Expand Down Expand Up @@ -235,11 +238,10 @@ public enum PaymentMethodType: RawRepresentable, Hashable, Codable {
case .mealVoucherSodexo: return "meal voucher sodexo"
case .upi: return "UPI"
case .cashAppPay: return "cash app"
case .bizum: return "bizum"
case let .other(name): return name.replacingOccurrences(of: "_", with: " ")
}
}
// swiftlint:enable cyclomatic_complexity

// swiftlint:enable cyclomatic_complexity function_body_length
}

Expand Down
4 changes: 1 addition & 3 deletions Adyen/Utilities/Localization.swift
Original file line number Diff line number Diff line change
Expand Up @@ -34,10 +34,8 @@ public func localizedString(_ key: LocalizationKey, _ parameters: LocalizationPa
switch parameters?.mode {
case let .enforced(locale: enforcedLocale):
translationAttempt = enforceLocalizedString(key: key.key, locale: enforcedLocale)
case .natural:
case .natural, .none:
translationAttempt = attempt(buildPossibleInputs(key.key, parameters))
case .none:
break
}

// Use fallback in case attempt result is nil or empty
Expand Down
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2021 Adyen N.V.
// Copyright (c) 2023 Adyen N.V.
//
// This file is open source and available under the MIT license. See the LICENSE file for more info.
//
Expand Down Expand Up @@ -48,8 +48,6 @@ internal struct JSONWebEncryption {
}
}

internal let header: Header

internal let encryptedKey: Data

internal let encryptedPayload: Data
Expand All @@ -60,21 +58,20 @@ internal struct JSONWebEncryption {

internal let compactRepresentation: String

internal init(header: Header,
internal init(encodedHeader: Data,
encryptedKey: Data,
encryptedPayload: Data,
initializationVector: Data,
authenticationTag: Data) throws {
self.header = header
authenticationTag: Data) {
self.encryptedKey = encryptedKey
self.encryptedPayload = encryptedPayload
self.initializationVector = initializationVector
self.authenticationTag = authenticationTag
self.compactRepresentation = try [AdyenCoder.encode(header).base64URLString(),
encryptedKey.base64URLString(),
initializationVector.base64URLString(),
encryptedPayload.base64URLString(),
authenticationTag.base64URLString()].joined(separator: ".")
self.compactRepresentation = [encodedHeader.base64URLString(),
encryptedKey.base64URLString(),
initializationVector.base64URLString(),
encryptedPayload.base64URLString(),
authenticationTag.base64URLString()].joined(separator: ".")
}

}
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
//
// Copyright (c) 2021 Adyen N.V.
// Copyright (c) 2023 Adyen N.V.
//
// This file is open source and available under the MIT license. See the LICENSE file for more info.
//
Expand Down Expand Up @@ -36,10 +36,10 @@ internal struct JSONWebEncryptionGenerator: AnyJSONWebEncryptionGenerator {
additionalAuthenticationData: additionalAuthenticationData)
let contentEncryptionOutput = try contentEncryptionAlgorithm.encrypt(input: contentEncryptionInput)

return try JSONWebEncryption(header: header,
encryptedKey: encryptedKey,
encryptedPayload: contentEncryptionOutput.encryptedPayload,
initializationVector: initializationVector,
authenticationTag: contentEncryptionOutput.authenticationTag)
return JSONWebEncryption(encodedHeader: encodedHeader,
encryptedKey: encryptedKey,
encryptedPayload: contentEncryptionOutput.encryptedPayload,
initializationVector: initializationVector,
authenticationTag: contentEncryptionOutput.authenticationTag)
}
}
3 changes: 2 additions & 1 deletion Tests/Adyen Tests/Core/PaymentMethodTests.swift
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,8 @@ class PaymentMethodTests: XCTestCase {
bacsDirectDebit,
giftCard1,
givexGiftCard,
mealVoucherSodexo
mealVoucherSodexo,
bizum
]
]
return try AdyenCoder.decode(dictionary) as PaymentMethods
Expand Down
5 changes: 5 additions & 0 deletions Tests/DummyData/DummyPaymentMethods.swift
Original file line number Diff line number Diff line change
Expand Up @@ -549,3 +549,8 @@ let cashAppPay: [String: Any] = [
"clientId": "testClient"
]
]

let bizum: [String: Any] = [
"type": "bizum",
"name": "Bizum",
]
1 change: 1 addition & 0 deletions spell-check-word-allow-list.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -188,4 +188,5 @@ whiteList:
- domainname
- appname
- mapkit
- bizum
- alipay

0 comments on commit b3d1a06

Please sign in to comment.