Skip to content

Commit 5be6625

Browse files
authored
Merge pull request #2479 from dubinc/paypal-updates
Enhance PayPal error logging with prefix
2 parents 97d371d + 232dce4 commit 5be6625

File tree

5 files changed

+7
-7
lines changed

5 files changed

+7
-7
lines changed

apps/web/app/(ee)/api/cron/payouts/charge-succeeded/send-paypal-payouts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ export async function sendPaypalPayouts({
4949
const data = await response.json();
5050

5151
if (!response.ok) {
52-
console.error("Error creating PayPal batch payout", data);
52+
console.error("[PayPal] Error creating PayPal batch payout", data);
5353

5454
await log({
5555
message: `Error creating PayPal batch payout. Invoice ID: ${invoiceId}. Error: ${JSON.stringify(

apps/web/app/(ee)/api/paypal/webhook/payout-status-changed.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,15 +41,15 @@ export async function payoutStatusChanged(event: any) {
4141

4242
if (!payout) {
4343
console.log(
44-
`Payout not found for invoice ${invoiceId} and partner ${paypalEmail}`,
44+
`[PayPal] Payout not found for invoice ${invoiceId} and partner ${paypalEmail}`,
4545
);
4646
return;
4747
}
4848

4949
if (body.event_type === "PAYMENT.PAYOUTS-ITEM.SUCCEEDED") {
5050
if (payout.status === "completed") {
5151
console.log(
52-
`Payout already completed for invoice ${invoiceId} and partner ${paypalEmail}`,
52+
`[PayPal] Payout already completed for invoice ${invoiceId} and partner ${paypalEmail}`,
5353
);
5454
return;
5555
}

apps/web/app/(ee)/api/paypal/webhook/route.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ export const POST = async (req: Request) => {
3535
return new Response("Unsupported event, skipping...");
3636
}
3737

38-
console.info(`Paypal webhook received: ${body.event_type}`, body);
38+
console.info(`[Paypal] Webhook received: ${body.event_type}`, body);
3939

4040
try {
4141
switch (body.event_type) {

apps/web/app/(ee)/api/paypal/webhook/verify-signature.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -34,14 +34,14 @@ export async function verifySignature({
3434
const certUrl = headers.get("paypal-cert-url");
3535

3636
if (!transmissionId || !transmissionSig || !timeStamp || !certUrl) {
37-
console.error("Missing required headers for signature verification");
37+
console.error("[PayPal] Missing required headers for signature verification");
3838
return false;
3939
}
4040

4141
const certPem = await downloadAndCache(certUrl);
4242

4343
if (!certPem) {
44-
console.error("Failed to download or cache PayPal certificate");
44+
console.error("[PayPal] Failed to download or cache PayPal certificate");
4545
return false;
4646
}
4747

apps/web/lib/paypal/create-paypal-token.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ export async function createPaypalToken() {
4040
const data = await response.json();
4141

4242
if (!response.ok) {
43-
console.error("Failed to create PayPal token.", data);
43+
console.error("[PayPal] Failed to create PayPal token.", data);
4444
throw new Error("Failed to create PayPal token.");
4545
}
4646

0 commit comments

Comments
 (0)