Skip to content

Commit

Permalink
fixes for CustomerRedeemables endpoint:
Browse files Browse the repository at this point in the history
- types names following CONTRIBUTING.md
- add missing voucher.gift.effect
- adding missing voucher.loyalty_card.next_expiration_date and voucher.loyalty_card.next_expiration_points
- adding missing voucher.redemption.redeemed_points
- voucher.active as optional field
  • Loading branch information
Marcin Slezak committed Apr 19, 2024
1 parent e870816 commit f87f608
Showing 1 changed file with 11 additions and 7 deletions.
18 changes: 11 additions & 7 deletions packages/sdk/src/types/Customers.ts
Original file line number Diff line number Diff line change
Expand Up @@ -134,12 +134,12 @@ export interface CustomerRedeemablesListResponse {
object: 'list'
total: number
data_ref: 'data'
data: CustomerRedeemable[]
data: CustomerRedeemablesListItemResponse[]
has_more: boolean
more_starting_after?: string
}

export interface CustomerRedeemable {
export interface CustomerRedeemablesListItemResponse {
id: string
created_at: string
redeemable_id: string
Expand All @@ -149,10 +149,10 @@ export interface CustomerRedeemable {
campaign_id: string
campaign_type: 'LOYALTY_PROGRAM' | 'PROMOTION' | 'DISCOUNT_COUPONS' | 'GIFT_VOUCHERS' | 'REFERRAL_PROGRAM'
voucher_type: 'GIFT_VOUCHER' | 'DISCOUNT_VOUCHER' | 'LOYALTY_CARD'
redeemable: RedeemableContainer
redeemable: CustomerRedeemablesListItemContainerResponse
}

export interface RedeemableContainerVoucher {
export interface CustomerRedeemablesListItemContainerVoucherResponse {
id: string
code: string
campaign?: string
Expand All @@ -163,10 +163,13 @@ export interface RedeemableContainerVoucher {
gift?: {
amount: number
balance: number
effect: string
}
loyalty_card?: {
points: number
balance: number
next_expiration_date?: string
next_expiration_points?: number
}
start_date?: string
expiration_date?: string
Expand All @@ -185,8 +188,9 @@ export interface RedeemableContainerVoucher {
quantity?: number
redeemed_quantity: number
url: string
redeemed_points?: number
}
active: boolean
active?: boolean
additional_info?: string
metadata?: Record<string, any>
assets: {
Expand All @@ -206,9 +210,9 @@ export interface RedeemableContainerVoucher {
object: 'voucher'
}

export interface RedeemableContainer {
export interface CustomerRedeemablesListItemContainerResponse {
type: 'voucher'
voucher?: RedeemableContainerVoucher
voucher?: CustomerRedeemablesListItemContainerVoucherResponse
status: 'ACTIVE' | 'USED' | 'DISABLED' | 'NOT_ACTIVE' | 'EXPIRED' | 'NO_BALANCE'
}

Expand Down

0 comments on commit f87f608

Please sign in to comment.