Просмотр исходного кода

add vat number option to payment form

Henry Oswald 11 лет назад
Родитель
Сommit
97f0fad525

+ 1 - 0
services/web/app/coffee/Features/Subscription/SubscriptionController.coffee

@@ -63,6 +63,7 @@ module.exports = SubscriptionController =
 									currency: currency
 									subdomain: Settings.apis.recurly.subdomain
 								showCouponField: req.query.scf
+								showVatField: req.query.svf
 								couponCode:      req.query.cc or ""
 								subscriptionFormOptions: JSON.stringify
 									acceptedCards: ['discover', 'mastercard', 'visa']

+ 5 - 1
services/web/app/views/subscriptions/new.jade

@@ -152,7 +152,11 @@ block content
 											if (showCouponField)
 												.form-group
 													input.form-control(type='text', ng-blur="applyCoupon()", ng-model="data.coupon", placeholder="#{translate('coupon')}")
-
+									.row
+										.col-md-8
+											if (showVatField)
+												.form-group
+													input.form-control(type='text', ng-blur="applyVatNumber()", ng-model="data.vat_number", placeholder="#{translate('vat_number')}")
 									.row
 										.col-xs-7
 											.form-group

+ 4 - 0
services/web/public/coffee/main/new-subscription.coffee

@@ -60,6 +60,10 @@ define [
 		$scope.applyCoupon = ->
 			pricing.coupon($scope.data.coupon).done()
 
+		$scope.applyVatNumber = ->
+			pricing.tax({tax_code: 'digital', vat_number: $scope.data.vat_number}).done()
+
+
 		$scope.changeCurrency = (newCurrency)->
 			$scope.currencyCode = newCurrency
 			pricing.currency(newCurrency).done()