From 6905ea4086ba365034d76775c7d0fa5c968b579c Mon Sep 17 00:00:00 2001 From: PLJNS Date: Tue, 21 Nov 2023 15:43:37 -0500 Subject: [PATCH] 2.5.10 correctly search for merchant on revoke --- src/moa-square/services/merchants.square.service.ts | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/src/moa-square/services/merchants.square.service.ts b/src/moa-square/services/merchants.square.service.ts index 7d74ef26..15945212 100644 --- a/src/moa-square/services/merchants.square.service.ts +++ b/src/moa-square/services/merchants.square.service.ts @@ -317,7 +317,12 @@ export class MerchantsSquareService { payload: SquareOauthAuthorizationRevokedEventPayload, ) { if (payload.merchant_id) { - await this.deleteOauth({ merchantId: payload.merchant_id }); + const merchant = await this.service.findOneOrFail({ + where: { squareId: payload.merchant_id }, + }); + if (merchant.id) { + await this.deleteOauth({ merchantId: merchant.id }); + } } }