Skip to content

Commit

Permalink
fix customer
Browse files Browse the repository at this point in the history
  • Loading branch information
xxl4 committed Dec 20, 2024
1 parent de74446 commit d083f53
Showing 1 changed file with 2 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -136,7 +136,7 @@ public function destroy(int $id)
{
$customer = $this->getRepositoryInstance()->findOrFail($id);

if (! $this->getRepositoryInstance()->haveActiveOrders($customer)) {
if (! $this->getRepositoryInstance()->checkIfCustomerHasOrderPendingOrProcessing($customer)) {
$this->getRepositoryInstance()->delete($id);

return response([
Expand Down Expand Up @@ -187,7 +187,7 @@ public function massDestroy(MassDestroyRequest $massDestroyRequest)
* Ensure that customers do not have any active orders before performing deletion.
*/
foreach ($customers as $customer) {
if ($this->getRepositoryInstance()->haveActiveOrders($customer)) {
if ($this->getRepositoryInstance()->checkIfCustomerHasOrderPendingOrProcessing($customer)) {
throw new \Exception(trans('Apis::app.admin.customers.customers.error.order-pending-account-delete'));
}
}
Expand Down

0 comments on commit d083f53

Please sign in to comment.