mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-01-30 21:27:17 +00:00
Make Checkout form submit read terms_and_conditions_accepted from the checkout form checkbox
This commit is contained in:
@@ -46,7 +46,6 @@ Darkswarm.factory 'Checkout', ($injector, CurrentOrder, ShippingMethods, StripeE
|
||||
munged_order =
|
||||
default_bill_address: !!@default_bill_address
|
||||
default_ship_address: !!@default_ship_address
|
||||
terms_and_conditions_accepted: true
|
||||
|
||||
for name, value of @order # Clone all data from the order JSON object
|
||||
switch name
|
||||
@@ -96,6 +95,10 @@ Darkswarm.factory 'Checkout', ($injector, CurrentOrder, ShippingMethods, StripeE
|
||||
last_name: @order.bill_address.lastname
|
||||
save_requested_by_customer: @secrets.save_requested_by_customer
|
||||
}
|
||||
|
||||
if @terms_and_conditions_accepted()
|
||||
munged_order["terms_and_conditions_accepted"] = true
|
||||
|
||||
munged_order
|
||||
|
||||
shippingMethod: ->
|
||||
@@ -115,3 +118,7 @@ Darkswarm.factory 'Checkout', ($injector, CurrentOrder, ShippingMethods, StripeE
|
||||
|
||||
cartTotal: ->
|
||||
@order.display_total + @shippingPrice() + @paymentPrice()
|
||||
|
||||
terms_and_conditions_accepted: ->
|
||||
terms_and_conditions_checkbox = angular.element("#accept_terms")[0]
|
||||
terms_and_conditions_checkbox? && terms_and_conditions_checkbox.checked
|
||||
|
||||
@@ -65,6 +65,7 @@ describe 'Checkout service', ->
|
||||
inject ($injector, _$httpBackend_, $rootScope)->
|
||||
$httpBackend = _$httpBackend_
|
||||
Checkout = $injector.get("Checkout")
|
||||
spyOn(Checkout, "terms_and_conditions_accepted")
|
||||
scope = $rootScope.$new()
|
||||
scope.Checkout = Checkout
|
||||
Navigation = $injector.get("Navigation")
|
||||
|
||||
Reference in New Issue
Block a user