test modu var ise, yani vakıfbank dan pos hesabı olmadan deneme yapılabiliyorsa dosyalarıda gönderebilirsiniz.
gateways altındaki dosya header('Content-type: text/html; charset=utf-8');
//header('Content-type: text/html; charset=iso-8859-9');
/*$GATEWAYMODULE["vakifbank3dnname"]="vakifbank3dn";
$GATEWAYMODULE["vakifbank3dnvisiblename"]="vakifbank3dn";
$GATEWAYMODULE["vakifbank3dntype"]="CC";*/
function vakifbank3dn_config() {
$configarray = array(
"FriendlyName" => array("Type" => "System", "Value"=>"Vakıfbank 3D"),
//"type" => array("FriendlyName" => "", "Type" => "hidden", "Size" => "32", "Value" => "CC",),
"uyeno" => array("FriendlyName" => "Üye No", "Type" => "text", "Size" => "32", "Description" => "Üye isyeri no (9 haneli)",),
"xcip" => array("FriendlyName" => "Xcip", "Type" => "text", "Size" => "32", "Description" => "Üye isyeri guvenlik kodu (10 haneli)",),
"dcins" => array("FriendlyName" => "Döviz Cinsi", "Type" => "text", "Size" => "9", "Description" => "YTL:949 nin uluslararasi kodu",),
"apiname" => array("FriendlyName" => "Api Kullanıcı Kodu", "Type" => "text", "Size" => "32", "Description" => "",),
"apipass" => array("FriendlyName" => "Api Kullanıcı Şifre", "Type" => "text", "Size" => "32", "Description" => "",),
"apiclient" => array("FriendlyName" => "İşyeri No", "Type" => "text", "Size" => "32", "Description" => "",),
"apiposno" => array("FriendlyName" => "Pos No", "Type" => "text", "Size" => "32", "Description" => "Üye İşyeri Pos No",),
"reqtype" => array("FriendlyName" => "İşlem Türü", "Type" => "dropdown", "Options" => "PRO,OPR", "Description" => "İşlem Türü", ),
"SubmitText" => array("FriendlyName" => "Buton Yazısı", "Type" => "text", "Size" => "32", "Description" => "Örn:3D işlemini başlat",),
//"TestMode" => array("FriendlyName" => "Test Mode", "Type" => "yesno", "Description" => "", ),
);
return $configarray;
}
function vakifbank3dn_3dsecure($params) {
/*if ("on" == $params['TestMode']) {
$gateway_url = "http://sanalposprovtest.garanti.com.tr/servlet/gt3dengine";
$Mode = "TEST";
} else {
$gateway_url = "https://sanalposprov.garanti.com.tr/servlet/gt3dengine";
$Mode = "PROD";
}*/
if (949 != $params['currency']) {
// If the currency is not TL, you should change the amount into TL
// And don't forget NOT to change $params['amount'] into any other variable.
// Ex: $params['amount'] = $params['amount'] * 2.1; // Euro into TL
}
// Let's change TL format into Kurus
/* If you want to provide Installment option to your customers, you have to add it as $configarray element or post value.
If you prefer post value, add a select box to your Smarty design with the name of InstallmentCnt and values like 3,6,12 etc.
In this case you have to change $params['InstallmentCnt'] with $_POST['InstallmentCnt'] in the following code.
Also if you charge more in the case of using Installment, use these codes:
$addition = array (
3 => 7, // %7 addition to amount if customer choose 3-Installments
6 => 11, // %11 addition to amount if customer choose 6-Installments
12 => 18, // %18 addition to amount if customer choose 12-Installments
);
if (isset ($_POST['InstallmentCnt']) && 1 < (int)$_POST['InstallmentCnt']) {
$Amount = round(($Amount*(100 + $addition[$_POST['InstallmentCnt']]))/100);
}
*/
$IPAddress = $_SERVER['REMOTE_ADDR'];
$SubmitText = isset($params['SubmitText']) ? $params['SubmitText']:"3D işlemini başlat";
$gateway_url = "https://get724.vakifbank.com.tr/Get724/get724uye.aspx";
//$uyeno = str_pad($params['uyeno'], 9, "0", STR_PAD_LEFT);
$uyeno = $params['uyeno'];
$kkno = $params['cardnum'];
$gectar = substr($params['cardexp'],2,2).substr($params['cardexp'],0,2);
$Amount = (float) str_replace(',', "." , (string)$params['amount']);
$Amount = (float) $Amount * 100;
$dcins = $params['dcins'];
$sipbil = $params['invoiceid']; //siparis bilgisi (max 40 hane)
$sesbil = $params['username']; //session bilgisi (max 40 hane)
$callbackurl = $params['systemurl']."/modules/gateways/callback/vakifbank3dn.php";
$zaman = date('YmdHis');
$xcip = $params['xcip'];
$hashStr = $uyeno . $kkno . $gectar . $Amount . $dcins . $sipbil . $sesbil . $callbackurl . $callbackurl . $zaman . $xcip;
$ozet = base64_encode(pack('H*',sha1($hashStr)));
return '<form method="post" action="'.$gateway_url.'">
<input type="hidden" name="uyeno" value="'.$uyeno.'" />
<input type="hidden" name="kkno" value="'.$kkno.'" />
<input type="hidden" name="gectar" value="'.$gectar.'" />
<input type="hidden" name="tutar" value="'.$Amount.'" />
<input type="hidden" name="dcins" value="'.$dcins.'" />
<input type="hidden" name="sipbil" value="'.$sipbil.'" />
<input type="hidden" name="sesbil" value="'.$sesbil.'" />
<input type="hidden" name="burl" value="'.$callbackurl.'" />
<input type="hidden" name="hurl" value="'.$callbackurl.'" />
<input type="hidden" name="zaman" value="'.$zaman.'" />
<input type="hidden" name="ozet" value="'.$ozet.'" />
<input type="hidden" name="ip" value="'.$IPAddress.'" />
<input type="hidden" name="orderid" value="'.$params["invoiceid"].'" />
<input type="hidden" name="customeremailaddress" value="'. $params["clientdetails"]["email"].'" />
<input type="hidden" name="customeripaddress" value="'.$IPAddress.'" />
<input type="hidden" name="cardnumber" value="'.$params["cardnum"].'">
<input type="hidden" name="cardexpiredatemonth" value="'.substr($params['cardexp'],0,2).'">
<input type="hidden" name="cardexpiredateyear" value="'.substr($params['cardexp'],2,2).'">
<input type="hidden" name="cardcvv" value="'.$params["cccvv"].'">
<noscript>
<div class="errorbox"><b>JavaScript is currently disabled or is not supported by your
browser.</b><br />Please click the continue button to proceed with the processing of your
transaction.</div>
</noscript>
<input id="submit" type="submit" value="'.$SubmitText.'" />
</form>';
} gateways/callback altındaki dosya class API
{
/*Gerçek Hesap Ýþlemleri*/
/*<Aktif>*/
public static $real_apiname;
public static $real_apipass;
public static $real_apiclient;
public static $real_apiposno;
public static $real_apixcip;
public static $real_gateway;
public static $real_gatpath;
/*</Aktif>*/
/*Test, Sahte Hesap Ýþlemleri*/
/*<Test>*/
public static $test_gateway;
public static $test_gatpath;
public static $test_apiname;
public static $test_apipass;
public static $test_apiclient;
public static $test_apiposno;
public static $test_apixcip;
/*</Test>*/
public $ReqType;
public $ExtraProcessid=0;
public static $isrealgateway=false;
public static $timeout=90;
private $DataArray;
private $ExtraProcesspuan;
public function __construct()
{
$this->ReqType = 'Auth';
$this->DataArray = array("ip"=>'$_POST[ip]',
"orderid" => '$_POST[orderid]',
"cc_no"=>'$_POST[kkno]',
"cc_month"=>'$_POST[cardexpiredatemonth]',
"cc_year"=>'$_POST[cardexpiredateyear]',
"cc_ccv"=>'$_POST[cardcvv]',
"tutar"=>'$_POST[tutar]',
"currency"=>'$_POST[dcins]',
"cc_instalment_order" => '',
"cc_holdername"=>$params['clientdetails']['firstname']." ".$params['clientdetails']['lastname']);
$this->ExtraProcesspuan = '';
if (constant_config('webpos_mode')!=NULL)
{
if (MODULE_PAYMENT_WEBPOS_MODE == 'Aktif')
{
self::$isrealgateway = true;
}
else
{
self::$isrealgateway = false;
}
}
}
public function __get($key){
}
public function __set($key, $value){
if(array_key_exists($key, get_class_vars(__CLASS__))){
$this->{$key} = $value;
}
}
private function getmodel(&$nameis,&$passwordis,&$clientidis,&$posnois,&$xcipis,&$DataArray)
{
$extraid = $this->ExtraProcessid;
$extrapuan = $this->ExtraProcesspuan;
$ReqTypeis = ($this->ReqType == 'Auth')?'PRO':'OPR';
$oid = (strlen($DataArray['orderid'])>24)? substr(str_replace('.','0',$DataArray['orderid']),0,24):substr('00000000000000000000',0,(24-strlen($DataArray['orderid']))).str_replace('.','0',$DataArray['orderid']);
$tutar = sprintf('%012d',str_replace('.', '', number_format($DataArray['tutar'], 2, '','')));
$installment = ($DataArray['cc_instalment_order']=='')?'00':sprintf('%02d',$DataArray['cc_instalment_order']);
return
"kullanici=".$nameis."&sifre=".$passwordis."&islem=".$ReqTypeis."&uyeno=".$clientidis."&posno=".$posnois."&kkno=".$DataArray['cc_no']."&gectar=".$DataArray['cc_year'].$DataArray['cc_month']."&cvc=".$DataArray['cc_ccv']."&tutar=".$tutar."&provno=000000&taksits=".$installment."&islemyeri=I&uyeref=".$oid."&vbref=0&khip=".$DataArray['ip']."&xcip=".$xcipis;
}
private function xmltohash($data)
{
$response = array();
$parser = xml_parser_create( );
xml_parser_set_option( $parser, XML_OPTION_CASE_FOLDING, 0 );
xml_parser_set_option( $parser, XML_OPTION_SKIP_WHITE, 1 );
xml_parse_into_struct( $parser, $data, $values, $tags );
xml_parser_free( $parser );
$arrQuotes = array();
foreach ( $values as $key => $val )
{
switch ( $val['type'] )
{
case "open" :
array_push($arrQuotes,$val['tag'] );
break;
case "close" :
array_pop($arrQuotes);
break;
case "complete" :
array_push($arrQuotes,$val['tag'] );
$val['value'] = (array_key_exists('value', $val))?$val['value']:"";
eval( "\$response['".implode( $arrQuotes, "']['" ).( "'] = \"".$val['value']."\";" ) );
array_pop($arrQuotes);
}
}
return $response;
}
public function vkf_error_codes( $Status )
{
switch ( $Status )
{
case "02" :
$msg = "Kartla ilgili problem. Bankanýzý arayýnýz.";
return $msg;
case "69" :
$msg = "Eksik Parametre. Kart bilgilerinizi kontrol edip tekrar deneyiniz.";
return $msg;
case "68" :
$msg = "Hatalý Ýþlem Tipi. Lütfen sorunu yönetime bildirin.";
return $msg;
case "67" :
$msg = "Parametre uzunluklarýnda uyuþmazlýk. Lütfen bilgilerinizi kontrol ediniz.";
return $msg;
case "66" :
$msg = "Numeric deger hatasý. Nümerik deðerlerden oluþmasý gereken alanlardan biri veya býrkaçý hatalý.";
return $msg;
case "64" :
$msg = "Ýþlem tipi taksit e uygun deðil.";
return $msg;
case "63" :
$msg = "Request mesajinda illegal karakter var.";
return $msg;
case "62" :
$msg = "Yetkisiz ya da tanýmsýz kullanýcý.";
return $msg;
case "61" :
$msg = "Hatalý Tarih.";
return $msg;
case "60" :
$msg = "Hareket Bulunamadi.";
return $msg;
case "59" :
$msg = "Gunsonu yapilacak hareket yok/GS Yapilmis.";
return $msg;
case "90" :
$msg = "Kayýt bulunamadý.";
return $msg;
case "91" :
$msg = "Begin Transaction error.";
return $msg;
case "92" :
$msg = "Insert Update Error.";
return $msg;
case "96" :
$msg = "DLL registration error.";
return $msg;
case "97" :
$msg = "IP Hatasý.";
return $msg;
case "98" :
$msg = "H. Iletisim hatasý.";
return $msg;
case "99" :
$msg = "DB Baglantý hatasý.";
return $msg;
case "70" :
$msg = "XCIP hatalý.";
return $msg;
case "71" :
$msg = "Üye Ýþyeri blokeli ya da tanýmsýz.";
return $msg;
case "72" :
$msg = "Tanýmsýz POS.";
return $msg;
case "73" :
$msg = "POS table update error.";
return $msg;
case "76" :
$msg = "Taksit e kapalý.";
return $msg;
case "74" :
$msg = "Hatalý taksit sayýsý.";
return $msg;
case "75" :
$msg = "Illegal State.";
return $msg;
case "85" :
$msg = "Kayit Reversal Durumda.";
return $msg;
case "86" :
$msg = "Kayit Degistirilemez.";
return $msg;
case "87" :
$msg = "Kayit Iade Durumda.";
return $msg;
case "88" :
$msg = "Kayit Iptal Durumda.";
return $msg;
case "89" :
$msg = "Geçersiz kayýt.";
return $msg;
case "01" :
$msg = "Eski kayýt. Bir önceki sipariþle ayný sipariþ numarasý girildi.";
return $msg;
}
$msg = "Lütfen bilgilerinizi kontrol ediniz..";
return $msg;
}
public function HTTPPOST()
{
$name='';
$password='';
$clientid='';
$posno='';
$xcip='';
$host='';
$path='';
$timeout = self::$timeout;
if(self::$isrealgateway)
{
$name = self::$real_apiname;
$password = self::$real_apipass;
$clientid = self::$real_apiclient;
$posno = self::$real_apiposno;
$xcip = self::$real_apixcip;
$host = self::$real_gateway;
$path = self::$real_gatpath;
}
else
{
$name = self::$test_apiname;
$password = self::$test_apipass;
$clientid = self::$test_apiclient;
$posno = self::$test_apiposno;
$xcip = self::$test_apixcip;
$host = self::$test_gateway;
$path = self::$test_gatpath;
}
$getdata = $this->getmodel($name,$password,$clientid,$posno,$xcip,$this->DataArray);
$path = "/vpos724v3/?".$getdata;
$buffer = "";
if (!extension_loaded('curl')) {
$fp = fsockopen("ssl://subesiz.vakifbank.com.tr", 443, $errno, $errstr, $timeout);
if (!$fp)
{
$msg['result'] = -1;
$msg['msg'] = ":: Baðlantý hatasý lütfen daha sonra tekrar deneyiniz.";
return $msg;
}
fputs($fp, "GET " .$path. " HTTP/1.1\r\n");
fputs($fp, "Host: subesiz.vakifbank.com.tr\r\n");
fputs($fp, "Connection: Close\r\n\r\n");
$buffer = fread( $fp, 8192 );
fclose($fp);
}
else
{
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL,"https://subesiz.vakifbank.com.tr/".$path);
curl_setopt($ch, CURLOPT_SSL_VERIFYHOST,1);
curl_setopt($ch, CURLOPT_SSL_VERIFYPEER,0);
curl_setopt($ch, CURLOPT_RETURNTRANSFER,1);
curl_setopt($ch, CURLOPT_TIMEOUT, $timeout);
$buffer = curl_exec($ch);
if (curl_errno($ch))
{
$msg['result'] = -1;
$msg['msg'] = ":: Baðlantý hatasý lütfen daha sonra tekrar deneyiniz.";
return $msg; /* curl_error($ch) */
}
else
{
curl_close($ch);
}
}
/*echo $buffer;*/
$Response = substr( $buffer, strpos( $buffer, "<Cevap>" ) );
$responseArray = $this->xmltohash( $Response );
switch ( $responseArray['Cevap']['Msg']['Kod'] )
{
case "00" :
$msg['result'] = 1;
$msg['auth_code'] = $responseArray['Cevap']['Msg']['Mesaj'];
break;
default:
$msg['result'] = -1;
$msg['msg'] = $this->vkf_error_codes( $responseArray['Cevap']['Msg']['Kod'] )."-".$responseArray['Cevap']['Msg']['BKMKod'];
}
return $msg;
}
}
/*
* @BugFixes
* Security code is generated with main Garanti root password not the password for sale, it is changed.
*
* @Addition
* $response value was extended with some customer and order datas.
*
*/
// If you see broken chars, change the header
//header('Content-type: text/html; charset=utf-8');
//header('Content-type: text/html; charset=iso-8859-9');
# Required File Includes
include("../../../dbconnect.php");
include("../../../includes/functions.php");
include("../../../includes/gatewayfunctions.php");
include("../../../includes/invoicefunctions.php");
$gatewaymodule = "vakifbank3dn";
$GATEWAY = getGatewayVariables($gatewaymodule);
if (!$GATEWAY["type"]) die("Module Not Activated");
$successArray = array("Y","A");
if (isset($_POST["status"]) && in_array($_POST["status"], $successArray)) {
$reqtype = 'Auth';
/*Gerçek Hesap İşlemleri*/
/*<Aktif>*/
API::$real_apiname = $GATEWAY['apiname']; //API KULLANICI KODU
API::$real_apipass = $GATEWAY['apipass']; //API KULLANICI ŞİFRE
API::$real_apiclient = $GATEWAY['apiclient']; //İŞYERİ NO
API::$real_apiposno = $GATEWAY['apiposno']; //POS NO
API::$real_apixcip = $GATEWAY['xcip']; //GÜVENLİK KODU
API::$real_gateway = 'https://subesiz.vakifbank.com.tr';
API::$real_gatpath = '/vpos724v3/?';
/*</Aktif>*/
/*Test, Sahte Hesap İşlemleri*/
/*<Test>*/
API::$test_gateway = 'https://subesiz.vakifbank.com.tr';
API::$test_gatpath = '/vpos724v3/?';
API::$test_apiname = $GATEWAY['apiname'];
API::$test_apipass = $GATEWAY['apipass'];
API::$test_apiclient = $GATEWAY['apiclient'];
API::$test_apiposno = $GATEWAY['apiposno'];
API::$test_apixcip = $GATEWAY['xcip'];
API::$timeout = 90;
}