forked from mewebstudio/pos
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request mewebstudio#65 from nuryagdym/interpos-integration
Interpos integration and many other fixes, improvements
- Loading branch information
Showing
149 changed files
with
3,404 additions
and
3,986 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -3,6 +3,7 @@ | |
Bu paket ile amaçlanan; ortak bir arayüz sınıfı ile, tüm Türk banka sanal pos sistemlerinin kullanılabilmesidir. | ||
|
||
- **EST POS** altyapısı tam olarak test edilmiş ve kullanıma hazırdır. Akbank, TEB ve Ziraat bankası test edilmiştir. | ||
|
||
- **Garanti Virtual POS** ödeme sistemi çalışmaktadır, fakat 3D ödeme kısmının üretim ortamında test edilmesi gerekiyor. | ||
|
||
- **YapıKredi PosNet** sistemi 3D ödeme çalışmaktadır, fakat `cancel`, `refund` işlemleri test edilmedi. | ||
|
@@ -11,6 +12,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. | ||
|
||
- **InterPOS (Deniz bank)** destegi eklenmistir, test edildikce, sorunlari bulundukca hatalar giderilecek. | ||
|
||
### Özellikler | ||
- Standart E-Commerce modeliyle ödeme (model => `regular`) | ||
- 3D Secure modeliyle ödeme (model => `3d`) | ||
|
@@ -84,7 +87,7 @@ $order = [ | |
'name' => 'John Doe', // zorunlu değil | ||
'email' => '[email protected]', // zorunlu değil | ||
'user_id' => '12', // zorunlu değil | ||
'amount' => (float) 20, // Sipariş tutarı | ||
'amount' => 20.0, // Sipariş tutarı | ||
'installment' => '0', | ||
'currency' => 'TRY', | ||
'ip' => $ip, | ||
|
@@ -173,6 +176,15 @@ $pos = \Mews\Pos\Factory\PosFactory::createPosGateway($account, $yeni_ayarlar); | |
### Örnek Kodlar | ||
`./pos/examples` dizini içerisinde. | ||
|
||
3D ödeme örnek kodlar genel olarak kart bilgilerini website sunucusuna POST eder (`index.php` => `form.php`), | ||
ondan sonra da işlenip gateway'e yönlendiriliyor. | ||
Bu şekilde farklı bankalar arası implementation degişmemesi sağlanmakta (ortak kredi kart formu ve aynı işlem akışı). | ||
Genel olarak kart bilgilerini, website sunucusuna POST yapmadan, | ||
direk gateway'e yönlendirecek şekilde kullanılabilinir (genelde, banka örnek kodları bu şekilde implement edilmiş). | ||
Fakat, | ||
- birden fazla bank seçenegi olunca veya müşteri banka degiştirmek istediginde kart bilgi formunu ona göre güncellemeniz gerekecek. | ||
- üstelik YKB POSNet ve VakıfBank POS kart bilgilerini website sunucusu tarafından POST edilmesini gerektiriyor. | ||
|
||
### Docker ile test ortamı | ||
Makinenizde Docker kurulu olmasi gerekiyor. | ||
Projenin root klasöründe `docker-compose up` komutu çalıştırmanız yeterli. | ||
|
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
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 |
---|---|---|
@@ -1,22 +1,20 @@ | ||
<?php | ||
|
||
require '../../_main_config.php'; | ||
require '../_payment_config.php'; | ||
|
||
$path = '/akbank/3d-host/'; | ||
$baseUrl = $hostUrl.$path; | ||
$baseUrl = $bankTestsUrl.'/3d-host/'; | ||
|
||
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals(); | ||
$ip = $request->getClientIp(); | ||
$account = \Mews\Pos\Factory\AccountFactory::createEstPosAccount( | ||
'akbank', | ||
'XXXXXXX', | ||
'XXXXXXX', | ||
'', | ||
\Mews\Pos\Gateways\AbstractGateway::MODEL_3D_HOST, | ||
'XXXXXXX' | ||
); | ||
|
||
$account = \Mews\Pos\Factory\AccountFactory::createEstPosAccount('akbank', 'XXXXXXX', 'XXXXXXX', '', '3d_host', 'XXXXXXX'); | ||
$pos = getGateway($account); | ||
|
||
try { | ||
$pos = \Mews\Pos\Factory\PosFactory::createPosGateway($account); | ||
$pos->setTestMode(true); | ||
} catch (\Mews\Pos\Exceptions\BankNotFoundException $e) { | ||
dump($e->getCode(), $e->getMessage()); | ||
} catch (\Mews\Pos\Exceptions\BankClassNullException $e) { | ||
dump($e->getCode(), $e->getMessage()); | ||
} | ||
$transaction = \Mews\Pos\Gateways\AbstractGateway::TX_PAY; | ||
|
||
$templateTitle = '3D Host Model Payment'; |
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 |
---|---|---|
@@ -1,54 +1,14 @@ | ||
<?php | ||
|
||
use Mews\Pos\Entity\Card\CreditCardEstPos; | ||
use Mews\Pos\Gateways\AbstractGateway; | ||
use Mews\Pos\Gateways\EstPos; | ||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
|
||
require '_config.php'; | ||
|
||
require '../../template/_header.php'; | ||
|
||
$orderId = date('Ymd').strtoupper(substr(uniqid(sha1(time())), 0, 4)); | ||
|
||
$amount = (float) 32.0; | ||
$installment = '0'; | ||
|
||
$successUrl = $baseUrl.'response.php'; | ||
$failUrl = $baseUrl.'response.php'; | ||
$order = getNewOrder($baseUrl, $ip); | ||
$session->set('order', $order); | ||
|
||
$rand = microtime(); | ||
|
||
$order = [ | ||
'id' => $orderId, | ||
'email' => '[email protected]', // optional | ||
'name' => 'John Doe', // optional | ||
'amount' => $amount, | ||
'installment' => $installment, | ||
'currency' => 'TRY', | ||
'ip' => $ip, | ||
'success_url' => $successUrl, | ||
'fail_url' => $failUrl, | ||
'lang' => EstPos::LANG_TR, | ||
'rand' => $rand, | ||
]; | ||
|
||
$redis->lPush('order', json_encode($order)); | ||
|
||
$pos->prepare($order, AbstractGateway::TX_PAY); | ||
$pos->prepare($order, $transaction); | ||
|
||
$formData = $pos->get3DFormData(); | ||
?> | ||
|
||
<form method="post" action="<?= $formData['gateway']; ?>" class="redirect-form" role="form"> | ||
<?php foreach ($formData['inputs'] as $key => $value) : ?> | ||
<input type="hidden" name="<?= $key; ?>" value="<?= $value; ?>"> | ||
<?php endforeach; ?> | ||
<div class="text-center">Redirecting...</div> | ||
<hr> | ||
<div class="form-group text-center"> | ||
<button type="submit" class="btn btn-lg btn-block btn-success">Submit</button> | ||
</div> | ||
</form> | ||
|
||
<?php require '../../template/_footer.php'; | ||
require '../../template/_redirect_form.php'; | ||
require '../../template/_footer.php'; |
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 |
---|---|---|
@@ -1,109 +1,4 @@ | ||
<?php | ||
|
||
use Mews\Pos\Gateways\AbstractGateway; | ||
use Symfony\Component\HttpFoundation\RedirectResponse; | ||
|
||
require '_config.php'; | ||
|
||
require '../../template/_header.php'; | ||
|
||
if ($request->getMethod() !== 'POST') { | ||
echo new RedirectResponse($baseUrl); | ||
exit(); | ||
} | ||
|
||
$order = (array) json_decode($redis->lPop('order')); | ||
|
||
$pos->prepare($order, AbstractGateway::TX_PAY); | ||
$payment = $pos->payment(); | ||
$response = $payment->getResponse(); | ||
?> | ||
|
||
<div class="result"> | ||
<h3 class="text-center text-<?= $pos->isSuccess() ? 'success' : 'danger'; ?>"> | ||
<?= $pos->isSuccess() ? 'Payment is successful!' : 'Payment is not successful'; ?> | ||
</h3> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Response:</dt> | ||
<dd class="col-sm-9"><?= $response->response; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Status:</dt> | ||
<dd class="col-sm-9"><?= $response->status; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Transaction:</dt> | ||
<dd class="col-sm-9"><?= $response->transaction; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Transaction Type:</dt> | ||
<dd class="col-sm-9"><?= $response->transaction_type; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Transaction Security:</dt> | ||
<dd class="col-sm-9"><?= $response->transaction_security; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Hash:</dt> | ||
<dd class="col-sm-9"><?= $response->hash; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Order ID:</dt> | ||
<dd class="col-sm-9"><?= $response->order_id ? $response->order_id : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">AuthCode:</dt> | ||
<dd class="col-sm-9"><?= $response->auth_code ? $response->auth_code : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">HostRefNum:</dt> | ||
<dd class="col-sm-9"><?= $response->host_ref_num ? $response->host_ref_num : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">ProcReturnCode:</dt> | ||
<dd class="col-sm-9"><?= $response->code ? $response->code : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">mdStatus:</dt> | ||
<dd class="col-sm-9"><?= $response->md_status ? $response->md_status : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Error Code:</dt> | ||
<dd class="col-sm-9"><?= $response->error_code ? $response->error_code : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Error Message:</dt> | ||
<dd class="col-sm-9"><?= $response->error_message ? $response->error_message : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-3">Md Error Message:</dt> | ||
<dd class="col-sm-9"><?= $response->md_error_message ? $response->md_error_message : '-'; ?></dd> | ||
</dl> | ||
<hr> | ||
<dl class="row"> | ||
<dt class="col-sm-12">All Data Dump:</dt> | ||
<dd class="col-sm-12"> | ||
<pre><?php dump($response); ?></pre> | ||
</dd> | ||
</dl> | ||
<hr> | ||
<div class="text-right"> | ||
<a href="index.php" class="btn btn-lg btn-info">< Click to payment form</a> | ||
</div> | ||
</div> | ||
|
||
<?php require '../../template/_footer.php'; | ||
$card = null; | ||
require '../../template/_payment_response.php'; |
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 |
---|---|---|
@@ -1,22 +1,20 @@ | ||
<?php | ||
|
||
require '../../_main_config.php'; | ||
require '../_payment_config.php'; | ||
|
||
$path = '/akbank/3d-pay/'; | ||
$baseUrl = $hostUrl.$path; | ||
$baseUrl = $bankTestsUrl.'/3d-pay/'; | ||
|
||
$request = \Symfony\Component\HttpFoundation\Request::createFromGlobals(); | ||
$ip = $request->getClientIp(); | ||
$account = \Mews\Pos\Factory\AccountFactory::createEstPosAccount( | ||
'akbank', | ||
'XXXXXXX', | ||
'XXXXXXX', | ||
'', | ||
\Mews\Pos\Gateways\AbstractGateway::MODEL_3D_PAY, | ||
'XXXXXXX' | ||
); | ||
|
||
$account = \Mews\Pos\Factory\AccountFactory::createEstPosAccount('akbank', 'XXXXXXX', 'XXXXXXX', '', '3d_pay', 'XXXXXXX'); | ||
$pos = getGateway($account); | ||
|
||
try { | ||
$pos = \Mews\Pos\Factory\PosFactory::createPosGateway($account); | ||
$pos->setTestMode(true); | ||
} catch (\Mews\Pos\Exceptions\BankNotFoundException $e) { | ||
dump($e->getCode(), $e->getMessage()); | ||
} catch (\Mews\Pos\Exceptions\BankClassNullException $e) { | ||
dump($e->getCode(), $e->getMessage()); | ||
} | ||
$transaction = \Mews\Pos\Gateways\AbstractGateway::TX_PAY; | ||
|
||
$templateTitle = '3D Pay Model Payment'; |
Oops, something went wrong.