Merge branch 'dev' into staging
This commit is contained in:
commit
a3c9dfb12a
@ -42,7 +42,25 @@ export default class StripeController extends ApiController {
|
||||
}
|
||||
}
|
||||
|
||||
@Get("/api/v1/admin/stripe/:uid", [authHandler, ruleHandler])
|
||||
@Get("/api/v1/admin/stripe/:uid")
|
||||
protected async getStripeSubscriptionByUid(req: Request, response: Response) {
|
||||
try {
|
||||
const uid = req.params["uid"];
|
||||
if (!uid) {
|
||||
this.httpBadRequest(response, "No uid provided");
|
||||
return;
|
||||
}
|
||||
|
||||
const stripe_subscription = await this.stripeService.getStripeSubscriptionByUid(uid);
|
||||
|
||||
this.httpSuccess(response, stripe_subscription);
|
||||
} catch (error) {
|
||||
this.httpInternalError(response, error);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
@Get("/api/v1/admin/stripe/:uid/client-portal", [authHandler, ruleHandler])
|
||||
protected async getClientPortalSession(req: Request, response: Response) {
|
||||
try {
|
||||
const uid = req.params["uid"];
|
||||
|
@ -855,7 +855,7 @@ export default async function main() {
|
||||
|
||||
const rulesGroups = [
|
||||
{
|
||||
name: "Gestion des types d'actes et des documents",
|
||||
name: "Gestion des matrices d'actes et des documents",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
rules: [
|
||||
@ -877,7 +877,7 @@ export default async function main() {
|
||||
]
|
||||
},
|
||||
{
|
||||
name: "Gestion du RIB",
|
||||
name: "Intégration du RIB",
|
||||
created_at: new Date(),
|
||||
updated_at: new Date(),
|
||||
rules : [
|
||||
|
@ -38,54 +38,8 @@ export default class StripeService {
|
||||
|
||||
}
|
||||
|
||||
public async createCheckoutSessionUpdate(uid: string, subscription: Subscription) {
|
||||
|
||||
|
||||
|
||||
// return this.client.checkout.sessions.create({
|
||||
// mode: "payment",
|
||||
// payment_method_types: ["card", "paypal"],
|
||||
// billing_address_collection: "auto",
|
||||
// success_url: this.variables.APP_HOST + "/subscription/success",
|
||||
// cancel_url: this.variables.APP_HOST + "/subscription/error",
|
||||
// metadata: {
|
||||
// subscription: JSON.stringify(subscription),
|
||||
// },
|
||||
// });
|
||||
|
||||
// const priceId =
|
||||
// subscription.type === "STANDARD"
|
||||
// ? this.variables.STRIPE_STANDARD_SUBSCRIPTION_PRICE_ID
|
||||
// : this.variables.STRIPE_UNLIMITED_SUBSCRIPTION_PRICE_ID;
|
||||
|
||||
// return this.client.checkout.sessions.create({
|
||||
// mode: "subscription",
|
||||
// payment_method_types: ["card", "paypal"],
|
||||
// billing_address_collection: "auto",
|
||||
// line_items: [
|
||||
// {
|
||||
// price: priceId,
|
||||
// quantity: subscription.type === "STANDARD" ? subscription.nb_seats : 1,
|
||||
// },
|
||||
// ],
|
||||
// success_url: this.variables.APP_HOST + "/subscription/success",
|
||||
// cancel_url: this.variables.APP_HOST + "/subscription/error",
|
||||
// metadata: {
|
||||
// subscription: JSON.stringify(subscription),
|
||||
// },
|
||||
// });
|
||||
// const subscriptions = await this.client.subscriptions.retrieve(uid);
|
||||
// const itemId = subscriptions.items.data[0]?.id;
|
||||
|
||||
// return await this.client.subscriptions.update(uid, {
|
||||
// items: [
|
||||
// {
|
||||
// id: itemId,
|
||||
// price: priceId,
|
||||
// quantity: subscription.nb_seats,
|
||||
// },
|
||||
// ],
|
||||
// });
|
||||
public async getStripeSubscriptionByUid(subscriptionId: string) {
|
||||
return await this.client.subscriptions.retrieve(subscriptionId);
|
||||
}
|
||||
|
||||
public async createClientPortalSession(subscriptionId: string) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user