feat(helcim): add transaction list + card update helpers
- listHelcimCustomerTransactions(customerCode): GET /card-transactions/
with customerCode filter, sorts newest-first, caps at 50, normalizes
Helcim status (APPROVED/DECLINED) + type (refund) into
paid/refunded/failed/other.
- updateHelcimCustomerDefaultPaymentMethod(customerId, cardToken):
resolves cardToken -> cardId via /customers/{id}/cards, then PATCHes
/customers/{id}/cards/{cardId}/default.
- updateHelcimSubscriptionPaymentMethod(subscriptionId, cardToken):
wraps updateHelcimSubscription with a cardToken payload.
- helcimUpdateCardSchema: Zod schema { cardToken: string } for the
upcoming /api/helcim/update-card route.
- Unit tests for all three helpers (success + error paths).
This commit is contained in:
parent
b6f5ae8c5e
commit
6888663148
3 changed files with 305 additions and 0 deletions
|
|
@ -79,6 +79,10 @@ export const helcimSubscriptionSchema = z.object({
|
|||
cadence: z.enum(['monthly', 'annual']).default('monthly')
|
||||
})
|
||||
|
||||
export const helcimUpdateCardSchema = z.object({
|
||||
cardToken: z.string().min(1).max(500)
|
||||
})
|
||||
|
||||
export const helcimUpdateBillingSchema = z.object({
|
||||
customerId: z.union([z.string().min(1), z.number()]),
|
||||
billingAddress: z.object({
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue