fix: 更新错误处理逻辑以防止重复订阅 ChatGPT 套餐

This commit is contained in:
QLHazyCoder
2026-05-11 15:10:10 +08:00
parent d7b7c63ea0
commit c063561a11
2 changed files with 29 additions and 1 deletions
+1 -1
View File
@@ -7758,7 +7758,7 @@ function isPhoneSmsPlatformRateLimitFailure(error) {
function isPlusCheckoutNonFreeTrialFailure(error) {
const message = getErrorMessage(error);
return /PLUS_CHECKOUT_NON_FREE_TRIAL::|今日应付金额不是\s*0|没有免费试用资格/i.test(message);
return /PLUS_CHECKOUT_NON_FREE_TRIAL::|今日应付金额不是\s*0|没有免费试用资格|该账号已经开通过\s*ChatGPT\s*订阅套餐,不能重复订阅(?:。)?(?:\s*checkout_order\s*|\(\s*checkout_order\s*\))?/i.test(message);
}
function isGpcTaskEndedFailure(error) {
+28
View File
@@ -781,3 +781,31 @@ test('auto-run does not restart GPC checkout when Plus account has no free-trial
assert.deepStrictEqual(result.events.steps, [6, 7]);
assert.equal(result.events.invalidations.length, 0);
});
test('auto-run does not restart GPC checkout when account already has a ChatGPT subscription', async () => {
const plusGpcSteps = {
6: { key: 'plus-checkout-create' },
7: { key: 'plus-checkout-billing' },
10: { key: 'oauth-login' },
};
const harness = createHarness({
startStep: 6,
failureStep: 7,
failureBudget: 1,
failureMessage: 'GPC_TASK_ENDED::该账号已经开通过ChatGPT订阅套餐,不能重复订阅。(checkout_order',
stepDefinitions: plusGpcSteps,
finalOAuthChainStartStep: 10,
customState: {
stepStatuses: { 3: 'completed' },
plusPaymentMethod: 'gpc-helper',
plusCheckoutSource: 'gpc-helper',
},
});
const result = await harness.runAndCaptureError();
assert.ok(result?.error);
assert.deepStrictEqual(result.events.steps, [6, 7]);
assert.equal(result.events.invalidations.length, 0);
assert.ok(!result.events.logs.some(({ message }) => /回到步骤 6 重新创建 GPC 任务/.test(message)));
});