mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-07 23:27:35 +00:00
Add endpoint for updating organization plan
This commit is contained in:
@@ -36,6 +36,27 @@ export const getOrganizationPlan = async (req: Request, res: Response) => {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Update the organization plan to product with id [productId]
|
||||||
|
* @param req
|
||||||
|
* @param res
|
||||||
|
* @returns
|
||||||
|
*/
|
||||||
|
export const updateOrganizationPlan = async (req: Request, res: Response) => {
|
||||||
|
const {
|
||||||
|
productId
|
||||||
|
} = req.body;
|
||||||
|
|
||||||
|
const { data } = await licenseServerKeyRequest.patch(
|
||||||
|
`${await getLicenseServerUrl()}/api/license-server/v1/customers/${req.organization.customerId}/cloud-plan`,
|
||||||
|
{
|
||||||
|
productId
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
return res.status(200).send(data);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Return the organization's payment methods on file
|
* Return the organization's payment methods on file
|
||||||
*/
|
*/
|
||||||
|
|||||||
@@ -25,6 +25,21 @@ router.get(
|
|||||||
organizationsController.getOrganizationPlan
|
organizationsController.getOrganizationPlan
|
||||||
);
|
);
|
||||||
|
|
||||||
|
router.patch(
|
||||||
|
'/:organizationId/plan',
|
||||||
|
requireAuth({
|
||||||
|
acceptedAuthModes: ['jwt', 'apiKey']
|
||||||
|
}),
|
||||||
|
requireOrganizationAuth({
|
||||||
|
acceptedRoles: [OWNER, ADMIN, MEMBER],
|
||||||
|
acceptedStatuses: [ACCEPTED]
|
||||||
|
}),
|
||||||
|
param('organizationId').exists().trim(),
|
||||||
|
body('productId').exists().isString(),
|
||||||
|
validateRequest,
|
||||||
|
organizationsController.updateOrganizationPlan
|
||||||
|
);
|
||||||
|
|
||||||
router.get(
|
router.get(
|
||||||
'/:organizationId/billing-details/payment-methods',
|
'/:organizationId/billing-details/payment-methods',
|
||||||
requireAuth({
|
requireAuth({
|
||||||
|
|||||||
Reference in New Issue
Block a user