Skip to content

Commit

Permalink
Add missing DiscountFixed type (#207)
Browse files Browse the repository at this point in the history
* add missing DiscountFixed type

* add changeset for changes related to missing DiscountFixed type

* Update the changeset description for DiscountFixed type

---------

Co-authored-by: Marcin Slezak <[email protected]>
  • Loading branch information
marcin-slezak and Marcin Slezak committed May 8, 2023
1 parent 3d7d014 commit e7fab63
Show file tree
Hide file tree
Showing 7 changed files with 57 additions and 15 deletions.
37 changes: 37 additions & 0 deletions .changeset/gentle-carrots-carry.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
---
'@voucherify/sdk': patch
---

Added missing DiscountFixed type addressing issue #206. Affected types:
- type `ClientSideValidateResponse` related to:
- response for GET `/validate`
- type `SimplePromotionTier` related to:
- response GET `/promotions/validation`
- type `PromotionsCreate` related to:
- params for POST `/campaigns`
- type `PromotionsValidateResponse` related to:
- response for POST `/promotions/validation`
- type `VouchersResponse` related to:
- response for POST `/redeem`
- response for POST `/vouchers/qualification`
- params for POST and PUT `/vouchers/${encode(voucher.code)}`
- response for GET `/vouchers/${encode(code)}`
- response POST `loyalties/{campaignId}/members/{memberId}/redemption`
- response POST `/vouchers/${encode(code)}/enable`
- response POST `/vouchers/${encode(code)}/disable`
- type `VouchersImport` related to:
- params for POST `/vouchers/import`
- type `PromotionTier` related to:
- response for GET `/promotions/tiers`
- response for GET `/promotions/${encode(promotionId)}/tiers`
- response for POST `/promotions/tiers/${encode(promotionsTierId)}/redemption`
- response for POST `/vouchers/${encode(code)}/redemption`
- type `PromotionTiersCreateParams` related to:
- params for POST `/promotions/${encode(promotionId)}/tiers`
- type `ValidationsValidateVoucherResponse` related to:
- response for POST `/vouchers/${encode(code)}/validate`
- type `SimpleVoucher` related to:
- response GET/PUT/POST `/campaigns/${encode(name)}`
- response GET `/campaigns`
- params POST `/campaigns`
- response POST `/campaigns/qualification`
4 changes: 2 additions & 2 deletions packages/sdk/src/types/ClientSide.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { CustomerRequest, CustomersCreateBody, CustomersCreateResponse, CustomersUpdateConsentsBody } from './Customers'
import { VouchersListParams, VouchersResponse } from './Vouchers'
import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher'
import { DiscountAmount, DiscountPercent, DiscountUnit, DiscountFixed } from './DiscountVoucher'
import { OrdersCreateResponse, OrdersItem } from './Orders'

import { ConsentsListResponse } from './Consents'
Expand Down Expand Up @@ -54,7 +54,7 @@ export interface ClientSideListVouchersResponse {
export interface ClientSideValidateResponse {
code?: string
valid: boolean
discount?: DiscountUnit | DiscountAmount | DiscountPercent
discount?: DiscountUnit | DiscountAmount | DiscountPercent | DiscountFixed
applicable_to?: ApplicableToResultList
order?: {
amount: number
Expand Down
5 changes: 5 additions & 0 deletions packages/sdk/src/types/DiscountVoucher.ts
Original file line number Diff line number Diff line change
Expand Up @@ -61,3 +61,8 @@ export interface DiscountPercent {
amount_limit?: number
effect?: DiscountPercentVouchersEffectTypes
}
export interface DiscountFixed {
type?: DiscountVouchersTypesEnum.FIXED
fixed_amount?: number
effect?: DiscountFixedVouchersEffectTypes
}
8 changes: 4 additions & 4 deletions packages/sdk/src/types/PromotionTiers.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher'
import { DiscountAmount, DiscountPercent, DiscountUnit, DiscountFixed } from './DiscountVoucher'
import { OrdersCreateResponse, OrdersItem } from './Orders'

import { SimpleCustomer } from './Customers'
Expand All @@ -12,7 +12,7 @@ export interface SimplePromotionTier {
id: string
name: string
banner?: string
discount: DiscountUnit | DiscountPercent | DiscountAmount
discount: DiscountUnit | DiscountPercent | DiscountAmount | DiscountFixed
hierarchy: number
object: 'promotion_tier'
}
Expand All @@ -30,7 +30,7 @@ export interface PromotionTier {
}
validation_rule_assignments: ValidationRulesListAssignmentsResponse
action: {
discount: DiscountUnit | DiscountPercent | DiscountAmount
discount: DiscountUnit | DiscountPercent | DiscountAmount | DiscountFixed
}
hierarchy: number
metadata?: Record<string, any>
Expand All @@ -56,7 +56,7 @@ export interface PromotionTiersCreateParams {
name?: string
banner?: string
action?: {
discount?: DiscountUnit | DiscountPercent | DiscountAmount
discount?: DiscountUnit | DiscountPercent | DiscountAmount | DiscountFixed
}
metadata?: Record<string, any>
}
Expand Down
6 changes: 3 additions & 3 deletions packages/sdk/src/types/Promotions.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher'
import { DiscountAmount, DiscountPercent, DiscountUnit, DiscountFixed } from './DiscountVoucher'

import { OrdersItem } from './Orders'
import { PromotionTier } from './PromotionTiers'
Expand Down Expand Up @@ -53,7 +53,7 @@ export interface PromotionsCreate {
name: string
banner: string
action: {
discount: DiscountUnit | DiscountAmount | DiscountPercent
discount: DiscountUnit | DiscountAmount | DiscountPercent | DiscountFixed
}
metadata?: Record<string, any>
}[]
Expand Down Expand Up @@ -86,7 +86,7 @@ export interface PromotionsValidateResponse {
name: string
start_date?: string
expiration_date?: string
discount?: DiscountUnit | DiscountAmount | DiscountPercent
discount?: DiscountUnit | DiscountAmount | DiscountPercent | DiscountFixed
discount_amount?: number
applied_discount_amount?: number
metadata?: Record<string, any>
Expand Down
4 changes: 2 additions & 2 deletions packages/sdk/src/types/Validations.ts
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { DiscountAmount, DiscountPercent, DiscountUnit } from './DiscountVoucher'
import { DiscountAmount, DiscountPercent, DiscountUnit, DiscountFixed } from './DiscountVoucher'
import { CustomersCreateBody } from './Customers'
import { StackableOptions, StackableRedeemableParams, StackableRedeemableResponse } from './Stackable'
import { ValidationSessionParams, ValidationSessionResponse } from './ValidateSession'
Expand Down Expand Up @@ -41,7 +41,7 @@ export interface ValidationsValidateVoucherResponse {
metadata?: Record<string, any>
code?: string
valid?: boolean
discount?: DiscountAmount | DiscountUnit | DiscountPercent
discount?: DiscountAmount | DiscountUnit | DiscountPercent | DiscountFixed
gift?: {
amount: number
balance: number
Expand Down
8 changes: 4 additions & 4 deletions packages/sdk/src/types/Vouchers.ts
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
import { OrdersGetResponse } from './Orders'
import { SimpleCustomer } from './Customers'
import { DiscountUnit, DiscountAmount, DiscountPercent } from './DiscountVoucher'
import { DiscountUnit, DiscountAmount, DiscountPercent, DiscountFixed } from './DiscountVoucher'

export type VoucherType = 'GIFT_VOUCHER' | 'DISCOUNT_VOUCHER' | 'LOYALTY_CARD' | 'LUCKY_DRAW'
export interface SimpleVoucher {
Expand All @@ -13,7 +13,7 @@ export interface SimpleVoucher {
}
type: VoucherType
is_referral_code?: boolean
discount?: DiscountUnit | DiscountAmount | DiscountPercent
discount?: DiscountUnit | DiscountAmount | DiscountPercent | DiscountFixed
loyalty_card?: {
points: number
balance: number
Expand All @@ -29,7 +29,7 @@ export interface VouchersResponse {
campaign?: string
category?: string
type?: 'DISCOUNT_VOUCHER' | 'GIFT_VOUCHER'
discount?: DiscountAmount | DiscountPercent | DiscountUnit
discount?: DiscountAmount | DiscountPercent | DiscountUnit | DiscountFixed
gift?: {
amount: number
balance: number
Expand Down Expand Up @@ -210,7 +210,7 @@ export interface VouchersImport {
code: string
category?: string
type?: 'DISCOUNT_VOUCHER' | 'GIFT_VOUCHER'
discount: DiscountAmount | DiscountPercent | DiscountUnit
discount: DiscountAmount | DiscountPercent | DiscountUnit | DiscountFixed
additional_info?: string
start_date?: string
expiration_date?: string
Expand Down

0 comments on commit e7fab63

Please sign in to comment.