Skip to content
This repository has been archived by the owner on Jul 24, 2024. It is now read-only.

feat: subscription offering replace products endpoint #939

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
15 changes: 5 additions & 10 deletions src/endpoints/subscription-offerings.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,16 +30,6 @@ class SubscriptionOfferingsEndpoint extends CRUDExtend {
})
}

AttachProducts(offeringId, body) {
return this.request.send(`${this.endpoint}/${offeringId}/products/attach`, 'POST', {
...body
})
}

RemoveProduct(offeringId, productId) {
return this.request.send(`${this.endpoint}/${offeringId}/products/${productId}`, 'DELETE')
}

AttachPlans(offeringId, body) {
return this.request.send(`${this.endpoint}/${offeringId}/plans/attach`, 'POST', {
...body
Expand All @@ -64,6 +54,11 @@ class SubscriptionOfferingsEndpoint extends CRUDExtend {
}, undefined, undefined, false)
}

ReplaceProducts(offeringId, productIds) {
return this.request.send(`${this.endpoint}/${offeringId}/products/replace`, 'PUT', {
products: productIds
})
}
}

export default SubscriptionOfferingsEndpoint
6 changes: 2 additions & 4 deletions src/types/subscription-offerings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -154,13 +154,11 @@ export interface SubscriptionOfferingsEndpoint

GetAttachedPlans(id: string) : Promise<Resource<SubscriptionOfferingPlan[]>>

AttachProducts(offeringId: string, body: SubscriptionOfferingAttachProductBody): Promise<Resource<SubscriptionProduct[]>>

RemoveProduct(offeringId: string, productId: string): Promise<void>

AttachPlans(offeringId: string, body: SubscriptionOfferingAttachPlanBody): Promise<Resource<SubscriptionPlan[]>>

RemovePlan(offeringId: string, planId: string): Promise<void>

AttachProrationPolicy(offeringId: string, body: SubscriptionOfferingAttachProrationPolicyBody | null): Promise<Resource<SubscriptionOfferingAttachProrationPolicyBody>>

ReplaceProducts(offeringId: string, productIds: string[]): Promise<Resource<SubscriptionProduct[]>>
}
Loading