-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #246 from omise/feature/MIT-2092
Filter Truemoney Wallet / TrueMoney payment methods
- Loading branch information
Showing
7 changed files
with
143 additions
and
20 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
90 changes: 90 additions & 0 deletions
90
OmiseSDKTests/Views/PaymentChooserViewControllerTests.swift
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,90 @@ | ||
// | ||
// PaymentChooserViewControllerTests.swift | ||
// OmiseSDKTests | ||
// | ||
// Created by Andrei Solovev on 5/12/23. | ||
// Copyright © 2023 Omise. All rights reserved. | ||
// | ||
|
||
import XCTest | ||
@testable import OmiseSDK | ||
|
||
class PaymentChooserViewControllerTests: XCTestCase { | ||
let allSourceTypes: [OMSSourceTypeValue] = [ | ||
.internetBankingBAY, | ||
.internetBankingBBL, | ||
.mobileBankingSCB, | ||
.mobileBankingOCBCPAO, | ||
.mobileBankingOCBC, | ||
.mobileBankingBAY, | ||
.mobileBankingBBL, | ||
.mobileBankingKTB, | ||
.alipay, | ||
.alipayCN, | ||
.alipayHK, | ||
.billPaymentTescoLotus, | ||
.barcodeAlipay, | ||
.dana, | ||
.gcash, | ||
.installmentBAY, | ||
.installmentFirstChoice, | ||
.installmentBBL, | ||
.installmentMBB, | ||
.installmentKTC, | ||
.installmentKBank, | ||
.installmentSCB, | ||
.installmentCiti, | ||
.installmentTTB, | ||
.installmentUOB, | ||
.kakaoPay, | ||
.eContext, | ||
.promptPay, | ||
.payNow, | ||
.touchNGo, | ||
.touchNGoAlipayPlus, | ||
.trueMoney, | ||
.trueMoneyJumpApp, | ||
.pointsCiti, | ||
.fpx, | ||
.mobileBankingKBank, | ||
.rabbitLinepay, | ||
.grabPay, | ||
.grabPayRms, | ||
.boost, | ||
.shopeePay, | ||
.shopeePayJumpApp, | ||
.maybankQRPay, | ||
.duitNowQR, | ||
.duitNowOBW, | ||
.atome, | ||
.payPay | ||
] | ||
|
||
func testTruemoveFiltering() { | ||
let trueMoneyWalletOnly = allSourceTypes.filter { $0 != .trueMoneyJumpApp } | ||
let trueMoneyJumpAppOnly = allSourceTypes.filter { $0 != .trueMoney } | ||
let trueMoneyAndJumpApp = allSourceTypes | ||
let noTrueMoneyAndJumpApp = allSourceTypes.filter { | ||
($0 != .trueMoney) && ($0 != .trueMoneyJumpApp) | ||
} | ||
|
||
let vc = PaymentChooserViewController() | ||
vc.loadView() | ||
|
||
vc.allowedPaymentMethods = trueMoneyWalletOnly | ||
XCTAssertTrue(vc.showingValues.contains(.truemoney)) | ||
XCTAssertFalse(vc.showingValues.contains(.truemoneyJumpApp)) | ||
|
||
vc.allowedPaymentMethods = trueMoneyJumpAppOnly | ||
XCTAssertTrue(vc.showingValues.contains(.truemoneyJumpApp)) | ||
XCTAssertFalse(vc.showingValues.contains(.truemoney)) | ||
|
||
vc.allowedPaymentMethods = trueMoneyAndJumpApp | ||
XCTAssertTrue(vc.showingValues.contains(.truemoneyJumpApp)) | ||
XCTAssertFalse(vc.showingValues.contains(.truemoney)) | ||
|
||
vc.allowedPaymentMethods = noTrueMoneyAndJumpApp | ||
XCTAssertFalse(vc.showingValues.contains(.truemoneyJumpApp)) | ||
XCTAssertFalse(vc.showingValues.contains(.truemoney)) | ||
} | ||
} |