Skip to content

Commit 5bad105

Browse files
committed
Add method to create just a simple payment fee
1 parent e3a608c commit 5bad105

File tree

1 file changed

+14
-8
lines changed

1 file changed

+14
-8
lines changed

Yosemite/Yosemite/Stores/Order/OrderFactory.swift

Lines changed: 14 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,13 +33,19 @@ enum OrderFactory {
3333
shippingLines: [],
3434
coupons: [],
3535
refunds: [],
36-
fees: [.init(feeID: 0,
37-
name: "Simple Payments",
38-
taxClass: "",
39-
taxStatus: taxable ? .taxable : .none,
40-
total: amount,
41-
totalTax: "",
42-
taxes: [],
43-
attributes: [])])
36+
fees: [simplePaymentFee(feeID: 0, amount: amount, taxable: taxable)])
37+
}
38+
39+
/// Creates a fee line suitable to be used within a simple payments order.
40+
///
41+
static func simplePaymentFee(feeID: Int64, amount: String, taxable: Bool) -> OrderFeeLine {
42+
.init(feeID: feeID,
43+
name: "Simple Payments",
44+
taxClass: "",
45+
taxStatus: taxable ? .taxable : .none,
46+
total: amount,
47+
totalTax: "",
48+
taxes: [],
49+
attributes: [])
4450
}
4551
}

0 commit comments

Comments
 (0)