diff --git a/scripts/e2e-control-plane-flow.cjs b/scripts/e2e-control-plane-flow.cjs index d64c479..e042541 100644 --- a/scripts/e2e-control-plane-flow.cjs +++ b/scripts/e2e-control-plane-flow.cjs @@ -322,53 +322,52 @@ async function main() { } } if (!checkoutTxHash) { - console.log(JSON.stringify(result, null, 2)); - return; - } - - const checkoutConfirmRes = await requestJSON( - "POST", - "/marketplace/checkout/confirm", - { - quote_id: checkoutQuote.quote_id, - wallet, - offer_id: OFFER_ID, - org_root_id: ORG_ROOT_ID, - principal_id: PRINCIPAL_ID, - principal_role: PRINCIPAL_ROLE, - workspace_id: WORKSPACE_ID, - tx_hash: checkoutTxHash, - chain_id: CHAIN_ID, - }, - sessionToken - ); - if (!checkoutConfirmRes.ok) { - if (isTxPendingResponse(checkoutConfirmRes)) { - result.stages.marketplace_checkout = summarizeSkip( - "tx_pending", - checkoutConfirmRes.status, - checkoutConfirmRes.data?.error || JSON.stringify(checkoutConfirmRes.data || {}) - ); - } else { - throw new Error( - `POST /marketplace/checkout/confirm failed (${checkoutConfirmRes.status}): ${JSON.stringify(checkoutConfirmRes.data)}` - ); - } + // Keep running; governance install may still be valid for pre-existing entitlements. } else { - const entitlements = await expectOK( - "GET", - `/marketplace/entitlements?wallet=${encodeURIComponent(wallet)}`, - undefined, + const checkoutConfirmRes = await requestJSON( + "POST", + "/marketplace/checkout/confirm", + { + quote_id: checkoutQuote.quote_id, + wallet, + offer_id: OFFER_ID, + org_root_id: ORG_ROOT_ID, + principal_id: PRINCIPAL_ID, + principal_role: PRINCIPAL_ROLE, + workspace_id: WORKSPACE_ID, + tx_hash: checkoutTxHash, + chain_id: CHAIN_ID, + }, sessionToken ); - result.stages.marketplace_checkout = { - status: checkoutConfirmRes.data.status, - entitlement_id: checkoutConfirmRes.data.entitlement_id, - tx_hash: checkoutTxHash, - entitlement_count: Array.isArray(entitlements.entitlements) - ? entitlements.entitlements.length - : 0, - }; + if (!checkoutConfirmRes.ok) { + if (isTxPendingResponse(checkoutConfirmRes)) { + result.stages.marketplace_checkout = summarizeSkip( + "tx_pending", + checkoutConfirmRes.status, + checkoutConfirmRes.data?.error || JSON.stringify(checkoutConfirmRes.data || {}) + ); + } else { + throw new Error( + `POST /marketplace/checkout/confirm failed (${checkoutConfirmRes.status}): ${JSON.stringify(checkoutConfirmRes.data)}` + ); + } + } else { + const entitlements = await expectOK( + "GET", + `/marketplace/entitlements?wallet=${encodeURIComponent(wallet)}`, + undefined, + sessionToken + ); + result.stages.marketplace_checkout = { + status: checkoutConfirmRes.data.status, + entitlement_id: checkoutConfirmRes.data.entitlement_id, + tx_hash: checkoutTxHash, + entitlement_count: Array.isArray(entitlements.entitlements) + ? entitlements.entitlements.length + : 0, + }; + } } } }