chore: code review comments
This commit is contained in:
@@ -11,6 +11,7 @@
|
|||||||
"enumMembers",
|
"enumMembers",
|
||||||
"duplicates"
|
"duplicates"
|
||||||
],
|
],
|
||||||
|
"ignore": ["ai/**"],
|
||||||
"ignoreWorkspaces": [
|
"ignoreWorkspaces": [
|
||||||
"packages/atmn",
|
"packages/atmn",
|
||||||
"packages/autumn-js",
|
"packages/autumn-js",
|
||||||
|
|||||||
@@ -83,6 +83,7 @@
|
|||||||
"setup": "node scripts/setup/setup.js",
|
"setup": "node scripts/setup/setup.js",
|
||||||
"setup:s3-admin": "bun scripts/setup/setupS3Admin.ts",
|
"setup:s3-admin": "bun scripts/setup/setupS3Admin.ts",
|
||||||
"setup:test": "infisical run --env=dev --recursive -- bun scripts/setup/setup-test.ts",
|
"setup:test": "infisical run --env=dev --recursive -- bun scripts/setup/setup-test.ts",
|
||||||
|
"stripe:link-test": "ENV_FILE=.env infisical run --env=dev --recursive -- bun scripts/setup/link-test-stripe-account.ts",
|
||||||
"agent:bootstrap": "bash scripts/setup/agent-bootstrap.sh",
|
"agent:bootstrap": "bash scripts/setup/agent-bootstrap.sh",
|
||||||
"dev:agent": "bash scripts/setup/devAgent.sh",
|
"dev:agent": "bash scripts/setup/devAgent.sh",
|
||||||
"migrate-functions": "infisical run --env=dev --recursive -- bun scripts/migrations/migrate-functions.ts",
|
"migrate-functions": "infisical run --env=dev --recursive -- bun scripts/migrations/migrate-functions.ts",
|
||||||
|
|||||||
47
scripts/setup/STRIPE_TEST_OAUTH.md
Normal file
47
scripts/setup/STRIPE_TEST_OAUTH.md
Normal file
@@ -0,0 +1,47 @@
|
|||||||
|
# Stripe Test OAuth Linking
|
||||||
|
|
||||||
|
Use this when local tests say the test org has no linked Stripe account, or when Stripe Connect webhooks are visible in Stripe but Autumn cannot map events back to `unit-test-org`.
|
||||||
|
|
||||||
|
The Connect webhook destination should be:
|
||||||
|
|
||||||
|
```txt
|
||||||
|
https://c.autumn.ngrok.app/webhooks/connect/sandbox
|
||||||
|
```
|
||||||
|
|
||||||
|
OAuth still needs the Autumn org row to store the connected account ID:
|
||||||
|
|
||||||
|
```json
|
||||||
|
{ "test_stripe_connect": { "account_id": "acct_..." } }
|
||||||
|
```
|
||||||
|
|
||||||
|
## Commands
|
||||||
|
|
||||||
|
List recent connected accounts for the test org email:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
bun stripe:link-test -- --list --email=unit-test-org@test.com
|
||||||
|
```
|
||||||
|
|
||||||
|
Link an explicit account:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
bun stripe:link-test -- --account-id=acct_...
|
||||||
|
```
|
||||||
|
|
||||||
|
Link the newest account matching the test org email:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
bun stripe:link-test -- --latest --email=unit-test-org@test.com
|
||||||
|
```
|
||||||
|
|
||||||
|
If the org has a direct Stripe secret key, `createStripeCli` will prefer that over OAuth Connect. To force the OAuth account for sandbox tests:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
bun stripe:link-test -- --account-id=acct_... --clear-secret-key
|
||||||
|
```
|
||||||
|
|
||||||
|
After linking, rerun a focused checkout test before the full suite:
|
||||||
|
|
||||||
|
```sh
|
||||||
|
ENV_FILE=.env infisical run --env=dev --recursive -- bun test --timeout 0 server/tests/integration/billing/attach/checkout/stripe-checkout/prepaid/stripe-checkout-prepaid-basic.test.ts
|
||||||
|
```
|
||||||
@@ -2,7 +2,7 @@ import { describe, expect, test } from "bun:test";
|
|||||||
import { Hono } from "hono";
|
import { Hono } from "hono";
|
||||||
import { stripeWebhookEarlyAckMiddleware } from "@/external/stripe/webhookMiddlewares/stripeWebhookEarlyAckMiddleware";
|
import { stripeWebhookEarlyAckMiddleware } from "@/external/stripe/webhookMiddlewares/stripeWebhookEarlyAckMiddleware";
|
||||||
|
|
||||||
const wait = (ms = 0) => new Promise((resolve) => setTimeout(resolve, ms));
|
const waitForImmediate = () => new Promise((resolve) => setImmediate(resolve));
|
||||||
|
|
||||||
const createApp = () => {
|
const createApp = () => {
|
||||||
const app = new Hono();
|
const app = new Hono();
|
||||||
@@ -72,7 +72,7 @@ describe("stripeWebhookEarlyAckMiddleware", () => {
|
|||||||
expect(processed).toBe(false);
|
expect(processed).toBe(false);
|
||||||
|
|
||||||
resolveProcessing();
|
resolveProcessing();
|
||||||
await wait(5);
|
await waitForImmediate();
|
||||||
expect(processed).toBe(true);
|
expect(processed).toBe(true);
|
||||||
});
|
});
|
||||||
|
|
||||||
@@ -91,7 +91,7 @@ describe("stripeWebhookEarlyAckMiddleware", () => {
|
|||||||
expect(await response.json()).toEqual({ received: true });
|
expect(await response.json()).toEqual({ received: true });
|
||||||
expect(started).toBe(false);
|
expect(started).toBe(false);
|
||||||
|
|
||||||
await wait(5);
|
await waitForImmediate();
|
||||||
expect(started).toBe(true);
|
expect(started).toBe(true);
|
||||||
});
|
});
|
||||||
});
|
});
|
||||||
|
|||||||
Reference in New Issue
Block a user