Skip to content

Commit

Permalink
examples - improved examples
Browse files Browse the repository at this point in the history
  • Loading branch information
nuryagdym committed Dec 16, 2023
1 parent e3771f3 commit bb4f04a
Show file tree
Hide file tree
Showing 6 changed files with 23 additions and 19 deletions.
4 changes: 3 additions & 1 deletion config/pos_production.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

/**
* NOT! Bu dosya örnek amaçlıdır. Canlı ortamda kopyasını oluşturup, kopyasını kullanınız!
*/
return [
'banks' => [
'akbankv3' => [
Expand Down
13 changes: 6 additions & 7 deletions examples/_common-codes/3d/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,15 +30,14 @@
$request->get('lang', PosInterface::LANG_TR)
);
$session->set('order', $order);
$session->set('tx', $transaction);

$card = createCard($pos, $request->request->all());

/**
* PayFlex'te provizyonu (odemeyi) tamamlamak icin tekrar kredi kart bilgileri isteniyor,
* bu yuzden kart bilgileri kaydediyoruz
*/
$session->set('card', $request->request->all());
$session->set('tx', $transaction);
if (get_class($pos) === \Mews\Pos\Gateways\PayFlexV4Pos::class) {
// bu gateway için ödemeyi tamamlarken tekrar kart bilgisi lazım olacak.
$session->set('card', $request->request->all());
}

try {

Expand All @@ -53,7 +52,7 @@
* $event->setRequestData($data);
* }
*
* Bu asamada bu Event sadece PosNet, PayFlexCPV4Pos, PayFlexV4Pos, KuveytPos gatewayler'de trigger edilir.
* Bu asamada bu Event sadece PosNet, PayFlexCPV4Pos, PayFlexV4Pos, KuveytPos, AkOde gatewayler'de trigger edilir.
*/
});

Expand Down
8 changes: 7 additions & 1 deletion examples/_main_config.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,13 @@ function createCard(PosInterface $pos, array $card): \Mews\Pos\Entity\Card\Credi
$card['name'],
$card['type'] ?? null
);
} catch (Exception $e) {
} catch (\Mews\Pos\Exceptions\CardTypeRequiredException $e) {
// bu gateway için kart tipi zorunlu
dd($e);
} catch (\Mews\Pos\Exceptions\CardTypeNotSupportedException $e) {
// sağlanan kart tipi bu gateway tarafından desteklenmiyor
dd($e);
} catch (\Exception $e) {
dd($e);
}
}
Expand Down
5 changes: 5 additions & 0 deletions examples/_templates/_payment_response.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,11 @@
* }
* });*/

if (get_class($pos) === \Mews\Pos\Gateways\PayFlexV4Pos::class) {
// bu gateway için ödemeyi tamamlarken tekrar kart bilgisi lazım.
$savedCard = $session->get('card');
$card = createCard($pos, $savedCard);
}
doPayment($pos, $paymentModel, $transaction, $order, $card);
} catch (HashMismatchException $e) {
dd($e);
Expand Down
6 changes: 1 addition & 5 deletions examples/payflex-cp-v4/3d-pay/response.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php

require './_config.php';

$savedCard = $session->get('card');
$card = createCard($pos, $savedCard);

$card = null;
require '../../_templates/_payment_response.php';
6 changes: 1 addition & 5 deletions examples/payflex-mpi-v4/3d/response.php
Original file line number Diff line number Diff line change
@@ -1,8 +1,4 @@
<?php

require './_config.php';

$savedCard = $session->get('card');
$card = createCard($pos, $savedCard);

$card = null;
require '../../_templates/_payment_response.php';

0 comments on commit bb4f04a

Please sign in to comment.