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

Commit

Permalink
fix: subscription proration policy prefix, offering attach/detach pro…
Browse files Browse the repository at this point in the history
…duct (#940)

BREAKING CHANGE:
  • Loading branch information
rostyk-kanafotskyy committed Jul 17, 2024
1 parent 753d046 commit 3bbe020
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 3 deletions.
10 changes: 10 additions & 0 deletions src/endpoints/subscription-offerings.js
Original file line number Diff line number Diff line change
Expand Up @@ -30,6 +30,16 @@ 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 Down
8 changes: 6 additions & 2 deletions src/types/subscription-offerings.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ export interface SubscriptionOfferingRelationships {
proration_policy?: {
data: {
id: string
type: 'proration_policy'
type: 'subscription_proration_policy'
}
}
}
Expand Down Expand Up @@ -86,7 +86,7 @@ export interface SubscriptionOfferingAttachPlanBody {
}

export interface SubscriptionOfferingAttachProrationPolicyBody {
type: 'proration_policy'
type: 'subscription_proration_policy'
id: string
}

Expand Down Expand Up @@ -154,6 +154,10 @@ 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>
Expand Down
2 changes: 1 addition & 1 deletion src/types/subscription-proration-policies.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
* DOCS: TODO: add docs when ready
*/
export interface SubscriptionProrationPolicyBase {
type: 'proration_policy'
type: 'subscription_proration_policy'
attributes: {
name: string
rounding: 'up' | 'down' | 'nearest'
Expand Down

0 comments on commit 3bbe020

Please sign in to comment.