Skip to content

Commit

Permalink
feat: renames planName to planId and deprecates planName
Browse files Browse the repository at this point in the history
  • Loading branch information
Haripriyan committed Oct 6, 2020
1 parent a8e32e6 commit 3481e78
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 2 deletions.
4 changes: 3 additions & 1 deletion src/interfaces/cb-types.ts
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,9 @@ export interface CBCheckoutProps extends CBCheckoutParams {

export type CBCheckoutParams = {
site: string;
planName: string;
/** @deprecated since 1.0.7. Use `planId` instead. **/
planName?: string;
planId?: string;
} & CBCheckoutQueryParams;

export type CBCheckoutQueryParams = {
Expand Down
11 changes: 10 additions & 1 deletion src/models/CBCheckout.ts
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,16 @@ export class CBCheckout {
}

private baseUrl() {
return `https://${this.props.site}.chargebee.com/hosted_pages/plans/${this.props.planName}`;
return `https://${
this.props.site
}.chargebee.com/hosted_pages/plans/${this.planResource()}`;
}

private planResource() {
if (this.props.planId) {
return this.props.planId;
}
return this.props.planName;
}

private buildQueryParams() {
Expand Down

0 comments on commit 3481e78

Please sign in to comment.