-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
10 changed files
with
177 additions
and
139 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
import { routes } from './routes' | ||
import { billingPaymentsAPI } from './payments' | ||
import { billingLimitsAPI } from './limits' | ||
import { billingPlansAPI } from './plans' | ||
|
||
export function billingAPI(req) { | ||
return { | ||
...billingPaymentsAPI(req), | ||
...billingLimitsAPI(req), | ||
...billingPlansAPI(req), | ||
|
||
getBillingInfo(appId) { | ||
return req.billing.get(routes.billingInfo(appId)) | ||
}, | ||
|
||
getSubscriptionStatus(appId) { | ||
return req.billing.get(routes.subscriptionStatus(appId)) | ||
}, | ||
|
||
loadSubscriptionsInfo() { | ||
return req.billing.get(routes.devSubscriptionsInfo()) | ||
}, | ||
|
||
getBillingPeriodInfo(appId) { | ||
return req.billing.get(routes.billingPeriodInfo(appId)) | ||
}, | ||
|
||
// TODO: seems like we do not use the function | ||
// getInviteCode(appId) { | ||
// return req.billing.get(routes.inviteCode(appId)) | ||
// }, | ||
|
||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,49 @@ | ||
import { routes } from './routes' | ||
|
||
export function billingLimitsAPI(req) { | ||
return { | ||
getPlanComponentsData(appId, planId, billingPeriod) { | ||
return req.billing.get(routes.planComponentsData(appId, planId, billingPeriod)) | ||
}, | ||
|
||
getCurrentPlanComponentData(appId) { | ||
return req.billing.get(routes.planComponentsData(appId, 'current', 'current')) | ||
}, | ||
|
||
getComponentLimit(appId, componentId) { | ||
return req.billing.get(routes.componentLimit(appId, componentId)) | ||
}, | ||
|
||
apiCallsBlocked(appId) { | ||
return req.billing.get(routes.apiCallsBlocked(appId)) | ||
}, | ||
|
||
loadHiveUsage(appId, cached = true) { | ||
return req.billing.get(routes.hiveUsage(appId)).query({ cached }) | ||
}, | ||
|
||
loadHiveLimit(appId) { | ||
return req.billing.get(routes.hiveLimits(appId)) | ||
}, | ||
|
||
scalePlanePricingEstimate(appId, query) { | ||
return req.billing.get(routes.tiersFloatPriceEstimation(appId)).query(query) | ||
}, | ||
|
||
scaleFixedPlanePricingEstimate(appId, tierId, query) { | ||
return req.billing.get(routes.tiersFloatPriceEstimation(appId, tierId)).query(query) | ||
}, | ||
|
||
getMaxTier(appId) { | ||
return req.billing.get(routes.maxTier(appId)) | ||
}, | ||
|
||
setMaxTier(appId, tierId) { | ||
return req.billing.put(routes.maxTier(appId), { tierId }) | ||
}, | ||
|
||
getTiersList(appId) { | ||
return req.billing.get(routes.tiers(appId)) | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,39 @@ | ||
import { routes } from './routes' | ||
|
||
export function billingPaymentsAPI(req) { | ||
return { | ||
loadPaymentProfilesForCloneApp(appId) { | ||
return req.billing.get(routes.paymentProfilesForCloneApp(appId)) | ||
}, | ||
|
||
confirmConsolidateApp(appId, { paymentProfileId, newBillingPlan, newBillingPeriod }) { | ||
return req.billing.put(routes.consolidateApp(appId, paymentProfileId)) | ||
.query({ newBillingPlan, newBillingPeriod }) | ||
}, | ||
|
||
loadPaymentProfiles() { | ||
return req.billing.get(routes.devPaymentProfile()) | ||
}, | ||
|
||
setPaymentProfile(appId, paymentProfileId) { | ||
return req.billing.put(routes.devPaymentProfileCard(appId, paymentProfileId)) | ||
}, | ||
|
||
addPaymentProfile(data) { | ||
return req.billing.post(routes.devPaymentProfile(), data) | ||
}, | ||
|
||
updatePaymentProfile(id, data) { | ||
return req.billing.put(routes.devPaymentProfileById(id), data) | ||
}, | ||
|
||
deletePaymentProfile(id) { | ||
return req.billing.delete(routes.devPaymentProfileById(id)) | ||
}, | ||
|
||
exchangeBBtoUSD(appId, bbAmount) { | ||
return req.billing.post(routes.exchangeBB(appId), bbAmount) | ||
.set({ 'Content-Type': 'application/json' }) | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,17 @@ | ||
import { routes } from './routes' | ||
|
||
export function billingPlansAPI(req) { | ||
return { | ||
getPlans(appId) { | ||
return req.billing.get(routes.billingPlans(appId)) | ||
}, | ||
|
||
switchToPlan(appId, planId, billingPeriod) { | ||
return req.billing.put(routes.switchPlan(appId, planId, billingPeriod)) | ||
}, | ||
|
||
unlockPlan(appId, planId) { | ||
return req.billing.put(routes.unlockPlan(appId, planId)) | ||
}, | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
import { prepareRoutes } from '../utils/routes' | ||
|
||
export const routes = prepareRoutes({ | ||
billingInfo : '/:appId/console/billing/application/accountinfo', | ||
billingPlans : '/:appId/console/billing/application/plans', | ||
planComponentsData : '/:appId/console/billing/application/plans/:planId/:billingPeriod/components', | ||
switchPlan : '/:appId/console/billing/application/subscriptions/:planId/:billingPeriod', | ||
componentLimit : '/:appId/console/billing/application/limits/:componentId', | ||
billingPeriodInfo : '/:appId/console/billing/application/billing-period-info', | ||
exchangeBB : '/:appId/console/billing/application/bb/exchange', | ||
consolidateApp : '/:appId/console/billing/application/consolidate/:paymentProfileId', | ||
tiers : '/:appId/console/billing/application/tiers', | ||
maxTier : '/:appId/console/billing/application/tiers/max', | ||
tiersFloatPriceEstimation : '/:appId/console/billing/application/tiers/price-estimation', | ||
tiersFixedPriceEstimation : '/:appId/console/billing/application/tiers/price-estimation/:tierId', | ||
paymentProfilesForCloneApp: '/:appId/console/billing/application/payment-profiles-for-clone-operation', | ||
devPaymentProfileCard : '/:appId/console/billing/application/creditcard/:paymentProfileId', | ||
|
||
apiCallsBlocked: '/:appId/console/billing/apicalls/blocked', | ||
// inviteCode : '/:appId/console/billing/refcode', | ||
|
||
devSubscriptionsInfo : '/console/billing/developer/subscriptions-info', | ||
devPaymentProfile : '/console/billing/developer/payment-profile', | ||
devPaymentProfileById: '/console/billing/developer/payment-profile/:id', | ||
|
||
subscriptionStatus: '/:appId/billing/subscriptions/status', | ||
unlockPlan : '/:appId/billing/plan/:planId/unlock', | ||
|
||
hiveLimits: '/:appId/billing/limits/hive', | ||
hiveUsage : '/:appId/service/billing/usage/hive', | ||
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters