From 314713004b3db18e5650bb299107861ef9187ce4 Mon Sep 17 00:00:00 2001 From: Andrei Solovev Date: Thu, 15 Feb 2024 11:51:40 +0700 Subject: [PATCH 1/2] Filter shopeepay and shopeepay_jumpapp --- OmiseSDK/PaymentChooserViewController.swift | 9 ++++++ .../PaymentChooserViewControllerTests.swift | 29 ++++++++++++++++++- 2 files changed, 37 insertions(+), 1 deletion(-) diff --git a/OmiseSDK/PaymentChooserViewController.swift b/OmiseSDK/PaymentChooserViewController.swift index 6560ae01..08060ffc 100644 --- a/OmiseSDK/PaymentChooserViewController.swift +++ b/OmiseSDK/PaymentChooserViewController.swift @@ -524,6 +524,7 @@ class PaymentChooserViewController: AdaptableStaticTableViewController [PaymentChooserOption] { + var filter = paymentOptions + if filter.contains(.shopeePay) && filter.contains(.shopeePayJumpApp) { + filter.removeAll { $0 == .shopeePay } + } + return filter + } } diff --git a/OmiseSDKTests/Not Refactored Tests/Views/PaymentChooserViewControllerTests.swift b/OmiseSDKTests/Not Refactored Tests/Views/PaymentChooserViewControllerTests.swift index 2e30b856..53ee49b6 100644 --- a/OmiseSDKTests/Not Refactored Tests/Views/PaymentChooserViewControllerTests.swift +++ b/OmiseSDKTests/Not Refactored Tests/Views/PaymentChooserViewControllerTests.swift @@ -87,6 +87,34 @@ class PaymentChooserViewControllerTests: XCTestCase { XCTAssertFalse(vc.showingValues.contains(.truemoney)) } + func testShopeePayFiltering() { + let shopeePayOnly = allSourceTypes.filter { $0 != .shopeePayJumpApp } + let shopeePayJumpAppOnly = allSourceTypes.filter { $0 != .shopeePay } + let shopeePayAndJumpApp = allSourceTypes + let noShopeePayandJumpApp = allSourceTypes.filter { + ($0 != .shopeePay) && ($0 != .shopeePayJumpApp) + } + + let vc = PaymentChooserViewController() + vc.loadView() + + vc.allowedPaymentMethods = shopeePayOnly + XCTAssertTrue(vc.showingValues.contains(.shopeePay)) + XCTAssertFalse(vc.showingValues.contains(.shopeePayJumpApp)) + + vc.allowedPaymentMethods = shopeePayJumpAppOnly + XCTAssertTrue(vc.showingValues.contains(.shopeePayJumpApp)) + XCTAssertFalse(vc.showingValues.contains(.shopeePay)) + + vc.allowedPaymentMethods = shopeePayAndJumpApp + XCTAssertTrue(vc.showingValues.contains(.shopeePayJumpApp)) + XCTAssertFalse(vc.showingValues.contains(.shopeePay)) + + vc.allowedPaymentMethods = noShopeePayandJumpApp + XCTAssertFalse(vc.showingValues.contains(.shopeePayJumpApp)) + XCTAssertFalse(vc.showingValues.contains(.shopeePay)) + } + func testAlphabetSorting() { let vc = PaymentChooserViewController() vc.loadView() @@ -144,7 +172,6 @@ class PaymentChooserViewControllerTests: XCTestCase { .installment, .ocbcDigital, .rabbitLinepay, - .shopeePay, .shopeePayJumpApp, .alipayCN, .alipayHK, From d4f7dd888a9a96948bbd37f83c0a32a9b7c9c607 Mon Sep 17 00:00:00 2001 From: Andrei Solovev Date: Thu, 15 Feb 2024 11:56:49 +0700 Subject: [PATCH 2/2] Add SHopeepay Jump App to Settings --- ExampleApp/Resources/Main.storyboard | 140 ++++++++++-------- .../PaymentSettingTableViewController.swift | 5 + 2 files changed, 84 insertions(+), 61 deletions(-) diff --git a/ExampleApp/Resources/Main.storyboard b/ExampleApp/Resources/Main.storyboard index 0de80adc..2f62d77d 100644 --- a/ExampleApp/Resources/Main.storyboard +++ b/ExampleApp/Resources/Main.storyboard @@ -732,14 +732,14 @@ You can present via either Storyboard or Code and you can see the code in the Ex - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - - + - + + + + + + + + + +