feat: implement plan upgrade logic with prorated pricing and MercadoPago integration
This commit is contained in:
@@ -5,8 +5,12 @@ import {
|
||||
GetSubscriptionInitPointParams,
|
||||
GetSuscriptionInitPointResponse,
|
||||
MPPreApprovalResponse,
|
||||
VerifyPendingPlanPaymentParams,
|
||||
VerifyPendingPlanPaymentResponse,
|
||||
} from "../../Models/PlanSubscriptions/PlanSubscriptions.interface";
|
||||
import { connect } from "mongoose";
|
||||
import { validateSessionUser } from "../../helpers/check";
|
||||
import { MercadoPagoWebhookService } from "../MercadoPago/MercadoPagoWebhook.Service";
|
||||
|
||||
export class PlanSubscriptionsService {
|
||||
public async getInitPoint(
|
||||
@@ -27,4 +31,10 @@ export class PlanSubscriptionsService {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
await PlanSubscriptionsList.cancell(data);
|
||||
}
|
||||
|
||||
public async verifyPendingPayment(data: VerifyPendingPlanPaymentParams): Promise<VerifyPendingPlanPaymentResponse> {
|
||||
await connect(`${process.env.DATABASE_CONNECTION}`);
|
||||
await validateSessionUser({ sessionUser: data.sessionUser });
|
||||
return new MercadoPagoWebhookService().verifyPendingPlanPayment(data.sessionUser);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user