mirror of
https://github.com/openfoodfoundation/openfoodnetwork
synced 2026-03-14 04:04:23 +00:00
WIP: Send credit card details to server on checkout
This commit is contained in:
@@ -2,6 +2,7 @@ Darkswarm.controller "CheckoutCtrl", ($scope, storage, CheckoutFormState, Order,
|
||||
$scope.Order = Order
|
||||
storage.bind $scope, "Order.order", {storeName: "order_#{Order.order.id}#{Order.order.user_id}"}
|
||||
$scope.order = Order.order # Ordering is important
|
||||
$scope.secrets = Order.secrets
|
||||
|
||||
$scope.enabled = if CurrentUser then true else false
|
||||
|
||||
|
||||
@@ -1,3 +1,8 @@
|
||||
Darkswarm.controller "PaymentCtrl", ($scope) ->
|
||||
angular.extend(this, new FieldsetMixin($scope))
|
||||
$scope.name = "payment"
|
||||
|
||||
$scope.months = {1: "January", 2: "February", 3: "March", 4: "April", 5: "May", 6: "June", 7: "July", 8: "August", 9: "September", 10: "October", 11: "November", 12: "December"}
|
||||
$scope.years = [moment().year()..(moment().year()+15)]
|
||||
$scope.secrets.card_month = "1"
|
||||
$scope.secrets.card_year = moment().year()
|
||||
|
||||
@@ -1,6 +1,7 @@
|
||||
Darkswarm.factory 'Order', ($resource, order, $http, CheckoutFormState, flash, Navigation)->
|
||||
new class Order
|
||||
errors: {}
|
||||
secrets: {}
|
||||
|
||||
constructor: ->
|
||||
@order = order
|
||||
@@ -30,6 +31,17 @@ Darkswarm.factory 'Order', ($resource, order, $http, CheckoutFormState, flash, N
|
||||
|
||||
if CheckoutFormState.ship_address_same_as_billing
|
||||
munged_order.ship_address_attributes = munged_order.bill_address_attributes
|
||||
|
||||
angular.extend munged_order.payments_attributes[0], {
|
||||
source_attributes:
|
||||
number: @secrets.card_number
|
||||
month: @secrets.card_month
|
||||
year: @secrets.card_year
|
||||
verification_value: @secrets.card_verification_value
|
||||
first_name: @order.bill_address.firstname
|
||||
last_name: @order.bill_address.lastname
|
||||
}
|
||||
|
||||
munged_order
|
||||
|
||||
shippingMethod: ->
|
||||
|
||||
Reference in New Issue
Block a user