[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]
[tor-commits] [donate/master] Set default amount correctly on donateonce press
commit 577803d6f916be3f9ec125a9283d9792ee96e43a
Author: Peter Haight <peterh@xxxxxxxxxxxxxxx>
Date: Fri Dec 21 15:21:35 2018 -0800
Set default amount correctly on donateonce press
It was going to 125 instead of 60. I centralized it a little bit more to
make it harder to mess up.
Issue #37989
---
public/js/payment_controller.js | 9 +++++----
src/js/payment_controller.js | 9 +++++----
2 files changed, 10 insertions(+), 8 deletions(-)
diff --git a/public/js/payment_controller.js b/public/js/payment_controller.js
index a302fc15..e283d805 100644
--- a/public/js/payment_controller.js
+++ b/public/js/payment_controller.js
@@ -11224,7 +11224,8 @@ function PerkInfo(id, fieldIds, helpText, friendlyName, friendlyName2) {
function PaymentController(paypalMerchantId, environmentName, stripePublishableKey, promo = false) {
this.country = 'US';
this.priceSetName = 'once';
- this.amount = 7500;
+ this.promo = promo;
+ this.setDefaultOnceAmount();
this.environmentName = environmentName;
this.noPerk = true;
this.noRegions = false;
@@ -11236,7 +11237,6 @@ function PaymentController(paypalMerchantId, environmentName, stripePublishableK
'credit_card': '.credit-card-form-wrapper,#donate-submit-button',
'paypal': '#paypal-container,#paypal-button-area',
};
- this.promo = promo;
this.perkInfoMap = {
't-shirt': new PerkInfo('t-shirt', ['perk-style-1', 'perk-fit-1', 'perk-size-1'], t('t-t-shirt__help-text'), t('t-t-shirt__friendly-name')),
't-shirt-pack': new PerkInfo('t-shirt-pack', ['perk-style-1', 'perk-fit-1', 'perk-size-1', 'perk-fit-2', 'perk-size-2'], t('t-t-shirt-pack__help-text'), t('t-t-shirt-pack__friendly-name'), t('t-t-shirt-pack-2__friendly-name')),
@@ -11514,7 +11514,7 @@ PaymentController.prototype.noPerkCheckboxClicked = function(event) {
PaymentController.prototype.onceButtonClicked = function(event) {
event.preventDefault();
this.clearOtherAmount();
- this.amount = 12500;
+ this.setDefaultOnceAmount();
this.perk = 't-shirt-pack';
this.priceSetName = 'once';
this.setPriceSet();
@@ -11848,12 +11848,13 @@ PaymentController.prototype.setPriceSet = function() {
PaymentController.prototype.setInitialPromoAdjustments = function() {
this.adjustPriceSetDueToPromo();
- this.setDefaultOnceAmount();
}
PaymentController.prototype.setDefaultOnceAmount = function() {
if (this.promo) {
this.amount = 6000;
+ } else {
+ this.amount = 7500;
}
}
diff --git a/src/js/payment_controller.js b/src/js/payment_controller.js
index 9a7de2f7..0351ad70 100644
--- a/src/js/payment_controller.js
+++ b/src/js/payment_controller.js
@@ -21,7 +21,8 @@ function PerkInfo(id, fieldIds, helpText, friendlyName, friendlyName2) {
function PaymentController(paypalMerchantId, environmentName, stripePublishableKey, promo = false) {
this.country = 'US';
this.priceSetName = 'once';
- this.amount = 7500;
+ this.promo = promo;
+ this.setDefaultOnceAmount();
this.environmentName = environmentName;
this.noPerk = true;
this.noRegions = false;
@@ -33,7 +34,6 @@ function PaymentController(paypalMerchantId, environmentName, stripePublishableK
'credit_card': '.credit-card-form-wrapper,#donate-submit-button',
'paypal': '#paypal-container,#paypal-button-area',
};
- this.promo = promo;
this.perkInfoMap = {
't-shirt': new PerkInfo('t-shirt', ['perk-style-1', 'perk-fit-1', 'perk-size-1'], t('t-t-shirt__help-text'), t('t-t-shirt__friendly-name')),
't-shirt-pack': new PerkInfo('t-shirt-pack', ['perk-style-1', 'perk-fit-1', 'perk-size-1', 'perk-fit-2', 'perk-size-2'], t('t-t-shirt-pack__help-text'), t('t-t-shirt-pack__friendly-name'), t('t-t-shirt-pack-2__friendly-name')),
@@ -311,7 +311,7 @@ PaymentController.prototype.noPerkCheckboxClicked = function(event) {
PaymentController.prototype.onceButtonClicked = function(event) {
event.preventDefault();
this.clearOtherAmount();
- this.amount = 12500;
+ this.setDefaultOnceAmount();
this.perk = 't-shirt-pack';
this.priceSetName = 'once';
this.setPriceSet();
@@ -645,12 +645,13 @@ PaymentController.prototype.setPriceSet = function() {
PaymentController.prototype.setInitialPromoAdjustments = function() {
this.adjustPriceSetDueToPromo();
- this.setDefaultOnceAmount();
}
PaymentController.prototype.setDefaultOnceAmount = function() {
if (this.promo) {
this.amount = 6000;
+ } else {
+ this.amount = 7500;
}
}
_______________________________________________
tor-commits mailing list
tor-commits@xxxxxxxxxxxxxxxxxxxx
https://lists.torproject.org/cgi-bin/mailman/listinfo/tor-commits