diff --git a/OmiseSDK/Client.swift b/OmiseSDK/Client.swift index 2d68e000..e9d6d6ed 100644 --- a/OmiseSDK/Client.swift +++ b/OmiseSDK/Client.swift @@ -331,7 +331,7 @@ extension Client { // swiftlint:disable:next function_body_length private static func completeRequest(_ request: Request, callback: Request.Callback?) -> ((Data?, URLResponse?, Error?) -> Void) { // swiftlint:disable:next closure_body_length - return { (data: Data?, response: URLResponse?, error: Error?) -> Void in + return { (data: Data?, response: URLResponse?, error: Error?) in guard let callback = callback else { return } // nobody around to hear the leaf falls var result: RequestResult diff --git a/OmiseSDK/Resources/Assets.xcassets/Method/ocbc_digital.imageset/Contents.json b/OmiseSDK/Resources/Assets.xcassets/Method/ocbc-digital.imageset/Contents.json similarity index 68% rename from OmiseSDK/Resources/Assets.xcassets/Method/ocbc_digital.imageset/Contents.json rename to OmiseSDK/Resources/Assets.xcassets/Method/ocbc-digital.imageset/Contents.json index 6ca5fd17..d2532b38 100644 --- a/OmiseSDK/Resources/Assets.xcassets/Method/ocbc_digital.imageset/Contents.json +++ b/OmiseSDK/Resources/Assets.xcassets/Method/ocbc-digital.imageset/Contents.json @@ -1,17 +1,17 @@ { "images" : [ { - "filename" : "ocbc_digital.png", + "filename" : "ocbc-digital.png", "idiom" : "universal", "scale" : "1x" }, { - "filename" : "ocbc_digital@2x.png", + "filename" : "ocbc-digital@2x.png", "idiom" : "universal", "scale" : "2x" }, { - "filename" : "ocbc_digital@3x.png", + "filename" : "ocbc-digital@3x.png", "idiom" : "universal", "scale" : "3x" } diff --git a/OmiseSDK/Resources/Assets.xcassets/Method/ocbc-digital.imageset/ocbc-digital.png b/OmiseSDK/Resources/Assets.xcassets/Method/ocbc-digital.imageset/ocbc-digital.png new file mode 100644 index 00000000..f51f6333 Binary files /dev/null and b/OmiseSDK/Resources/Assets.xcassets/Method/ocbc-digital.imageset/ocbc-digital.png differ diff --git a/OmiseSDK/Resources/Assets.xcassets/Method/ocbc-digital.imageset/ocbc-digital@2x.png b/OmiseSDK/Resources/Assets.xcassets/Method/ocbc-digital.imageset/ocbc-digital@2x.png new file mode 100644 index 00000000..38c91405 Binary files /dev/null and b/OmiseSDK/Resources/Assets.xcassets/Method/ocbc-digital.imageset/ocbc-digital@2x.png differ diff --git a/OmiseSDK/Resources/Assets.xcassets/Method/ocbc-digital.imageset/ocbc-digital@3x.png b/OmiseSDK/Resources/Assets.xcassets/Method/ocbc-digital.imageset/ocbc-digital@3x.png new file mode 100644 index 00000000..e475a7f4 Binary files /dev/null and b/OmiseSDK/Resources/Assets.xcassets/Method/ocbc-digital.imageset/ocbc-digital@3x.png differ diff --git a/OmiseSDK/Resources/Assets.xcassets/Method/ocbc_digital.imageset/ocbc_digital.png b/OmiseSDK/Resources/Assets.xcassets/Method/ocbc_digital.imageset/ocbc_digital.png deleted file mode 100644 index d615ec35..00000000 Binary files a/OmiseSDK/Resources/Assets.xcassets/Method/ocbc_digital.imageset/ocbc_digital.png and /dev/null differ diff --git a/OmiseSDK/Resources/Assets.xcassets/Method/ocbc_digital.imageset/ocbc_digital@2x.png b/OmiseSDK/Resources/Assets.xcassets/Method/ocbc_digital.imageset/ocbc_digital@2x.png deleted file mode 100644 index ae2f2356..00000000 Binary files a/OmiseSDK/Resources/Assets.xcassets/Method/ocbc_digital.imageset/ocbc_digital@2x.png and /dev/null differ diff --git a/OmiseSDK/Resources/Assets.xcassets/Method/ocbc_digital.imageset/ocbc_digital@3x.png b/OmiseSDK/Resources/Assets.xcassets/Method/ocbc_digital.imageset/ocbc_digital@3x.png deleted file mode 100644 index 29aa9d17..00000000 Binary files a/OmiseSDK/Resources/Assets.xcassets/Method/ocbc_digital.imageset/ocbc_digital@3x.png and /dev/null differ diff --git a/OmiseSDKTests/CapabilityOperationFixtureTests.swift b/OmiseSDKTests/CapabilityOperationFixtureTests.swift index 0b644ecd..a839e839 100644 --- a/OmiseSDKTests/CapabilityOperationFixtureTests.swift +++ b/OmiseSDKTests/CapabilityOperationFixtureTests.swift @@ -3,7 +3,6 @@ import XCTest class CapabilityOperationFixtureTests: XCTestCase { - // swiftlint:disable:next function_body_length func testCapabilityRetrieve() { let decoder = Client.makeJSONDecoder(for: Request?.none) @@ -30,30 +29,6 @@ class CapabilityOperationFixtureTests: XCTestCase { XCTFail("Capability doesn't have the BAY Installment backend") } - if let trueMoneyBackend = capability[OMSSourceTypeValue.trueMoney] { - XCTAssertEqual(trueMoneyBackend.supportedCurrencies, [.thb]) - } else { - XCTFail("Capability doesn't have the TrueMoney backend") - } - - if let citiPointsBackend = capability[OMSSourceTypeValue.pointsCiti] { - XCTAssertEqual(citiPointsBackend.supportedCurrencies, [.thb]) - } else { - XCTFail("Capability doesn't have the Citi Points backend") - } - - if let rabbitLinePayBackend = capability[OMSSourceTypeValue.rabbitLinepay] { - XCTAssertEqual(rabbitLinePayBackend.supportedCurrencies, [.thb]) - } else { - XCTFail("Capability doesn't have the Rabbit LINE Pay backend") - } - - if let ocbcPaoBackend = capability[OMSSourceTypeValue.mobileBankingOCBCPAO] { - XCTAssertEqual(ocbcPaoBackend.supportedCurrencies, [.sgd]) - } else { - XCTFail("Capability doesn't have the OCBC Pay Anyone backend") - } - if let fpxBackend = capability[OMSSourceTypeValue.fpx] { XCTAssertEqual(fpxBackend.banks, [ Capability.Backend.Bank(name: "UOB", code: "uob", isActive: true) @@ -70,17 +45,20 @@ class CapabilityOperationFixtureTests: XCTestCase { XCTFail("Capability doesn't have the Mobile Banking KBank backend") } - if let grabPayBackend = capability[OMSSourceTypeValue.grabPay] { - XCTAssertEqual(grabPayBackend.supportedCurrencies, [.sgd, .myr]) - } else { - XCTFail("Capability doesn't have the GrabPay backend") - } - - if let payPayBackend = capability[OMSSourceTypeValue.payPay] { - XCTAssertEqual(payPayBackend.supportedCurrencies, [.jpy]) - } else { - XCTFail("Capability doesn't have the PayPay backend") + func testCapabilitySupportsCurrency(_ capability: Capability, sourceType: OMSSourceTypeValue, currencies: Set) { + if let backend = capability[sourceType] { + XCTAssertEqual(backend.supportedCurrencies, currencies) + } else { + XCTFail("Capability doesn't have the \(sourceType) backend") + } } + + testCapabilitySupportsCurrency(capability, sourceType: .trueMoney, currencies: [.thb]) + testCapabilitySupportsCurrency(capability, sourceType: .pointsCiti, currencies: [.thb]) + testCapabilitySupportsCurrency(capability, sourceType: .rabbitLinepay, currencies: [.thb]) + testCapabilitySupportsCurrency(capability, sourceType: .mobileBankingOCBCPAO, currencies: [.sgd]) + testCapabilitySupportsCurrency(capability, sourceType: .grabPay, currencies: [.sgd, .myr]) + testCapabilitySupportsCurrency(capability, sourceType: .payPay, currencies: [.jpy]) } catch { XCTFail("Cannot decode the source \(error)") }