remove application_fee_amount (#8496)
* Clean up linting * Type fix --------- Co-authored-by: gitstart-calcom <gitstart@users.noreply.github.com> Co-authored-by: GitStart-Cal.com <121884634+gitstart-calcom@users.noreply.github.com> Co-authored-by: Joe Au-Yeung <j.auyeung419@gmail.com> Co-authored-by: Joe Au-Yeung <65426560+joeauyeung@users.noreply.github.com>pull/8496/merge
parent
07fbc4cbd3
commit
81d8628a87
|
@ -62,9 +62,7 @@ export class PaymentService implements IAbstractPaymentService {
|
|||
});
|
||||
|
||||
// Parse keys with zod
|
||||
const { client_id, payment_fee_fixed, payment_fee_percentage } = stripeAppKeysSchema.parse(
|
||||
stripeAppKeys?.keys
|
||||
);
|
||||
const { payment_fee_fixed, payment_fee_percentage } = stripeAppKeysSchema.parse(stripeAppKeys?.keys);
|
||||
const paymentFee = Math.round(payment.amount * payment_fee_percentage + payment_fee_fixed);
|
||||
|
||||
const customer = await retrieveOrCreateStripeCustomerByEmail(
|
||||
|
@ -76,7 +74,6 @@ export class PaymentService implements IAbstractPaymentService {
|
|||
amount: payment.amount,
|
||||
currency: this.credentials.default_currency,
|
||||
payment_method_types: ["card"],
|
||||
application_fee_amount: paymentFee,
|
||||
customer: customer.id,
|
||||
};
|
||||
|
||||
|
@ -143,9 +140,7 @@ export class PaymentService implements IAbstractPaymentService {
|
|||
});
|
||||
|
||||
// Parse keys with zod
|
||||
const { client_id, payment_fee_fixed, payment_fee_percentage } = stripeAppKeysSchema.parse(
|
||||
stripeAppKeys?.keys
|
||||
);
|
||||
const { payment_fee_fixed, payment_fee_percentage } = stripeAppKeysSchema.parse(stripeAppKeys?.keys);
|
||||
const paymentFee = Math.round(payment.amount * payment_fee_percentage + payment_fee_fixed);
|
||||
|
||||
const customer = await retrieveOrCreateStripeCustomerByEmail(
|
||||
|
@ -200,7 +195,7 @@ export class PaymentService implements IAbstractPaymentService {
|
|||
return paymentData;
|
||||
}
|
||||
|
||||
async chargeCard(payment: Payment, bookingId: Booking["id"]): Promise<Payment> {
|
||||
async chargeCard(payment: Payment): Promise<Payment> {
|
||||
try {
|
||||
const stripeAppKeys = await prisma?.app.findFirst({
|
||||
select: {
|
||||
|
@ -216,9 +211,7 @@ export class PaymentService implements IAbstractPaymentService {
|
|||
const setupIntent = paymentObject.setupIntent;
|
||||
|
||||
// Parse keys with zod
|
||||
const { client_id, payment_fee_fixed, payment_fee_percentage } = stripeAppKeysSchema.parse(
|
||||
stripeAppKeys?.keys
|
||||
);
|
||||
const { payment_fee_fixed, payment_fee_percentage } = stripeAppKeysSchema.parse(stripeAppKeys?.keys);
|
||||
|
||||
const paymentFee = Math.round(payment.amount * payment_fee_percentage + payment_fee_fixed);
|
||||
|
||||
|
|
|
@ -106,7 +106,7 @@ export const paymentsRouter = router({
|
|||
const paymentInstance = new PaymentService(paymentCredential);
|
||||
|
||||
try {
|
||||
const paymentData = await paymentInstance.chargeCard(booking.payment[0], booking.id);
|
||||
const paymentData = await paymentInstance.chargeCard(booking.payment[0]);
|
||||
|
||||
if (!paymentData) {
|
||||
throw new TRPCError({ code: "NOT_FOUND", message: `Could not generate payment data` });
|
||||
|
|
Loading…
Reference in New Issue