Skip to content

Commit

Permalink
Garanti ve YKB Posnet eklendi
Browse files Browse the repository at this point in the history
Signed-off-by: Muharrem ERİN <[email protected]>
  • Loading branch information
mewebstudio committed Nov 15, 2018
1 parent 2e53409 commit 8c5f6fa
Show file tree
Hide file tree
Showing 39 changed files with 1,851 additions and 1,030 deletions.
1 change: 0 additions & 1 deletion LICENSE.txt
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.

25 changes: 16 additions & 9 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,8 +1,11 @@
# Türk bankaları için sanal pos paketi (PHP)

Bu paket ile amaçlanan; ortak bir arayüz sınıfı ile, tüm Türk banka sanal pos sistemlerinin kullanılabilmesidir. Şu an için EST altyapısı kullanan bankalar desteklenmektedir.
Bu paket ile amaçlanan; ortak bir arayüz sınıfı ile, tüm Türk banka sanal pos sistemlerinin kullanılabilmesidir.
EST altyapısı tam olarak test edilmiş ve kullanıma hazırdır.
Garanti Ödeme sistemi çalışmaktadır, fakat 3D ödeme kısmının üretim ortamında test edilmesi gerekiyor.
YapıKredi Posnet sistemi çalışmaktadır, fakat 3D ödeme kısmının üretim ortamında test edilmesi gerekiyor.

> Şu an elimde sadece Akbank test API ve kullanıcı bilgileri olduğu için, diğer EST altyapısı kullanan banklarda test yapamadım.
> EST altyapısında olan Akbank ve Ziraat bankası test edilmiştir.
### Özellikler
- Standart E-Commerce modeliyle ödeme (model => regular)
Expand Down Expand Up @@ -89,16 +92,21 @@ $card = [
];

// API kullanıcısı ile oluşturulan $pos değişkenine prepare metoduyla sipariş bilgileri gönderiliyor
try {
$pos->prepare($order);
} catch (\Mews\Pos\Exceptions\UnsupportedTransactionTypeException $e) {
var_dump($e->getCode(), $e->getMessage());
exit();
}
$pos->prepare($order);

// Ödeme tamamlanıyor
$payment = $pos->payment($card);

// Ödeme başarılı mı?
$payment->isSuccess();
//veya
$pos->isSuccess();

// Ödeme başarısız mı?
$payment->isError();
//veya
$pos->isError();

// Sonuç çıktısı
var_dump($payment->response);

Expand Down Expand Up @@ -171,7 +179,6 @@ $pos = new \Mews\Pos\Pos($account, $yeni_ayarlar);

### Yol Haritası
- Dökümantasyon hazırlanacak
- EST harici altyapılar için de geliştirme yapılacak
- UnitTest yazılacak -> Bu hiçbir zaman olmayabilir, birisi el atarsa sevinirim :)

> Değerli yorum, öneri ve katkılarınızı bekliyorum.
Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -14,9 +14,11 @@
"php": "^7.1.3",
"ext-dom": "*",
"ext-json": "*",
"ext-mcrypt": "*",
"ext-SimpleXML": "*",
"guzzlehttp/guzzle": "^6.3",
"symfony/http-foundation": "^4.1"
"symfony/http-foundation": "^4.1",
"symfony/serializer": "^4.1"
},
"autoload": {
"psr-4": {
Expand Down
54 changes: 53 additions & 1 deletion config/pos.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
<?php

return [

// Currencies
'currencies' => [
'TRY' => 949,
'USD' => 840,
Expand All @@ -10,6 +12,7 @@
'RUB' => 643,
],

// Banks
'banks' => [
'akbank' => [
'name' => 'AKBANK T.A.S.',
Expand All @@ -23,5 +26,54 @@
],
]
],
]
'ziraat' => [
'name' => 'Ziraat Bankası',
'class' => \Mews\Pos\EstPos::class,
'urls' => [
'production' => 'https://sanalpos2.ziraatbank.com.tr/fim/api',
'test' => 'https://entegrasyon.asseco-see.com.tr/fim/api',
'gateway' => [
'production' => 'https://sanalpos2.ziraatbank.com.tr/fim/est3dgate',
'test' => 'https://entegrasyon.asseco-see.com.tr/fim/est3Dgate',
],
]
],
'isbank' => [
'name' => 'İşbank',
'class' => \Mews\Pos\EstPos::class,
'urls' => [
'production' => 'https://sanalpos.isbank.com.tr/fim/api',
'test' => 'https://entegrasyon.asseco-see.com.tr/fim/api',
'gateway' => [
'production' => 'https://sanalpos.isbank.com.tr/fim/est3Dgate',
'test' => 'https://entegrasyon.asseco-see.com.tr/fim/est3Dgate',
],
]
],
'yapikredi' => [
'name' => 'Yapıkredi',
'class' => \Mews\Pos\PosNet::class,
'urls' => [
'production' => 'https://posnet.yapikredi.com.tr/PosnetWebService/XML',
'test' => 'http://setmpos.ykb.com/PosnetWebService/XML',
'gateway' => [
'production' => 'http://posnet.ykb.com/3DSWebService/YKBPaymentService',
'test' => 'http://setmpos.ykb.com/3DSWebService/YKBPaymentService',
],
]
],
'garanti' => [
'name' => 'Garanti',
'class' => \Mews\Pos\GarantiPos::class,
'urls' => [
'production' => 'https://sanalposprov.garanti.com.tr/VPServlet',
'test' => 'https://sanalposprovtest.garanti.com.tr/VPServlet',
'gateway' => [
'production' => 'https://sanalposprov.garanti.com.tr/servlet/gt3dengine',
'test' => 'https://sanalposprovtest.garanti.com.tr/servlet/gt3dengine',
],
]
],
],

];
41 changes: 4 additions & 37 deletions examples/akbank/3d-pay/_config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

session_start();

require '../../../vendor/autoload.php';

$host_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://$_SERVER[HTTP_HOST]";
Expand All @@ -12,8 +14,8 @@
$account = [
'bank' => 'akbank',
'model' => '3d_pay',
'client_id' => 'xxx',
'store_key' => 'xxx',
'client_id' => 'XXXXXXX',
'store_key' => 'XXXXXXX',
'env' => 'test',
];

Expand All @@ -25,39 +27,4 @@
var_dump($e->getCode(), $e->getMessage());
}

$amount = (double) 100;
$instalment = '0';

$ok_url = $base_url . 'response.php';
$fail_url = $base_url . 'response.php';

$transaction = 'pay'; // pay => Auth, pre PreAuth
$transaction_type = $pos->bank->types[$transaction];

$rand = microtime();

$order = [
'id' => 'unique-order-id-006',
'email' => '[email protected]', // optional
'name' => 'John Doe', // optional
'amount' => $amount,
'installment' => $instalment,
'currency' => 'TRY',
'ip' => $ip,
'ok_url' => $ok_url,
'fail_url' => $fail_url,
'transaction' => $transaction,
'transaction_type' => $transaction_type,
'lang' => 'tr',
'rand' => $rand,
];

$pos->prepare($order);

$hash = $pos->bank->create3DHash();
$order['hash'] = $hash;

$currency = $pos->config['currencies'][$order['currency']];
$gateway = $pos->bank->gateway;

$template_title = '3D Pay Model Payment';
49 changes: 18 additions & 31 deletions examples/akbank/3d-pay/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,63 +4,50 @@

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

$url = $base_url . 'form.php';
?>

<form method="post" action="<?php echo $gateway; ?>" role="form">
<form method="post" action="<?php echo $url; ?>" role="form">
<div class="row">
<div class="form-group col-sm-12">
<label for="name">Card holder name</label>
<input type="text" name="name" id="name" class="form-control input-lg" placeholder="Card holder name">
</div>
<div class="form-group col-sm-3">
<label for="cardType">Card Type</label>
<select name="cardType" id="cardType" class="form-control input-lg">
<label for="type">Card Type</label>
<select name="type" id="type" class="form-control input-lg">
<option value="">Type</option>
<option value="1">Visa</option>
<option value="2">MasterCard</option>
<option value="visa">Visa</option>
<option value="master">MasterCard</option>
</select>
</div>
<div class="form-group col-sm-9">
<label for="pan">Card Number</label>
<input type="text" name="pan" id="pan" class="form-control input-lg" placeholder="Credit card number">
<label for="number">Card Number</label>
<input type="text" name="number" id="number" class="form-control input-lg" placeholder="Credit card number">
</div>
<div class="form-group col-sm-4">
<label for="Ecom_Payment_Card_ExpDate_Month">Expire Month</label>
<select name="Ecom_Payment_Card_ExpDate_Month" id="Ecom_Payment_Card_ExpDate_Month" class="form-control input-lg">
<label for="month">Expire Month</label>
<select name="month" id="month" class="form-control input-lg">
<option value="">Month</option>
<?php for ($i = 1; $i <= 12; $i++): ?>
<option value="<?php echo $i; ?>"><?php echo str_pad($i, 2, 0, STR_PAD_LEFT); ?></option>
<?php endfor; ?>
</select>
</div>
<div class="form-group col-sm-4">
<label for="Ecom_Payment_Card_ExpDate_Year">Expire Year</label>
<select name="Ecom_Payment_Card_ExpDate_Year" id="Ecom_Payment_Card_ExpDate_Year" class="form-control input-lg">
<label for="year">Expire Year</label>
<select name="year" id="year" class="form-control input-lg">
<option value="">Year</option>
<?php for ($i = date('y'); $i <= date('y') + 20; $i++): ?>
<option value="<?php echo $i; ?>"><?php echo 2000 + $i; ?></option>
<?php endfor; ?>
</select>
</div>
<div class="form-group col-sm-4">
<label for="cv2">Cvv</label>
<input type="text" name="cv2" id="cv2" class="form-control input-lg" placeholder="Cvv">
<label for="cvv">Cvv</label>
<input type="text" name="cvv" id="cvv" class="form-control input-lg" placeholder="Cvv">
</div>
</div>
<?php if (isset($order['name'])): ?>
<input type="hidden" name="firmaadi" value="<?php echo $order['name']; ?>">
<?php endif; ?>
<?php if (isset($order['email'])): ?>
<input type="hidden" name="Email" value="<?php echo $order['email']; ?>">
<?php endif; ?>
<input type="hidden" name="clientid" value="<?php echo $account['client_id']; ?>" />
<input type="hidden" name="amount" value="<?php echo $order['amount']; ?>" />
<input type="hidden" name="islemtipi" value="<?php echo $order['transaction_type']; ?>" />
<input type="hidden" name="taksit" value="<?php echo $order['installment']; ?>" />
<input type="hidden" name="oid" value="<?php echo $order['id']; ?>" />
<input type="hidden" name="okUrl" value="<?php echo $order['ok_url']; ?>" />
<input type="hidden" name="failUrl" value="<?php echo $order['fail_url']; ?>" />
<input type="hidden" name="rnd" value="<?php echo $rand; ?>" />
<input type="hidden" name="hash" value="<?php echo $hash; ?>" />
<input type="hidden" name="storetype" value="<?php echo $account['model']; ?>" />
<input type="hidden" name="lang" value="<?php echo $order['lang']; ?>" />
<input type="hidden" name="currency" value="<?php echo $currency; ?>" />
<hr>
<div class="form-group text-center">
<button type="submit" class="btn btn-lg btn-block btn-success">Payment</button>
Expand Down
5 changes: 4 additions & 1 deletion examples/akbank/3d-pay/response.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@
exit();
}

$order = $_SESSION['order'];

$pos->prepare($order);
$payment = $pos->payment();
$response = $payment->response;

Expand Down Expand Up @@ -52,7 +55,7 @@
<hr>
<dl class="row">
<dt class="col-sm-3">Order ID:</dt>
<dd class="col-sm-9"><?php echo $response->id; ?></dd>
<dd class="col-sm-9"><?php echo $response->order_id ? $response->order_id : '-'; ?></dd>
</dl>
<hr>
<dl class="row">
Expand Down
45 changes: 6 additions & 39 deletions examples/akbank/3d/_config.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

session_start();

require '../../../vendor/autoload.php';

$host_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://$_SERVER[HTTP_HOST]";
Expand All @@ -12,10 +14,10 @@
$account = [
'bank' => 'akbank',
'model' => '3d',
'client_id' => 'xxx',
'username' => 'xxx',
'password' => 'xxx.',
'store_key' => 'xxx',
'client_id' => 'XXXXXXX',
'username' => 'XXXXXXX',
'password' => 'XXXXXXX',
'store_key' => 'XXXXXXX',
'env' => 'test',
];

Expand All @@ -27,39 +29,4 @@
var_dump($e->getCode(), $e->getMessage());
}

$amount = (double) 320;
$instalment = '0';

$ok_url = $base_url . 'response.php';
$fail_url = $base_url . 'response.php';

$transaction = 'pay'; // pay => Auth, pre PreAuth
$transaction_type = $pos->bank->types[$transaction];

$rand = microtime();

$order = [
'id' => 'unique-order-id-007',
'email' => '[email protected]', // optional
'name' => 'John Doe', // optional
'amount' => $amount,
'installment' => $instalment,
'currency' => 'TRY',
'ip' => $ip,
'ok_url' => $ok_url,
'fail_url' => $fail_url,
'transaction' => $transaction,
'transaction_type' => $transaction_type,
'lang' => 'tr',
'rand' => $rand,
];

$pos->prepare($order);

$hash = $pos->bank->create3DHash();
$order['hash'] = $hash;

$currency = $pos->config['currencies'][$order['currency']];
$gateway = $pos->bank->gateway;

$template_title = '3D Model Payment';
5 changes: 1 addition & 4 deletions examples/akbank/3d/form.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,6 @@
$success_url = $base_url . 'response.php';
$fail_url = $base_url . 'response.php';

$transaction = 'pay'; // pay => Auth, pre PreAuth
$transaction_type = $pos->bank->types[$transaction];

$rand = microtime();

$order = [
Expand All @@ -32,7 +29,7 @@
'ip' => $ip,
'success_url' => $success_url,
'fail_url' => $fail_url,
'transaction' => $transaction,
'transaction' => 'pay', // pay => Auth, pre PreAuth,
'lang' => 'tr',
'rand' => $rand,
];
Expand Down
Loading

0 comments on commit 8c5f6fa

Please sign in to comment.