-
-
Notifications
You must be signed in to change notification settings - Fork 21
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
🧹🥗🥔
Marketplace
: Use DeliveryArea#price
to calculate `Cart#price_…
…total` (#1323) * 🥔 `Marketplace`: Use `DeliveryArea#price` to calculate `Cart#price_total` - #1136 Now the pricing reflects the delivery area when the Marketplace and Cart have them! Fancy! I feel like this is a reasonable amount of test coverage for this change, but if we want to add `request` or `component` specs or something I could be persuaded... * 🧹`Marketplace`: Missed some attributes for `Delivery`
- Loading branch information
Showing
6 changed files
with
45 additions
and
22 deletions.
There are no files selected for viewing
This file contains 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 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 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 |
---|---|---|
@@ -1,12 +1,23 @@ | ||
class Marketplace | ||
class Delivery < Record | ||
self.table_name = "marketplace_orders" | ||
|
||
belongs_to :marketplace | ||
belongs_to :shopper | ||
belongs_to :delivery_area | ||
validates :delivery_area_id, presence: true # rubocop:disable Rails/RedundantPresenceValidationOnBelongsTo | ||
|
||
has_encrypted :delivery_address | ||
attribute :delivery_window, WindowType.new | ||
has_encrypted :contact_phone_number | ||
has_encrypted :contact_email | ||
|
||
def window | ||
delivery_window | ||
end | ||
|
||
def fee | ||
delivery_area&.price.presence || marketplace&.delivery_fee.presence | ||
end | ||
end | ||
end |
This file contains 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 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 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