mirror of
https://github.com/overleaf/overleaf.git
synced 2025-02-24 08:31:13 +00:00
Load default coupon code if provided in query string
This commit is contained in:
parent
48a17729e4
commit
860de1528f
3 changed files with 12 additions and 5 deletions
|
@ -62,7 +62,8 @@ module.exports = SubscriptionController =
|
|||
recurlyConfig: JSON.stringify
|
||||
currency: currency
|
||||
subdomain: Settings.apis.recurly.subdomain
|
||||
showCouponField:req.query.scf
|
||||
showCouponField: req.query.scf
|
||||
couponCode: req.query.cc or ""
|
||||
subscriptionFormOptions: JSON.stringify
|
||||
acceptedCards: ['discover', 'mastercard', 'visa']
|
||||
target : "#subscribeForm"
|
||||
|
|
|
@ -8,7 +8,7 @@ block scripts
|
|||
window.countryCode = '#{countryCode}'
|
||||
window.plan_code = '#{plan_code}'
|
||||
window.recurlyApiKey = "!{settings.apis.recurly.publicKey}"
|
||||
|
||||
window.couponCode = "#{couponCode}"
|
||||
|
||||
block content
|
||||
- locals.supressDefaultJs = true
|
||||
|
@ -148,11 +148,10 @@ block content
|
|||
mixin countries_options()
|
||||
.row
|
||||
.col-md-8
|
||||
if showCouponField == 'true'
|
||||
if (showCouponField)
|
||||
.form-group
|
||||
input.form-control(type='text', ng-blur="applyCoupon()", ng-model="data.coupon", placeholder="#{translate('coupon')}")
|
||||
|
||||
|
||||
.row
|
||||
.col-xs-7
|
||||
.form-group
|
||||
|
|
|
@ -27,6 +27,7 @@ define [
|
|||
state:""
|
||||
city:""
|
||||
country:window.countryCode
|
||||
coupon: window.couponCode
|
||||
|
||||
|
||||
$scope.validation =
|
||||
|
@ -41,7 +42,13 @@ define [
|
|||
pricing = recurly.Pricing()
|
||||
window.pricing = pricing
|
||||
|
||||
pricing.plan(window.plan_code, { quantity: 1 }).address({country: $scope.data.country}).tax({tax_code: 'digital', vat_number: ''}).currency($scope.currencyCode).done()
|
||||
initialPricing = pricing
|
||||
.plan(window.plan_code, { quantity: 1 })
|
||||
.address({country: $scope.data.country})
|
||||
.tax({tax_code: 'digital', vat_number: ''})
|
||||
.currency($scope.currencyCode)
|
||||
.coupon($scope.data.coupon)
|
||||
.done()
|
||||
|
||||
pricing.on "change", =>
|
||||
$scope.planName = pricing.items.plan.name
|
||||
|
|
Loading…
Reference in a new issue