Skip to content

Commit

Permalink
Merge pull request #9 from coralsio/fix-update-payment-module-issue
Browse files Browse the repository at this point in the history
fix update payment module issue when catch an exception
  • Loading branch information
saeed-corals authored Dec 18, 2023
2 parents f0bbb3b + e671b98 commit e7fe9d2
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions src/PaymentServiceProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@
use Corals\Settings\Facades\Modules;
use Corals\User\Communication\Facades\CoralsNotification;
use Illuminate\Foundation\AliasLoader;
use Illuminate\Support\Facades\DB;

class PaymentServiceProvider extends BasePackageServiceProvider
{
Expand Down Expand Up @@ -93,9 +94,11 @@ public function bootPackage()
$this->addEvents();
} catch (\Exception $exception) {
if (isset($payment_module)) {
$payment_module->enabled = 0;
$payment_module->notes = $exception->getMessage();
$payment_module->save();
\DB::table('modules')->where('code', $payment_module->code)
->update([
'enabled' => 0,
'notes' => $exception->getMessage()
]);
flash(trans(
'Payment::exception.payment_service.error_load_module',
['code' => $payment_module->code]
Expand Down

0 comments on commit e7fe9d2

Please sign in to comment.