Skip to content

Commit 8c5f6fa

Browse files
committed
Garanti ve YKB Posnet eklendi
Signed-off-by: Muharrem ERİN <[email protected]>
1 parent 2e53409 commit 8c5f6fa

39 files changed

+1851
-1030
lines changed

LICENSE.txt

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -19,4 +19,3 @@ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
1919
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
2020
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
2121
SOFTWARE.
22-

README.md

Lines changed: 16 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,11 @@
11
# Türk bankaları için sanal pos paketi (PHP)
22

3-
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.
3+
Bu paket ile amaçlanan; ortak bir arayüz sınıfı ile, tüm Türk banka sanal pos sistemlerinin kullanılabilmesidir.
4+
EST altyapısı tam olarak test edilmiş ve kullanıma hazırdır.
5+
Garanti Ödeme sistemi çalışmaktadır, fakat 3D ödeme kısmının üretim ortamında test edilmesi gerekiyor.
6+
YapıKredi Posnet sistemi çalışmaktadır, fakat 3D ödeme kısmının üretim ortamında test edilmesi gerekiyor.
47

5-
> Ş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.
8+
> EST altyapısında olan Akbank ve Ziraat bankası test edilmiştir.
69
710
### Özellikler
811
- Standart E-Commerce modeliyle ödeme (model => regular)
@@ -89,16 +92,21 @@ $card = [
8992
];
9093

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

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

100+
// Ödeme başarılı mı?
101+
$payment->isSuccess();
102+
//veya
103+
$pos->isSuccess();
104+
105+
// Ödeme başarısız mı?
106+
$payment->isError();
107+
//veya
108+
$pos->isError();
109+
102110
// Sonuç çıktısı
103111
var_dump($payment->response);
104112

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

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

177184
> Değerli yorum, öneri ve katkılarınızı bekliyorum.

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,9 +14,11 @@
1414
"php": "^7.1.3",
1515
"ext-dom": "*",
1616
"ext-json": "*",
17+
"ext-mcrypt": "*",
1718
"ext-SimpleXML": "*",
1819
"guzzlehttp/guzzle": "^6.3",
19-
"symfony/http-foundation": "^4.1"
20+
"symfony/http-foundation": "^4.1",
21+
"symfony/serializer": "^4.1"
2022
},
2123
"autoload": {
2224
"psr-4": {

config/pos.php

Lines changed: 53 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,8 @@
11
<?php
22

33
return [
4+
5+
// Currencies
46
'currencies' => [
57
'TRY' => 949,
68
'USD' => 840,
@@ -10,6 +12,7 @@
1012
'RUB' => 643,
1113
],
1214

15+
// Banks
1316
'banks' => [
1417
'akbank' => [
1518
'name' => 'AKBANK T.A.S.',
@@ -23,5 +26,54 @@
2326
],
2427
]
2528
],
26-
]
29+
'ziraat' => [
30+
'name' => 'Ziraat Bankası',
31+
'class' => \Mews\Pos\EstPos::class,
32+
'urls' => [
33+
'production' => 'https://sanalpos2.ziraatbank.com.tr/fim/api',
34+
'test' => 'https://entegrasyon.asseco-see.com.tr/fim/api',
35+
'gateway' => [
36+
'production' => 'https://sanalpos2.ziraatbank.com.tr/fim/est3dgate',
37+
'test' => 'https://entegrasyon.asseco-see.com.tr/fim/est3Dgate',
38+
],
39+
]
40+
],
41+
'isbank' => [
42+
'name' => 'İşbank',
43+
'class' => \Mews\Pos\EstPos::class,
44+
'urls' => [
45+
'production' => 'https://sanalpos.isbank.com.tr/fim/api',
46+
'test' => 'https://entegrasyon.asseco-see.com.tr/fim/api',
47+
'gateway' => [
48+
'production' => 'https://sanalpos.isbank.com.tr/fim/est3Dgate',
49+
'test' => 'https://entegrasyon.asseco-see.com.tr/fim/est3Dgate',
50+
],
51+
]
52+
],
53+
'yapikredi' => [
54+
'name' => 'Yapıkredi',
55+
'class' => \Mews\Pos\PosNet::class,
56+
'urls' => [
57+
'production' => 'https://posnet.yapikredi.com.tr/PosnetWebService/XML',
58+
'test' => 'http://setmpos.ykb.com/PosnetWebService/XML',
59+
'gateway' => [
60+
'production' => 'http://posnet.ykb.com/3DSWebService/YKBPaymentService',
61+
'test' => 'http://setmpos.ykb.com/3DSWebService/YKBPaymentService',
62+
],
63+
]
64+
],
65+
'garanti' => [
66+
'name' => 'Garanti',
67+
'class' => \Mews\Pos\GarantiPos::class,
68+
'urls' => [
69+
'production' => 'https://sanalposprov.garanti.com.tr/VPServlet',
70+
'test' => 'https://sanalposprovtest.garanti.com.tr/VPServlet',
71+
'gateway' => [
72+
'production' => 'https://sanalposprov.garanti.com.tr/servlet/gt3dengine',
73+
'test' => 'https://sanalposprovtest.garanti.com.tr/servlet/gt3dengine',
74+
],
75+
]
76+
],
77+
],
78+
2779
];

examples/akbank/3d-pay/_config.php

Lines changed: 4 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
session_start();
4+
35
require '../../../vendor/autoload.php';
46

57
$host_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://$_SERVER[HTTP_HOST]";
@@ -12,8 +14,8 @@
1214
$account = [
1315
'bank' => 'akbank',
1416
'model' => '3d_pay',
15-
'client_id' => 'xxx',
16-
'store_key' => 'xxx',
17+
'client_id' => 'XXXXXXX',
18+
'store_key' => 'XXXXXXX',
1719
'env' => 'test',
1820
];
1921

@@ -25,39 +27,4 @@
2527
var_dump($e->getCode(), $e->getMessage());
2628
}
2729

28-
$amount = (double) 100;
29-
$instalment = '0';
30-
31-
$ok_url = $base_url . 'response.php';
32-
$fail_url = $base_url . 'response.php';
33-
34-
$transaction = 'pay'; // pay => Auth, pre PreAuth
35-
$transaction_type = $pos->bank->types[$transaction];
36-
37-
$rand = microtime();
38-
39-
$order = [
40-
'id' => 'unique-order-id-006',
41-
'email' => '[email protected]', // optional
42-
'name' => 'John Doe', // optional
43-
'amount' => $amount,
44-
'installment' => $instalment,
45-
'currency' => 'TRY',
46-
'ip' => $ip,
47-
'ok_url' => $ok_url,
48-
'fail_url' => $fail_url,
49-
'transaction' => $transaction,
50-
'transaction_type' => $transaction_type,
51-
'lang' => 'tr',
52-
'rand' => $rand,
53-
];
54-
55-
$pos->prepare($order);
56-
57-
$hash = $pos->bank->create3DHash();
58-
$order['hash'] = $hash;
59-
60-
$currency = $pos->config['currencies'][$order['currency']];
61-
$gateway = $pos->bank->gateway;
62-
6330
$template_title = '3D Pay Model Payment';

examples/akbank/3d-pay/index.php

Lines changed: 18 additions & 31 deletions
Original file line numberDiff line numberDiff line change
@@ -4,63 +4,50 @@
44

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

7+
$url = $base_url . 'form.php';
78
?>
89

9-
<form method="post" action="<?php echo $gateway; ?>" role="form">
10+
<form method="post" action="<?php echo $url; ?>" role="form">
1011
<div class="row">
12+
<div class="form-group col-sm-12">
13+
<label for="name">Card holder name</label>
14+
<input type="text" name="name" id="name" class="form-control input-lg" placeholder="Card holder name">
15+
</div>
1116
<div class="form-group col-sm-3">
12-
<label for="cardType">Card Type</label>
13-
<select name="cardType" id="cardType" class="form-control input-lg">
17+
<label for="type">Card Type</label>
18+
<select name="type" id="type" class="form-control input-lg">
1419
<option value="">Type</option>
15-
<option value="1">Visa</option>
16-
<option value="2">MasterCard</option>
20+
<option value="visa">Visa</option>
21+
<option value="master">MasterCard</option>
1722
</select>
1823
</div>
1924
<div class="form-group col-sm-9">
20-
<label for="pan">Card Number</label>
21-
<input type="text" name="pan" id="pan" class="form-control input-lg" placeholder="Credit card number">
25+
<label for="number">Card Number</label>
26+
<input type="text" name="number" id="number" class="form-control input-lg" placeholder="Credit card number">
2227
</div>
2328
<div class="form-group col-sm-4">
24-
<label for="Ecom_Payment_Card_ExpDate_Month">Expire Month</label>
25-
<select name="Ecom_Payment_Card_ExpDate_Month" id="Ecom_Payment_Card_ExpDate_Month" class="form-control input-lg">
29+
<label for="month">Expire Month</label>
30+
<select name="month" id="month" class="form-control input-lg">
2631
<option value="">Month</option>
2732
<?php for ($i = 1; $i <= 12; $i++): ?>
2833
<option value="<?php echo $i; ?>"><?php echo str_pad($i, 2, 0, STR_PAD_LEFT); ?></option>
2934
<?php endfor; ?>
3035
</select>
3136
</div>
3237
<div class="form-group col-sm-4">
33-
<label for="Ecom_Payment_Card_ExpDate_Year">Expire Year</label>
34-
<select name="Ecom_Payment_Card_ExpDate_Year" id="Ecom_Payment_Card_ExpDate_Year" class="form-control input-lg">
38+
<label for="year">Expire Year</label>
39+
<select name="year" id="year" class="form-control input-lg">
3540
<option value="">Year</option>
3641
<?php for ($i = date('y'); $i <= date('y') + 20; $i++): ?>
3742
<option value="<?php echo $i; ?>"><?php echo 2000 + $i; ?></option>
3843
<?php endfor; ?>
3944
</select>
4045
</div>
4146
<div class="form-group col-sm-4">
42-
<label for="cv2">Cvv</label>
43-
<input type="text" name="cv2" id="cv2" class="form-control input-lg" placeholder="Cvv">
47+
<label for="cvv">Cvv</label>
48+
<input type="text" name="cvv" id="cvv" class="form-control input-lg" placeholder="Cvv">
4449
</div>
4550
</div>
46-
<?php if (isset($order['name'])): ?>
47-
<input type="hidden" name="firmaadi" value="<?php echo $order['name']; ?>">
48-
<?php endif; ?>
49-
<?php if (isset($order['email'])): ?>
50-
<input type="hidden" name="Email" value="<?php echo $order['email']; ?>">
51-
<?php endif; ?>
52-
<input type="hidden" name="clientid" value="<?php echo $account['client_id']; ?>" />
53-
<input type="hidden" name="amount" value="<?php echo $order['amount']; ?>" />
54-
<input type="hidden" name="islemtipi" value="<?php echo $order['transaction_type']; ?>" />
55-
<input type="hidden" name="taksit" value="<?php echo $order['installment']; ?>" />
56-
<input type="hidden" name="oid" value="<?php echo $order['id']; ?>" />
57-
<input type="hidden" name="okUrl" value="<?php echo $order['ok_url']; ?>" />
58-
<input type="hidden" name="failUrl" value="<?php echo $order['fail_url']; ?>" />
59-
<input type="hidden" name="rnd" value="<?php echo $rand; ?>" />
60-
<input type="hidden" name="hash" value="<?php echo $hash; ?>" />
61-
<input type="hidden" name="storetype" value="<?php echo $account['model']; ?>" />
62-
<input type="hidden" name="lang" value="<?php echo $order['lang']; ?>" />
63-
<input type="hidden" name="currency" value="<?php echo $currency; ?>" />
6451
<hr>
6552
<div class="form-group text-center">
6653
<button type="submit" class="btn btn-lg btn-block btn-success">Payment</button>

examples/akbank/3d-pay/response.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,9 @@
99
exit();
1010
}
1111

12+
$order = $_SESSION['order'];
13+
14+
$pos->prepare($order);
1215
$payment = $pos->payment();
1316
$response = $payment->response;
1417

@@ -52,7 +55,7 @@
5255
<hr>
5356
<dl class="row">
5457
<dt class="col-sm-3">Order ID:</dt>
55-
<dd class="col-sm-9"><?php echo $response->id; ?></dd>
58+
<dd class="col-sm-9"><?php echo $response->order_id ? $response->order_id : '-'; ?></dd>
5659
</dl>
5760
<hr>
5861
<dl class="row">

examples/akbank/3d/_config.php

Lines changed: 6 additions & 39 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,7 @@
11
<?php
22

3+
session_start();
4+
35
require '../../../vendor/autoload.php';
46

57
$host_url = (isset($_SERVER['HTTPS']) && $_SERVER['HTTPS'] === 'on' ? 'https' : 'http') . "://$_SERVER[HTTP_HOST]";
@@ -12,10 +14,10 @@
1214
$account = [
1315
'bank' => 'akbank',
1416
'model' => '3d',
15-
'client_id' => 'xxx',
16-
'username' => 'xxx',
17-
'password' => 'xxx.',
18-
'store_key' => 'xxx',
17+
'client_id' => 'XXXXXXX',
18+
'username' => 'XXXXXXX',
19+
'password' => 'XXXXXXX',
20+
'store_key' => 'XXXXXXX',
1921
'env' => 'test',
2022
];
2123

@@ -27,39 +29,4 @@
2729
var_dump($e->getCode(), $e->getMessage());
2830
}
2931

30-
$amount = (double) 320;
31-
$instalment = '0';
32-
33-
$ok_url = $base_url . 'response.php';
34-
$fail_url = $base_url . 'response.php';
35-
36-
$transaction = 'pay'; // pay => Auth, pre PreAuth
37-
$transaction_type = $pos->bank->types[$transaction];
38-
39-
$rand = microtime();
40-
41-
$order = [
42-
'id' => 'unique-order-id-007',
43-
'email' => '[email protected]', // optional
44-
'name' => 'John Doe', // optional
45-
'amount' => $amount,
46-
'installment' => $instalment,
47-
'currency' => 'TRY',
48-
'ip' => $ip,
49-
'ok_url' => $ok_url,
50-
'fail_url' => $fail_url,
51-
'transaction' => $transaction,
52-
'transaction_type' => $transaction_type,
53-
'lang' => 'tr',
54-
'rand' => $rand,
55-
];
56-
57-
$pos->prepare($order);
58-
59-
$hash = $pos->bank->create3DHash();
60-
$order['hash'] = $hash;
61-
62-
$currency = $pos->config['currencies'][$order['currency']];
63-
$gateway = $pos->bank->gateway;
64-
6532
$template_title = '3D Model Payment';

examples/akbank/3d/form.php

Lines changed: 1 addition & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,6 @@
1717
$success_url = $base_url . 'response.php';
1818
$fail_url = $base_url . 'response.php';
1919

20-
$transaction = 'pay'; // pay => Auth, pre PreAuth
21-
$transaction_type = $pos->bank->types[$transaction];
22-
2320
$rand = microtime();
2421

2522
$order = [
@@ -32,7 +29,7 @@
3229
'ip' => $ip,
3330
'success_url' => $success_url,
3431
'fail_url' => $fail_url,
35-
'transaction' => $transaction,
32+
'transaction' => 'pay', // pay => Auth, pre PreAuth,
3633
'lang' => 'tr',
3734
'rand' => $rand,
3835
];

0 commit comments

Comments
 (0)