Skip to content

Commit

Permalink
[5.4] MSTR-308: Never overwrite nor delete surcharge_accepted (#1211)
Browse files Browse the repository at this point in the history
  • Loading branch information
guillegr123 authored Jun 7, 2024
1 parent 8ab72d6 commit 32a1a0e
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 6 deletions.
5 changes: 2 additions & 3 deletions src/apps/myaccount/submodules/billing/billing.js
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,7 @@ define(function(require) {
$billingContactForm = $template.find('#form_billing'),
$submitButton = $template.find('#myaccount_billing_save'),
isValid = monster.ui.valid($billingContactForm),
isSurchargeAccepted = !!_.get(account, ['braintree', 'surcharge_accepted']),
formData = {},
updatedAccount = {};

Expand All @@ -1185,9 +1186,7 @@ define(function(require) {

delete updatedAccount.contact.billing.region_select;

if (surchargeAccepted === '') {
_.unset(updatedAccount, ['braintree', 'surcharge_accepted']);
} else {
if (!isSurchargeAccepted && surchargeAccepted) {
updatedAccount.braintree = _.merge({}, updatedAccount.braintree, {
surcharge_accepted: surchargeAccepted
});
Expand Down
4 changes: 1 addition & 3 deletions src/apps/myaccount/submodules/creditCard/creditCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -406,9 +406,7 @@ define(function(require) {
})
});

args.submitCallback && args.submitCallback({
surchargeAccepted: ''
});
args.submitCallback && args.submitCallback();
});
});

Expand Down

0 comments on commit 32a1a0e

Please sign in to comment.