Skip to content

Commit

Permalink
example.
Browse files Browse the repository at this point in the history
  • Loading branch information
Saifallak committed May 27, 2024
1 parent f29b8da commit b446e62
Showing 1 changed file with 8 additions and 1 deletion.
9 changes: 8 additions & 1 deletion src/Controllers/DummyController.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use Illuminate\Http\Request;
use ctf0\PayMob\Facades\PayMob;
use ctf0\PayMob\Integrations\CreditCard;
use ctf0\PayMob\Integrations\MobileWallet;
use Illuminate\Http\Client\RequestException;

class DummyController extends Controller
Expand Down Expand Up @@ -36,7 +37,13 @@ public function process(Request $request)
$total = 0; // order total

try {
return (new CreditCard($user))->checkOut($total); // or MobileWallet, etc..
if ($payment_type == 'card_payment') {
return (new CreditCard($user))->checkOut($total)['url'] ?? '';
} else if ($payment_type == 'mobile_wallet') {
return (new MobileWallet($user))->checkOut($total)['url'] ?? '';
} else {
abort(403, __('Method not supported')); // // or MobileWallet, etc..
}
} catch (RequestException $e) {
return __('something went wrong, please try again later');
}
Expand Down

0 comments on commit b446e62

Please sign in to comment.