-
Notifications
You must be signed in to change notification settings - Fork 121
[Bookings] Add Yosemite models for booking info #16245
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Merged
itsmeichigo
merged 7 commits into
trunk
from
WOOMOB-1508-add-yosemite-models-for-bookings-info
Oct 16, 2025
Merged
Changes from all commits
Commits
Show all changes
7 commits
Select commit
Hold shift + click to select a range
341ac34
Add booking info readonly models
RafaelKayumov 10a34cc
Add basic mapping persistence for booking info
RafaelKayumov 1ce9895
Add tests for booking store
itsmeichigo ebeca20
Add order info to Booking model
itsmeichigo 5e3cf8a
Display basic info on booking list
itsmeichigo 2f0855b
Revert UI change
itsmeichigo 086b94f
Merge branch 'trunk' into WOOMOB-1508-add-yosemite-models-for-booking…
itsmeichigo File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
9 changes: 9 additions & 0 deletions
9
Modules/Sources/Networking/Model/Bookings/BookingCustomerInfo.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import Foundation | ||
|
|
||
| public struct BookingCustomerInfo: Hashable { | ||
| public let billingAddress: Address | ||
|
|
||
| public init(billingAddress: Address) { | ||
| self.billingAddress = billingAddress | ||
| } | ||
| } |
19 changes: 19 additions & 0 deletions
19
Modules/Sources/Networking/Model/Bookings/BookingOrderInfo.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,19 @@ | ||
| // periphery:ignore:all | ||
| import Foundation | ||
|
|
||
| public struct BookingOrderInfo: Hashable { | ||
| public let statusKey: String | ||
| public let paymentInfo: BookingPaymentInfo? | ||
| public let customerInfo: BookingCustomerInfo? | ||
| public let productInfo: BookingProductInfo? | ||
|
|
||
| public init(statusKey: String, | ||
| paymentInfo: BookingPaymentInfo?, | ||
| customerInfo: BookingCustomerInfo?, | ||
| productInfo: BookingProductInfo?) { | ||
| self.statusKey = statusKey | ||
| self.paymentInfo = paymentInfo | ||
| self.customerInfo = customerInfo | ||
| self.productInfo = productInfo | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
Modules/Sources/Networking/Model/Bookings/BookingPaymentInfo.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import Foundation | ||
|
|
||
| public struct BookingPaymentInfo: Hashable { | ||
| public let paymentMethodID: String | ||
| public let paymentMethodTitle: String | ||
| public let subtotal: String | ||
| public let subtotalTax: String | ||
| public let total: String | ||
| public let totalTax: String | ||
|
|
||
| public init(paymentMethodID: String, | ||
| paymentMethodTitle: String, | ||
| subtotal: String, | ||
| subtotalTax: String, | ||
| total: String, | ||
| totalTax: String) { | ||
| self.paymentMethodID = paymentMethodID | ||
| self.paymentMethodTitle = paymentMethodTitle | ||
| self.subtotal = subtotal | ||
| self.subtotalTax = subtotalTax | ||
| self.total = total | ||
| self.totalTax = totalTax | ||
| } | ||
| } |
9 changes: 9 additions & 0 deletions
9
Modules/Sources/Networking/Model/Bookings/BookingProductInfo.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,9 @@ | ||
| import Foundation | ||
|
|
||
| public struct BookingProductInfo: Hashable { | ||
| public let name: String | ||
|
|
||
| public init(name: String) { | ||
| self.name = name | ||
| } | ||
| } |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
35 changes: 35 additions & 0 deletions
35
Modules/Sources/Yosemite/Model/Booking/BookingCustomerInfo+ReadOnlyConvertible.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,35 @@ | ||
| import Foundation | ||
| import Storage | ||
|
|
||
| // MARK: - Storage.BookingCustomerInfo: ReadOnlyConvertible | ||
| // | ||
| extension Storage.BookingCustomerInfo: ReadOnlyConvertible { | ||
| public func update(with customerInfo: Yosemite.BookingCustomerInfo) { | ||
| billingAddress1 = customerInfo.billingAddress.address1 | ||
| billingAddress2 = customerInfo.billingAddress.address2 | ||
| billingCity = customerInfo.billingAddress.city | ||
| billingCompany = customerInfo.billingAddress.company | ||
| billingCountry = customerInfo.billingAddress.country | ||
| billingEmail = customerInfo.billingAddress.email | ||
| billingFirstName = customerInfo.billingAddress.firstName | ||
| billingLastName = customerInfo.billingAddress.lastName | ||
| billingPhone = customerInfo.billingAddress.phone | ||
| billingPostcode = customerInfo.billingAddress.postcode | ||
| billingState = customerInfo.billingAddress.state | ||
| } | ||
|
|
||
| public func toReadOnly() -> Yosemite.BookingCustomerInfo { | ||
| let address = Yosemite.Address(firstName: billingFirstName ?? "", | ||
| lastName: billingLastName ?? "", | ||
| company: billingCompany, | ||
| address1: billingAddress1 ?? "", | ||
| address2: billingAddress2, | ||
| city: billingCity ?? "", | ||
| state: billingState ?? "", | ||
| postcode: billingPostcode ?? "", | ||
| country: billingCountry ?? "", | ||
| phone: billingPhone, | ||
| email: billingEmail) | ||
| return .init(billingAddress: address) | ||
| } | ||
| } |
18 changes: 18 additions & 0 deletions
18
Modules/Sources/Yosemite/Model/Booking/BookingOrderInfo+ReadOnlyConvertible.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,18 @@ | ||
| import Foundation | ||
| import Storage | ||
|
|
||
| // MARK: - Storage.BookingOrderInfo: ReadOnlyConvertible | ||
| // | ||
| extension Storage.BookingOrderInfo: ReadOnlyConvertible { | ||
| public func update(with orderInfo: Yosemite.BookingOrderInfo) { | ||
| statusKey = orderInfo.statusKey | ||
| // Relationships are handled in BookingStore | ||
| } | ||
|
|
||
| public func toReadOnly() -> Yosemite.BookingOrderInfo { | ||
| return .init(statusKey: statusKey ?? "", | ||
| paymentInfo: paymentInfo?.toReadOnly(), | ||
| customerInfo: customerInfo?.toReadOnly(), | ||
| productInfo: productInfo?.toReadOnly()) | ||
| } | ||
| } |
24 changes: 24 additions & 0 deletions
24
Modules/Sources/Yosemite/Model/Booking/BookingPaymentInfo+ReadOnlyConvertible.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,24 @@ | ||
| import Foundation | ||
| import Storage | ||
|
|
||
| // MARK: - Storage.BookingPaymentInfo: ReadOnlyConvertible | ||
| // | ||
| extension Storage.BookingPaymentInfo: ReadOnlyConvertible { | ||
| public func update(with paymentInfo: Yosemite.BookingPaymentInfo) { | ||
| paymentMethodID = paymentInfo.paymentMethodID | ||
| paymentMethodTitle = paymentInfo.paymentMethodTitle | ||
| subtotal = paymentInfo.subtotal | ||
| subtotalTax = paymentInfo.subtotalTax | ||
| total = paymentInfo.total | ||
| totalTax = paymentInfo.totalTax | ||
| } | ||
|
|
||
| public func toReadOnly() -> Yosemite.BookingPaymentInfo { | ||
| return .init(paymentMethodID: paymentMethodID ?? "", | ||
| paymentMethodTitle: paymentMethodTitle ?? "", | ||
| subtotal: subtotal ?? "", | ||
| subtotalTax: subtotalTax ?? "", | ||
| total: total ?? "", | ||
| totalTax: totalTax ?? "") | ||
| } | ||
| } |
14 changes: 14 additions & 0 deletions
14
Modules/Sources/Yosemite/Model/Booking/BookingProductInfo+ReadOnlyConvertible.swift
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -0,0 +1,14 @@ | ||
| import Foundation | ||
| import Storage | ||
|
|
||
| // MARK: - Storage.BookingProductInfo: ReadOnlyConvertible | ||
| // | ||
| extension Storage.BookingProductInfo: ReadOnlyConvertible { | ||
| public func update(with productInfo: Yosemite.BookingProductInfo) { | ||
| name = productInfo.name | ||
| } | ||
|
|
||
| public func toReadOnly() -> Yosemite.BookingProductInfo { | ||
| return .init(name: name ?? "") | ||
| } | ||
| } | ||
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I'm just wondering what these
MARKnotations do at the extensions? Are they used for code generation or something?There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, just for clarity I believe.