mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-24 20:36:49 +00:00
Set shipping method when creating order for subscription
This commit is contained in:
@@ -15,6 +15,7 @@ class OrderFactory
|
||||
set_user
|
||||
build_line_items
|
||||
set_addresses
|
||||
set_shipping_method
|
||||
create_payment
|
||||
@order
|
||||
end
|
||||
@@ -65,6 +66,10 @@ class OrderFactory
|
||||
@order.update_attributes(attrs.slice(:bill_address_attributes, :ship_address_attributes))
|
||||
end
|
||||
|
||||
def set_shipping_method
|
||||
@order.select_shipping_method(attrs[:shipping_method_id])
|
||||
end
|
||||
|
||||
def create_payment
|
||||
@order.update_distribution_charge!
|
||||
@order.payments.create(payment_method_id: attrs[:payment_method_id], amount: @order.reload.total)
|
||||
|
||||
Reference in New Issue
Block a user