-
Notifications
You must be signed in to change notification settings - Fork 17
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
* Added Promotion Tiers types * Updated types * Fixed build error * Dropped ? from metadata * Updated types * Updates
- Loading branch information
Showing
5 changed files
with
126 additions
and
39 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,5 @@ | ||
--- | ||
'@voucherify/sdk': patch | ||
--- | ||
|
||
Added Promotion Tiers types |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,100 @@ | ||
import { DiscountAmount, DiscountPercent, DiscountUnit } from './Vouchers' | ||
import { OrdersCreateResponse, OrdersItem } from './Orders' | ||
|
||
import { SimpleCustomer } from './Customers' | ||
import { ValidationRulesListAssignmentsResponse } from './ValidationRules' | ||
|
||
export interface PromotionTier { | ||
id: string | ||
object: 'promotion_tier' | ||
name: string | ||
banner?: string | ||
campaign: { | ||
id: string | ||
object: 'campaign' | ||
start_date?: string | ||
expiration_date?: string | ||
active: boolean | ||
} | ||
validation_rule_assignments: ValidationRulesListAssignmentsResponse | ||
action: { | ||
discount: DiscountUnit | DiscountPercent | DiscountAmount | ||
} | ||
hierarchy: number | ||
metadata?: Record<string, any> | ||
} | ||
|
||
export interface PromotionTiersListAllParams { | ||
is_available?: boolean | ||
limit?: number | ||
page?: number | ||
} | ||
|
||
export interface PromotionTiersListAllResponse { | ||
object: 'list' | ||
data_ref: 'tiers' | ||
tiers: PromotionTier[] | ||
has_more: boolean | ||
} | ||
|
||
export type PromotionTiersListResponse = PromotionTiersListAllResponse | ||
|
||
export interface PromotionTiersCreateParams { | ||
name?: string | ||
banner?: string | ||
action?: { | ||
discount?: DiscountUnit | DiscountPercent | DiscountAmount | ||
} | ||
metadata?: Record<string, any> | ||
} | ||
|
||
export type PromotionTiersCreateResponse = PromotionTier | ||
|
||
export interface PromotionTiersRedeemParams { | ||
customer?: Omit<SimpleCustomer, 'object'> & { description?: string } | ||
order?: { | ||
id?: string | ||
source_id?: string | ||
amount?: number | ||
items?: OrdersItem[] | ||
status?: 'CREATED' | 'PAID' | 'CANCELLED' | 'FULFILLED' | ||
metadata?: Record<string, any> | ||
} | ||
metadata?: Record<string, any> | ||
session?: { | ||
key: string | ||
} | ||
} | ||
|
||
export interface PromotionTiersRedeemResponse { | ||
id: string | ||
object: 'redemption' | ||
date: string | ||
customer_id?: string | ||
tracking_id?: string | ||
order: Omit<OrdersCreateResponse, 'object' | 'customer'> & { | ||
customer: { | ||
id: string | ||
object: 'customer' | ||
referrals: $FixMe[] | ||
} | ||
total_discount_amount?: number | ||
total_amount?: number | ||
} | ||
result?: string | ||
promotion_tier: PromotionTier & { | ||
summary: { | ||
redemptions: { | ||
total_redeemed: number | ||
} | ||
orders: { | ||
total_amount: number | ||
total_discount_amount: number | ||
} | ||
} | ||
} | ||
} | ||
|
||
export type PromotionTiersUpdateParams = PromotionTiersCreateParams & { id: string } | ||
|
||
export type PromotionTiersUpdateResponse = PromotionTier |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters