@stardeck-customer-apps/testing 0.20.0 → 0.22.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/SKILL.md CHANGED
@@ -421,6 +421,24 @@ externalId })` helper models a trusted platform/channel link, and
421
421
  `isVirtual: false`; create/list validation matches the control plane
422
422
  (expiry 90–600s, amount positive int, payment-method enum, deploymentId UUID,
423
423
  list `limit` 1–100, status filter values).
424
+ Beam direct charges (inline checkout): `.directCharges`, `.getDirectCharge(id)`,
425
+ `.completeDirectCharge(id)` and `.failDirectCharge(id, failureCode?)` settle a
426
+ PENDING charge and return the `charge.succeeded` / `charge.failed` payload to
427
+ pass to `.deliverBeamEvent`. `QR_PROMPT_PAY` returns `ENCODED_IMAGE` (expiry
428
+ honours `expiryDurationInSec`), wallets and mobile banking return `REDIRECT`
429
+ to `https://beam.stardeck.test/pay/<id>?returnUrl=…`, and the same
430
+ `idempotencyKey` returns the same charge. Card tokens: `tokenizeBeamCard`
431
+ against the simulated Beam host returns `ctok_sim_<n>`; the card number picks
432
+ the outcome of a `CARD_TOKEN` charge — `4111111111111111` / `5372074248113841`
433
+ succeed (`NONE`), `4953261730509988` / `4389783280144506` need OTP
434
+ (`REDIRECT`), `4943129900084541` fails `CH_INSUFFICIENT_FUNDS`,
435
+ `4111111111000025` fails `CH_CARD_DECLINED`, `4111111111000033` fails
436
+ `CH_CARD_RESTRICTED`, anything else fails `CH_PROCESSING_FAILED`.
437
+ `.setCardTokenization(false)` models a merchant with no publishable key
438
+ (`getCardTokenizationConfig` throws `CARD_TOKENIZATION_NOT_CONFIGURED`).
439
+ Raw `CARD` / `CARD_INSTALLMENTS`, token methods without a `cardToken`, and
440
+ non-QR methods without a `returnUrl` are
441
+ refused with 400, as on the control plane.
424
442
  - `app.storage` — uploads through storage-sdk: `.uploads`, `.latest()`, `.count`, `.clear()`.
425
443
  - `app.messages` — outbound Slack/LINE/Facebook sends:
426
444
  `.all()`, `.latest()`, `.to(recipient)`, `.channel("line")`, `.count`, `.clear()`. LINE Flex
@@ -497,8 +515,8 @@ true })` remains source-compatible but the simulator (like the control plane)
497
515
  - For merge-correct reads, request aliases in batches and include every id in
498
516
  the returned canonical set. Page directory UIs through `search({ query,
499
517
  cursor, limit })`; `list()` intentionally keeps its previous array shape.
500
- - `PaymentsServerClient` (Stripe checkout + Beam payment links + Bolt+
501
- connections/intents/charges, product list) — captured in `app.payments`;
518
+ - `PaymentsServerClient` (Stripe checkout + Beam payment links + Beam direct
519
+ charges and card tokenization + Bolt+ connections/intents/charges, product list) — captured in `app.payments`;
502
520
  fulfill checkout via `markPaid` (poll) or `deliverStripeEvent` /
503
521
  `deliverBeamEvent` (webhook push). Drive a terminal without hardware via
504
522
  `approveBoltIntent` / `declineBoltIntent` / `expireBoltIntent`. Beam payment-link
@@ -512,7 +530,8 @@ cursor, limit })`; `list()` intentionally keeps its previous array shape.
512
530
  one-shot HTTP or network failures during Stripe checkout creation/status polling
513
531
  and Beam payment-link creation/status polling. The operation names are
514
532
  `stripe.createCheckout`, `stripe.getCheckoutSessionStatus`,
515
- `beam.createPaymentLink`, and `beam.getPaymentLinkStatus`. HTTP failures support
533
+ `beam.createPaymentLink`, `beam.getPaymentLinkStatus`, `beam.createDirectCharge`,
534
+ and `beam.getCharge`. HTTP failures support
516
535
  statuses 400, 402, 409, 429, 500, and 503 plus optional `code`, `details`, and
517
536
  `retryAfterSeconds`; `{ kind: "network", message }` rejects fetch instead.
518
537
  `app.reset()` clears pending failures.
@@ -530,8 +549,13 @@ cursor, limit })`; `list()` intentionally keeps its previous array shape.
530
549
  production) or `app.starlens.reject("not a receipt")` (the 422 the SDK maps to
531
550
  `UnsupportedDocumentError`). An unregistered call fails with a descriptive 502 so a
532
551
  test never passes on an invented extraction. `app.starlens.calls` records each
533
- request's version, input names/media types (never bytes), schema and
534
- instructions — assert your `.describe()` aliases reached the wire there.
552
+ request's version, effort, input names/media types (never bytes), schema and
553
+ instructions — assert your `.describe()` aliases and `effort: "high"` retries
554
+ reached the wire there. `version: "v1"` with `effort: "high"` is refused with the
555
+ same 400 `unsupported_effort` as production (the SDK throws `ValidationError`). A
556
+ high request with no image input answers `effort: "low"` as production does;
557
+ pass `effort: "low"` in `app.starlens.mock(...)` to simulate an image production
558
+ could not decode.
535
559
 
536
560
  ### Receipt layout and printer capabilities
537
561
 
package/dist/index.d.mts CHANGED
@@ -210,7 +210,7 @@ interface CapturedCheckout {
210
210
  metadata?: Record<string, string>;
211
211
  createdAt: Date;
212
212
  }
213
- type PaymentSimulatorOperation = "stripe.createCheckout" | "stripe.getCheckoutSessionStatus" | "beam.createPaymentLink" | "beam.getPaymentLinkStatus";
213
+ type PaymentSimulatorOperation = "stripe.createCheckout" | "stripe.getCheckoutSessionStatus" | "beam.createPaymentLink" | "beam.getPaymentLinkStatus" | "beam.createDirectCharge" | "beam.getCharge";
214
214
  type PaymentSimulatorFailure = {
215
215
  kind?: "http";
216
216
  status: 400 | 402 | 409 | 429 | 500 | 503;
@@ -269,6 +269,26 @@ interface SimBoltCharge {
269
269
  sourceId?: string;
270
270
  createdAt?: string;
271
271
  }
272
+ /** A direct charge (`createDirectCharge`) as the simulator holds it. */
273
+ interface SimDirectCharge {
274
+ id: string;
275
+ status: "SUCCEEDED" | "FAILED" | "PENDING";
276
+ amount: number;
277
+ currency: string;
278
+ paymentMethodType: string;
279
+ referenceId: string | null;
280
+ deviceType: string | null;
281
+ returnUrl: string | null;
282
+ actionRequired: "NONE" | "REDIRECT" | "ENCODED_IMAGE";
283
+ redirectUrl: string | null;
284
+ /** When the QR (or the charge) stops being payable. */
285
+ expiresAt: string;
286
+ failureCode: string | null;
287
+ /** Last four digits of a CARD_TOKEN charge's card. */
288
+ cardLast4: string | null;
289
+ idempotencyKey: string | null;
290
+ createdAt: string;
291
+ }
272
292
  interface TestPayments {
273
293
  get checkouts(): CapturedCheckout[];
274
294
  latest(): CapturedCheckout | undefined;
@@ -317,6 +337,19 @@ interface TestPayments {
317
337
  expireBoltIntent(intentId: string): void;
318
338
  listBoltIntents(): SimBoltIntentRecord[];
319
339
  getBoltIntent(intentId: string): SimBoltIntentRecord | undefined;
340
+ /** Every direct charge created so far, oldest first. */
341
+ get directCharges(): SimDirectCharge[];
342
+ getDirectCharge(chargeId: string): SimDirectCharge | undefined;
343
+ /**
344
+ * The shopper paid: mark a PENDING direct charge SUCCEEDED and return the
345
+ * `charge.succeeded` payload. Delivers no webhook; pass the payload to
346
+ * `deliverBeamEvent` the way Beam would.
347
+ */
348
+ completeDirectCharge(chargeId: string): Record<string, unknown>;
349
+ /** Mark a PENDING direct charge FAILED; returns the `charge.failed` payload. */
350
+ failDirectCharge(chargeId: string, failureCode?: string): Record<string, unknown>;
351
+ /** Turn card tokenization off, as for a merchant with no publishable key. On by default. */
352
+ setCardTokenization(enabled: boolean): void;
320
353
  clear(): void;
321
354
  get count(): number;
322
355
  }
@@ -536,7 +569,10 @@ interface TestEdge {
536
569
  }
537
570
  /** One Starlens request the app made, as the simulator saw it (names only, never bytes). */
538
571
  interface CapturedStarlensCall {
572
+ /** As sent (`latest` stays `latest`). */
539
573
  version: string;
574
+ /** As requested; `"low"` when the app did not set one. The reply says what ran. */
575
+ effort: "low" | "high";
540
576
  inputs: {
541
577
  name: string;
542
578
  mediaType: string | null;
@@ -557,6 +593,12 @@ type StarlensReply = {
557
593
  path: string;
558
594
  reason: string;
559
595
  }[];
596
+ /**
597
+ * The effort the reply says ran. Defaults to the requested effort, or `"low"` for a
598
+ * high request with no image input (production cannot crop a PDF, audio or video).
599
+ * Set `"low"` to simulate a high request on an image production could not decode.
600
+ */
601
+ effort?: "low" | "high";
560
602
  } | {
561
603
  reject: string;
562
604
  };
package/dist/index.d.ts CHANGED
@@ -210,7 +210,7 @@ interface CapturedCheckout {
210
210
  metadata?: Record<string, string>;
211
211
  createdAt: Date;
212
212
  }
213
- type PaymentSimulatorOperation = "stripe.createCheckout" | "stripe.getCheckoutSessionStatus" | "beam.createPaymentLink" | "beam.getPaymentLinkStatus";
213
+ type PaymentSimulatorOperation = "stripe.createCheckout" | "stripe.getCheckoutSessionStatus" | "beam.createPaymentLink" | "beam.getPaymentLinkStatus" | "beam.createDirectCharge" | "beam.getCharge";
214
214
  type PaymentSimulatorFailure = {
215
215
  kind?: "http";
216
216
  status: 400 | 402 | 409 | 429 | 500 | 503;
@@ -269,6 +269,26 @@ interface SimBoltCharge {
269
269
  sourceId?: string;
270
270
  createdAt?: string;
271
271
  }
272
+ /** A direct charge (`createDirectCharge`) as the simulator holds it. */
273
+ interface SimDirectCharge {
274
+ id: string;
275
+ status: "SUCCEEDED" | "FAILED" | "PENDING";
276
+ amount: number;
277
+ currency: string;
278
+ paymentMethodType: string;
279
+ referenceId: string | null;
280
+ deviceType: string | null;
281
+ returnUrl: string | null;
282
+ actionRequired: "NONE" | "REDIRECT" | "ENCODED_IMAGE";
283
+ redirectUrl: string | null;
284
+ /** When the QR (or the charge) stops being payable. */
285
+ expiresAt: string;
286
+ failureCode: string | null;
287
+ /** Last four digits of a CARD_TOKEN charge's card. */
288
+ cardLast4: string | null;
289
+ idempotencyKey: string | null;
290
+ createdAt: string;
291
+ }
272
292
  interface TestPayments {
273
293
  get checkouts(): CapturedCheckout[];
274
294
  latest(): CapturedCheckout | undefined;
@@ -317,6 +337,19 @@ interface TestPayments {
317
337
  expireBoltIntent(intentId: string): void;
318
338
  listBoltIntents(): SimBoltIntentRecord[];
319
339
  getBoltIntent(intentId: string): SimBoltIntentRecord | undefined;
340
+ /** Every direct charge created so far, oldest first. */
341
+ get directCharges(): SimDirectCharge[];
342
+ getDirectCharge(chargeId: string): SimDirectCharge | undefined;
343
+ /**
344
+ * The shopper paid: mark a PENDING direct charge SUCCEEDED and return the
345
+ * `charge.succeeded` payload. Delivers no webhook; pass the payload to
346
+ * `deliverBeamEvent` the way Beam would.
347
+ */
348
+ completeDirectCharge(chargeId: string): Record<string, unknown>;
349
+ /** Mark a PENDING direct charge FAILED; returns the `charge.failed` payload. */
350
+ failDirectCharge(chargeId: string, failureCode?: string): Record<string, unknown>;
351
+ /** Turn card tokenization off, as for a merchant with no publishable key. On by default. */
352
+ setCardTokenization(enabled: boolean): void;
320
353
  clear(): void;
321
354
  get count(): number;
322
355
  }
@@ -536,7 +569,10 @@ interface TestEdge {
536
569
  }
537
570
  /** One Starlens request the app made, as the simulator saw it (names only, never bytes). */
538
571
  interface CapturedStarlensCall {
572
+ /** As sent (`latest` stays `latest`). */
539
573
  version: string;
574
+ /** As requested; `"low"` when the app did not set one. The reply says what ran. */
575
+ effort: "low" | "high";
540
576
  inputs: {
541
577
  name: string;
542
578
  mediaType: string | null;
@@ -557,6 +593,12 @@ type StarlensReply = {
557
593
  path: string;
558
594
  reason: string;
559
595
  }[];
596
+ /**
597
+ * The effort the reply says ran. Defaults to the requested effort, or `"low"` for a
598
+ * high request with no image input (production cannot crop a PDF, audio or video).
599
+ * Set `"low"` to simulate a high request on an image production could not decode.
600
+ */
601
+ effort?: "low" | "high";
560
602
  } | {
561
603
  reject: string;
562
604
  };