Skip to content

Commit ea1d402

Browse files
committed
Use billing address for customer section data
1 parent 211b736 commit ea1d402

File tree

2 files changed

+9
-7
lines changed

2 files changed

+9
-7
lines changed

WooCommerce/Classes/ViewModels/Booking Details/BookingDetailsViewModel.swift

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -168,7 +168,9 @@ private extension BookingDetailsViewModel {
168168

169169
@MainActor
170170
func updateCustomerSection(with customer: Customer) {
171-
customerContent.update(with: customer)
171+
if let billingAddress = customer.billing {
172+
customerContent.update(with: billingAddress)
173+
}
172174
insertCustomerSectionIfAbsent()
173175
}
174176

WooCommerce/Classes/ViewModels/Booking Details/CustomerContent.swift

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -9,20 +9,20 @@ extension BookingDetailsViewModel {
99
@Published var billingAddressText: String?
1010

1111
@MainActor
12-
func update(with customer: Customer) {
12+
func update(with address: Address) {
1313
let name = [
14-
customer.firstName,
15-
customer.lastName
14+
address.firstName,
15+
address.lastName
1616
]
1717
.compactMap { $0 }
1818
.filter { !$0.isEmpty }
1919
.joined(separator: " ")
2020

21-
let billingAddress = customer.billing.flatMap(formatAddress)
21+
let billingAddress = formatAddress(address)
2222

2323
nameText = name
24-
emailText = customer.email
25-
phoneText = customer.billing?.phone ?? ""
24+
emailText = address.email
25+
phoneText = address.phone ?? ""
2626
billingAddressText = billingAddress
2727
}
2828

0 commit comments

Comments
 (0)