From 4b6edace09c6fc3bb7314dea495fbb6a8eafbbb5 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Mon, 1 Apr 2019 09:46:02 -0400 Subject: [PATCH] handle refund echecks --- src/Billing/Controllers/PayPalController.cs | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/src/Billing/Controllers/PayPalController.cs b/src/Billing/Controllers/PayPalController.cs index c7151443ec..e627925330 100644 --- a/src/Billing/Controllers/PayPalController.cs +++ b/src/Billing/Controllers/PayPalController.cs @@ -92,9 +92,15 @@ namespace Bit.Billing.Controllers return new BadRequestResult(); } - if(ipnTransaction.PaymentType == "echeck") + if(ipnTransaction.PaymentStatus == "Refunded" && ipnTransaction.ParentTxnId == null) { - // Not accepting eChecks + // Refunds require parent transaction + return new OkResult(); + } + + if(ipnTransaction.PaymentType == "echeck" && ipnTransaction.PaymentStatus != "Refunded") + { + // Not accepting eChecks, unless it is a refund _logger.LogWarning("Got an eCheck payment. " + ipnTransaction.TxnId); return new OkResult(); }