Check order status on demand
All checks were successful
continuous-integration/drone/push Build is passing

This commit is contained in:
Kieran 2023-05-30 11:34:32 +01:00
parent bfc133bdc9
commit 79f6bcc37f
Signed by: Kieran
GPG Key ID: DE71CEB3925BE941

View File

@ -181,6 +181,20 @@ public class DownloadController : Controller
if (order?.Status == PaywallOrderStatus.Paid)
{
return true;
}
if (order?.Status is PaywallOrderStatus.Unpaid)
{
// check status
var svc = await _paymentFactory.CreateProvider(order.Service);
var status = await svc.GetOrderStatus(order.Id);
if (status != default && status.Status != order.Status)
{
await _paymentOrders.UpdateStatus(order.Id, status.Status);
}
if (status?.Status == PaywallOrderStatus.Paid)
{
return true;
}
}
}