Написание плагина оплаты

  • 0 Ответов
  • 124 Просмотров

0 Пользователей и 1 Гость просматривают эту тему.

*

Оффлайн rkron

Написание плагина оплаты
« : 02.03.2017, 12:25:28 »
Прошу помощи у форумчан в написании плагина оплаты joomla+joomshoping для Казкоммерц банка. В Казкоме для оплаты требуется отправка подписанного запроса. В подпись включается сертификат номер ордера и сумма оплаты. Все это шифруется инвертируется и отправляется банку. Вопрос как правильнее включить сертификат в отправку запроса. Принцип работы здесь https://testpay.kkb.kz/doc/htm/ расписан.
[spoiler]<?php



defined('_JEXEC') or die();
?>
<div class="col100">
<fieldset class="adminform">

   <!-- test mode alert -->

   <?php if ($params['testmode'] == '1') { ?>
   <div class="alert alert-warning alert-dismissible" role="alert">
      <button type="button" class="close" data-dismiss="alert" aria-label="Close"><span aria-hidden="true">&times;</span></button>
      <?php echo _JSHOP_KBK_TESTMODE_ALERT; ?>
   </div>
   <?php } ?>
   <table class="admintable" width = "100%" >

   <!-- test mode -->

      <tr>
         <td style="width:250px;" class="key">
            <?php echo _JSHOP_TESTMODE; ?>
         </td>
         <td>
            <?php
               print JHTML::_('select.booleanlist', 'pm_params[testmode]', 'class = "inputbox" size = "1"', $params['testmode']);
               echo " ".JHTML::tooltip(_JSHOP_KBK_TESTMODE_DESC);
            ?>
         </td>
      </tr>

         <!-- Merchant certificate ID -->

      <tr>
         <td  class="key">
            <?php echo _JSHOP_KBK_MERCHANT_CERTIFICATE_ID; ?>
         </td>
         <td>
            <input type="text" class="inputbox" name="pm_params[certificate_id]"  size="45" value="<?php echo $params['certificate_id']?>">
            <?php echo JHTML::tooltip(_JSHOP_KBK_MERCHANT_CERTIFICATE_ID_DESC);?>
         </td>
      </tr>

   <!-- Merchant name -->

      <tr>
         <td  class="key">
            <?php echo _JSHOP_KBK_MERCHANT_NAME; ?>
         </td>
         <td>
            <input type="text" class="inputbox" name="pm_params[name]"  size="45" value="<?php echo $params['name']?>">
            <?php echo JHTML::tooltip(_JSHOP_KBK_MERCHANT_NAME_DESC);?>
         </td>
      </tr>
       
       


   <!-- Private key pass -->

      <tr>
         <td  class="key">
            <?php echo _JSHOP_KBK_PRIVATE_KEY_PASS; ?>
         </td>
         <td>
            <input type="text" class="inputbox" name="pm_params[merchant_pass]"  size="45" value="<?php echo $params['merchant_pass']?>">
            <?php echo JHTML::tooltip(_JSHOP_KBK_PRIVATE_KEY_PASS_DESC);?>
         </td>
      </tr>

         

         <!-- Merchant ID -->

      <tr>
         <td  class="key">
            <?php echo _JSHOP_KBK_MERCHANT_ID; ?>
         </td>
         <td>
            <input type="text" class="inputbox" name="pm_params[merchant_id]"  size="45"  value="<?php echo $params['merchant_id']?>">
            <?php echo JHTML::tooltip(_JSHOP_KBK_MERCHANT_ID_DESC);?>
         </td>
      </tr>

       

   <!-- transaction -->

      <tr>
         <td class="key">
            <?php echo _JSHOP_TRANSACTION_PENDING;?>
         </td>
         <td>
            <?php
               echo JHTML::_('select.genericlist',$orders->getAllOrderStatus(), 'pm_params[transaction_pending_status]', 'class = "inputbox" size = "1"', 'status_id', 'name', $params['transaction_pending_status']);
               echo " ".JHTML::tooltip(_JSHOP_KBK_TRANSACTION_PENDING_DESC);
            ?>
         </td>
      </tr>
      <tr>
         <td class="key">
            <?php echo _JSHOP_TRANSACTION_END;?>
         </td>
         <td>
            <?php
               echo JHTML::_('select.genericlist',$orders->getAllOrderStatus(), 'pm_params[transaction_end_status]', 'class = "inputbox" size = "1"', 'status_id', 'name', $params['transaction_end_status']);
               echo " ".JHTML::tooltip(_JSHOP_KBK_TRANSACTION_END_DESC);
            ?>
         </td>
      </tr>
      <tr>
         <td class="key">
            <?php echo _JSHOP_TRANSACTION_FAILED;?>
         </td>
         <td>
            <?php
               echo JHTML::_('select.genericlist',$orders->getAllOrderStatus(), 'pm_params[transaction_failed_status]', 'class = "inputbox" size = "1"', 'status_id', 'name', $params['transaction_failed_status']);
               echo " ".JHTML::tooltip(_JSHOP_KBK_TRANSACTION_FAILED_DESC);
            ?>
         </td>
      </tr>
   </table>
</fieldset> 
<div class="clr"></div>
[/spoiler]
все классы сведены в хелпер
[spoiler]<?php



class KKBsign {
    // -----------------------------------------------------------------------------------------------
    function load_private_key($filename, $password = NULL){
        $this->ecode=0;
        if(!is_file($filename)){ $this->ecode=4; $this->estatus = "[KEY_FILE_NOT_FOUND]"; return false;};
        $c = file_get_contents($filename);
        if(strlen(trim($password))>0){$prvkey = openssl_get_privatekey($c, $password); $this->parse_errors(openssl_error_string());
        } else {$prvkey = openssl_get_privatekey($c); $this->parse_errors(openssl_error_string());};
        if(is_resource($prvkey)){ $this->private_key = $prvkey; return $c;}
        return false;
    }
    // -----------------------------------------------------------------------------------------------
   
    function invert(){ $this->invert = 1;}
    // -----------------------------------------------------------------------------------------------
   
    function reverse($str){   return strrev($str);}
    // -----------------------------------------------------------------------------------------------
    function sign($str){
        if($this->private_key){
            openssl_sign($str, $out, $this->private_key);
            if($this->invert == 1) $out = $this->reverse($out);
            //openssl_free_key($this->private_key);
            return $out;
        };
    }
    // -----------------------------------------------------------------------------------------------
    function sign64($str){   return base64_encode($this->sign($str));}
    // -----------------------------------------------------------------------------------------------
    function check_sign($data, $str, $filename){
        if($this->invert == 1)  $str = $this->reverse($str);
        if(!is_file($filename)){ $this->ecode=4; $this->estatus = "[KEY_FILE_NOT_FOUND]"; return 2;};
        $this->pubkey = file_get_contents($filename);
        $pubkeyid = openssl_get_publickey($this->pubkey);
        $this->parse_errors(openssl_error_string());
        if (is_resource($pubkeyid)){
            $result = openssl_verify($data, $str, $pubkeyid);
            $this->parse_errors(openssl_error_string());
            openssl_free_key($pubkeyid);
            return $result;
        };
        return 3;
    }
    // -----------------------------------------------------------------------------------------------
    function check_sign64($data, $str, $filename){
        return $this->check_sign($data, base64_decode($str), $filename);
    }
    // -----------------------------------------------------------------------------------------------
    function parse_errors($error){
        // -----===++[Parses error to errorcode and message]++===-----
        /*error:0906D06C - Error reading Certificate. Verify Cert type.
        error:06065064 - Bad decrypt. Verify your Cert password or Cert type.
        error:0906A068 - Bad password read. Maybe empty password.*/
        if (strlen($error)>0){
            if (strpos($error,"error:0906D06C")>0){$this->ecode = 1; $this->estatus = "Error reading Certificate. Verify Cert type.";};
            if (strpos($error,"error:06065064")>0){$this->ecode = 2; $this->estatus = "Bad decrypt. Verify your Cert password or Cert type.";};
            if (strpos($error,"error:0906A068")>0){$this->ecode = 3; $this->estatus = "Bad password read. Maybe empty password.";};
            if ($this->ecode = 0){$this->ecode = 255; $this->estatus = $error;};
        };
    }
};

class XML {

    var $parser;
    var $xarray = array();
    var $lasttag;

    function xml()
    {   $this->parser = xml_parser_create();
        xml_set_object($this->parser, $this);
        xml_parser_set_option($this->parser, XML_OPTION_CASE_FOLDING, true);
        xml_set_element_handler($this->parser, "tag_open", "tag_close");
        xml_set_character_data_handler($this->parser, "cdata");
    }

    function parse($data)
    {
        xml_parse($this->parser, $data);
        ksort($this->xarray,SORT_STRING);
        return $this->xarray;
    }

    function tag_open($parser, $tag, $attributes)
    {
        $this->lasttag = $tag;
        $this->xarray['TAG_'.$tag] = $tag;
        if (is_array($attributes)){
            foreach ($attributes as $key => $value) {
                $this->xarray[$tag.'_'.$key] = $value;
            };
        };
    }

    function cdata($parser, $cdata)
    {   $tag = $this->lasttag;
        $this->xarray[$tag.'_CHARDATA'] = $cdata;
    }

    function tag_close($parser, $tag)
    {}
}
// -----------------------------------------------------------------------------------------------
function process_XML($filename,$reparray) {
    // -----===++[Process XML template - replaces tags in file to array values]++===-----
    // variables:
    // $filename - string: name of XML template
    // $reparray - array: data to replace
    //
    // XML template tag format:[tag name] example: [MERCHANT_CERTIFICATE_ID]
    //
    // Functionality:Searches file for array index and replaces to value
    // example: in array > $reparray['MERCHANT_CERTIFICATE_ID'] = "12345"
    // before replace: cert_id="[MERCHANT_CERTIFICATE_ID]"
    // after replace: cert_id="12345"
    // if operation successful returns file contents with replaced values
    // if template not found returns "[ERROR]"
    //
   
    if(is_file($filename)){
        $content = file_get_contents($filename);
        foreach ($reparray as $key => $value) {$content = str_replace("[".$key."]",$value,$content);};
        return $content;
    } else {return "[ERROR]";};
};

function createQuery($template, $repArray) {
    $content = $template;
    foreach ($repArray as $key => $value)
    {
        $content = str_replace("[".$key."]",$value, $content);
    };

    return $content;

};
// -----------------------------------------------------------------------------------------------
function split_sign($xml,$tag){
    // -----===++[Process XML string to array of values]++===-----
    // variables:
    // $xml - string: XML string
    // $tag - string: split tag name
    // $array["LETTER"] = an XML section enclosed in <$tag></$tag>
    // $array["SIGN"] = an XML sign section enclosed in <$tag+"_sign"></$tag+"_sign">
    // $array["RAWSIGN"] = an XML sign section with stripped <$tag+"_sign"></$tag+"_sign"> tags
    // example:
    // income data:
    // $xml = "<order order_id="12345"><department amount="10"/></order><order_sign type="SHA/RSA">ljkhsdfmnuuewrhkj</order_sign>"
    // $tag = "ORDER"
    // result:
    // $array["LETTER"] = "<order order_id="12345"><department amount="10"/></order>"
    // $array["SIGN"] = "<order_sign type="SHA/RSA">ljkhsdfmnuuewrhkj</order_sign>"
    // $array["RAWSIGN"] = "ljkhsdfmnuuewrhkj"
    //
    // -----===++[��������� XML ������ � ��������������]++===-----
    // ����������:
    // $xml - ������: XML ������
    // $tag - ������: ��� ���� �����������
    // $array["LETTER"] = XML ������ ����������� � <$tag></$tag>
    // $array["SIGN"] = XML ������ ������� ����������� � <$tag+"_sign"></$tag+"_sign">
    // $array["RAWSIGN"] = XML ������ ������� � ����������� <$tag+"_sign"></$tag+"_sign"> ������
    // ������:
    // ������� ������:
    // $xml = "<order order_id="12345"><department amount="10"/></order><order_sign type="SHA/RSA">ljkhsdfmnuuewrhkj</order_sign>"
    // $tag = "ORDER"
    // ���������:
    // $array["LETTER"] = "<order order_id="12345"><department amount="10"/></order>"
    // $array["SIGN"] = "<order_sign type="SHA/RSA">ljkhsdfmnuuewrhkj</order_sign>"
    // $array["RAWSIGN"] = "ljkhsdfmnuuewrhkj"


    $array = array();
    $letterst = stristr($xml,"<".$tag);
    $signst = stristr($xml,"<".$tag."_SIGN");
    $signed = stristr($xml,"</".$tag."_SIGN");
    $doced = stristr($signed,">");
    $array['LETTER'] = substr($letterst,0,-strlen($signst));
    $array['SIGN'] = substr($signst,0,-strlen($doced)+1);
    $rawsignst = stristr($array['SIGN'],">");
    $rawsigned = stristr($rawsignst,"</");
    $array['RAWSIGN'] = substr($rawsignst,1,-strlen($rawsigned));
    return $array;
}

class KkbHelper
{
    private $MERCHANT_CERTIFICATE_ID;
    private $MERCHANT_NAME;
    private $MERCHANT_ID;
    private $PRIVATE_KEY_FN;
    private $PRIVATE_KEY_PASS;
    private $XML_TEMPLATE_FN;
    private $XML_COMMAND_TEMPLATE_FN;
    private $PUBLIC_KEY_FN;
    private $ACTION_URL;

    public function __construct($MERCHANT_CERTIFICATE_ID, $MERCHANT_NAME, $MERCHANT_ID, $PRIVATE_KEY_FN, $PRIVATE_KEY_PASS,  $PUBLIC_KEY_FN, $ACTION_URL)
    {
        $this->MERCHANT_CERTIFICATE_ID = $MERCHANT_CERTIFICATE_ID;
        $this->MERCHANT_NAME = $MERCHANT_NAME;
        $this->MERCHANT_ID = $MERCHANT_ID;
        $this->PRIVATE_KEY_FN = $PRIVATE_KEY_FN;
        $this->PRIVATE_KEY_PASS = $PRIVATE_KEY_PASS;

        $this->PUBLIC_KEY_FN = $PUBLIC_KEY_FN;

        $this->XML_TEMPLATE_FN = '<certificate_id="[MERCHANT_CERTIFICATE_ID]" name="[MERCHANT_NAME]"><order order_id="[ORDER_ID]" amount="[AMOUNT]" currency="[CURRENCY]">< merchant_id="[MERCHANT_ID]" amount="[AMOUNT]"/></order></merchant>';
        $this->XML_COMMAND_TEMPLATE_FN = '<merchant_id="[MERCHANT_ID]"><command type="[COMMAND]"/><payment reference="[REFERENCE_ID]" approval_code="[APPROVAL_CODE]" orderid="[ORDER_ID]" amount="[AMOUNT]" currency_code="[CURRENCY]"/><reason>[REASON]</reason></merchant>';
        $this->ACTION_URL = $ACTION_URL;
    }

    public function getActionUrl()
    {
        return $this->ACTION_URL;
    }

    public function process_request($order_id, $currency_code, $amount, $b64=true) {

        if (strlen($order_id)>0){
            if (is_numeric($order_id)){
                if ($order_id>0){
                    $order_id = sprintf ("%06d",$order_id);
                } else { return "Null Order ID";};
            } else { return "Order ID must be number";};
        } else { return "Empty Order ID";};

        if (strlen($currency_code)==0){return "Empty Currency code";};
        if ($amount==0){return "Nothing to charge";};

        $request = array();
        $request['MERCHANT_CERTIFICATE_ID'] = $this->MERCHANT_CERTIFICATE_ID;
        $request['MERCHANT_NAME'] = $this->MERCHANT_NAME;
        $request['ORDER_ID'] = $order_id;
        $request['CURRENCY'] = $currency_code;
        $request['MERCHANT_ID'] = $this->MERCHANT_ID;
        $request['AMOUNT'] = $amount;

        $kkb = new KKBSign();
        $kkb->invert();
        if (!$kkb->load_private_key($this->PRIVATE_KEY_FN, $this->PRIVATE_KEY_PASS)){
            if ($kkb->ecode>0){return $kkb->estatus;};
        };

        $result = createQuery($this->XML_TEMPLATE_FN, $request);
        if (strpos($result,"[RERROR]")>0){ return "Error reading XML template.";};

        $result_sign = '<merchant_sign type="RSA">'.$kkb->sign64($result).'</merchant_sign>';
        $xml = "<document>".$result.$result_sign."</document>";
        if ($b64){return base64_encode($xml);} else {return $xml;};
    }

    public function process_response($response) {

        $xml_parser = new xml();
        $result = $xml_parser->parse($response);
        if (in_array("ERROR",$result)){
            return $result;
        };
        if (in_array("DOCUMENT",$result)){
            $kkb = new KKBSign();
            $kkb->invert();
            $data = split_sign($response, "BANK");
            $check = $kkb->check_sign64($data['LETTER'], $data['RAWSIGN'], $this->PUBLIC_KEY_FN);
            if ($check == 1)
                $data['CHECKRESULT'] = "[SIGN_GOOD]";
            elseif ($check == 0)
                $data['CHECKRESULT'] = "[SIGN_BAD]";
            else
                $data['CHECKRESULT'] = "[SIGN_CHECK_ERROR]: ".$kkb->estatus;
            return array_merge($result,$data);
        };
        return "[XML_DOCUMENT_UNKNOWN_TYPE]";
    }

    public function process_refund($reference, $approval_code, $order_id, $currency_code, $amount, $reason) {

        if(!$reference) return "Empty Transaction ID";


        if (strlen($order_id)>0){
            if (is_numeric($order_id)){
                if ($order_id>0){
                    $order_id = sprintf ("%06d",$order_id);
                } else { return "Null Order ID";};
            } else { return "Order ID must be number";};
        } else { return "Empty Order ID";};

        if(!$reason) $reason = "Transaction revert";

        if (strlen($currency_code)==0){return "Empty Currency code";};
        if ($amount==0){return "Nothing to charge";};

        $request = array();
        $request['MERCHANT_ID'] = $this->MERCHANT_ID;
        $request['MERCHANT_NAME'] = $this->MERCHANT_NAME;
        $request['COMMAND'] = 'reverse';
        $request['REFERENCE_ID'] = $reference;
        $request['APPROVAL_CODE'] = $approval_code;
        $request['ORDER_ID'] = $order_id;
        $request['CURRENCY'] = $currency_code;
        //$request['MERCHANT_ID'] = $this->MERCHANT_ID;
        $request['AMOUNT'] = $amount;
        $request['REASON'] = $reason;

        $kkb = new KKBSign();
        $kkb->invert();
        if (!$kkb->load_private_key($this->PRIVATE_KEY_FN,$this->PRIVATE_KEY_PASS)){
            if ($kkb->ecode>0){return $kkb->estatus;};
        };

        $result = createQuery($this->XML_COMMAND_TEMPLATE_FN, $request);
        if (strpos($result,"[RERROR]")>0){ return "Error reading XML template.";};
        $result_sign = '<merchant_sign type="RSA" cert_id="' . $this->MERCHANT_CERTIFICATE_ID . '">'.$kkb->sign64($result).'</merchant_sign>';
        $xml = "<document>".$result.$result_sign."</document>";
        return $xml;
    }



    public function process_complete($reference, $approval_code, $order_id, $currency_code, $amount) {

        if(!$reference) return "Empty Transaction ID";

        if (strlen($order_id)>0) {
            if (is_numeric($order_id)){
                if ($order_id>0){
                    $order_id = sprintf ("%06d",$order_id);
                } else { return "Null Order ID";};
            } else { return "Order ID must be number";};
        } else { return "Empty Order ID";};

        if (strlen($currency_code)==0){return "Empty Currency code";};
        if ($amount==0){return "Nothing to charge";};

        $request = array();
        $request['MERCHANT_ID'] = $this->MERCHANT_ID;
        $request['MERCHANT_NAME'] = $this->MERCHANT_NAME;
        $request['COMMAND'] = 'complete';
        $request['REFERENCE_ID'] = $reference;
        $request['APPROVAL_CODE'] = $approval_code;
        $request['ORDER_ID'] = $order_id;
        $request['CURRENCY'] = $currency_code;
        //$request['MERCHANT_ID'] = $this->MERCHANT_ID;
        $request['AMOUNT'] = $amount;
        $request['REASON'] = '';

        $kkb = new KKBSign();
        $kkb->invert();
        if (!$kkb->load_private_key($this->PRIVATE_KEY_FN, $this->PRIVATE_KEY_PASS)){
            if ($kkb->ecode>0){return $kkb->estatus;};
        };

        $result = createQuery($this->XML_COMMAND_TEMPLATE_FN, $request);
        if (strpos($result,"[RERROR]")>0){ return "Error reading XML template.";};
        $result_sign = '<merchant_sign type="RSA" cert_id="' . $this->MERCHANT_CERTIFICATE_ID . '">'.$kkb->sign64($result).'</merchant_sign>';
        $xml = "<document>".$result.$result_sign."</document>";
        return $xml;
    }


    public function request($url)
    {

       
        $ch = curl_init();
        curl_setopt($ch, CURLOPT_URL,$url); // set url to post to
        curl_setopt($ch, CURLOPT_FAILONERROR, 1);
        curl_setopt($ch, CURLOPT_FOLLOWLOCATION, 1);// allow redirects
        curl_setopt($ch, CURLOPT_RETURNTRANSFER,1); // return into a variable
        curl_setopt($ch, CURLOPT_TIMEOUT, 3); // times out after 4s
        //curl_setopt($ch, CURLOPT_STDERR, $fOut );
        //curl_setopt($ch, CURLOPT_VERBOSE, 1);
        curl_setopt($ch, CURLOPT_HTTP_VERSION, CURL_HTTP_VERSION_1_0);
        $result = curl_exec($ch); // run the whole process
        curl_close($ch);

//        $xml_parser = new xml();
//        $result = $xml_parser->parse($result);

        return $result;
    }

}
[/spoiler]
запросы
[spoiler]<?php



defined('_JEXEC') or die('Restricted access');

require("helper_kkb.php");

class pm_kbk extends PaymentRoot {

       
    function showPaymentForm($params, $pmconfigs) {
        include(dirname(__FILE__)."/paymentform.php");
    }

    function showAdminFormParams($params) {
        $jmlThisDocument = JFactory::getDocument();
        switch ($jmlThisDocument->language) {
            case 'en-gb': include(JPATH_SITE.'/administrator/components/com_jshopping/lang/en-GB_kbk.php'); $language = 'en'; break;
            case 'ru-ru': include(JPATH_SITE.'/administrator/components/com_jshopping/lang/ru-RU_kbk.php'); $language = 'ru'; break;
            default: include(JPATH_SITE.'/administrator/components/com_jshopping/lang/ru-RU_kbk.php');
        }
       
        $array_params = array('testmode', 'certificate_id', 'name',  'merchant_pass', 'merchant_id',  'transaction_end_status', 'transaction_pending_status', 'transaction_failed_status');
       
        foreach ($array_params as $key)
            if (!isset($params[$key]))
                $params[$key] = '';
        $orders      = JModelLegacy ::getInstance('orders', 'JshoppingModel');
        $currency   = JModelLegacy ::getInstance('currencies', 'JshoppingModel');
       
        include(dirname(__FILE__)."/adminparamsform.php");   
       
        jimport('joomla.html.pane');
    }
   
   
    function checkTransaction($pmconfigs, $order, $act){
        $jshopConfig = JSFactory::getConfig();
        $session     = JFactory::getSession();
       
        if ($pmconfigs['testmode']){
            $host = "testpay.kkb.kz/jsp/process/logon.jsp";
        } else{
            $host = "epay.kkb.kz/jsp/process/logon.jsp";
        }

       $post = JFactory::getApplication()->input->post->getArray();

       $helper = $this->getKkbHelper($method);
     

        return array(1, '',  $transaction, $transactiondata);
    }

   

    function showEndForm($pmconfigs, $order){
        $jshopConfig = JSFactory::getConfig();
        $pm_method = $this->getPmMethod();

         if ($pmconfigs['testmode']){
            $host = "testpay.kkb.kz/jsp/process/logon.jsp";
        } else{
            $host = "epay.kkb.kz/jsp/process/logon.jsp";
        }
       
         $uri = JURI::getInstance();       
         $liveurlhost = $uri->toString(array("scheme",'host', 'port'));

          
         
         if ($pmconfigs['notifyurlsef']){
        $notify_url = $liveurlhost.SEFLink("index.php?option=com_jshopping&controller=checkout&task=step7&act=notify&js_paymentclass=".$pm_method->payment_class."&no_lang=1");
        }else{
        $notify_url = JURI::root()."index.php?option=com_jshopping&controller=checkout&task=step7&act=notify&js_paymentclass=".$pm_method->payment_class."&no_lang=1";
        }
        $return = $liveurlhost.SEFLink("index.php?option=com_jshopping&controller=checkout&task=step7&act=return&js_paymentclass=".$pm_method->payment_class);
        $cancel_return = $liveurlhost.SEFLink("index.php?option=com_jshopping&controller=checkout&task=step7&act=cancel&js_paymentclass=".$pm_method->payment_class);

        $currency_id = 398; //KZT
        $helper = $this->getKkbHelper($method);
        $content = $helper->process_request($order_id, $currency_id, $amount, false);
        $url = $helper->getActionUrl();
        $message = ' url:' . $url;
        $message .= ' Xml: ' . $content;
        $this->debugLog($message, "KKB: _sendRequest:", 'debug');

    ?>
    <html>
        <head>
            <meta http-equiv="content-type" content="text/html; charset=utf-8" />           
        </head>
        <body>
            <form id="paymentform" action="https://<?php print $host?>" name = "paymentform" method = "post">
              <input type="hidden" name="Signed_Order_B64" value="' . base64_encode($content). '">
              <input type='hidden' name='Language' value='utf-8'>
              <input type='hidden' name='email' value='<?php print $order->email?>'>
              <input type='hidden' name='BackLink' value='<?php print $notify_url?>'>
              <input type='hidden' name='FailureBackLink' value='<?php print $return?>'>
         <input type='hidden' name='PostLink' value='<?php print $cancel_return?>'>
              <input type="hidden" name="appendix" value=""/>
       </form>       
        <?php print _JSHOP_REDIRECT_TO_PAYMENT_PAGE?>
        <br>
        <script type="text/javascript">document.getElementById('paymentform').submit();</script>
        </body>
        </html>
        <?php
        die();             
    }

    function getUrlParams($pmconfigs){
        return array();
    } 
   
    function getErrorMessage(){
        if ($this->_errormessage==""){
            $this->_errormessage = _JSHOP_ERROR_PAYMENT_DATA;
        }
    return $this->_errormessage;
    }

    }
   
    

?>
[/spoiler]
помогите кто чем может