Skip to content

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

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

  • Add coupons()->validate() — checks a coupon code against a cart before payment is created (POST /v1/sales/coupons/validate). Nothing is redeemed.
  • treatments()->sync() payment card: bin dropped, last_4 (last four digits) added.

Details

  • New Coupons resource, exposed as $client->coupons().
  • validate(string $code, array $items, ?string $patientId = null, ?string $email = null, ?string $opportunityId = null).
  • items: 1–6 lines, each a plan_id or product_id + variant_id, plus quantity. Never amounts.
  • Shopper ids sent only when provided.
  • 404 → NotFoundException (unknown code). 422 → ValidationException (any other refusal).
  • Treatments::sync is pass-through; docs updated only.
  • checkoutEvents()->update() card docs unchanged.

Tests

  • New CouponsTest: URL, method, headers, body shape, optional ids, 404, 422.
  • TreatmentsTest updated for last_4.
  • make ci green: cs-fixer, phpstan max, phpunit 242 tests.

Docs

README, ARCHITECTURE, INTEGRATION_GUIDE, CHANGELOG

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

Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
Co-Authored-By: Claude Sonnet 5.5 <noreply@anthropic.com>
@raunak-cispl1
raunak-cispl1 merged commit 8f5e81a into main Nov 3, 2026
2 checks passed
@raunak-cispl1
raunak-cispl1 deleted the feat/coupons-validate-card-last4 branch November 3, 2026 08:36
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