Skip to content

feat(catalog): add PRICING_RULE, PRODUCT_SET, TIME_PERIOD and customer groups#64

Merged
mbates merged 3 commits intomainfrom
feat/59-pricing-rules-customer-groups
Apr 14, 2026
Merged

feat(catalog): add PRICING_RULE, PRODUCT_SET, TIME_PERIOD and customer groups#64
mbates merged 3 commits intomainfrom
feat/59-pricing-rules-customer-groups

Conversation

@mbates
Copy link
Copy Markdown
Owner

@mbates mbates commented Apr 14, 2026

Summary

  • Extends CatalogObjectType with PRICING_RULE, PRODUCT_SET, TIME_PERIOD and typed data interfaces on CatalogObject
  • Adds catalog helpers: createProductSet, createPricingRule, createTimePeriod
  • Adds composite createWholesalePricing — atomically creates product set + discount + pricing rule via batchUpsert so the rule can reference freshly-created IDs
  • Adds CustomerGroupsService (square.customerGroups) with CRUD, cursor-paginated list, and addCustomer / removeCustomer membership helpers
  • Wired into client.ts and index.ts exports

Unblocks wholesale pricing per retailer (Mickles admin dashboard) — the dashboard can now sync wholesale prices to Square POS instead of storing them in DynamoDB as an invoicing-only workaround.

Test plan

  • npm run typecheck clean
  • npm run lint clean
  • npm test — 444/444 pass (18 new tests covering new helpers, validation, BigInt coercion, batch response handling, and all CustomerGroupsService methods)

Closes #59

…r groups

Adds support for Square's customer-specific pricing primitives:

- Extends CatalogObjectType with PRICING_RULE, PRODUCT_SET, TIME_PERIOD
  and typed data interfaces on CatalogObject
- New catalog helpers: createProductSet, createPricingRule, createTimePeriod
- New composite createWholesalePricing that atomically creates a product set,
  discount, and pricing rule in a single batchUpsert
- New CustomerGroupsService wrapping customers.groups SDK client with CRUD,
  list pagination, and addCustomer/removeCustomer membership helpers
- Wired square.customerGroups into client and index exports

Closes #59
@codecov
Copy link
Copy Markdown

codecov bot commented Apr 14, 2026

Codecov Report

❌ Patch coverage is 96.07843% with 4 lines in your changes missing coverage. Please review.
✅ Project coverage is 97.06%. Comparing base (e8b175f) to head (be9ec67).
⚠️ Report is 12 commits behind head on main.

Files with missing lines Patch % Lines
src/core/services/catalog.service.ts 93.65% 0 Missing and 4 partials ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main      #64      +/-   ##
==========================================
- Coverage   97.18%   97.06%   -0.12%     
==========================================
  Files          17       18       +1     
  Lines         853      955     +102     
  Branches      244      277      +33     
==========================================
+ Hits          829      927      +98     
  Misses          1        1              
- Partials       23       27       +4     

☔ View full report in Codecov by Sentry.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

Copy link
Copy Markdown

Copilot AI left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

Adds Square Customer Groups support and extends the Catalog wrapper to support pricing-rule-related catalog object types (pricing rules, product sets, time periods), including an atomic wholesale-pricing batch upsert helper.

Changes:

  • Extended CatalogObjectType and CatalogObject typed data to include PRICING_RULE, PRODUCT_SET, and TIME_PERIOD.
  • Added catalog helpers: createProductSet, createPricingRule, createTimePeriod, plus composite createWholesalePricing using batchUpsert.
  • Introduced CustomerGroupsService with CRUD, cursor-paginated listing, and membership helpers; wired into client + exports, with new tests.

Reviewed changes

Copilot reviewed 6 out of 6 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
src/core/services/customer-groups.service.ts New Customer Groups service with CRUD, list pagination, and membership methods.
src/core/services/catalog.service.ts Adds new catalog object types/data and helper methods, including atomic wholesale pricing creation.
src/core/client.ts Wires customerGroups service onto the wrapper client.
src/core/index.ts Exports CustomerGroupsService.
src/core/tests/customer-groups.service.test.ts Adds unit tests for the new Customer Groups service.
src/core/tests/catalog.service.test.ts Adds unit tests for new catalog helpers and createWholesalePricing.

💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.

Comment thread src/core/services/customer-groups.service.ts
Comment thread src/core/services/customer-groups.service.ts
Comment thread src/core/services/catalog.service.ts
mbates added 2 commits April 14, 2026 14:49
- customerGroups.create: auto-generate idempotencyKey for consistency with other services
- customerGroups.update: validate non-empty name like create
- createWholesalePricing: rename shadowed 'discount' variable to 'discountInput'
@mbates mbates merged commit 756b613 into main Apr 14, 2026
4 checks passed
@mbates mbates deleted the feat/59-pricing-rules-customer-groups branch April 14, 2026 22:42
@github-actions
Copy link
Copy Markdown

🎉 This PR is included in version 1.10.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add PRICING_RULE and CUSTOMER_GROUP catalog object support

2 participants