Skip to content

Commit

Permalink
Merge pull request #2055 from holium/hosting-fix-provisional-ship-entry
Browse files Browse the repository at this point in the history
Make /provisional-ship-entry non-blocking
  • Loading branch information
gdbroman authored Sep 28, 2023
2 parents bbf4964 + 91697b1 commit 41cb9af
Showing 1 changed file with 40 additions and 17 deletions.
57 changes: 40 additions & 17 deletions hosting-holium-com/src/pages/payment.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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',
Expand All @@ -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,
Expand Down

1 comment on commit 41cb9af

@vercel
Copy link

@vercel vercel bot commented on 41cb9af Sep 28, 2023

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Successfully deployed to the following URLs:

hosting-holium-com – ./hosting-holium-com

realm-onboarding.vercel.app
hosting-holium-com-holium.vercel.app
hosting-holium-com-git-master-holium.vercel.app
hosting.holium.com

Please sign in to comment.