Index: uc_turkish_banks.install =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/uc_turkish_banks/uc_turkish_banks.install,v retrieving revision 1.2 diff -u -r1.2 uc_turkish_banks.install --- uc_turkish_banks.install 22 Jun 2008 15:14:19 -0000 1.2 +++ uc_turkish_banks.install 22 Jun 2008 16:38:08 -0000 @@ -22,7 +22,7 @@ PRIMARY KEY (cid, bankname) ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - db_query("CREATE TABLE {uc_turkish_banks_orders} ( + db_query("CREATE TABLE {uc_turkish_banks_orders} ( cuid int(11) NOT NULL auto_increment, cid int(11) NOT NULL, oid int(11) NOT NULL default '0', @@ -35,8 +35,8 @@ instalment_ratio decimal(4,2) NOT NULL, valid_until INTEGER NOT NULL ) /*!40100 DEFAULT CHARACTER SET UTF8 */ "); - break; - } + break; + } } /** Index: uc_turkish_banks.module =================================================================== RCS file: /cvs/drupal-contrib/contributions/modules/uc_turkish_banks/uc_turkish_banks.module,v retrieving revision 1.2 diff -u -r1.2 uc_turkish_banks.module --- uc_turkish_banks.module 22 Jun 2008 15:14:09 -0000 1.2 +++ uc_turkish_banks.module 22 Jun 2008 16:38:10 -0000 @@ -7,9 +7,9 @@ * * A module used to process payments using Banks in Turkey. Currently uses the EST e-secure payment service. This module currently supports instalments and as a paymant method uses 3D Secure OOS PAY. * - *T�rk Bankalari i�in �deme eklentisidir. EST G�venli e-�deme servisi kullanmaktadir. Taksitli satisi desteklemektedir. Satis y�ntemi olarak 3D Secure OOS PAY metodunu kullanmaktadir. + *T�rk Bankalari i�in �deme eklentisidir. EST G�venli e-�deme servisi kullanmaktadir. Taksitli satisi desteklemektedir. Satis y�ntemi olarak 3D Secure OOS PAY metodunu kullanmaktadir. * - *Support the following banks/ Asagidaki bankalar desteklenmektedir. + * Supports the following banks / Asagidaki bankalar desteklenmektedir. * * 1. Is Bankasi * 2. Akbank @@ -23,7 +23,7 @@ * 10. Denizbank */ - /** +/** * Implementation of hook_menu(). */ function uc_turkish_banks_menu($may_cache) { @@ -54,7 +54,7 @@ 'type' => MENU_DEFAULT_LOCAL_TASK, ); - $items[] = array( + $items[] = array( 'path' => 'admin/store/settings/banks/add', 'title' => t('Add New Bank'), 'description' => t('Add a New Bank'), @@ -395,7 +395,6 @@ '#weight' => 21, ); return $form; - } /** @@ -434,8 +433,7 @@ else { // Otherwise we try to update the coupon with matching coupon id if (db_query("UPDATE {uc_turkish_banks} SET bankname = '%s', clientid = '%s',username = '%s',password = '%s',bankurl = '%s',storekey = '%s',processtype = '%s',cardname = '%s',valid_until = %d WHERE cid = %d", - $form['bankname'],$form['clientid'],$form['username'],$form['password'],$form['bankurl'],$form['storekey'],$form['processtype'],$form['cardname'],$valid_until,$form['cid'])) - { + $form['bankname'],$form['clientid'],$form['username'],$form['password'],$form['bankurl'],$form['storekey'],$form['processtype'],$form['cardname'],$valid_until,$form['cid'])) { $message = "Bank updated succssfully"; } else { @@ -461,7 +459,6 @@ /** * Delete confirm */ - function uc_turkish_banks_delete_confirm($cid) { $form['cid'] = array('#type' => 'value', '#value' => $cid); return confirm_form($form, @@ -489,7 +486,7 @@ // BURASI MUALLAK BAKILACAK.... function uc_turkish_banks_order($op, $arg1, $arg2) { - switch($op) { + switch ($op) { case 'save': list($bank_temp,$amount_temp,$bank_cid,$taksit)=explode('|', $_SESSION['taksit']); //print "TEST:".$_SESSION['bank_cid'].' '. $bank.' '.$amount ; @@ -513,7 +510,7 @@ } } - /** +/** * Implementation of hook_form_alter(). */ function uc_turkish_banks_form_alter($form_id, &$form) { @@ -526,7 +523,7 @@ $form['#suffix'] = ''. drupal_get_form('uc_turkish_banks_form', $order) .''; } } - if ($form_id == 'uc_cart_checkout_form'){ + if ($form_id == 'uc_cart_checkout_form') { drupal_add_js(drupal_get_path('module', 'uc_turkish_banks') .'/uc_turkish_banks.js'); } } @@ -575,7 +572,7 @@ } - /** +/** * Implementation of hook_payment_method(). */ function uc_turkish_banks_payment_method() { @@ -597,10 +594,7 @@ return $methods; } - - - - + /******************************************************************************* * Callback Functions, Forms, and Tables ******************************************************************************/ @@ -740,13 +734,13 @@ $clientId = $bank->clientid; //banks tarafindan magazaya verilen isyeri numarasi $amount = uc_currency_format($order->order_total, FALSE, FALSE, '.'); //tutar $oid = $order->order_id; //Siparis numarasi - $okUrl = url('cart/banks/complete/'. uc_cart_get_id(), NULL, NULL, TRUE); //Islem basariliysa d�n�lecek isyeri sayfasi (3D isleminin ve �deme isleminin sonucu) - $failUrl = url('cart/banks/complete/'. uc_cart_get_id(), NULL, NULL, TRUE); //Islem basarisizsa d�n�lecek isyeri sayfasi (3D isleminin ve �deme isleminin sonucu) - $rnd = microtime(); //Tarih ve zaman gibi s�rekli degisen bir deger g�venlik ama�li kullaniliyor + $okUrl = url('cart/banks/complete/'. uc_cart_get_id(), NULL, NULL, TRUE); //Islem basariliysa d�n�lecek isyeri sayfasi (3D isleminin ve �deme isleminin sonucu) + $failUrl = url('cart/banks/complete/'. uc_cart_get_id(), NULL, NULL, TRUE); //Islem basarisizsa d�n�lecek isyeri sayfasi (3D isleminin ve �deme isleminin sonucu) + $rnd = microtime(); //Tarih ve zaman gibi s�rekli degisen bir deger g�venlik ama�li kullaniliyor $islemtipi= $bank->processtype; //Islem tipi $storekey = $bank->storekey; //Isyeri anahtari - $hashstr = $clientId . $oid . $amount . $okUrl . $failUrl . $islemtipi . $taksit . $rnd . $storekey; //g�venlik ama�li hashli deger + $hashstr = $clientId . $oid . $amount . $okUrl . $failUrl . $islemtipi . $taksit . $rnd . $storekey; //g�venlik ama�li hashli deger $hash = base64_encode(pack('H*',sha1($hashstr))); @@ -809,12 +803,12 @@ $index1=0; $index2=0; - while($index1 < strlen($hashparams)) - { + while ($index1 < strlen($hashparams)) { $index2 = strpos($hashparams,":",$index1); $vl = $_POST[substr($hashparams,$index1,$index2- $index1)]; - if($vl == null) + if ($vl == NULL) { $vl = ""; + } $paramsval = $paramsval . $vl; $index1 = $index2 + 1; } @@ -823,24 +817,21 @@ $hash = base64_encode(pack('H*',sha1($hashval))); - if($paramsval != $hashparamsval || $hashparam != $hash) - { - uc_order_comment_save($order->order_id, 0, t('G�venlik Uyarisi. Sayisal Imza Ge�erli Degil'), 'admin'); + if ($paramsval != $hashparamsval || $hashparam != $hash) { + uc_order_comment_save($order->order_id, 0, t('G�venlik Uyarisi. Sayisal Imza Ge�erli Degil'), 'admin'); } $mdStatus = $_POST["mdStatus"]; $ErrMsg = $_POST["mdErrorMsg"]; - if($mdStatus == 1 || $mdStatus == 2 || $mdStatus == 3 || $mdStatus == 4) - { - $comment = t('Garanti bankssi ile �deme alidi.'); + if ($mdStatus == 1 || $mdStatus == 2 || $mdStatus == 3 || $mdStatus == 4) { + $comment = t('Garanti bankssi ile �deme alidi.'); uc_payment_enter($order->order_id, 'Garanti Bank', $_POST["amount"], 0, NULL, $comment); uc_order_comment_save($order->order_id, 0, t('Order created through website.'), 'admin'); $_SESSION['do_complete'] = TRUE; drupal_goto('cart/checkout/complete'); } - else - { + else { $message = t('Odemeniz GERCEKLESEMEMISTIR. Lutfen sepetinizi kontrol ederek tekrar deneyiniz.'); $message .= t('
Detay:'.$mdStatus.':'.$ErrMsg.'.'); drupal_set_message($message); @@ -848,7 +839,6 @@ drupal_goto('cart/checkout/review'); } } - /******************************************************************************* * Hook Functions (Ubercart) @@ -866,7 +856,6 @@ return $gateways; } - /******************************************************************************* * Callback Functions, Forms, and Tables ******************************************************************************/ @@ -922,16 +911,12 @@ } function uc_turkish_banks_charge($order_id, $amount, $data) { - - - if (!function_exists('curl_init')) { drupal_set_message(t('The Garanti Bank service requires cURL. Please talk to your system administrator to get this configured.')); return array('success' => FALSE); } - - // XML request sablonu + // XML request sablonu $request= "DATA=". "". "{NAME}". @@ -1023,7 +1008,6 @@ } curl_close($ch); - $Response =""; $OrderId =""; $AuthCode =""; @@ -1032,41 +1016,39 @@ $HOSTMSG =""; $response_tag="Response"; - $posf = strpos ( $result, ("<" . $response_tag . ">") ); - $posl = strpos ( $result, ("") ) ; + $posf = strpos($result, "<". $response_tag .">"); + $posl = strpos($result, ""); $posf = $posf+ strlen($response_tag) +2 ; - $Response = substr ( $result, $posf, $posl - $posf) ; + $Response = substr($result, $posf, $posl - $posf); $response_tag="OrderId"; - $posf = strpos ( $result, ("<" . $response_tag . ">") ); - $posl = strpos ( $result, ("") ) ; - $posf = $posf+ strlen($response_tag) +2 ; - $OrderId = substr ( $result, $posf , $posl - $posf ) ; + $posf = strpos($result, "<". $response_tag .">"); + $posl = strpos($result, ""); + $posf = $posf+ strlen($response_tag) +2; + $OrderId = substr($result, $posf, $posl - $posf); $response_tag="AuthCode"; - $posf = strpos ( $result, "<" . $response_tag . ">" ); - $posl = strpos ( $result, "" ) ; - $posf = $posf+ strlen($response_tag) +2 ; - $AuthCode = substr ( $result, $posf , $posl - $posf ) ; + $posf = strpos($result, "<". $response_tag .">"); + $posl = strpos($result, ""); + $posf = $posf+ strlen($response_tag) +2; + $AuthCode = substr($result, $posf, $posl - $posf); $response_tag="ProcReturnCode"; - $posf = strpos ( $result, "<" . $response_tag . ">" ); - $posl = strpos ( $result, "" ) ; - $posf = $posf+ strlen($response_tag) +2 ; - $ProcReturnCode = substr ( $result, $posf , $posl - $posf ) ; + $posf = strpos($result, "<". $response_tag .">"); + $posl = strpos($result, ""); + $posf = $posf+ strlen($response_tag) +2; + $ProcReturnCode = substr($result, $posf, $posl - $posf); $response_tag="ErrMsg"; - $posf = strpos ( $result, "<" . $response_tag . ">" ); - $posl = strpos ( $result, "" ) ; - $posf = $posf+ strlen($response_tag) +2 ; - $ErrMsg = substr ( $result, $posf , $posl - $posf ) ; - + $posf = strpos($result, "<". $response_tag .">"); + $posl = strpos($result, ""); + $posf = $posf+ strlen($response_tag) +2; + $ErrMsg = substr($result, $posf, $posl - $posf); $x_response_code = $Response; $x_response_text = $ErrMsg; $x_approval_code = $AuthCode; - if ($x_response_code != 'Approved') { $message = t('Credit card declined: !amount', array('!amount' => uc_currency_format($amount))); $result = array( @@ -1086,8 +1068,6 @@ ); } - uc_order_comment_save($order_id, $user->uid, $message, 'admin'); - return $result; }