File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -269,12 +269,15 @@ class HubSubscription {
269269 this . onLoadCustomBillingSucceeded ( data ) ;
270270 continueHandler ( ) ;
271271 } ) . fail ( xhr => {
272- this . onLoadCustomBillingFailed ( 'Loading custom billing options failed.' ) ;
272+ this . onLoadCustomBillingFailed ( xhr . status , 'Loading custom billing options failed.' ) ;
273+ // store's documented answer for "this hub has no custom billing" is a 404 with a JSON error body
274+ if ( xhr . status == 404 && xhr . responseJSON ?. status == 'error' ) {
275+ continueHandler ( ) ;
276+ }
273277 } ) ;
274278 }
275279
276280 onLoadCustomBillingSucceeded ( data ) {
277- // custom_billing is null when the hub has no custom billing
278281 this . _subscriptionData . customBilling = data . custom_billing || null ;
279282 if ( this . _subscriptionData . customBilling ) {
280283 this . _subscriptionData . quantity = this . _subscriptionData . customBilling . quantity || this . _subscriptionData . quantity ;
@@ -284,8 +287,13 @@ class HubSubscription {
284287 this . _subscriptionData . inProgress = false ;
285288 }
286289
287- onLoadCustomBillingFailed ( error ) {
288- this . _subscriptionData . errorMessage = error ;
290+ onLoadCustomBillingFailed ( status , error ) {
291+ if ( status == 404 ) {
292+ this . _subscriptionData . customBilling = null ;
293+ this . _subscriptionData . errorMessage = '' ;
294+ } else {
295+ this . _subscriptionData . errorMessage = error ;
296+ }
289297 this . _subscriptionData . inProgress = false ;
290298 }
291299
You can’t perform that action at this time.
0 commit comments