-
-
Notifications
You must be signed in to change notification settings - Fork 58
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
4 changed files
with
52 additions
and
60 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,48 @@ | ||
<?php | ||
|
||
namespace Cone\Bazar\Gateway; | ||
|
||
use Cone\Bazar\Models\Order; | ||
use Cone\Bazar\Models\Transaction; | ||
use Exception; | ||
use Illuminate\Http\Request; | ||
|
||
class ManualDriver extends Driver | ||
{ | ||
/** | ||
* The driver name. | ||
*/ | ||
protected string $name = 'manual'; | ||
|
||
/** | ||
* Process the payment. | ||
*/ | ||
public function pay(Order $order, ?float $amount = null, array $attributes = []): Transaction | ||
{ | ||
$transaction = parent::pay($order, $amount, $attributes); | ||
|
||
$transaction->markAsCompleted(); | ||
|
||
return $transaction; | ||
} | ||
|
||
/** | ||
* Process the refund. | ||
*/ | ||
public function refund(Order $order, ?float $amount = null, array $attributes = []): Transaction | ||
{ | ||
$transaction = parent::refund($order, $amount, $attributes); | ||
|
||
$transaction->markAsCompleted(); | ||
|
||
return $transaction; | ||
} | ||
|
||
/** | ||
* Handle the notification request. | ||
*/ | ||
public function handleNotification(Request $request): Response | ||
{ | ||
throw new Exception('This payment gateway does not support payment notifications.'); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters