Skip to content

Commit

Permalink
[5.4] MSTR-327: Fix Payment Method Pop-up After Successful ACH Setup (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
guillegr123 committed Dec 6, 2024
1 parent b0055c0 commit dc2c270
Show file tree
Hide file tree
Showing 2 changed files with 9 additions and 21 deletions.
6 changes: 3 additions & 3 deletions src/apps/myaccount/submodules/billing/billing.js
Original file line number Diff line number Diff line change
Expand Up @@ -481,7 +481,7 @@ define(function(require) {
return next(null, mainData);
}

self.getPaymentMethods({
self.billingGetPaymentMethods({
success: function(payments) {
next(null, _.assign({}, mainData, { payments: payments }));
},
Expand Down Expand Up @@ -644,7 +644,7 @@ define(function(require) {

monster.waterfall([
function reloadPaymentMethods(next) {
self.getPaymentMethods({
self.billingGetPaymentMethods({
success: function(payments) {
next(null, payments);
},
Expand Down Expand Up @@ -1144,7 +1144,7 @@ define(function(require) {
});
},

getPaymentMethods: function(args) {
billingGetPaymentMethods: function(args) {
var self = this;

monster.request({
Expand Down
24 changes: 6 additions & 18 deletions src/apps/myaccount/submodules/creditCard/creditCard.js
Original file line number Diff line number Diff line change
Expand Up @@ -576,21 +576,7 @@ define(function(require) {
}
});
},
billing: function(next) {
self.callApi({
resource: 'billing.get',
data: {
accountId: self.accountId,
generateError: false
},
success: function(data) {
next(null, data.data);
},
error: function() {
next(true);
}
});
}
billing: _.bind(self.billingGetBillingData, self)
}, function(err, results) {
if (err) {
return;
Expand All @@ -599,13 +585,15 @@ define(function(require) {
var account = results.account,
billing = results.billing,
isSurchargeAccepted = self.billingIsSurchargeAccepted(account),
hasCreditCards = !_.chain(billing).get('credit_cards', []).isEmpty().value(),
hasCreditCards = !_.chain(billing).get('customer.credit_cards', []).isEmpty().value(),
country = _.get(account, ['contact', 'billing', 'country']),
region = _.get(account, ['contact', 'billing', 'region']),
surcharge = self.billingGetCreditCardSurcharge(country, region),
isCardAccepted = !!surcharge;
isCardAccepted = !!surcharge,
hasVerifiedACH = _.chain(billing).get('payments', []).some({ type: 'ach', verified: true, 'default': true }).value();

if (!hasCreditCards || country !== 'US' || (isCardAccepted && isSurchargeAccepted)) {
if (
!hasCreditCards || country !== 'US' || (isCardAccepted && isSurchargeAccepted) || hasVerifiedACH) {
return;
}

Expand Down

0 comments on commit dc2c270

Please sign in to comment.