add UI for stripe_v2

This commit is contained in:
Tanmay Deep Sharma
2025-12-01 20:01:59 +05:30
parent 1df5fd513a
commit a1a31e50ad
14 changed files with 1601 additions and 96 deletions
@@ -6,6 +6,7 @@ class EnterpriseAccountAPI extends ApiClient {
super('', { accountScoped: true, enterprise: true });
}
// V1 endpoints
checkout() {
return axios.post(`${this.url}checkout`);
}
@@ -23,6 +24,49 @@ class EnterpriseAccountAPI extends ApiClient {
action_type: action,
});
}
// V2 Billing endpoints
get v2BillingUrl() {
const accountId = this.accountIdFromRoute;
return `/enterprise/api/v2/accounts/${accountId}/billing`;
}
getCreditGrants() {
return axios.get(`${this.v2BillingUrl}/credit_grants`);
}
getPricingPlans() {
return axios.get(`${this.v2BillingUrl}/pricing_plans`);
}
getTopupOptions() {
return axios.get(`${this.v2BillingUrl}/topup_options`);
}
topupCredits(credits) {
return axios.post(`${this.v2BillingUrl}/topup`, { credits });
}
subscribeToPlan(pricingPlanId, quantity) {
return axios.post(`${this.v2BillingUrl}/subscribe`, {
pricing_plan_id: pricingPlanId,
quantity,
});
}
cancelSubscription(reason = null, feedback = null) {
return axios.post(`${this.v2BillingUrl}/cancel_subscription`, {
reason,
feedback,
});
}
changePricingPlan(pricingPlanId, quantity) {
return axios.post(`${this.v2BillingUrl}/change_pricing_plan`, {
pricing_plan_id: pricingPlanId,
quantity,
});
}
}
export default new EnterpriseAccountAPI();