1
0
mirror of https://github.com/bitwarden/server.git synced 2025-04-05 13:08:17 -05:00

early return

This commit is contained in:
Kyle Spearrin 2019-02-22 08:20:34 -05:00
parent 4e99ae0dd6
commit c0e9d95538

View File

@ -225,8 +225,11 @@ namespace Bit.Billing.Controllers
{ {
var transaction = await _transactionRepository.GetByGatewayIdAsync( var transaction = await _transactionRepository.GetByGatewayIdAsync(
GatewayType.PayPal, ipnTransaction.TxnId); GatewayType.PayPal, ipnTransaction.TxnId);
if(transaction == null) if(transaction != null)
{ {
return new OkResult();
}
try try
{ {
var tx = new Transaction var tx = new Transaction
@ -274,13 +277,15 @@ namespace Bit.Billing.Controllers
// Catch foreign key violations because user/org could have been deleted. // Catch foreign key violations because user/org could have been deleted.
catch(SqlException e) when(e.Number == 547) { } catch(SqlException e) when(e.Number == 547) { }
} }
}
else if(ipnTransaction.PaymentStatus == "Refunded") else if(ipnTransaction.PaymentStatus == "Refunded")
{ {
var refundTransaction = await _transactionRepository.GetByGatewayIdAsync( var refundTransaction = await _transactionRepository.GetByGatewayIdAsync(
GatewayType.PayPal, ipnTransaction.TxnId); GatewayType.PayPal, ipnTransaction.TxnId);
if(refundTransaction == null) if(refundTransaction != null)
{ {
return new OkResult();
}
var parentTransaction = await _transactionRepository.GetByGatewayIdAsync( var parentTransaction = await _transactionRepository.GetByGatewayIdAsync(
GatewayType.PayPal, ipnTransaction.ParentTxnId); GatewayType.PayPal, ipnTransaction.ParentTxnId);
if(parentTransaction == null) if(parentTransaction == null)
@ -316,7 +321,6 @@ namespace Bit.Billing.Controllers
}); });
} }
} }
}
return new OkResult(); return new OkResult();
} }