-
Notifications
You must be signed in to change notification settings - Fork 113
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Show description for trial tap to pay line items
When a merchant tries out tap to pay on iPhone, we make an order which will remain in their history, even though it gets refunded. To help merchants identify the order, this adds a specific description rather than showing `Simple Payment` for these payments.
- Loading branch information
Showing
8 changed files
with
94 additions
and
15 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
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1165,6 +1165,7 @@ final class OrderStoreTests: XCTestCase { | |
// Given | ||
let feeID: Int64 = 1234 | ||
let amount = "100.00" | ||
let amountName = "A simple amount" | ||
let taxable = true | ||
let note = "This is a note" | ||
let email = "[email protected]" | ||
|
@@ -1178,6 +1179,7 @@ final class OrderStoreTests: XCTestCase { | |
feeID: feeID, | ||
status: .pending, | ||
amount: amount, | ||
amountName: amountName, | ||
taxable: taxable, | ||
orderNote: note, | ||
email: email) { _ in } | ||
|
@@ -1188,7 +1190,7 @@ final class OrderStoreTests: XCTestCase { | |
let receivedFees = try XCTUnwrap(request.parameters["fee_lines"] as? [[String: AnyHashable]]).first | ||
let expectedFees: [String: AnyHashable] = [ | ||
"id": 1234, | ||
"name": "Simple Payments", | ||
"name": "A simple amount", | ||
"tax_status": "taxable", | ||
"tax_class": "", | ||
"total": "100.00" | ||
|
@@ -1212,6 +1214,42 @@ final class OrderStoreTests: XCTestCase { | |
assertEqual(receivedNote, note) | ||
} | ||
|
||
func test_update_simple_payments_order_sends_default_name_when_none_provided() throws { | ||
// Given | ||
let feeID: Int64 = 1234 | ||
let amount = "100.00" | ||
let taxable = true | ||
let note = "This is a note" | ||
let email = "[email protected]" | ||
|
||
let store = OrderStore(dispatcher: dispatcher, storageManager: storageManager, network: network) | ||
network.simulateResponse(requestUrlSuffix: "orders/963", filename: "order") | ||
|
||
// When | ||
let action = OrderAction.updateSimplePaymentsOrder(siteID: sampleSiteID, | ||
orderID: sampleOrderID, | ||
feeID: feeID, | ||
status: .pending, | ||
amount: amount, | ||
amountName: nil, | ||
taxable: taxable, | ||
orderNote: note, | ||
email: email) { _ in } | ||
store.onAction(action) | ||
|
||
// Then | ||
let request = try XCTUnwrap(network.requestsForResponseData.last as? JetpackRequest) | ||
let receivedFees = try XCTUnwrap(request.parameters["fee_lines"] as? [[String: AnyHashable]]).first | ||
let expectedFees: [String: AnyHashable] = [ | ||
"id": 1234, | ||
"name": "Simple Payments", | ||
"tax_status": "taxable", | ||
"tax_class": "", | ||
"total": "100.00" | ||
] | ||
assertEqual(expectedFees, receivedFees) | ||
} | ||
|
||
func test_create_order_sends_expected_fields() throws { | ||
// Given | ||
let store = OrderStore(dispatcher: dispatcher, storageManager: storageManager, network: network) | ||
|