| 12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758 | 
							- <?php
 - 
 - 
 - namespace MirfalahTech\Laravel\Payment\Gateway\DummyPay;
 - 
 - 
 - use Illuminate\Http\Request;
 - use Illuminate\Support\Facades\Response as Res;
 - use MirfalahTech\Laravel\Payment\Contracts\PayableEntity;
 - use MirfalahTech\Laravel\Payment\Contracts\PaymentGatewayDriver;
 - use Symfony\Component\HttpFoundation\Response;
 - 
 - class DummyPayDriver implements PaymentGatewayDriver
 - {
 -     /**
 -      * @var string
 -      */
 -     protected $callback_url;
 - 
 -     /**
 -      * @var string
 -      */
 -     protected $return_url;
 - 
 -     public function __construct(string $callback_url, string $return_url){
 -         $this->callback_url = rtrim($callback_url, '/');
 -         $this->return_url = rtrim($return_url, '/');
 -     }
 - 
 -     public function createPaymentURL(PayableEntity $payable, array $options = []): string
 -     {
 -         $order_id = $payable->getBillId();
 -         return "$this->callback_url?'".http_build_query(compact('order_id'));
 -     }
 - 
 -     public function verifyGatewayReturn(Request $request): bool
 -     {
 -         return true;
 -     }
 - 
 -     public function verifyGatewayCallback(Request $request, Response &$response = null): bool
 -     {
 -         if($request->query->has('status')){
 -             Res::redirectTo($this->return_url);
 -             return $request->query->get('status') == 'success';
 -         } else {
 -             $order_id = $request->query->get('order_id');
 -             /** @noinspection HtmlUnknownTarget */
 -             $html = sprintf(
 -                 '<a href="%s">Click Here for Positive Response</a><br/><br/><a href="%s">Click Here for Negative Response</a>',
 -                 $this->callback_url.'?'.http_build_query(['order_id' => $order_id, 'status' => 'success']),
 -                 $this->callback_url.'?'.http_build_query(['order_id' => $order_id, 'status' => 'failed'])
 -             );
 -             Res::make($html);
 -             return false;
 -         }
 -     }
 - }
 
 
  |