1
0
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:
Kyle Spearrin 2019-02-01 23:29:12 -05:00
parent 4ade9a229b
commit fb3cdba99e
2 changed files with 52 additions and 42 deletions

View File

@ -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();
}

View File

@ -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();
}