diff --git a/Xendit.podspec b/Xendit.podspec index 345d9e4..0e2e1d1 100755 --- a/Xendit.podspec +++ b/Xendit.podspec @@ -1,12 +1,16 @@ Pod::Spec.new do |s| s.name = "Xendit" - s.version = "0.1.0" + s.version = "2.1.8" s.summary = "Xendit is an API for accepting payments online" s.homepage = "https://www.xendit.co" s.license = "MIT" s.author = { "Juan Gonzalez’" => "juan@xendit.co" } s.social_media_url = "https://www.facebook.com/xendit" - s.platform = :ios, "8.0" - s.source = { :git => 'https://github.com/xendit/xendit-sdk-ios.git', :tag => s.version } - s.ios.vendored_frameworks = 'Xendit.framework' + s.platform = :ios, "9.0" + s.ios.deployment_target = '9.0' + s.swift_versions = ["4", "5"] + s.source = { :git => 'https://github.com/xendit/xendit-sdk-ios-src.git', :tag => s.version } + s.source_files = "Xendit/**/*.{h,m,swift}" + s.pod_target_xcconfig = { 'ONLY_ACTIVE_ARCH' => 'YES', 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64 i386' } + s.user_target_xcconfig = { 'EXCLUDED_ARCHS[sdk=iphonesimulator*]' => 'arm64 i386' } end diff --git a/Xendit/Models/CardData.swift b/Xendit/Models/CardData.swift index cd64bc7..f44ab75 100755 --- a/Xendit/Models/CardData.swift +++ b/Xendit/Models/CardData.swift @@ -17,6 +17,8 @@ public enum CYBCardTypes { case VISA_ELECTRON case DANKORT case MAESTRO + case DINER + case UNIONPAY case UNKNOWN func stringValue() -> String { @@ -37,6 +39,10 @@ public enum CYBCardTypes { return "034" case .MAESTRO: return "042" + case .DINER: + return "005" + case .UNIONPAY: + return "062" case .UNKNOWN: return "0" } diff --git a/Xendit/WebViewController/AuthenticationWebviewController.swift b/Xendit/WebViewController/AuthenticationWebviewController.swift index c9a9035..4bad77a 100644 --- a/Xendit/WebViewController/AuthenticationWebviewController.swift +++ b/Xendit/WebViewController/AuthenticationWebviewController.swift @@ -75,10 +75,10 @@ class AuthenticationWebViewController: UIViewController, WKScriptMessageHandler, view.addSubview(webView) NSLayoutConstraint.activate([ - NSLayoutConstraint(item: webView, attribute: .leading, relatedBy: .equal, toItem: view, attribute: .leading, multiplier: 1, constant: 0), - NSLayoutConstraint(item: webView, attribute: .top, relatedBy: .equal, toItem: view, attribute: .top, multiplier: 1, constant: 0), - NSLayoutConstraint(item: webView, attribute: .trailing, relatedBy: .equal, toItem: view, attribute: .trailing, multiplier: 1, constant: 0), - NSLayoutConstraint(item: webView, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1, constant: 0), + NSLayoutConstraint(item: webView!, attribute: .leading, relatedBy: .equal, toItem: view, attribute: .leading, multiplier: 1, constant: 0), + NSLayoutConstraint(item: webView!, attribute: .top, relatedBy: .equal, toItem: view, attribute: .top, multiplier: 1, constant: 0), + NSLayoutConstraint(item: webView!, attribute: .trailing, relatedBy: .equal, toItem: view, attribute: .trailing, multiplier: 1, constant: 0), + NSLayoutConstraint(item: webView!, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1, constant: 0), ]) } diff --git a/Xendit/WebViewController/WebViewController.swift b/Xendit/WebViewController/WebViewController.swift index b324444..c5a60a1 100755 --- a/Xendit/WebViewController/WebViewController.swift +++ b/Xendit/WebViewController/WebViewController.swift @@ -80,10 +80,10 @@ class WebViewController: UIViewController, WKScriptMessageHandler, WKNavigationD view.addSubview(webView) NSLayoutConstraint.activate([ - NSLayoutConstraint(item: webView, attribute: .leading, relatedBy: .equal, toItem: view, attribute: .leading, multiplier: 1, constant: 0), - NSLayoutConstraint(item: webView, attribute: .top, relatedBy: .equal, toItem: view, attribute: .top, multiplier: 1, constant: 0), - NSLayoutConstraint(item: webView, attribute: .trailing, relatedBy: .equal, toItem: view, attribute: .trailing, multiplier: 1, constant: 0), - NSLayoutConstraint(item: webView, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1, constant: 0), + NSLayoutConstraint(item: webView!, attribute: .leading, relatedBy: .equal, toItem: view, attribute: .leading, multiplier: 1, constant: 0), + NSLayoutConstraint(item: webView!, attribute: .top, relatedBy: .equal, toItem: view, attribute: .top, multiplier: 1, constant: 0), + NSLayoutConstraint(item: webView!, attribute: .trailing, relatedBy: .equal, toItem: view, attribute: .trailing, multiplier: 1, constant: 0), + NSLayoutConstraint(item: webView!, attribute: .bottom, relatedBy: .equal, toItem: view, attribute: .bottom, multiplier: 1, constant: 0), ]) } diff --git a/Xendit/Xendit.swift b/Xendit/Xendit.swift index 6d9d597..fea6183 100755 --- a/Xendit/Xendit.swift +++ b/Xendit/Xendit.swift @@ -194,7 +194,12 @@ import Foundation return CYBCardTypes.DANKORT } else if isCardMaestro(cardNumber: cardNumber) { return CYBCardTypes.MAESTRO + } else if isCardDiner(cardNumber: cardNumber) { + return CYBCardTypes.DINER + } else if isCardUnionPay(cardNumber: cardNumber) { + return CYBCardTypes.UNIONPAY } + return CYBCardTypes.UNKNOWN } @@ -276,6 +281,30 @@ import Foundation return false } + // Validate Card for type Diner + private static func isCardDiner(cardNumber: String) -> Bool{ + if cardNumber.count > 2 { + let index3 = cardNumber.index(cardNumber.startIndex, offsetBy: 3) + let startingNumber3 = Int(cardNumber[..= 300 && startingNumber3 <= 305) + } + return false + } + + // Validate Card for type UnionPay + private static func isCardUnionPay(cardNumber: String) -> Bool{ + if cardNumber.count > 2 { + let index = cardNumber.index(cardNumber.startIndex, offsetBy: 2) + let startingNumber = Int(cardNumber[..