Skip to content

Commit 4497467

Browse files
committed
own the billing page's error texts instead of displaying backend messages
1 parent 1b0159e commit 4497467

1 file changed

Lines changed: 14 additions & 14 deletions

File tree

‎assets/js/hubsubscription.js‎

Lines changed: 14 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -94,7 +94,7 @@ class HubSubscription {
9494
}).done(data => {
9595
this.onLoadSubscriptionSucceeded(data);
9696
}).fail(xhr => {
97-
this.onLoadSubscriptionFailed(xhr.status, xhr.responseJSON?.message || 'Loading subscription failed.');
97+
this.onLoadSubscriptionFailed(xhr.status, 'Loading subscription failed.');
9898
});
9999
});
100100
}
@@ -139,7 +139,7 @@ class HubSubscription {
139139
}).done(data => {
140140
this.onLoadBillingSessionSucceeded(data);
141141
}).fail(xhr => {
142-
this.onLoadBillingSessionFailed(xhr.status, xhr.responseJSON?.message || 'Loading billing session failed.');
142+
this.onLoadBillingSessionFailed(xhr.status, 'Loading billing session failed.');
143143
});
144144
}
145145

@@ -189,7 +189,7 @@ class HubSubscription {
189189
}).done(data => {
190190
this.onLookupCustomerSucceeded(data);
191191
}).fail(xhr => {
192-
this.onLookupCustomerFailed(xhr.status, xhr.responseJSON?.message || 'Looking up your subscription failed.');
192+
this.onLookupCustomerFailed(xhr.status, 'Looking up your subscription failed.');
193193
});
194194
}
195195

@@ -241,7 +241,7 @@ class HubSubscription {
241241
}).done(_ => {
242242
this.onCreateSessionSucceeded();
243243
}).fail(xhr => {
244-
this.onCreateSessionFailed(xhr.responseJSON?.message || 'Requesting confirmation link failed.');
244+
this.onCreateSessionFailed('Requesting confirmation link failed.');
245245
});
246246
}
247247

@@ -269,7 +269,7 @@ class HubSubscription {
269269
this.onLoadCustomBillingSucceeded(data);
270270
continueHandler();
271271
}).fail(xhr => {
272-
this.onLoadCustomBillingFailed(xhr.responseJSON?.message || 'Loading custom billing options failed.');
272+
this.onLoadCustomBillingFailed('Loading custom billing options failed.');
273273
});
274274
}
275275

@@ -305,7 +305,7 @@ class HubSubscription {
305305
this.onLoadPriceSucceeded(data, yearlyPlanId, monthlyPlanId);
306306
continueHandler();
307307
}).fail(xhr => {
308-
this.onLoadPriceFailed(xhr.responseJSON?.message || 'Loading price failed.');
308+
this.onLoadPriceFailed('Loading price failed.');
309309
});
310310
}
311311

@@ -398,7 +398,7 @@ class HubSubscription {
398398
}).done(data => {
399399
this.openPaddleCheckout(data.pay_link, locale);
400400
}).fail(xhr => {
401-
this.onPostFailed(xhr.responseJSON?.message || 'Checkout failed.');
401+
this.onPostFailed('Checkout failed.');
402402
});
403403
}
404404

@@ -568,7 +568,7 @@ class HubSubscription {
568568
}).done(_ => {
569569
this.onCheckoutSucceeded();
570570
}).fail(xhr => {
571-
this.onPostFailed(xhr.responseJSON?.message || 'Creating subscription failed.');
571+
this.onPostFailed('Creating subscription failed.');
572572
});
573573
}
574574

@@ -606,7 +606,7 @@ class HubSubscription {
606606
});
607607
});
608608
}).fail(xhr => {
609-
this.onPutFailed(xhr.status, xhr.responseJSON?.message || 'Updating payment method failed.');
609+
this.onPutFailed(xhr.status, 'Updating payment method failed.');
610610
});
611611
}
612612

@@ -622,7 +622,7 @@ class HubSubscription {
622622
}).done(_ => {
623623
this.loadManageSubscription();
624624
}).fail(xhr => {
625-
this.onPutFailed(xhr.status, xhr.responseJSON?.message || 'Updating subscription failed.');
625+
this.onPutFailed(xhr.status, 'Updating subscription failed.');
626626
});
627627
}
628628

@@ -642,7 +642,7 @@ class HubSubscription {
642642
this._subscriptionData.shouldTransferToHub = !!this._subscriptionData.returnUrl;
643643
this.loadManageSubscription();
644644
}).fail(xhr => {
645-
this.onPutFailed(xhr.status, xhr.responseJSON?.message || 'Updating subscription failed.');
645+
this.onPutFailed(xhr.status, 'Updating subscription failed.');
646646
});
647647
}
648648

@@ -682,7 +682,7 @@ class HubSubscription {
682682
this._subscriptionData.errorMessage = '';
683683
this._subscriptionData.inProgress = false;
684684
}).fail(xhr => {
685-
this.onPutFailed(xhr.status, xhr.responseJSON?.message || 'Calculating price failed.');
685+
this.onPutFailed(xhr.status, 'Calculating price failed.');
686686
});
687687
}
688688

@@ -701,7 +701,7 @@ class HubSubscription {
701701
this._subscriptionData.shouldTransferToHub = !!this._subscriptionData.returnUrl;
702702
this.loadManageSubscription();
703703
}).fail(xhr => {
704-
this.onPutFailed(xhr.status, xhr.responseJSON?.message || 'Updating subscription failed.');
704+
this.onPutFailed(xhr.status, 'Updating subscription failed.');
705705
});
706706
}
707707

@@ -735,7 +735,7 @@ class HubSubscription {
735735
}).fail(xhr => {
736736
// Expected for a card checkout until Paddle's payment webhook links the session to the new
737737
// billing; the license block then offers a retry.
738-
this._subscriptionData.errorMessage = xhr.responseJSON?.message || 'Refreshing license failed.';
738+
this._subscriptionData.errorMessage = 'Refreshing license failed.';
739739
this._subscriptionData.needsTokenRefresh = false;
740740
this._subscriptionData.inProgress = false;
741741
});

0 commit comments

Comments
 (0)