Skip to content

Commit

Permalink
Merge pull request #229 from omise/develop
Browse files Browse the repository at this point in the history
[Dev -> Master] 4.25.0
  • Loading branch information
Andrei Solovev authored Oct 6, 2023
2 parents 21e5eb1 + 5e8d9e3 commit 89e9e88
Show file tree
Hide file tree
Showing 24 changed files with 600 additions and 216 deletions.
149 changes: 84 additions & 65 deletions ExampleApp/Resources/Main.storyboard

Large diffs are not rendered by default.

6 changes: 5 additions & 1 deletion ExampleApp/Shared/PaymentSettingTableViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -120,13 +120,13 @@ class PaymentSettingTableViewController: UITableViewController {
@IBOutlet private var fpxCell: UITableViewCell!
@IBOutlet private var rabbitLinepayCell: UITableViewCell!
@IBOutlet private var OCBCPAOPaymentCell: UITableViewCell!
@IBOutlet private var OCBCDigitalPaymentCell: UITableViewCell!
@IBOutlet private var grabPayPaymentCell: UITableViewCell!
@IBOutlet private var boostPaymentCell: UITableViewCell!
@IBOutlet private var shopeePayPaymentCell: UITableViewCell!
@IBOutlet private var maybankQRPayPaymentCell: UITableViewCell!
@IBOutlet private var duitNowQRPaymentCell: UITableViewCell!
@IBOutlet private var duitNowOBWPaymentCell: UITableViewCell!

@IBOutlet private var useCapabilityAPIValuesCell: UITableViewCell!
@IBOutlet private var useSpecifiedValuesCell: UITableViewCell!

Expand Down Expand Up @@ -337,6 +337,8 @@ extension PaymentSettingTableViewController {
return .rabbitLinepay
case OCBCPAOPaymentCell:
return .mobileBankingOCBCPAO
case OCBCDigitalPaymentCell:
return .mobileBankingOCBC
case grabPayPaymentCell:
return .grabPay
case boostPaymentCell:
Expand Down Expand Up @@ -403,6 +405,8 @@ extension PaymentSettingTableViewController {
return mobileBankingSCBPaymentCell
case .mobileBankingOCBCPAO:
return OCBCPAOPaymentCell
case .mobileBankingOCBC:
return OCBCDigitalPaymentCell
case .mobileBankingKBank:
return mobileBankingKBankPaymentCell
case .mobileBankingBBL:
Expand Down
20 changes: 17 additions & 3 deletions OmiseSDK.xcodeproj/project.pbxproj
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@
7509D4EF2A1D1F9F0050AB38 /* OmiseTestSDK in Embed Frameworks */ = {isa = PBXBuildFile; productRef = 7509D4ED2A1D1F9F0050AB38 /* OmiseTestSDK */; settings = {ATTRIBUTES = (CodeSignOnCopy, ); }; };
7509D4F42A1D2C3E0050AB38 /* AtomeFormViewModelMockup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7509D4E32A1C89F10050AB38 /* AtomeFormViewModelMockup.swift */; };
7509D4F52A1D2F550050AB38 /* AtomeFormViewContextMockup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 7509D4E12A1C876B0050AB38 /* AtomeFormViewContextMockup.swift */; };
75131F862AC2BD9D008BCB17 /* UIViewController+NavigationBarStyle.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75131F852AC2BD9D008BCB17 /* UIViewController+NavigationBarStyle.swift */; };
753279382A31B40F008048AD /* CountryListViewModelMockup.swift in Sources */ = {isa = PBXBuildFile; fileRef = 753279372A31B40F008048AD /* CountryListViewModelMockup.swift */; };
75348D4E29C3FCC70008C8A3 /* Bundle+OmiseSDK.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75348D4D29C3FCC70008C8A3 /* Bundle+OmiseSDK.swift */; };
75405A782A25D327008C21F6 /* String+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75405A772A25D327008C21F6 /* String+Helpers.swift */; };
Expand Down Expand Up @@ -73,6 +74,7 @@
756C8F202A40694000D53059 /* CreditCardFormViewModel.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756C8F1F2A40694000D53059 /* CreditCardFormViewModel.swift */; };
756C8F222A40694F00D53059 /* CreditCardFormViewContext.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756C8F212A40694F00D53059 /* CreditCardFormViewContext.swift */; };
756C8F262A40698600D53059 /* TextFieldView.swift in Sources */ = {isa = PBXBuildFile; fileRef = 756C8F252A40698600D53059 /* TextFieldView.swift */; };
758244092ACE988700781B3B /* PaymentInformationTestCase.swift in Sources */ = {isa = PBXBuildFile; fileRef = 8A429E7A2109A3AE007C230F /* PaymentInformationTestCase.swift */; };
759856242A286C880087B605 /* UIScrollView+Helpers.swift in Sources */ = {isa = PBXBuildFile; fileRef = 759856232A286C880087B605 /* UIScrollView+Helpers.swift */; };
75B43B572A0277A3004352C7 /* PaymentInformation.Atome.swift in Sources */ = {isa = PBXBuildFile; fileRef = 75B43B562A0277A3004352C7 /* PaymentInformation.Atome.swift */; };
75DAD88C2A0BA5130098AF96 /* OmiseTestSDK in Frameworks */ = {isa = PBXBuildFile; productRef = 75DAD88B2A0BA5130098AF96 /* OmiseTestSDK */; };
Expand Down Expand Up @@ -277,6 +279,7 @@
7509D4E12A1C876B0050AB38 /* AtomeFormViewContextMockup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AtomeFormViewContextMockup.swift; sourceTree = "<group>"; };
7509D4E32A1C89F10050AB38 /* AtomeFormViewModelMockup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AtomeFormViewModelMockup.swift; sourceTree = "<group>"; };
7509D4E62A1C8E3D0050AB38 /* AtomeFormViewModelTests.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = AtomeFormViewModelTests.swift; sourceTree = "<group>"; };
75131F852AC2BD9D008BCB17 /* UIViewController+NavigationBarStyle.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "UIViewController+NavigationBarStyle.swift"; sourceTree = "<group>"; };
753279372A31B40F008048AD /* CountryListViewModelMockup.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = CountryListViewModelMockup.swift; sourceTree = "<group>"; };
75348D4D29C3FCC70008C8A3 /* Bundle+OmiseSDK.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "Bundle+OmiseSDK.swift"; sourceTree = "<group>"; };
75405A772A25D327008C21F6 /* String+Helpers.swift */ = {isa = PBXFileReference; lastKnownFileType = sourcecode.swift; path = "String+Helpers.swift"; sourceTree = "<group>"; };
Expand Down Expand Up @@ -556,6 +559,14 @@
path = "---";
sourceTree = "<group>";
};
75131F842AC2BD8F008BCB17 /* Extensions */ = {
isa = PBXGroup;
children = (
75131F852AC2BD9D008BCB17 /* UIViewController+NavigationBarStyle.swift */,
);
name = Extensions;
sourceTree = "<group>";
};
753279362A31B406008048AD /* CountryLists */ = {
isa = PBXGroup;
children = (
Expand Down Expand Up @@ -729,6 +740,7 @@
8A2BE95820A9A8FE000CEB60 /* Views */ = {
isa = PBXGroup;
children = (
75131F842AC2BD8F008BCB17 /* Extensions */,
756C8F242A40697100D53059 /* TextFieldView */,
7502CA5D2A31A7BE00766E7D /* CountryListViewController */,
75405AA12A27CB15008C21F6 /* AtomeFormViewController */,
Expand Down Expand Up @@ -1193,6 +1205,7 @@
8A7A9EC0216642D100F12D86 /* Swift Version Compatibility.swift in Sources */,
8A0A67E821383614006356B7 /* PaymentChooserViewController.swift in Sources */,
98FF99BB2577789800476487 /* Configuration.swift in Sources */,
75131F862AC2BD9D008BCB17 /* UIViewController+NavigationBarStyle.swift in Sources */,
8A72CD5E2162358400F14F76 /* PaymentOptionTableViewCell.swift in Sources */,
8AD391B1230C05BC00383286 /* Colors.swift in Sources */,
75F2A0BB2A1A60630038FA54 /* AtomeFormViewContext.swift in Sources */,
Expand Down Expand Up @@ -1336,6 +1349,7 @@
7509D4E72A1C8E3D0050AB38 /* AtomeFormViewModelTests.swift in Sources */,
7509D4E22A1C876B0050AB38 /* AtomeFormViewContextMockup.swift in Sources */,
8A3C10562159F7FC00BEFD8A /* InvalidCardAPIErrorParsingTestCase.swift in Sources */,
758244092ACE988700781B3B /* PaymentInformationTestCase.swift in Sources */,
8A37E43620B584D300E2DA18 /* ModelTestCase.swift in Sources */,
);
runOnlyForDeploymentPostprocessing = 0;
Expand Down Expand Up @@ -1854,7 +1868,7 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
INFOPLIST_FILE = OmiseSDKTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand All @@ -1877,7 +1891,7 @@
CLANG_ENABLE_MODULES = YES;
"CODE_SIGN_IDENTITY[sdk=iphoneos*]" = "";
INFOPLIST_FILE = OmiseSDKTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down Expand Up @@ -2000,7 +2014,7 @@
buildSettings = {
CLANG_ENABLE_MODULES = YES;
INFOPLIST_FILE = OmiseSDKTests/Info.plist;
IPHONEOS_DEPLOYMENT_TARGET = 11.0;
IPHONEOS_DEPLOYMENT_TARGET = 12;
LD_RUNPATH_SEARCH_PATHS = (
"$(inherited)",
"@executable_path/Frameworks",
Expand Down
5 changes: 3 additions & 2 deletions OmiseSDK/AuthorizingPaymentViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -97,7 +97,8 @@ public class AuthorizingPaymentViewController: UIViewController {
viewController.authorizedURL = authorizedURL
viewController.expectedReturnURLPatterns = expectedReturnURLPatterns
viewController.delegate = delegate

viewController.applyNavigationBarStyle()

return navigationController
}

Expand Down Expand Up @@ -223,7 +224,7 @@ extension AuthorizingPaymentViewController: WKNavigationDelegate {
type: .default,
url.absoluteString)
}
} else if let url = navigationAction.request.url, let scheme = url.scheme?.lowercased(), (scheme != "https" && scheme != "http") {
} else if let url = navigationAction.request.url, let scheme = url.scheme?.lowercased(), scheme != "https" && scheme != "http" {
os_log("Redirected to custom-scheme %{private}@ URL",
log: uiLogObject,
type: .debug,
Expand Down
9 changes: 8 additions & 1 deletion OmiseSDK/Capability.swift
Original file line number Diff line number Diff line change
Expand Up @@ -79,6 +79,7 @@ extension Capability {
case fpx
case rabbitLinepay
case ocbcPao
case ocbcDigital
case grabPay
case grabPayRms
case boost
Expand Down Expand Up @@ -161,6 +162,8 @@ extension Capability.Backend.Payment {
return true
case (.ocbcPao, .ocbcPao):
return true
case (.ocbcDigital, .ocbcDigital):
return true
case (.grabPay, .grabPay):
return true
case (.grabPayRms, .grabPayRms):
Expand Down Expand Up @@ -285,6 +288,8 @@ extension Capability.Backend {
self.payment = .rabbitLinepay
case .source(.mobileBankingOCBCPAO):
self.payment = .ocbcPao
case .source(.mobileBankingOCBC):
self.payment = .ocbcDigital
case .source(.grabPay):
switch provider {
case .rms:
Expand Down Expand Up @@ -330,7 +335,7 @@ extension Capability.Backend {
try encoder.encodeJSONDictionary(configurations)
try container.encode(Array(supportedCurrencies), forKey: .supportedCurrencies)
// swiftlint:disable:next line_length
case .internetBanking, .alipay, .alipayCN, .alipayHK, .atome, .dana, .gcash, .kakaoPay, .touchNGoAlipayPlus, .touchNGo, .promptpay, .paynow, .truemoney, .points, .billPayment, .eContext, .mobileBanking, .fpx, .rabbitLinepay, .ocbcPao, .grabPay, .grabPayRms, .boost, .shopeePay, .shopeePayJumpApp, .maybankQRPay, .duitNowQR, .duitNowOBW, .payPay:
case .internetBanking, .alipay, .alipayCN, .alipayHK, .atome, .dana, .gcash, .kakaoPay, .touchNGoAlipayPlus, .touchNGo, .promptpay, .paynow, .truemoney, .points, .billPayment, .eContext, .mobileBanking, .fpx, .rabbitLinepay, .ocbcPao, .ocbcDigital, .grabPay, .grabPayRms, .boost, .shopeePay, .shopeePayJumpApp, .maybankQRPay, .duitNowQR, .duitNowOBW, .payPay:
try container.encode(Array(supportedCurrencies), forKey: .supportedCurrencies)
}
}
Expand Down Expand Up @@ -414,6 +419,8 @@ extension Capability.Backend {
self = .source(.rabbitLinepay)
case .ocbcPao:
self = .source(.mobileBankingOCBCPAO)
case .ocbcDigital:
self = .source(.mobileBankingOCBC)
case .grabPay:
self = .source(.grabPay)
case .grabPayRms:
Expand Down
4 changes: 0 additions & 4 deletions OmiseSDK/CardExpiryDateTextField.swift
Original file line number Diff line number Diff line change
Expand Up @@ -181,10 +181,6 @@ import UIKit
}

static let monthStringRegularExpression: NSRegularExpression! = try? NSRegularExpression(pattern: "^([0-1]?\\d)", options: [])

public override func replace(_ range: UITextRange, withText text: String) {
super.replace(range, withText: text)
}

// swiftlint:disable:next cyclomatic_complexity function_body_length
public override func paste(_ sender: Any?) {
Expand Down
2 changes: 1 addition & 1 deletion OmiseSDK/Client.swift
Original file line number Diff line number Diff line change
Expand Up @@ -398,7 +398,7 @@ extension Client {

// MARK: - Constants
extension Client {
static let sdkVersion: String = "4.24.3"
static let sdkVersion: String = "4.25.0"

static let currentPlatform: String = ProcessInfo.processInfo.operatingSystemVersionString
static let currentDevice: String = UIDevice.current.model
Expand Down
5 changes: 5 additions & 0 deletions OmiseSDK/Compatibility/OmiseCapability.swift
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,9 @@ public class __OmiseCapabilitySourceBackendPayment: __OmiseCapabilityBackendPaym
static let ocbcPaoSourceBackendPayment =
__OmiseCapabilitySourceBackendPayment(sourceType: OMSSourceTypeValue.mobileBankingOCBCPAO)

static let ocbcDigitalSourceBackendPayment =
__OmiseCapabilitySourceBackendPayment(sourceType: OMSSourceTypeValue.mobileBankingOCBC)

static let grabPaySourceBackendPayment =
__OmiseCapabilitySourceBackendPayment(sourceType: OMSSourceTypeValue.grabPay)

Expand Down Expand Up @@ -209,6 +212,8 @@ extension __OmiseCapabilityBackendPayment {
return __OmiseCapabilitySourceBackendPayment.rabbitLinepaySourceBackendPayment
case .ocbcPao:
return __OmiseCapabilitySourceBackendPayment.ocbcPaoSourceBackendPayment
case .ocbcDigital:
return __OmiseCapabilitySourceBackendPayment.ocbcDigitalSourceBackendPayment
case .grabPay, .grabPayRms:
return __OmiseCapabilitySourceBackendPayment.grabPaySourceBackendPayment
case .boost:
Expand Down
6 changes: 6 additions & 0 deletions OmiseSDK/Compatibility/OmiseSource.swift
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,9 @@ public class __SourcePaymentInformation: NSObject {
/// Payment Information for an OCBC Pay Anyone
public static let ocbcPaoPayment = __SourcePaymentInformation(type: OMSSourceTypeValue.mobileBankingOCBCPAO)!

/// Payment Information for an OCBC Digital
public static let ocbcDigitalPayment = __SourcePaymentInformation(type: OMSSourceTypeValue.mobileBankingOCBC)!

/// Payment Information for a GrabPay Payment
public static let grabPayPayment = __SourcePaymentInformation(type: OMSSourceTypeValue.grabPay)!

Expand Down Expand Up @@ -619,6 +622,9 @@ extension __SourcePaymentInformation {
case .ocbcPao:
return __SourcePaymentInformation.ocbcPaoPayment

case .ocbcDigital:
return __SourcePaymentInformation.ocbcDigitalPayment

case .grabPay:
return __SourcePaymentInformation.grabPayPayment

Expand Down
31 changes: 6 additions & 25 deletions OmiseSDK/CreditCardFormViewController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -263,31 +263,7 @@ public class CreditCardFormViewController: UIViewController, PaymentChooserUI, P
cvvInfoButton.tintColor = .badgeBackground
formFieldsAccessoryView.barTintColor = .formAccessoryBarTintColor

#if compiler(>=5.1)
if #available(iOS 13, *) {
let appearance = navigationItem.standardAppearance ?? UINavigationBarAppearance(idiom: .phone)
appearance.configureWithOpaqueBackground()
appearance.titleTextAttributes = [
NSAttributedString.Key.foregroundColor: UIColor.headings
]
appearance.largeTitleTextAttributes = [
NSAttributedString.Key.foregroundColor: UIColor.headings
]
let renderer = UIGraphicsImageRenderer(size: CGSize(width: 1, height: 1))
let image = renderer.image { (context) in
context.cgContext.setFillColor(UIColor.line.cgColor)
context.fill(CGRect(origin: .zero, size: CGSize(width: 1, height: 1)))
}
appearance.shadowImage = image.resizableImage(withCapInsets: UIEdgeInsets.zero)
.withRenderingMode(.alwaysTemplate)
appearance.shadowColor = preferredSecondaryColor ?? defaultPaymentChooserUISecondaryColor
navigationItem.standardAppearance = appearance

let scrollEdgeAppearance = appearance.copy()
appearance.shadowColor = preferredSecondaryColor ?? defaultPaymentChooserUISecondaryColor
navigationItem.scrollEdgeAppearance = scrollEdgeAppearance
}
#endif
applyNavigationBarStyle(.shadow(color: preferredSecondaryColor ?? defaultPaymentChooserUISecondaryColor))
}

private func setupBillingStackView() {
Expand Down Expand Up @@ -399,7 +375,12 @@ public class CreditCardFormViewController: UIViewController, PaymentChooserUI, P
// We'll leave the adjusting scroll view insets job for iOS 11 and later to the layoutMargins + safeAreaInsets here
automaticallyAdjustsScrollViewInsets = true
}

// Storyboard shows wrong warning on textContentType == .creditCardNumber
// Set textContentType manually
cardNumberTextField.textContentType = .creditCardNumber

cardNumberTextField.textContentType = .creditCardNumber
cardNumberTextField.rightView = cardBrandIconImageView
secureCodeTextField.rightView = cvvInfoButton
secureCodeTextField.rightViewMode = .always
Expand Down
2 changes: 2 additions & 0 deletions OmiseSDK/Globals.swift
Original file line number Diff line number Diff line change
Expand Up @@ -144,6 +144,8 @@ extension OMSSourceTypeValue {
return "rabbit_linepay"
case .mobileBankingOCBCPAO:
return "mobile_banking_ocbc_pao"
case .mobileBankingOCBC:
return "mobile_banking_ocbc"
case .grabPay, .grabPayRms:
return "grabpay"
case .boost:
Expand Down
Loading

0 comments on commit 89e9e88

Please sign in to comment.