mirror of
https://github.com/bitwarden/server.git
synced 2025-02-06 00:11:22 +01:00
check to make sure not already refunded
This commit is contained in:
parent
4ade9a229b
commit
fb3cdba99e
@ -94,6 +94,9 @@ namespace Bit.Billing.Controllers
|
||||
return new BadRequestResult();
|
||||
}
|
||||
|
||||
if(!saleTransaction.Refunded.GetValueOrDefault() &&
|
||||
saleTransaction.RefundedAmount.GetValueOrDefault() < refund.TotalRefundedAmount.ValueAmount)
|
||||
{
|
||||
saleTransaction.RefundedAmount = refund.TotalRefundedAmount.ValueAmount;
|
||||
if(saleTransaction.RefundedAmount == saleTransaction.Amount)
|
||||
{
|
||||
@ -119,6 +122,7 @@ namespace Bit.Billing.Controllers
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new OkResult();
|
||||
}
|
||||
|
@ -237,7 +237,12 @@ namespace Bit.Billing.Controllers
|
||||
throw new Exception("Cannot find refunded charge.");
|
||||
}
|
||||
|
||||
chargeTransaction.RefundedAmount = charge.AmountRefunded / 100M;
|
||||
var amountRefunded = charge.AmountRefunded / 100M;
|
||||
|
||||
if(!chargeTransaction.Refunded.GetValueOrDefault() &&
|
||||
chargeTransaction.RefundedAmount.GetValueOrDefault() < amountRefunded)
|
||||
{
|
||||
chargeTransaction.RefundedAmount = amountRefunded;
|
||||
if(charge.Refunded)
|
||||
{
|
||||
chargeTransaction.Refunded = true;
|
||||
@ -267,6 +272,7 @@ namespace Bit.Billing.Controllers
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
return new OkResult();
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user