diff --git a/LICENSE.txt b/LICENSE.txt index df46ae58..54f5d5ee 100644 --- a/LICENSE.txt +++ b/LICENSE.txt @@ -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. - diff --git a/README.md b/README.md index 1fc69a4c..6829b774 100644 --- a/README.md +++ b/README.md @@ -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) @@ -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); @@ -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. diff --git a/composer.json b/composer.json index 6c1aa520..001be609 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/config/pos.php b/config/pos.php index 7da3156a..4936cf05 100644 --- a/config/pos.php +++ b/config/pos.php @@ -1,6 +1,8 @@ [ 'TRY' => 949, 'USD' => 840, @@ -10,6 +12,7 @@ 'RUB' => 643, ], + // Banks 'banks' => [ 'akbank' => [ 'name' => 'AKBANK T.A.S.', @@ -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', + ], + ] + ], + ], + ]; diff --git a/examples/akbank/3d-pay/_config.php b/examples/akbank/3d-pay/_config.php index 2146bb42..b1fdefc4 100644 --- a/examples/akbank/3d-pay/_config.php +++ b/examples/akbank/3d-pay/_config.php @@ -1,5 +1,7 @@ 'akbank', 'model' => '3d_pay', - 'client_id' => 'xxx', - 'store_key' => 'xxx', + 'client_id' => 'XXXXXXX', + 'store_key' => 'XXXXXXX', 'env' => 'test', ]; @@ -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' => 'mail@customer.com', // 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'; diff --git a/examples/akbank/3d-pay/index.php b/examples/akbank/3d-pay/index.php index 532344b9..5ca2ca74 100644 --- a/examples/akbank/3d-pay/index.php +++ b/examples/akbank/3d-pay/index.php @@ -4,25 +4,30 @@ require '../../template/_header.php'; +$url = $base_url . 'form.php'; ?> -