Module for HostCMS 6.+

hostcms

 

The Fondy module is designed for HostCMS 6. +

Download it  here

Installation Instructions:

  1. In the menu “Content” -> “Online stores” choose the store to which you want to connect the module. In the upper horizontal menu, go to the section “Directories” -> “Payment Systems”. In the “Payment system” menu, select “Add”. In the field “Name” we enter the name of the payment system “Fondy”, fill the “Description” field arbitrarily, click “Apply”

  2. Screenshot_2On the “Payment Systems” menu opposite the “Fondy” item, we click the “Edit” button (the pencil icon). In the window for editing information about the payment system, in the “Additional” tab – we remember the value of the “Identifier” property (for example, 27).

  3. We go to the window for editing information about the payment (the “Basic” tab). Check the box next to “Activity”. In the “Processor” field you need to copy the code from the filefondyHandler.php(https://github.com/cloudipsp/hostcms/blob/master/fondyHandler.php). Then you need to do the following:

    а) in line «class Shop_Payment_System_HandlerXX extends Shop_Payment_System_Handler» instead of characters XX you must specify an identifier (from the “Additional” tab). The result should be a string like «class Shop_Payment_System_Handler27 extends Shop_Payment_System_Handler»;

    б) indicate your data in the code block below:

// ---------------------------------------------------------------------------------------------
// Настройки модуля
// ---------------------------------------------------------------------------------------------
    protected $_fondy_merchant_id = 'ID мерчанта'; // полученный в лчином кабинете Fondy
    protected $_fondy_redirect_mode = 0; // 1 - с перенаправлением, 0 - без перенаправления
    protected $_fondy_secret_key = 'секретный ключ'; // секретный ключ
    protected $_fondy_language = 'ru'; // язык, платежной системы
    // id валюты, в которой будет производиться платеж
    protected $_fondy_currency_id = 1; // 1 - рубли (RUR), 2 - евро (EUR), 3 - доллары (USD)
// ----------------------------------------------------------------------------------------------
// конец настроек
// ----------------------------------------------------------------------------------------------

Screenshot_3

Press the button “Apply”. The “Payment Systems Reference” window can now be closed.

  1. Go to the menu “Site Structure” -> “Typical Dynamic Pages” and open the “Online Store” folder. Then click on the “Edit” button (pencil icon) opposite the “Shopping Cart Online” item. In the opened window for editing a typical dynamic page, go to the “Page Settings” tab. In the field “Settings of a typical dynamic page” (before the line “// Adding goods to the basket”), you need to insert the following code of the Fondy handler (https://github.com/cloudipsp/hostcms/blob/master/cart_update.php):
    // ------------------------------------------------
    // Notification processing of payment from Fondy 
    // ------------------------------------------------
    if (isset($_GET['paymentcallback']) and $_GET['paymentcallback'] == 'fondy')
    {
        if (empty($_POST)){
            $input = json_decode(file_get_contents("php://input"));
            $_POST = array();
            foreach($input as $key=>$val)
            {
                $_POST[$key] =  $val ;
            }
        }   
        if (isset($_POST['order_status']) and $_POST['order_status'] == 'approved')
        {
            $order_id = explode('#', $_POST['order_id']); // Номер заказа
            $oShop_Order = Core_Entity::factory('Shop_Order')->find($order_id[0]);
            if (!is_null($oShop_Order->id))
            {
                //  of handler of the payment system
                Shop_Payment_System_Handler::factory($oShop_Order->Shop_Payment_System)
                ->shopOrder($oShop_Order)
                ->paymentProcessing();
            }
            exit();       
        }
    }
    // ------------------------------------------------
    // end of handler Fondy
    // ------------------------------------------------

Screenshot_1Press the button “Apply”. The window “List of typical dynamic pages” can now be closed, the configuration of the module is complete!

Podłącz się do FONDY i dowiedz się więcej!