Skip to content

Commit 2e433c8

Browse files
authored
Merge pull request #6219 from woocommerce/add/order-factory-helpers-deleted-lines
Order Creation: Add helpers for deleted fee and shipping lines
2 parents b5045f4 + d0a81f1 commit 2e433c8

File tree

1 file changed

+12
-0
lines changed

1 file changed

+12
-0
lines changed

Yosemite/Yosemite/Stores/Order/OrderFactory.swift

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -52,6 +52,18 @@ public enum OrderFactory {
5252
attributes: [])
5353
}
5454

55+
/// Creates a fee line suitable to delete a fee line already saved remotely in an order.
56+
///
57+
public static func deletedFeeLine(_ feeLine: OrderFeeLine) -> OrderFeeLine {
58+
feeLine.copy(name: .some(nil))
59+
}
60+
61+
/// Creates a shipping line suitable to delete a shipping line already saved remotely in an order.
62+
///
63+
public static func deletedShippingLine(_ shippingLine: ShippingLine) -> ShippingLine {
64+
shippingLine.copy(methodID: .some(nil))
65+
}
66+
5567
/// References a new empty order with constants `Date` values.
5668
///
5769
public static let emptyNewOrder = Order.empty

0 commit comments

Comments
 (0)