Yeni Cevap 
 
Konuyu Değerlendir
  • 0 Oy - 0 Ortalama
  • 1
  • 2
  • 3
  • 4
  • 5
Ziraat XML sanalpos entegrasyonu PHP
Yazar Mesaj
metalboyii Çevrimdışı
Member
***

Mesajlar: 15
Katılım: May 2013
Rep Puanı: 0
Mesaj: #1
Toungue Ziraat XML sanalpos entegrasyonu PHP
Öncelikle merhaba
Ziraat bankası ile sanalpos entegrasyonu yapmaya çalışmaktayım.Durum olarak iki adet servis adresi mevcut bunlar;
https://mpi-test.ziraatbank.com.tr
https://sanalpos-test.ziraatbank.com.tr/Service.asmx

Mpı enrollment aşamasından geçiyorum Status Y aldığımda xml sanalpos adresine post ediyorum fakat bu haliyle 1001 veya 3001 hatası almaktayım.Kart bilgileri ve merchant no tamamen örnek için yazılmıştır.
Yanlış olan bir durum mevcutmudur?

Sanalposa gönderirken kullandığım kod aşağıdaki gibidir

Kod:
$client = new SoapClient("https://sanalpos-test.ziraatbank.com.tr/?WSDL");
$param=array('parameters' => array('xmlRequest'=>$request));
$result = $client->__call("Process",$param);
print($result->ProcessResult);

$resultDocument = new DOMDocument();
$resultDocument->loadXML($result->ProcessResult);
$resultNode = $resultDocument->getElementsByTagName("Result")->item(0);
$code = $resultNode->getElementsByTagName("Code")->item(0)->nodeValue;
$trnxId = $resultDocument->getElementsByTagName("TrnxID")->item(0)->nodeValue;  
$host = $resultDocument->getElementsByTagName("Host")->item(0);
$RC = null;
$message = null;
$authCode = null;
$RRN = null;

PHP bu öncesinde ;

<html>

<?php

function GenerateSaleRequest($merchantId, $merchantPassword, $cardNumber, $expiry, $cvv2, $brand, $amountType,$amountCode, $amount, $eci, $cavv)
{

                $xmlDocument = new DOMDocument( "1.0", "UTF-8" );


                $posRequest = $xmlDocument->createElement( "PosRequest" );
                $originator = $xmlDocument->createElement( "Originator" );
                $acquirer = $xmlDocument->createElement( "Acquirer" );

                $acquirer->setAttribute( "ID", "1" );

                $merchant = $xmlDocument->createElement( "Merchant" );

                $merchant->setAttribute( "HostMerchantId", $merchantId);
                $merchant->setAttribute( "Password", $merchantPassword );

                $trnx = $xmlDocument->createElement( "Trnx" );
                $trnx->setAttribute( "Type", "Sale" );

                $payment = $xmlDocument->createElement( "Payment" );

                $pan = $xmlDocument->createElement( "PAN" );

                $pan->setAttribute( "PAN", $cardNumber); // Kart Numarası
                $pan->setAttribute( "Expiry", $expiry);
                $pan->setAttribute( "CVV2",$cvv2);
                $pan->setAttribute( "Brand", $brand);

                $pamount = $xmlDocument->createElement("Amount");
                $pamount->setAttribute( "Amount", $amount); // 10,25 YTL
                $pamount->setAttribute( "Type", $amountType);
                $pamount->setAttribute( "Code", $amountCode);

                $originator->appendChild($acquirer);
                $originator->appendChild($merchant);

                $payment->appendChild($pan);
                $payment->appendChild($pamount);

                if( $eci != "" )
                {
                              
                               $options = $xmlDocument->createElement("Options");
                              
                               $peci = $xmlDocument->createElement("Item");
                    $peci->setAttribute("Name", "ECI");
                    $peci->setAttribute("Value", $eci);

                                              
                               $pcavv = $xmlDocument->createElement("Item");
                    $pcavv->setAttribute("Name", "CAVV");
                    $pcavv->setAttribute("Value", $cavv);
                        
                               $options->appendChild($peci);
                               $options->appendChild($pcavv);
                               $payment->appendChild($options);                    
                }

                $posRequest->appendChild($originator);
                $posRequest->appendChild($trnx);
                $posRequest->appendChild($payment);
                $xmlDocument->appendChild($posRequest);
                
                return $xmlDocument->saveXML();
}

$request = GenerateSaleRequest("000000000070780", "", "4446760000012552", "200910", "123", "Visa", "1","949", "1100", "", "");

// print $request;

$client = new SoapClient("https://sanalpos-test.ziraatbank.com.tr/?WSDL");
$param=array('parameters' => array('xmlRequest'=>$request));
$result = $client->__call("Process",$param);
print($result->ProcessResult);

$resultDocument = new DOMDocument();
$resultDocument->loadXML($result->ProcessResult);
$resultNode = $resultDocument->getElementsByTagName("Result")->item(0);
$code = $resultNode->getElementsByTagName("Code")->item(0)->nodeValue;
$trnxId = $resultDocument->getElementsByTagName("TrnxID")->item(0)->nodeValue;  
$host = $resultDocument->getElementsByTagName("Host")->item(0);
$RC = null;
$message = null;
$authCode = null;
$RRN = null;


if($host != null )
{            
                foreach($host->childNodes as $node)
                {
                               switch($node->localName)
                               {
                                               case "RC":
                                                               $RC = $node->nodeValue;
                                               break;
                                               case "Message":
                                                               $message = $node->nodeValue;
                                               break;
                                               case "AuthCode":
                                                               $authCode = $node->nodeValue;
                                               break;
                                               case "RRN":
                                                               $RRN = $node->nodeValue;
                                               break;
                               }
                }
                // if $host.getElementsByTagName("Message") supported
                /*
                $RCNode = $host.getElementsByTagName("RC")->item(0);
                                                                              
                if( $RCNode != null )
                               $RC = $RCNode.nodeValue;
                
                $messageNode = $host.getElementsByTagName("Message")->item(0);          
                if($messageNode != null)
                               $message = $messageNode.nodeValue;

                $authCodeNode = $host.getElementsByTagName("AuthCode")->item(0);      
                if($authCodeNode != null)
                               $authCode = $authCodeNode.nodeValue;
                              

                $RRNNode = $host.getElementsByTagName("RRN")->item(0);              
                if($RRNNode != null)
                               $RRN = $RRNNode.nodeValue;*/
}


if( $code == 0 )
                print("<br>İşlem Başarılı<br>");
else
                print("İşlem İsteği Reddedildi <br>");    


                print("İşlem Numarası :");print($trnxId);print("<br>");
                print("Sanal Pos Cevabı :");print($code);print("<br>");
                print("Provizyon Cevabı :");print($RC);print("<br>");
                print("Provizyon Mesajı :");print($message);print("<br>");
                print("Provizyon Kodu :");print($authCode);print("<br>");
                print("Provizyon İşlem No :");print($RRN);print("<br>");

?>
</html>
21-05-2013 09:43
Bu kullanıcının gönderdiği tüm mesajları bul Bu mesajı alıntı yap
Yeni Cevap 


Benzer Konular...
Konu: Yazar Cevaplar: Gösterim: Son Mesaj
  Ziraat Bankası Ortak Ödeme Sistemi Aggromore 3 3,664 05-12-2014 20:01
Son Mesaj: gulendam
Rolleyes Php Bankasya sanalpos hafifletilmiş örnekleme metalboyii 4 4,283 05-11-2014 18:34
Son Mesaj: yusuf
Wink Php 3D secure İşbankası sanalpos hafifletilmiş örnekleme metalboyii 2 5,097 02-06-2014 14:13
Son Mesaj: rezaradmehr
  Php Ziraat Ortak Ödeme Hafifletilmiş örnekleme metalboyii 0 2,174 21-01-2014 17:16
Son Mesaj: metalboyii
Toungue Php İşbankası sanalpos hafifletilmiş örnekleme metalboyii 0 1,980 15-01-2014 11:03
Son Mesaj: metalboyii
  Php 3D secure Bankasya sanalpos hafifletilmiş örnekleme metalboyii 0 2,131 15-01-2014 10:59
Son Mesaj: metalboyii

Foruma Git:


Bu konuyu görüntüleyen kullanıcı(lar): 1 Ziyaretçi