@@ -12,10 +12,6 @@ final class NewOrderViewModel: ObservableObject {
1212
1313 private var cancellables : Set < AnyCancellable > = [ ]
1414
15- /// Order details used to create the order
16- ///
17- @Published var orderDetails = OrderDetails ( )
18-
1915 /// Active navigation bar trailing item.
2016 /// Defaults to no visible button.
2117 ///
@@ -272,19 +268,6 @@ extension NewOrderViewModel {
272268 case loading
273269 }
274270
275- /// Type to hold all order detail values
276- ///
277- struct OrderDetails {
278- var items : [ NewOrderItem ] = [ ]
279-
280- func toOrder( ) -> Order {
281- OrderFactory . emptyNewOrder. copy ( status: . pending,
282- items: items. map { $0. orderItem } ,
283- billingAddress: nil ,
284- shippingAddress: nil )
285- }
286- }
287-
288271 /// Representation of order status display properties
289272 ///
290273 struct StatusBadgeViewModel {
@@ -313,52 +296,6 @@ extension NewOrderViewModel {
313296 }
314297 }
315298
316- /// Representation of new items in an order.
317- ///
318- struct NewOrderItem : Equatable , Identifiable {
319- let id : String
320- let productID : Int64
321- let variationID : Int64
322- var quantity : Decimal
323- let price : NSDecimalNumber
324- var subtotal : String {
325- String ( describing: quantity * price. decimalValue)
326- }
327-
328- var orderItem : OrderItem {
329- OrderItem ( itemID: 0 ,
330- name: " " ,
331- productID: productID,
332- variationID: variationID,
333- quantity: quantity,
334- price: price,
335- sku: nil ,
336- subtotal: subtotal,
337- subtotalTax: " " ,
338- taxClass: " " ,
339- taxes: [ ] ,
340- total: " " ,
341- totalTax: " " ,
342- attributes: [ ] )
343- }
344-
345- init ( product: Product , quantity: Decimal ) {
346- self . id = UUID ( ) . uuidString
347- self . productID = product. productID
348- self . variationID = 0 // Products in an order are represented in Core with a variation ID of 0
349- self . quantity = quantity
350- self . price = NSDecimalNumber ( string: product. price)
351- }
352-
353- init ( variation: ProductVariation , quantity: Decimal ) {
354- self . id = UUID ( ) . uuidString
355- self . productID = variation. productID
356- self . variationID = variation. productVariationID
357- self . quantity = quantity
358- self . price = NSDecimalNumber ( string: variation. price)
359- }
360- }
361-
362299 /// Representation of customer data display properties
363300 ///
364301 struct CustomerDataViewModel {
0 commit comments