Skip to content

Commit 45a9ea8

Browse files
committed
Fix logic
1 parent 660b7e3 commit 45a9ea8

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/api/webhooks/trolley/handlers/recipient-account.handler.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -97,7 +97,6 @@ export class RecipientAccountHandler {
9797
recipient_account_id: recipientAccountId,
9898
},
9999
});
100-
return;
101100
}
102101

103102
// no recipient, and payment method is not primary in trolley, return and do nothing
@@ -106,7 +105,7 @@ export class RecipientAccountHandler {
106105
}
107106

108107
// update the payment method if it exists & it was set to primary in trolley
109-
if (isPrimaryPaymentMethod) {
108+
if (recipientPaymentMethod && isPrimaryPaymentMethod) {
110109
await this.prisma.trolley_recipient_payment_method.update({
111110
where: { id: recipientPaymentMethod.id },
112111
data: {
@@ -117,6 +116,7 @@ export class RecipientAccountHandler {
117116

118117
// remove the payment method if it exists (with the same ID) and it was set as inactive in trolley
119118
if (
119+
recipientPaymentMethod &&
120120
!isPrimaryPaymentMethod &&
121121
recipientPaymentMethod.recipient_account_id === recipientAccountId
122122
) {

0 commit comments

Comments
 (0)