refactor: remove unused pm_id parameter from whIntentCreatedHandler and related functions
This commit is contained in:
parent
baf92787a7
commit
5f5aa18b87
3 changed files with 0 additions and 11 deletions
|
|
@ -38,7 +38,6 @@ const handler = async (
|
|||
// Handle the event
|
||||
switch (event.type) {
|
||||
case "payment_intent.created": {
|
||||
console.log("PaymentIntent failed", event.data);
|
||||
const paymentIntent = event.data.object;
|
||||
const { id, metadata } = paymentIntent;
|
||||
|
||||
|
|
@ -54,10 +53,6 @@ const handler = async (
|
|||
await caller.stripe.whIntentCreated({
|
||||
paymentId: metadata.paymentId as PaymentsId,
|
||||
pIntentId: id,
|
||||
pm_id:
|
||||
typeof paymentIntent.payment_method === "string"
|
||||
? paymentIntent.payment_method
|
||||
: "",
|
||||
});
|
||||
|
||||
break;
|
||||
|
|
|
|||
|
|
@ -33,14 +33,12 @@ export const stripeRouter = createTRPCRouter({
|
|||
z.object({
|
||||
paymentId: zPagamentoId,
|
||||
pIntentId: z.string(),
|
||||
pm_id: z.string(),
|
||||
}),
|
||||
)
|
||||
.query(async ({ input }) => {
|
||||
return await whIntentCreatedHandler({
|
||||
paymentId: input.paymentId,
|
||||
pIntentId: input.pIntentId,
|
||||
pm_id: input.pm_id,
|
||||
});
|
||||
}),
|
||||
whIntentFailed: publicProcedure
|
||||
|
|
|
|||
|
|
@ -79,20 +79,16 @@ export const createIntentHandler = async ({
|
|||
export const whIntentCreatedHandler = async ({
|
||||
pIntentId,
|
||||
paymentId,
|
||||
pm_id,
|
||||
}: {
|
||||
pIntentId: Payments["intent_id"];
|
||||
paymentId: PaymentsId;
|
||||
pm_id: string;
|
||||
}) => {
|
||||
try {
|
||||
const paymentMethod = await stripe.paymentMethods.retrieve(pm_id);
|
||||
return await db
|
||||
.updateTable("payments")
|
||||
.set({
|
||||
intent_id: pIntentId,
|
||||
paymentstatus: PaymentStatusEnum.processing,
|
||||
paymentmethod: paymentMethod.type,
|
||||
})
|
||||
.where("id", "=", paymentId)
|
||||
.returning("id")
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue