Skip to content

Commit

Permalink
removed standard checkout from hub
Browse files Browse the repository at this point in the history
  • Loading branch information
tobihagemann committed Nov 6, 2023
1 parent 7fa0b72 commit 6010768
Showing 1 changed file with 2 additions and 26 deletions.
28 changes: 2 additions & 26 deletions assets/js/hubsubscription.js
Original file line number Diff line number Diff line change
Expand Up @@ -228,37 +228,13 @@ class HubSubscription {

this._subscriptionData.inProgress = true;
this._subscriptionData.errorMessage = '';
if (this._subscriptionData.customBilling?.managed && this._subscriptionData.customBilling?.override) {
// managed && override
if (this._subscriptionData.customBilling?.managed) {
this.customCheckout(PADDLE_HUB_MANAGED_SUBSCRIPTION_PLAN_ID, locale);
} else if (this._subscriptionData.customBilling?.managed) {
// managed && !override
this.standardCheckout(PADDLE_HUB_MANAGED_SUBSCRIPTION_PLAN_ID, locale);
} else if (this._subscriptionData.customBilling?.override) {
// !managed && override
this.customCheckout(PADDLE_HUB_SELF_HOSTED_SUBSCRIPTION_PLAN_ID, locale);
} else {
// !managed && !override
this.standardCheckout(PADDLE_HUB_SELF_HOSTED_SUBSCRIPTION_PLAN_ID, locale);
this.customCheckout(PADDLE_HUB_SELF_HOSTED_SUBSCRIPTION_PLAN_ID, locale);
}
}

standardCheckout(productId, locale) {
this._paddle.then(paddle => {
paddle.Checkout.open({
product: productId,
email: this._subscriptionData.email,
quantity: this._subscriptionData.quantity,
locale: locale,
passthrough: '{"hub_id": ' + this._subscriptionData.hubId + '}',
successCallback: data => this.getPaddleOrderDetails(data.checkout.id),
closeCallback: () => {
this._subscriptionData.inProgress = false;
}
});
});
}

customCheckout(productId, locale) {
$.ajax({
url: GENERATE_PAY_LINK_URL,
Expand Down

0 comments on commit 6010768

Please sign in to comment.