Skip to content

Commit a63096d

Browse files
committed
Update readonly model to contain customer note
1 parent 159b28d commit a63096d

File tree

3 files changed

+9
-3
lines changed

3 files changed

+9
-3
lines changed

Modules/Sources/Networking/Model/Bookings/BookingCustomerInfo.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,10 @@ import Foundation
22

33
public struct BookingCustomerInfo: Hashable {
44
public let billingAddress: Address
5+
public let note: String?
56

6-
public init(billingAddress: Address) {
7+
public init(billingAddress: Address, note: String? = nil) {
78
self.billingAddress = billingAddress
9+
self.note = note
810
}
911
}

Modules/Sources/Networking/Model/Bookings/BookingOrderInfo.swift

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,10 @@ public struct BookingOrderInfo: Hashable {
2222
guard let billingAddress = order.billingAddress else {
2323
return nil
2424
}
25-
return BookingCustomerInfo(billingAddress: billingAddress)
25+
return BookingCustomerInfo(
26+
billingAddress: billingAddress,
27+
note: order.customerNote
28+
)
2629
}()
2730
self.productInfo = BookingProductInfo(name: order.items.first(where: { $0.productID == booking.productID })?.name ?? "")
2831
self.paymentInfo = BookingPaymentInfo(

Modules/Sources/Yosemite/Model/Booking/BookingCustomerInfo+ReadOnlyConvertible.swift

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,7 @@ extension Storage.BookingCustomerInfo: ReadOnlyConvertible {
1616
billingPhone = customerInfo.billingAddress.phone
1717
billingPostcode = customerInfo.billingAddress.postcode
1818
billingState = customerInfo.billingAddress.state
19+
note = customerInfo.note
1920
}
2021

2122
public func toReadOnly() -> Yosemite.BookingCustomerInfo {
@@ -30,6 +31,6 @@ extension Storage.BookingCustomerInfo: ReadOnlyConvertible {
3031
country: billingCountry ?? "",
3132
phone: billingPhone,
3233
email: billingEmail)
33-
return .init(billingAddress: address)
34+
return .init(billingAddress: address, note: note)
3435
}
3536
}

0 commit comments

Comments
 (0)