Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Currency formatting issue fixed and Add Transfer Icon Fix(Ticket 331 and 507) #303

Merged
merged 5 commits into from
Mar 25, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions Common/Sources/Helper/HyperwalletIconContent.swift
Original file line number Diff line number Diff line change
Expand Up @@ -42,4 +42,6 @@ public enum HyperwalletIconContent: String {
case credit = "\u{e907}"
/// The debit icon
case debit = "\u{e908}"
/// Add new transfer method
case addNewTransferMethod = "\u{ea0a}"
}
2 changes: 2 additions & 0 deletions Common/Sources/Helper/Theme.swift
Original file line number Diff line number Diff line change
Expand Up @@ -127,6 +127,8 @@ public class Theme: NSObject {
public struct Icon {
/// The icon font size
public static let size = 30
/// The add tranfer method icon size
public static let addTransferMethodIconSize = 20
/// The icon frame
public static let frame = CGSize(width: 30, height: 30)
/// The icon primary color
Expand Down
Binary file modified Common/Sources/Resources/icomoon.ttf
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@
<Test
Identifier = "AddTransferMethodBankAccountBusinessTests">
</Test>
<Test
Identifier = "AddTransferMethodBankAccountIndividualTests/testAddTransferMethod_createBankAccountInvalidRouting()">
</Test>
</SkippedTests>
</TestableReference>
</Testables>
Expand Down
6 changes: 2 additions & 4 deletions Transfer/Sources/CreateTransferController.swift
Original file line number Diff line number Diff line change
Expand Up @@ -234,11 +234,9 @@ extension CreateTransferController {
if let transferMethod = presenter.selectedTransferDestination {
tableViewCell.configure(transferMethod: transferMethod)
} else {
if selectTransferMethodCoordinator == nil {
tableViewCell.accessoryType = .none
}
tableViewCell.accessoryType = .none

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this changed?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

To hide the arrow mark next to Add Transfer Method title.

let title = "mobileAddTransferMethod".localized()
tableViewCell.configure(title, HyperwalletIconContent.addTransferMethod)
tableViewCell.configure(title, HyperwalletIconContent.addNewTransferMethod)
}
}

Expand Down
3 changes: 1 addition & 2 deletions Transfer/Sources/TransferAmountCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -147,9 +147,8 @@ final class TransferAmountCell: UITableViewCell {
currencySymbolLabel.text = TransferAmountCurrencyFormatter
.getTransferAmountCurrency(for: currencyCode)?.symbol
currencySymbolLabel.adjustsFontForContentSizeCategory = true

amountString = digits(amount: amount)
setFormattedAmount(amount.formatAmountToDouble())
amountString = digits(amount: amountTextField.text ?? "0")
amountTextField.adjustsFontSizeToFitWidth = true
amountTextField.adjustsFontForContentSizeCategory = true
currencyLabel.text = currencyCode
Expand Down
2 changes: 1 addition & 1 deletion Transfer/Sources/TransferDestinationCell.swift
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ extension TransferDestinationCell {
if !UIFont.isLargeSizeCategory {
let icon = UIImage.fontIcon(hyperwalletIcon.rawValue,
Theme.Icon.frame,
CGFloat(Theme.Icon.size),
CGFloat(Theme.Icon.addTransferMethodIconSize),
Theme.Icon.primaryColor)
imageView?.image = icon
imageView?.layer.cornerRadius = CGFloat(Theme.Icon.frame.width / 2)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,43 @@
"href": "https://localhost.com/rest/v3/users/usr-token/transfer-methods/trm-token"
}
]
}
},
{
"token": "trm-0c7a0310",
"type": "BANK_ACCOUNT",
"status": "ACTIVATED",
"verificationStatus": "NOT_REQUIRED",
"createdOn": "2019-12-25T22:22:15",
"transferMethodCountry": "JP",
"transferMethodCurrency": "JPY",
"branchId": "021000021",
"bankAccountId": "4111222233331200",
"bankAccountRelationship": "SELF",
"bankAccountPurpose": "SAVINGS",
"profileType": "INDIVIDUAL",
"firstName": "Stan",
"middleName": "Individual",
"lastName": "Fung",
"dateOfBirth": "2000-02-02",
"gender": "MALE",
"phoneNumber": "605-555-1323",
"mobileNumber": "605-555-1323",
"governmentId": "333333333",
"addressLine1": "1234 IndividualAddress St",
"addressLine2": "1234 AddressLineTwo St",
"city": "Test",
"stateProvince": "CA",
"country": "US",
"postalCode": "12345",
"links": [
{
"params": {
"rel": "self"
},
"href": "https://localhost.com/rest/v3/users/usr-token/transfer-methods/trm-token"
}
]
},
],
"links": [
{
Expand Down
48 changes: 48 additions & 0 deletions UITests/TransferFunds/TransferUserFundsTest.swift
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ class TransferUserFundsTest: BaseTests {
return "Canada ending in 1235"
}
}()

var expectedJapanDestinationLabel: String = {
if #available(iOS 11.2, *) {
return "Japan\nending in 1200"
} else {
return "Japan ending in 1200"
}
}()

override func setUp() {
super.setUp()
Expand Down Expand Up @@ -525,6 +533,46 @@ class TransferUserFundsTest: BaseTests {
clickBackButton()
transferFunds.verifyTransferFundsTitle()
}

func testTransferFunds_currencyFormatting() {
mockServer.setupStub(url: "/rest/v3/users/usr-token/transfer-methods",
filename: "ListMoreThanOneTransferMethod",
method: HTTPMethod.get)
mockServer.setupStub(url: "/rest/v3/transfers",
filename: "AvailableFundUSD",
method: HTTPMethod.post)

XCTAssertTrue(transferFundMenu.exists)
transferFundMenu.tap()
waitForNonExistence(spinner)

transferFunds.verifyBankAccountDestination(type: TransferMethods.bankAccount, endingDigit: "1234")

transferFunds.transferAmount.tap()
transferFunds.transferAmount.clearAmountFieldAndEnterText(text: "1.23")

transferFunds.addSelectDestinationLabel.tap()

XCTAssertTrue(selectDestination.selectDestinationTitle.exists)
XCTAssertTrue(selectDestination.addTransferMethodButton.exists)

waitForNonExistence(spinner)

XCTAssertEqual(selectDestination.getSelectDestinationRowTitle(index: 3), TransferMethods.bankAccount)
XCTAssertEqual(selectDestination.getSelectDestinationRowDetail(index: 3),
expectedJapanDestinationLabel)

selectDestination.tapSelectDestinationRow(index: 3)

waitForNonExistence(spinner)

XCTAssertTrue(transferFunds.transferAmount.exists)

transferFunds.transferAmount.tap()
transferFunds.transferAmount.typeText("2")

XCTAssertEqual(transferFunds.transferAmount.value as? String, "12")
}

private func assertButtonTrue(element: XCUIElement) {
if #available(iOS 13.0, *) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -176,11 +176,11 @@ class AddTransferMethodBankAccountIndividualTests: BaseTests {
filename: "UnexpectedErrorResponse",
method: HTTPMethod.post)

waitForExistence(addTransferMethod.branchIdInput)
waitForExistence(addTransferMethod.accountTypeLabel)

addTransferMethod.selectAccountType("CHECKING")
addTransferMethod.setBranchId("021000022")
addTransferMethod.setBankAccountId("12345")
addTransferMethod.selectAccountType("CHECKING")

addTransferMethod.clickCreateTransferMethodButton()
waitForNonExistence(spinner)
Expand Down