From b028696891ef053f018aed2552c11b95010f7673 Mon Sep 17 00:00:00 2001 From: Kyle Spearrin Date: Sat, 23 Feb 2019 20:24:34 -0500 Subject: [PATCH] assign credit type for account credit --- src/Billing/Controllers/BitPayController.cs | 2 +- src/Billing/Controllers/PayPalController.cs | 5 +++-- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/src/Billing/Controllers/BitPayController.cs b/src/Billing/Controllers/BitPayController.cs index 60c9b4503f..f8a5fbafe2 100644 --- a/src/Billing/Controllers/BitPayController.cs +++ b/src/Billing/Controllers/BitPayController.cs @@ -108,7 +108,7 @@ namespace Bit.Billing.Controllers CreationDate = GetTransactionDate(invoice), OrganizationId = ids.Item1, UserId = ids.Item2, - Type = TransactionType.Charge, + Type = TransactionType.Credit, Gateway = GatewayType.BitPay, GatewayId = invoice.Id, PaymentMethodType = PaymentMethodType.BitPay, diff --git a/src/Billing/Controllers/PayPalController.cs b/src/Billing/Controllers/PayPalController.cs index 042d9319e4..78008b2b60 100644 --- a/src/Billing/Controllers/PayPalController.cs +++ b/src/Billing/Controllers/PayPalController.cs @@ -226,7 +226,8 @@ namespace Bit.Billing.Controllers return new OkResult(); } - if(!ipnTransaction.IsAccountCredit()) + var isAccountCredit = ipnTransaction.IsAccountCredit(); + if(!isAccountCredit) { // Only processing credits via IPN for now return new OkResult(); @@ -250,7 +251,7 @@ namespace Bit.Billing.Controllers CreationDate = ipnTransaction.PaymentDate, OrganizationId = ids.Item1, UserId = ids.Item2, - Type = TransactionType.Charge, + Type = isAccountCredit ? TransactionType.Credit : TransactionType.Charge, Gateway = GatewayType.PayPal, GatewayId = ipnTransaction.TxnId, PaymentMethodType = PaymentMethodType.PayPal,