Payment module Hostcms

You can download the module here

  1. In the menu Content -> Web-stores select the store, to which the module is to be connected. In the top horizontal menu select the section Directory -> Payment systems. In the Payment system menu select Add. In the field Name enter the payment system name Fondy, fill the field Description at your own choosing and click Apply.

  2. In the menu “Payment systems directory” click “Edit” (pencil icon) next to Fondy. In the payment system information edit window select the tab “Additional” and memorize the “Identifier” value (for example, 27).
  3. Open the payment system information edit window (Main tab). Tick “Activity”. Copy the code from the file in the field “Processor” fondyHandler.php(https://github.com/cloudipsp/hostcms/blob/master/fondyHandler.php).Then do the following:
  1. In the line «class Shop_Payment_System_HandlerXX extends Shop_Payment_System_Handler» instead of XX symbols enter the identifier (from “Additional” tab). The result should be the line like «class Shop_Payment_System_Handler27 extends Shop_Payment_System_Handler»;
  2. Enter your information in the code block below:
// ---------------------------------------------------------------------------------------------
// Module settings
// ---------------------------------------------------------------------------------------------
protected $_fondy_merchant_id = 'merchant ID '; // from Fondy control panel
protected $_fondy_redirect_mode = 0; // 1 - with redirection, 0 - without redirection
protected $_fondy_secret_key = 'secret key'; // secret key
protected $_fondy_language = 'ru'; // payment system language
// id of the payment currency
protected $_fondy_currency_id = 1; // 1 - rubles (RUR), 2 - euro (EUR), 3 - dollars (USD)
// ----------------------------------------------------------------------------------------------
// end of settings
// ----------------------------------------------------------------------------------------------

  1. Click “Apply”. Now you can close the “Payment systems directory” window.
  2. Enter the menu “Website structure” – > “Dynamic page templates” and open the folder “Web-store”. Click “Edit” (pencil icon) next to “Web-store cart”. The dynamic page template edit window will open, select “Page settings” tab. Enter the following code of the Fondy processor in the field «Dynamic page template settings» (before the line «// Add products to the cart») (https://github.com/cloudipsp/hostcms/blob/master/cart_update.php):
    // ------------------------------------------------
    //Processing of the payment notification 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']); // Order ID
            $oShop_Order = Core_Entity::factory('Shop_Order')->find($order_id[0]);
            if (!is_null($oShop_Order->id))
            {
                // Launch payment system processor
                Shop_Payment_System_Handler::factory($oShop_Order->Shop_Payment_System)
->shopOrder($oShop_Order)
->paymentProcessing();
}
            exit();  
}
}
    // ------------------------------------------------
    //end of Fondy processor
// ------------------------------------------------
  1. Click “Apply”. Now you can close the “Dynamic page templates list” window, the module set up is compete!

Connect to FONDY
and learn more!