diff --git a/hosting-holium-com/src/pages/payment.tsx b/hosting-holium-com/src/pages/payment.tsx index af983d370c..a5b310d82b 100644 --- a/hosting-holium-com/src/pages/payment.tsx +++ b/hosting-holium-com/src/pages/payment.tsx @@ -123,15 +123,26 @@ export default function Payment({ productId: productId.toString(), auditTrailCode: 1000, }); - await thirdEarthApi.updatePaymentStatus(token, invoiceId, 'OK'); - const provisionalResponse = await thirdEarthApi.provisionalShipEntry({ - token, - product: productId.toString(), - invoiceId, - shipType: 'provisional', - }); - if (!provisionalResponse) return false; + try { + // Critical request, so we quit if it fails. + await thirdEarthApi.updatePaymentStatus(token, invoiceId, 'OK'); + } catch (e) { + console.error(e); + return false; + } + + try { + // This server call should be non-blocking since the user has already paid. + await thirdEarthApi.provisionalShipEntry({ + token, + product: productId.toString(), + invoiceId, + shipType: 'provisional', + }); + } catch (e) { + console.error(e); + } return goToPage('/upload-id', { product_type: 'byop-p', @@ -149,15 +160,27 @@ export default function Payment({ auditTrailCode: 1000, }); - await thirdEarthApi.updatePaymentStatus(token, invoiceId, 'OK'); - await thirdEarthApi.updatePlanetStatus(token, serverId, 'sold'); - await thirdEarthApi.provisionalShipEntry({ - token, - patp: serverId, - product: productId.toString(), - invoiceId, - shipType: 'planet', - }); + try { + // Critical request, so we quit if it fails. + await thirdEarthApi.updatePaymentStatus(token, invoiceId, 'OK'); + } catch (e) { + console.error(e); + return false; + } + + try { + // These server calls should be non-blocking since the user has already paid. + await thirdEarthApi.updatePlanetStatus(token, serverId, 'sold'); + await thirdEarthApi.provisionalShipEntry({ + token, + patp: serverId, + product: productId.toString(), + invoiceId, + shipType: 'planet', + }); + } catch (e) { + console.error(e); + } return goToPage('/booting', { product_type,