missing conditions adeded

This commit is contained in:
rahul shukla 2021-02-04 17:05:32 +05:30
parent 27c0a4f8ee
commit 765cd5dab6
2 changed files with 3 additions and 2 deletions

View File

@ -107,6 +107,7 @@ class DownloadableLinkPurchasedRepository extends Repository
}
$this->update([
'status' => $purchasedLink->download_used == $totalInvoiceQty ? $status : $purchasedLink->status,
'download_canceled' => $purchasedLink->download_bought - $totalInvoiceQty,
], $purchasedLink->id);
} else {

View File

@ -72,14 +72,14 @@ class DownloadableProductController extends Controller
}
if ($downloadableLinkPurchased->download_bought
&& ($downloadableLinkPurchased->download_bought - $downloadableLinkPurchased->download_used) <= 0) {
&& ($downloadableLinkPurchased->download_bought - ($downloadableLinkPurchased->download_used + $downloadableLinkPurchased->download_canceled)) <= 0) {
session()->flash('warning', trans('shop::app.customer.account.downloadable_products.download-error'));
return redirect()->route('customer.downloadable_products.index');
}
$remainingDownloads = $downloadableLinkPurchased->download_bought - ($downloadableLinkPurchased->download_used + 1);
$remainingDownloads = $downloadableLinkPurchased->download_bought - ($downloadableLinkPurchased->download_used + $downloadableLinkPurchased->download_canceled + 1);
if ($downloadableLinkPurchased->download_bought) {
$this->downloadableLinkPurchasedRepository->update([