Skip to content

Commit

Permalink
Release 1.5.0
Browse files Browse the repository at this point in the history
  • Loading branch information
adyen-git-manager committed Aug 4, 2017
1 parent de4864f commit f42f0bb
Show file tree
Hide file tree
Showing 257 changed files with 12,214 additions and 2,965 deletions.
5 changes: 1 addition & 4 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ Pods/
# Carthage
#
# Add this line if you want to avoid checking in source code from Carthage dependencies.
# Carthage/Checkouts
Carthage/Checkouts

Carthage/Build

Expand Down Expand Up @@ -72,6 +72,3 @@ xcuserdata
.DS_Store
.AppleDouble
.LSOverride

docs/
Adyen/Core/Config.swift
4 changes: 4 additions & 0 deletions .jazzy.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@ custom_categories:
children:
- CheckoutViewController
- CheckoutViewControllerDelegate
- CheckoutViewControllerCardScanDelegate
- AppearanceConfiguration
- name: Payment
children:
Expand All @@ -32,6 +33,9 @@ custom_categories:
- InputDetail
- InputType
- InputSelectItem
- OneClickInfo
- CardOneClickInfo
- PayPalOneClickInfo
- name: Utilities
children:
- CardType
Expand Down
3 changes: 2 additions & 1 deletion .swiftlint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,8 @@ disabled_rules:
- file_length
included:
- Adyen
- Examples
- AdyenTests
- AdyenUITests
- AdyenUIHost
excluded:
- Pods
5 changes: 0 additions & 5 deletions Adyen.podspec
Original file line number Diff line number Diff line change
Expand Up @@ -51,11 +51,6 @@ Pod::Spec.new do |s|
plugin.source_files = 'Adyen/Plugins/SEPADirectDebit/**/*'
plugin.dependency 'Adyen/Core'
plugin.dependency 'Adyen/CoreUI'
plugin.resource_bundles = {
'SEPADirectDebit' => [
'Adyen/Plugins/SEPADirectDebit/**/*.xib'
]
}
end

# Internals
Expand Down
672 changes: 402 additions & 270 deletions Adyen.xcodeproj/project.pbxproj

Large diffs are not rendered by default.

83 changes: 0 additions & 83 deletions Adyen/Core/BasePlugin.swift

This file was deleted.

30 changes: 0 additions & 30 deletions Adyen/Core/Currency.swift

This file was deleted.

35 changes: 35 additions & 0 deletions Adyen/Core/CurrencyFormatter.swift
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
//
// Copyright (c) 2017 Adyen B.V.
//
// This file is open source and available under the MIT license. See the LICENSE file for more info.
//

import Foundation

/// Convenience class to format a number with a given currency.
internal class CurrencyFormatter {

internal static func format(_ amount: Int, currencyCode: String) -> String? {
currencyFormatter.currencyCode = currencyCode

let maximumFractionDigits = currencyFormatter.maximumFractionDigits
let decimalMinorAmount = NSDecimalNumber(value: amount)
let convertedAmount = decimalMinorAmount.multiplying(byPowerOf10: Int16(-maximumFractionDigits)).doubleValue

let number = NSNumber(value: convertedAmount)

return currencyFormatter.string(from: number)
}

private static let currencyFormatter: NumberFormatter = {
let currencyFormatter = NumberFormatter()
currencyFormatter.numberStyle = .currency

return currencyFormatter
}()

private init() {

}

}
47 changes: 0 additions & 47 deletions Adyen/Core/Enum/CardBrandCode.swift

This file was deleted.

25 changes: 25 additions & 0 deletions Adyen/Core/Enum/Error.swift
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,31 @@ public enum Error: Swift.Error {

}

// MARK: - Equatable

extension Error: Equatable {

public static func ==(lhs: Error, rhs: Error) -> Bool {
switch (lhs, rhs) {
case let (.message(message1), .message(message2)):
return message1 == message2
case let (.serverError(serverError1), .serverError(serverError2)):
return serverError1 == serverError2
case (.unexpectedData, .unexpectedData):
return true
case (.unexpectedError, .unexpectedError):
return true
case (.canceled, .canceled):
return true
default:
return false
}
}

}

// MARK: - LocalizedError

extension Error: LocalizedError {
public var errorDescription: String? {
switch self {
Expand Down
85 changes: 82 additions & 3 deletions Adyen/Core/Enum/InputType.swift
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
//

/// Defines types of payment details.
public enum InputType: String {
public enum InputType: RawRepresentable, Equatable {

/// Text input type.
case text
Expand All @@ -22,9 +22,88 @@ public enum InputType: String {
/// CVC input type.
case cvc

/// Card token input type.
case cardToken
/// Card token input type. By default, cvcOptional is false.
case cardToken(cvcOptional: Bool)

/// Apple Pay token input type.
case applePayToken

/// Address input type.
case address

// MARK: - RawRepresentable

/// :nodoc:
public init?(rawValue: String) {
if rawValue == "text" {
self = .text
} else if rawValue == "boolean" {
self = .boolean
} else if rawValue == "select" {
self = .select
} else if rawValue == "iban" {
self = .iban
} else if rawValue == "cvc" {
self = .cvc
} else if rawValue == "cardToken" {
self = .cardToken(cvcOptional: false)
} else if rawValue == "applePayToken" {
self = .applePayToken
} else if rawValue == "address" {
self = .address
} else {
return nil
}
}

/// :nodoc:
public var rawValue: String {
switch self {
case .text:
return "text"
case .boolean:
return "boolean"
case .select:
return "select"
case .iban:
return "iban"
case .cvc:
return "cvc"
case .cardToken:
return "cardToken"
case .applePayToken:
return "applePayToken"
case .address:
return "address"
}
}

// MARK: - Equatable

/// :nodoc:
public static func ==(lhs: InputType, rhs: InputType) -> Bool {
switch (lhs, rhs) {
case (.text, .text):
return true
case (.boolean, .boolean):
return true
case (.select, .select):
return true
case (.iban, .iban):
return true
case (.cvc, .cvc):
return true
case (.cardToken(true), .cardToken(true)):
return true
case (.cardToken(false), .cardToken(false)):
return true
case (.applePayToken, .applePayToken):
return true
case (.address, .address):
return true
default:
return false
}
}

}
Loading

0 comments on commit f42f0bb

Please sign in to comment.