Skip to content

Commit

Permalink
Merge pull request #114 from mewebstudio/rector-integration
Browse files Browse the repository at this point in the history
Rector and Vakifbank common payment integration
  • Loading branch information
nuryagdym authored Mar 13, 2023
2 parents 118645c + 9ba7062 commit 76431a6
Show file tree
Hide file tree
Showing 149 changed files with 3,252 additions and 999 deletions.
File renamed without changes.
2 changes: 2 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,8 @@ Bu paket ile amaçlanan; ortak bir arayüz sınıfı ile, tüm Türk banka sanal

- **VakifBank GET 7/24 MPI ve VPOS 7/24** 3D Secure ödemesi çalışır durumda, diğer işlemlerde sorunlar ortaya çıktıkça giderilecek.

- **VakifBank Common Payment (Ortak Ödeme)** 3DPay ve 3DHost ödeme desteği eklendi.

- **InterPOS (Deniz bank)** destegi eklenmiştir, test edildikçe, sorunlar bulundukça hatalar giderilecek.

- **Kuveyt POS** 3d secure ödeme desteği eklenmiştir - testleri yapıldı, calışıyor.
Expand Down
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,8 @@
"php-http/curl-client": "^2.2",
"phpstan/phpstan": "^1.9",
"phpstan/phpstan-strict-rules": "^1.4",
"phpunit/phpunit": "^8.3",
"phpunit/phpunit": "^8.5",
"rector/rector": "^0.15.12",
"slim/psr7": "^1.4",
"squizlabs/php_codesniffer": "^3.5",
"symfony/var-dumper": "^5.1"
Expand Down
20 changes: 18 additions & 2 deletions config/pos.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,8 @@
return [
//if you need to use custom keys for currency mapping, otherwise leave empty
'currencies' => [
// 'TRY' => 949,
// 'USD' => 840,
// 'TRY' => '949',
// 'USD' => '840',
],
// Banks
'banks' => [
Expand Down Expand Up @@ -160,6 +160,22 @@
],
],
],
'vakifbank-cp' => [
'name' => 'VakifBank-POS-Common-Payment',
'class' => Mews\Pos\Gateways\VakifBankCPPos::class,
'urls' => [
'production' => 'https://cpweb.vakifbank.com.tr/CommonPayment/api/RegisterTransaction',
'test' => 'https://cptest.vakifbank.com.tr/CommonPayment/api/RegisterTransaction',
'gateway' => [
'production' => 'https://cpweb.vakifbank.com.tr/CommonPayment/SecurePayment',
'test' => 'https://cptest.vakifbank.com.tr/CommonPayment/SecurePayment',
],
'query' => [
'production' => 'https://cpweb.vakifbank.com.tr/CommonPayment/api/VposTransaction',
'test' => 'https://cptest.vakifbank.com.tr/CommonPayment/api/VposTransaction',
],
],
],
'denizbank' => [
'name' => 'DenizBank-InterPos',
'class' => Mews\Pos\Gateways\InterPos::class,
Expand Down
15 changes: 15 additions & 0 deletions docs/CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,20 @@
# Changelog

## [0.12.0] - 2023-03-13
### New Features
- Vakıfbank Common Payment (Ortak Ödeme) gateway desteği eklendi (`VakifBankCPPos`).
Sadece **3DPay** ve **3DHost** ödeme destekleri eklendi.
Örnek kodlar `examples/vakifbank-cp/` altında yer almaktadır.

### Changed
- **EstPos** - `MODEL_3D_PAY_HOSTING` desteği eklendi @umuttaymaz.
- `get3DFormData()` - artık zorunlu _kart_ veya _sipariş_ bilgileri olmadan çağrıldığında istisna fırlatır.
- `get3DFormData()` - dönen değere HTTP methodu eklendi. Örn: `'method' => 'POST'` (ya da GET);

### Fixed
- **Vakifbank** - bazı _undefined index_ hatalar giderildi.
- `VakifBankPosRequestDataMapper` - `OrderDescription` tanımsız olma durumu giderildi.

## [0.11.0] - 2023-01-08
### Changed
- Response formatı **object** yerine artık **array** olarak değiştirildi, `$pos->getResponse();` kod artık array döner.
Expand Down
6 changes: 3 additions & 3 deletions examples/_common-codes/3d-host/index.php
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?php

require '_config.php';
require '../../template/_header.php';
require '../../_templates/_header.php';

$order = getNewOrder(
$baseUrl,
Expand All @@ -18,5 +18,5 @@

$formData = $pos->get3DFormData();

require '../../template/_redirect_form.php';
require '../../template/_footer.php';
require '../../_templates/_redirect_form.php';
require '../../_templates/_footer.php';
6 changes: 3 additions & 3 deletions examples/_common-codes/3d/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
use Symfony\Component\HttpFoundation\RedirectResponse;

require '_config.php';
require '../../template/_header.php';
require '../../_templates/_header.php';

if ($request->getMethod() !== 'POST') {
echo new RedirectResponse($baseUrl.'index.php');
Expand Down Expand Up @@ -38,5 +38,5 @@
}


require '../../template/_redirect_form.php';
require '../../template/_footer.php';
require '../../_templates/_redirect_form.php';
require '../../_templates/_footer.php';
6 changes: 3 additions & 3 deletions examples/_common-codes/3d/index.php
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
<?php

require '_config.php';
require '../../template/_header.php';
require '../../_templates/_header.php';

$url = $baseUrl.'form.php';
$card = createCard($pos, $testCards['visa1']);

require '../../template/_credit_card_form.php';
require '../../template/_footer.php';
require '../../_templates/_credit_card_form.php';
require '../../_templates/_footer.php';
2 changes: 1 addition & 1 deletion examples/_common-codes/regular/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,4 +16,4 @@

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

require '../../template/_payment_response.php';
require '../../_templates/_payment_response.php';
File renamed without changes.
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
</div>
</div>
</div>

<script src="https://code.jquery.com/jquery-3.3.1.min.js" integrity="sha256-FgpCb/KJQlLNfOu91ta32o/NMZxltwRo8QtmkMRdAu8=" crossorigin="anonymous"></script>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,8 @@
<li> <a href="<?= $hostUrl ?>/finansbank-payfor/index.php">PayFor (Finansbank)</a></li>
<li> <a href="<?= $hostUrl ?>/garanti/index.php">Garanti POS</a></li>
<li> <a href="<?= $hostUrl ?>/interpos/index.php">InterPos (Deniz bank)</a></li>
<li> <a href="<?= $hostUrl ?>/vakifbank/index.php">VPOS (VakifBank bank)</a></li>
<li> <a href="<?= $hostUrl ?>/vakifbank/index.php">VPOS 7/24 (VakifBank)</a></li>
<li> <a href="<?= $hostUrl ?>/vakifbank-cp/index.php">Common Payment (VakifBank)</a></li>
<li> <a href="<?= $hostUrl ?>/ykb/index.php">PosNet (YKB)</a></li>
<li> <a href="<?= $hostUrl ?>/kuveytpos/index.php">KuveytPOS</a></li>
</ul>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,10 @@
require_once '_config.php';
require '../../template/_header.php';

if ($request->getMethod() !== 'POST' && AbstractGateway::TX_POST_PAY !== $transaction) {
if (($request->getMethod() !== 'POST' && AbstractGateway::TX_POST_PAY !== $transaction)
// Vakifbank-CP GET request ile cevapliyor
&& ($request->getMethod() === 'GET' && [] === $request->query->all())
) {
echo new RedirectResponse($baseUrl);
exit();
}
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<form method="post" action="<?= $formData['gateway']; ?>" class="redirect-form" role="form">
<form method="<?= $formData['method']; ?>" action="<?= $formData['gateway']; ?>" class="redirect-form" role="form">
<?php foreach ($formData['inputs'] as $key => $value) : ?>
<input type="hidden" name="<?= $key; ?>" value="<?= $value; ?>">
<?php endforeach; ?>
Expand Down
File renamed without changes.
2 changes: 1 addition & 1 deletion examples/akbank/3d-host/response.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

$card = null;
require '../../template/_payment_response.php';
require '../../_templates/_payment_response.php';
2 changes: 1 addition & 1 deletion examples/akbank/3d-pay-hosting/response.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

$card = null;
require '../../template/_payment_response.php';
require '../../_templates/_payment_response.php';
2 changes: 1 addition & 1 deletion examples/akbank/3d-pay/response.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

$card = null;
require '../../template/_payment_response.php';
require '../../_templates/_payment_response.php';
2 changes: 1 addition & 1 deletion examples/akbank/3d/response.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

$card = null;
require '../../template/_payment_response.php';
require '../../_templates/_payment_response.php';
4 changes: 2 additions & 2 deletions examples/akbank/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

$templateTitle = 'EST POS';
require './_payment_config.php';
require '../template/_header.php';
require '../template/_footer.php';
require '../_templates/_header.php';
require '../_templates/_footer.php';
8 changes: 4 additions & 4 deletions examples/akbank/regular/cancel.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

$templateTitle = 'Cancel Order';
require '_config.php';
require '../../template/_header.php';
require '../../_templates/_header.php';

$ord = $session->get('order') ? $session->get('order') : getNewOrder($baseUrl, $ip, $request->get('currency', 'TRY'), $session);
$ord = $session->get('order') ?: getNewOrder($baseUrl, $ip, $request->get('currency', 'TRY'), $session);

if (isset($ord['recurringFrequency'])) {
//tekrarlanan odemenin durumunu sorgulamak icin:
Expand All @@ -29,5 +29,5 @@
$pos->cancel();

$response = $pos->getResponse();
require '../../template/_simple_response_dump.php';
require '../../template/_footer.php';
require '../../_templates/_simple_response_dump.php';
require '../../_templates/_footer.php';
6 changes: 3 additions & 3 deletions examples/akbank/regular/history.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$templateTitle = 'History Order';

require '_config.php';
require '../../template/_header.php';
require '../../_templates/_header.php';

$ord = $session->get('order');

Expand All @@ -16,5 +16,5 @@
$query = $pos->history($order);

$response = $query->getResponse();
require '../../template/_simple_response_dump.php';
require '../../template/_footer.php';
require '../../_templates/_simple_response_dump.php';
require '../../_templates/_footer.php';
4 changes: 2 additions & 2 deletions examples/akbank/regular/post-auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

$templateTitle = 'Post Auth Order (ön provizyonu tamamlama)';

$ord = $session->get('order') ? $session->get('order') : getNewOrder($baseUrl, $ip, $request->get('currency', 'TRY'), $session);
$ord = $session->get('order') ?: getNewOrder($baseUrl, $ip, $request->get('currency', 'TRY'), $session);

$order = [
'id' => $ord['id'],
Expand All @@ -14,4 +14,4 @@
$transaction = \Mews\Pos\Gateways\AbstractGateway::TX_POST_PAY;
$card = null;

require '../../template/_payment_response.php';
require '../../_templates/_payment_response.php';
8 changes: 4 additions & 4 deletions examples/akbank/regular/refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,9 +4,9 @@

$templateTitle = 'Refund Order';
require '_config.php';
require '../../template/_header.php';
require '../../_templates/_header.php';

$ord = $session->get('order') ? $session->get('order') : getNewOrder($baseUrl, $ip, $request->get('currency', 'TRY'), $session);
$ord = $session->get('order') ?: getNewOrder($baseUrl, $ip, $request->get('currency', 'TRY'), $session);

// Refund Order
$order = [
Expand All @@ -21,5 +21,5 @@

$response = $pos->getResponse();

require '../../template/_simple_response_dump.php';
require '../../template/_footer.php';
require '../../_templates/_simple_response_dump.php';
require '../../_templates/_footer.php';
6 changes: 3 additions & 3 deletions examples/akbank/regular/status.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@

$templateTitle = 'Order Status';
require '_config.php';
require '../../template/_header.php';
require '../../_templates/_header.php';

$ord = $session->get('order');
$lastResponse = $session->get('last_response');
Expand All @@ -28,5 +28,5 @@
$pos->status();

$response = $pos->getResponse();
require '../../template/_simple_response_dump.php';
require '../../template/_footer.php';
require '../../_templates/_simple_response_dump.php';
require '../../_templates/_footer.php';
2 changes: 1 addition & 1 deletion examples/finansbank-payfor/3d-host/response.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

$card = null;
require '../../template/_payment_response.php';
require '../../_templates/_payment_response.php';
2 changes: 1 addition & 1 deletion examples/finansbank-payfor/3d-pay/response.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

$card = null;
require '../../template/_payment_response.php';
require '../../_templates/_payment_response.php';
2 changes: 1 addition & 1 deletion examples/finansbank-payfor/3d/response.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<?php

$card = null;
require '../../template/_payment_response.php';
require '../../_templates/_payment_response.php';
4 changes: 2 additions & 2 deletions examples/finansbank-payfor/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,5 @@

$templateTitle = 'PayFor (Finansbank)';
require './_payment_config.php';
require '../template/_header.php';
require '../template/_footer.php';
require '../_templates/_header.php';
require '../_templates/_footer.php';
8 changes: 4 additions & 4 deletions examples/finansbank-payfor/regular/cancel.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

$templateTitle = 'Cancel Order';
require '_config.php';
require '../../template/_header.php';
require '../../_templates/_header.php';

use Mews\Pos\Gateways\AbstractGateway;

$ord = $session->get('order') ? $session->get('order') : getNewOrder($baseUrl, $ip, $request->get('currency', 'TRY'), $session);
$ord = $session->get('order') ?: getNewOrder($baseUrl, $ip, $request->get('currency', 'TRY'), $session);

$order = [
'id' => $ord['id'],
Expand All @@ -21,5 +21,5 @@

$response = $pos->getResponse();

require '../../template/_simple_response_dump.php';
require '../../template/_footer.php';
require '../../_templates/_simple_response_dump.php';
require '../../_templates/_footer.php';
6 changes: 3 additions & 3 deletions examples/finansbank-payfor/regular/history.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
$templateTitle = 'History Order';

require '_config.php';
require '../../template/_header.php';
require '../../_templates/_header.php';

$ord = $session->get('order');

Expand All @@ -20,5 +20,5 @@

$response = $query->getResponse();

require '../../template/_simple_response_dump.php';
require '../../template/_footer.php';
require '../../_templates/_simple_response_dump.php';
require '../../_templates/_footer.php';
4 changes: 2 additions & 2 deletions examples/finansbank-payfor/regular/post-auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,10 +4,10 @@

$templateTitle = 'Post Auth Order (ön provizyonu tamamlama)';

$order = $session->get('order') ? $session->get('order') : getNewOrder($baseUrl, $ip, $request->get('currency', 'TRY'), $session);
$order = $session->get('order') ?: getNewOrder($baseUrl, $ip, $request->get('currency', 'TRY'), $session);

$session->set('post_order', $order);
$transaction = \Mews\Pos\Gateways\AbstractGateway::TX_POST_PAY;
$card = null;

require '../../template/_payment_response.php';
require '../../_templates/_payment_response.php';
8 changes: 4 additions & 4 deletions examples/finansbank-payfor/regular/refund.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

$templateTitle = 'Refund Order';
require '_config.php';
require '../../template/_header.php';
require '../../_templates/_header.php';

use Mews\Pos\Gateways\AbstractGateway;

$ord = $session->get('order') ? $session->get('order') : getNewOrder($baseUrl, $ip, $request->get('currency', 'TRY'), $session);
$ord = $session->get('order') ?: getNewOrder($baseUrl, $ip, $request->get('currency', 'TRY'), $session);

// Refund Order
$order = [
Expand All @@ -21,5 +21,5 @@

$response = $pos->getResponse();

require '../../template/_simple_response_dump.php';
require '../../template/_footer.php';
require '../../_templates/_simple_response_dump.php';
require '../../_templates/_footer.php';
Loading

0 comments on commit 76431a6

Please sign in to comment.