1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-18 11:38:15 -05:00

more stripe logging

This commit is contained in:
Kyle Spearrin 2019-02-28 20:49:39 -05:00
parent 77b673f768
commit 9916668a7a

View File

@ -94,7 +94,7 @@ namespace Bit.Billing.Controllers
{ {
if(!(parsedEvent.Data.Object is Subscription subscription)) if(!(parsedEvent.Data.Object is Subscription subscription))
{ {
throw new Exception("Subscription is null."); throw new Exception("Subscription is null. " + parsedEvent.Id);
} }
var ids = GetIdsFromMetaData(subscription.Metadata); var ids = GetIdsFromMetaData(subscription.Metadata);
@ -136,14 +136,14 @@ namespace Bit.Billing.Controllers
{ {
if(!(parsedEvent.Data.Object is Invoice invoice)) if(!(parsedEvent.Data.Object is Invoice invoice))
{ {
throw new Exception("Invoice is null."); throw new Exception("Invoice is null. " + parsedEvent.Id);
} }
var subscriptionService = new SubscriptionService(); var subscriptionService = new SubscriptionService();
var subscription = await subscriptionService.GetAsync(invoice.SubscriptionId); var subscription = await subscriptionService.GetAsync(invoice.SubscriptionId);
if(subscription == null) if(subscription == null)
{ {
throw new Exception("Invoice subscription is null."); throw new Exception("Invoice subscription is null. " + invoice.Id);
} }
string email = null; string email = null;
@ -178,7 +178,7 @@ namespace Bit.Billing.Controllers
{ {
if(!(parsedEvent.Data.Object is Charge charge)) if(!(parsedEvent.Data.Object is Charge charge))
{ {
throw new Exception("Charge is null."); throw new Exception("Charge is null. " + parsedEvent.Id);
} }
var chargeTransaction = await _transactionRepository.GetByGatewayIdAsync( var chargeTransaction = await _transactionRepository.GetByGatewayIdAsync(
@ -288,14 +288,14 @@ namespace Bit.Billing.Controllers
{ {
if(!(parsedEvent.Data.Object is Charge charge)) if(!(parsedEvent.Data.Object is Charge charge))
{ {
throw new Exception("Charge is null."); throw new Exception("Charge is null. " + parsedEvent.Id);
} }
var chargeTransaction = await _transactionRepository.GetByGatewayIdAsync( var chargeTransaction = await _transactionRepository.GetByGatewayIdAsync(
GatewayType.Stripe, charge.Id); GatewayType.Stripe, charge.Id);
if(chargeTransaction == null) if(chargeTransaction == null)
{ {
throw new Exception("Cannot find refunded charge."); throw new Exception("Cannot find refunded charge. " + charge.Id);
} }
var amountRefunded = charge.AmountRefunded / 100M; var amountRefunded = charge.AmountRefunded / 100M;
@ -342,7 +342,7 @@ namespace Bit.Billing.Controllers
{ {
if(!(parsedEvent.Data.Object is Invoice invoice)) if(!(parsedEvent.Data.Object is Invoice invoice))
{ {
throw new Exception("Invoice is null."); throw new Exception("Invoice is null. " + parsedEvent.Id);
} }
if(invoice.AttemptCount > 1 && UnpaidAutoChargeInvoiceForSubscriptionCycle(invoice)) if(invoice.AttemptCount > 1 && UnpaidAutoChargeInvoiceForSubscriptionCycle(invoice))
@ -354,7 +354,7 @@ namespace Bit.Billing.Controllers
{ {
if(!(parsedEvent.Data.Object is Invoice invoice)) if(!(parsedEvent.Data.Object is Invoice invoice))
{ {
throw new Exception("Invoice is null."); throw new Exception("Invoice is null. " + parsedEvent.Id);
} }
if(UnpaidAutoChargeInvoiceForSubscriptionCycle(invoice)) if(UnpaidAutoChargeInvoiceForSubscriptionCycle(invoice))