Skip to content

feat: add coupons().validate(); treatments().sync() card last_4 replaces bin - #15

Merged
raunak-cispl1 merged 2 commits into
mainfrom
feat/coupons-validate-card-last4
Nov 3, 2026
Merged

raunak-cispl1 merged 2 commits into
mainfrom
feat/coupons-validate-card-last4

Conversation

@raunak-cispl1

Copy link
Copy Markdown
Contributor

Summary

Mirrors the PHP SDK changes (branch feat/coupons-validate-card-last4, commit 1040ae5).

Added

  • coupons().validate() - checks a coupon code against a cart without redeeming it
    (POST /v1/sales/coupons/validate).
    • Options: code, items (1-6 lines), optional patientId / email / opportunityId.
    • Each item is { plan_id, quantity } or { product_id, variant_id, quantity }, never both, never amounts.
    • Optional ids are sent only when provided.
    • 404 throws NotFoundError; any other refusal (422) throws ValidationError.
    • New exports: Coupons, CouponCartItem, CouponValidateOptions.

Changed

  • BREAKING: treatments().sync() payment card: bin removed, optional last_4
    (last four digits) added. Checkout-events card docs unchanged.

Housekeeping

  • Version bumped to 0.0.4; CHANGELOG, README, ARCHITECTURE and INTEGRATION_GUIDE updated.
  • Resource-count comments and the client accessor test updated (seventeen -> eighteen).

Test plan

  • npm run ci green (lint, format, typecheck, 428 tests, build, publint)
  • npm run scrub silent
  • New coupons.spec.ts: URL, method, auth header, body shape, optional ids omitted, 404, 422

raunak-cispl1 and others added 2 commits November 3, 2026 12:42
…ces bin

- coupons().validate() checks a coupon code against a cart without
  redeeming it (POST /v1/sales/coupons/validate).
- BREAKING: treatments().sync() payment card: bin removed, optional
  last_4 added.
- Bump version to 0.0.4; update CHANGELOG, README and docs.

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
* origin/main:
  chore(deps-dev): Bump the build group across 1 directory with 3 updates
  chore(deps-dev): Bump @types/node from 22.20.1 to 22.20.5
  chore(deps-dev): Bump the eslint group with 2 updates
  chore(deps-dev): Bump the vitest group with 2 updates
@raunak-cispl1
raunak-cispl1 merged commit e0c33c5 into main Nov 3, 2026
2 checks passed
@raunak-cispl1
raunak-cispl1 deleted the feat/coupons-validate-card-last4 branch November 3, 2026 08:35
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant