@@ -20,27 +20,60 @@ export interface SubscriptionOfferingBase {
2020 attributes : {
2121 name : string
2222 description : string
23- created_at : string
24- updated_at : string
25- } ,
23+ }
24+ }
25+
26+ export interface SubscriptionOfferingRelationships {
2627 relationships ?: {
27- [ key : string ] : {
28- links ?: {
29- related ?: string
30- self ?: string
31- } ,
32- data ?: {
33- type ?: string
34- id ?: string
28+ plans ?: {
29+ data : {
30+ id : string
31+ type : 'subscription_offering_plan'
32+ } [ ]
33+ links : {
34+ related : string
35+ }
36+ }
37+ products ?: {
38+ data : {
39+ id : string
40+ type : 'subscription_offering_product'
41+ } [ ]
42+ links : {
43+ related : string
44+ }
45+ }
46+ proration_policy ?: {
47+ data : {
48+ id : string
49+ type : 'subscription_proration_policy'
3550 }
3651 }
3752 }
53+
3854}
3955
56+ export interface SubscriptionOfferingBuildProduct {
57+ external_ref ?: string
58+ name : string
59+ description ?: string
60+ sku ?: string
61+ main_image ?: string
62+ price ?: {
63+ [ key : string ] : {
64+ amount : number
65+ includes_tax ?: boolean
66+ }
67+ }
68+ price_units ?: {
69+ unit : "day" | "month"
70+ amount : number
71+ }
72+ }
4073export interface SubscriptionOfferingBuildBody {
4174 name : string
4275 description : string
43- products : string [ ]
76+ products : string [ ] | SubscriptionOfferingBuildProduct [ ]
4477 plans : string [ ]
4578}
4679
@@ -52,11 +85,23 @@ export interface SubscriptionOfferingAttachPlanBody {
5285 plans : string [ ]
5386}
5487
55- export interface SubscriptionOffering extends Identifiable , SubscriptionOfferingBase {
88+ export interface SubscriptionOfferingAttachProrationPolicyBody {
89+ type : 'subscription_proration_policy'
90+ id : string
91+ }
5692
93+ export interface SubscriptionOffering extends Identifiable , SubscriptionOfferingBase , SubscriptionOfferingRelationships {
94+ meta : {
95+ external_product_refs : string [ ]
96+ owner : string
97+ timestamps : {
98+ created_at : string
99+ updated_at : string
100+ }
101+ }
57102}
58103export type SubscriptionOfferingCreate = Omit < SubscriptionOfferingBase , 'attributes' > & { attributes : Partial < SubscriptionOfferingBase [ 'attributes' ] > }
59- export type SubscriptionOfferingUpdate = Omit < SubscriptionOffering , 'attributes' > & { attributes : Partial < SubscriptionOfferingBase [ 'attributes' ] > }
104+ export type SubscriptionOfferingUpdate = Identifiable & Omit < SubscriptionOfferingBase , 'attributes' > & { attributes : Partial < SubscriptionOfferingBase [ 'attributes' ] > }
60105
61106type SubscriptionOfferingAttachmentsRelationships = {
62107 relationships : {
@@ -69,7 +114,24 @@ type SubscriptionOfferingAttachmentsRelationships = {
69114 }
70115}
71116
72- export type SubscriptionOfferingPlan = SubscriptionPlan & SubscriptionOfferingAttachmentsRelationships
117+ export interface SubscriptionOfferingFilter {
118+ eq ?: {
119+ "products.external_ref" : string
120+ }
121+ }
122+
123+ type SubscriptionOfferingPlanMeta = {
124+ meta : {
125+ active_plan ?: boolean
126+ owner : string
127+ timestamps : {
128+ created_at : string
129+ updated_at : string
130+ }
131+ }
132+ }
133+
134+ export type SubscriptionOfferingPlan = Omit < SubscriptionPlan , 'meta' > & SubscriptionOfferingAttachmentsRelationships & SubscriptionOfferingPlanMeta
73135export type SubscriptionOfferingProduct = SubscriptionProduct & SubscriptionOfferingAttachmentsRelationships
74136/**
75137 * Subscription Offering Endpoints
@@ -80,7 +142,7 @@ export interface SubscriptionOfferingsEndpoint
80142 SubscriptionOffering ,
81143 SubscriptionOfferingCreate ,
82144 SubscriptionOfferingUpdate ,
83- never ,
145+ SubscriptionOfferingFilter ,
84146 never ,
85147 never
86148 > {
@@ -99,4 +161,8 @@ export interface SubscriptionOfferingsEndpoint
99161 AttachPlans ( offeringId : string , body : SubscriptionOfferingAttachPlanBody ) : Promise < Resource < SubscriptionPlan [ ] > >
100162
101163 RemovePlan ( offeringId : string , planId : string ) : Promise < void >
164+
165+ AttachProrationPolicy ( offeringId : string , body : SubscriptionOfferingAttachProrationPolicyBody | null ) : Promise < Resource < SubscriptionOfferingAttachProrationPolicyBody > >
166+
167+ ReplaceProducts ( offeringId : string , productIds : string [ ] ) : Promise < Resource < SubscriptionProduct [ ] > >
102168}
0 commit comments