Ejemplo n.º 1
0
 public function payment()
 {
     global $cookie, $cart;
     $id_currency = (int) $this->getModuleCurrency($cart);
     // If the currency is forced to a different one than the current one, then the cart must be updated
     if ($cart->id_currency != $id_currency) {
         if (Db::getInstance()->execute('UPDATE ' . _DB_PREFIX_ . 'cart SET id_currency = ' . (int) $id_currency . ' WHERE id_cart = ' . (int) $cart->id)) {
             $cart->id_currency = $id_currency;
         }
     }
     $currency = new Currency($id_currency);
     $language = new Language($cart->id_lang);
     $customer = new Customer($cart->id_customer);
     $carrier = new Carrier($cart->id_carrier, $cart->id_lang);
     $id_zone = self::MysqlGetValue('SELECT id_zone FROM ' . _DB_PREFIX_ . 'address a INNER JOIN ' . _DB_PREFIX_ . 'country c ON a.id_country = c.id_country WHERE id_address = ' . (int) $cart->id_address_delivery);
     require_once dirname(__FILE__) . '/mapi/mapi_package.php';
     $hipayAccount = $this->prod ? Configuration::get('HIPAY_ACCOUNT_' . $currency->iso_code) : Configuration::get('HIPAY_ACCOUNT_TEST_' . $currency->iso_code);
     $hipayPassword = $this->prod ? Configuration::get('HIPAY_PASSWORD_' . $currency->iso_code) : Configuration::get('HIPAY_PASSWORD_TEST_' . $currency->iso_code);
     $hipaySiteId = $this->prod ? Configuration::get('HIPAY_SITEID_' . $currency->iso_code) : Configuration::get('HIPAY_SITEID_TEST_' . $currency->iso_code);
     $hipaycategory = $this->prod ? Configuration::get('HIPAY_CATEGORY_' . $currency->iso_code) : Configuration::get('HIPAY_CATEGORY_TEST_' . $currency->iso_code);
     $paymentParams = new HIPAY_MAPI_PaymentParams();
     $paymentParams->setLogin($hipayAccount, $hipayPassword);
     $paymentParams->setAccounts($hipayAccount, $hipayAccount);
     // EN_us is not a standard format, but that's what Hipay uses
     if (isset($language->language_code)) {
         $paymentParams->setDefaultLang($this->formatLanguageCode($language->language_code));
     } else {
         $paymentParams->setDefaultLang(strtoupper($language->iso_code) . '_' . strtolower($language->iso_code));
     }
     $paymentParams->setMedia('WEB');
     $paymentParams->setRating(Configuration::get('HIPAY_RATING'));
     $paymentParams->setPaymentMethod(HIPAY_MAPI_METHOD_SIMPLE);
     $paymentParams->setCaptureDay(HIPAY_MAPI_CAPTURE_IMMEDIATE);
     $paymentParams->setCurrency(strtoupper($currency->iso_code));
     $paymentParams->setIdForMerchant($cart->id);
     $paymentParams->setMerchantSiteId($hipaySiteId);
     $paymentParams->setUrlCancel(self::getHttpHost(true, true) . __PS_BASE_URI__ . 'order.php?step=3');
     $paymentParams->setUrlNok(self::getHttpHost(true, true) . __PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . (int) $cart->id . '&id_module=' . (int) $this->id . '&secure_key=' . $customer->secure_key);
     $paymentParams->setUrlOk(self::getHttpHost(true, true) . __PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . (int) $cart->id . '&id_module=' . (int) $this->id . '&secure_key=' . $customer->secure_key);
     $paymentParams->setUrlAck(self::getHttpHost(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/validation.php?token=' . $cart->secure_key);
     $paymentParams->setBackgroundColor('#FFFFFF');
     if (!$paymentParams->check()) {
         return $this->l('[Hipay] Error: cannot create PaymentParams');
     }
     $item = new HIPAY_MAPI_Product();
     $item->setName($this->l('Cart'));
     $item->setInfo('');
     $item->setquantity(1);
     $item->setRef($cart->id);
     $item->setCategory($hipaycategory);
     $item->setPrice($cart->getOrderTotal());
     try {
         if (!$item->check()) {
             return $this->l('[Hipay] Error: cannot create "Cart" Product');
         }
     } catch (Exception $e) {
         return $this->l('[Hipay] Error: cannot create "Cart" Product');
     }
     $items = array($item);
     $order = new HIPAY_MAPI_Order();
     $order->setOrderTitle($this->l('Order total'));
     $order->setOrderCategory($hipaycategory);
     if (!$order->check()) {
         return $this->l('[Hipay] Error: cannot create Order');
     }
     try {
         $commande = new HIPAY_MAPI_SimplePayment($paymentParams, $order, $items);
     } catch (Exception $e) {
         return $this->l('[Hipay] Error:') . ' ' . $e->getMessage();
     }
     $xmlTx = $commande->getXML();
     $output = HIPAY_MAPI_SEND_XML::sendXML($xmlTx);
     $reply = HIPAY_MAPI_COMM_XML::analyzeResponseXML($output, $url, $err_msg, $err_keyword, $err_value, $err_code);
     if ($reply === true) {
         Tools::redirectLink($url);
     } else {
         global $smarty;
         include dirname(__FILE__) . '/../../header.php';
         $smarty->assign('errors', array('[Hipay] ' . strval($err_msg) . ' (' . $output . ')'));
         $_SERVER['HTTP_REFERER'] = self::getHttpHost(true, true) . __PS_BASE_URI__ . 'order.php?step=3';
         $smarty->display(_PS_THEME_DIR_ . 'errors.tpl');
         include dirname(__FILE__) . '/../../footer.php';
     }
 }
Ejemplo n.º 2
0
    public function payment()
    {
        global $cookie, $cart;
        $id_currency = (int) Db::getInstance()->getValue('SELECT id_currency FROM `' . _DB_PREFIX_ . 'module_currency` WHERE id_module = ' . (int) $this->id);
        if (!$id_currency or $id_currency == -2) {
            $id_currency = Configuration::get('PS_CURRENCY_DEFAULT');
        } elseif ($id_currency == -1) {
            $id_currency = $cart->id_currency;
        }
        if ($cart->id_currency != $id_currency) {
            if (Db::getInstance()->execute('UPDATE ' . _DB_PREFIX_ . 'cart SET id_currency = ' . (int) $id_currency . ' WHERE id_cart = ' . (int) $cart->id)) {
                $cart->id_currency = $id_currency;
            }
        }
        $currency = new Currency($id_currency);
        $language = new Language($cart->id_lang);
        $customer = new Customer($cart->id_customer);
        $carrier = new Carrier($cart->id_carrier, $cart->id_lang);
        $id_zone = Db::getInstance()->getValue('SELECT id_zone FROM ' . _DB_PREFIX_ . 'address a INNER JOIN ' . _DB_PREFIX_ . 'country c ON a.id_country = c.id_country WHERE id_address = ' . (int) $cart->id_address_delivery);
        // Define extracted from mapi/mapi_defs.php
        define('HIPAY_GATEWAY_URL', 'https://' . ($this->prod ? '' : 'test.') . 'payment.hipay.com/order/');
        require_once dirname(__FILE__) . '/mapi/mapi_package.php';
        $paymentParams = new HIPAY_MAPI_PaymentParams();
        $paymentParams->setLogin(Configuration::get('HIPAY_ACCOUNT'), Configuration::get('HIPAY_PASSWORD'));
        $paymentParams->setAccounts(Configuration::get('HIPAY_ACCOUNT'), Configuration::get('HIPAY_TAX_ACCOUNT') ? Configuration::get('HIPAY_TAX_ACCOUNT') : Configuration::get('HIPAY_ACCOUNT'));
        $paymentParams->setDefaultLang(strtolower($language->iso_code) . '_' . strtoupper($language->iso_code));
        $paymentParams->setMedia('WEB');
        $paymentParams->setRating(Configuration::get('HIPAY_RATING'));
        $paymentParams->setPaymentMethod(HIPAY_MAPI_METHOD_SIMPLE);
        $paymentParams->setCaptureDay(HIPAY_MAPI_CAPTURE_IMMEDIATE);
        $paymentParams->setCurrency(strtoupper($currency->iso_code));
        $paymentParams->setIdForMerchant($cart->id);
        $paymentParams->setMerchantSiteId(Configuration::get('HIPAY_SITEID'));
        $paymentParams->setUrlCancel(Tools::getHttpHost(true, true) . __PS_BASE_URI__ . 'order.php?step=3');
        $paymentParams->setUrlNok(Tools::getHttpHost(true, true) . __PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . (int) $cart->id . '&id_module=' . (int) $this->id . '&secure_key=' . $customer->secure_key);
        $paymentParams->setUrlOk(Tools::getHttpHost(true, true) . __PS_BASE_URI__ . 'order-confirmation.php?id_cart=' . (int) $cart->id . '&id_module=' . (int) $this->id . '&secure_key=' . $customer->secure_key);
        $paymentParams->setUrlAck(Tools::getHttpHost(true, true) . __PS_BASE_URI__ . 'modules/' . $this->name . '/validation.php');
        $paymentParams->setBackgroundColor('#FFFFFF');
        if (!$paymentParams->check()) {
            return $this->l('[Hipay] Error: cannot create PaymentParams');
        }
        $taxes = array();
        $result = Db::getInstance()->executeS('
		SELECT DISTINCT t.id_tax, tl.name, t.rate
		FROM ' . _DB_PREFIX_ . 'cart_product cp
		INNER JOIN ' . _DB_PREFIX_ . 'product p ON cp.id_product = p.id_product
		INNER JOIN ' . _DB_PREFIX_ . 'tax t ON p.id_tax = t.id_tax
		INNER JOIN ' . _DB_PREFIX_ . 'tax_lang tl ON tl.id_tax = t.id_tax AND tl.id_lang = ' . (int) $cookie->id_lang . '
		WHERE cp.id_cart = ' . (int) $cart->id . '
		UNION
		SELECT t2.id_tax, tl2.name, t2.rate
		FROM ' . _DB_PREFIX_ . 'cart c
		INNER JOIN ' . _DB_PREFIX_ . 'carrier ca ON c.id_carrier = ca.id_carrier
		INNER JOIN ' . _DB_PREFIX_ . 'tax t2 ON ca.id_tax = t2.id_tax
		INNER JOIN ' . _DB_PREFIX_ . 'tax_lang tl2 ON tl2.id_tax = t2.id_tax AND tl2.id_lang = ' . (int) $cookie->id_lang . '
		WHERE c.id_cart = ' . (int) $cart->id);
        foreach ($result as $row) {
            $tax = new HIPAY_MAPI_Tax();
            $tax->setTaxName($row['name']);
            $tax->setTaxVal($row['rate']);
            if (!$tax->check()) {
                return $this->l('[Hipay] Error: cannot create Tax');
            }
            $taxes[$row['id_tax']] = $tax;
        }
        $items = array();
        foreach ($cart->getProducts($cookie->id_lang) as $product) {
            $item = new HIPAY_MAPI_Product();
            $item->setName($product['name']);
            $item->setInfo($product['reference']);
            $item->setquantity($product['cart_quantity']);
            $item->setRef($product['id_product'] . ($product['id_product_attribute'] ? '-' . $product['id_product_attribute'] : ''));
            $item->setCategory(Configuration::get('HIPAY_CATEGORY_' . (int) $product['id_category_default']) ? Configuration::get('HIPAY_CATEGORY_' . (int) $product['id_category_default']) : Configuration::get('HIPAY_CATEGORY'));
            $price = Product::getPriceStatic($product['id_product'], false, $product['id_product_attribute'], 2, NULL, false, true, $product['cart_quantity']);
            $item->setPrice($price);
            if (Tax::checkTaxZone($product['id_tax'], $id_zone)) {
                $item->setTax(array($taxes[$product['id_tax']]));
            }
            if (!$item->check()) {
                return $this->l('[Hipay] Error: cannot create Product') . ' (' . $product['id_product'] . ($product['id_product_attribute'] ? '-' . $product['id_product_attribute'] : '') . ')';
            }
            $items[] = $item;
        }
        foreach ($cart->getDiscounts() as $voucher) {
            // For the moment, if there is a couher you can't use hipay
            return;
            $item = new HIPAY_MAPI_Product();
            $item->setName($voucher['name']);
            $item->setInfo($voucher['description']);
            $item->setquantity(1);
            $item->setRef('voucher_' . $voucher['id_discount']);
            $item->setCategory(Configuration::get('HIPAY_CATEGORY'));
            $item->setPrice(-1 * $voucher['value_real']);
            if (!$item->check()) {
                return $this->l('[Hipay] Error: cannot create Voucher') . ' (' . $voucher['name'] . ')';
            }
            $items[] = $item;
        }
        $order = new HIPAY_MAPI_Order();
        $order->setOrderTitle(Configuration::get('PS_SHOP_NAME'));
        $order->setOrderCategory(Configuration::get('HIPAY_CATEGORY'));
        $price = $cart->getOrderShippingCost($carrier->id, false);
        $shippingTax = Tax::checkTaxZone($carrier->id_tax, $id_zone) ? array($taxes[$carrier->id_tax]) : array();
        $order->setShipping($price, $shippingTax);
        if (!$order->check()) {
            return $this->l('[Hipay] Error: cannot create Order');
        }
        try {
            $commande = new HIPAY_MAPI_SimplePayment($paymentParams, $order, $items);
        } catch (Exception $e) {
            return $this->l('[Hipay] Error:') . ' ' . $e->getMessage();
        }
        $xmlTx = $commande->getXML();
        //d(htmlentities($xmlTx));
        $output = HIPAY_MAPI_SEND_XML::sendXML($xmlTx);
        $reply = HIPAY_MAPI_COMM_XML::analyzeResponseXML($output, $url, $err_msg, $err_keyword, $err_value, $err_code);
        if ($reply === true) {
            Tools::redirectLink($url);
        } else {
            global $smarty;
            include dirname(__FILE__) . '/../../header.php';
            $smarty->assign('errors', array('[Hipay] ' . strval($err_msg)));
            $_SERVER['HTTP_REFERER'] = Tools::getHttpHost(true, true) . __PS_BASE_URI__ . 'order.php?step=3';
            $smarty->display(_PS_THEME_DIR_ . 'errors.tpl');
            include dirname(__FILE__) . '/../../footer.php';
        }
    }
Ejemplo n.º 3
0
 function createSinglePaymentDlg()
 {
     $params = new HIPAY_MAPI_PaymentParams();
     //The Hipay platform connection parameters. This is not the information used to connect to your Hipay
     //account, but the specific login and password used to connect to the payment platform.
     //The login is the ID of the hipay merchant account receiving the payment, and the password is
     //the « merchant password » set within your Hipay account (site info).
     $params->setLogin('22955', 'mypassword');
     // The amounts will be credited to account 22955, except the taxes which will be credited to account 23192
     $params->setAccounts(22955, 23192);
     // The payment interface will be in International French by default
     $params->setDefaultLang('de_DE');
     // The interface will be the Web interface
     $params->setMedia('WEB');
     //The order content is intended for people at least 16 years old.
     $params->setRating('16+');
     // This is a single payment
     $params->setPaymentMethod(HIPAY_MAPI_METHOD_SIMPLE);
     // The capture take place immediately
     $params->setCaptureDay(HIPAY_MAPI_CAPTURE_IMMEDIATE);
     // The amounts are expressed in Euros, this has to be the same currency as the merchant's account.
     $params->setCurrency('EUR');
     // The merchant-selected identifier for this order is REF6522
     $params->setIdForMerchant('REF6522');
     // Two data elements of type key=value are declared and will be returned to the merchant after the payment in the
     // notification data feed [C].
     $params->setMerchantDatas('id_client', '2000');
     $params->setMerchantDatas('credit', '10');
     // This order relates to the web site which the merchant declared in the Hipay platform.
     // The I.D. assigned to this website is '9'
     $params->setMerchantSiteId(9);
     // If the payment is accepted, the user will be redirected to this page
     $params->setURLOk('http://www.mywebsite.com/success.html ');
     // If the payment is refused, the user will be redirected to this page
     $params->setUrlNok('http://www.mywebsite.com/refused.html ');
     // If the user cancels the payment, he will be redirected to this page
     $params->setUrlCancel('http://www.mywebsite.com/cancel.html ');
     // The email address used to send the notifications, on top of the http notifications.
     // cf chap 19 : RECEIVING A RESULTS NOTIFICATION ABOUT A PAYMENT ACTION
     $params->setEmailAck('*****@*****.**');
     // The merchant's site will be notified of the result of the payment by a call to the script
     // "listen_hipay_notification.php"
     // cf chap 19 : RECEIVING A RESULTS NOTIFICATION ABOUT A PAYMENT ACTION
     $params->setUrlAck('http://www.mywebsite.com/listen_hipay_notification.php');
     // The background color of the interface will be #FFFFFF (default color recommended)
     $t = $params->setBackgroundColor('#FFFFFF');
     $t = $params->check();
     if (!$t) {
         echo "An error occurred while creating the paymentParams object";
         exit;
     }
     // ## Taxes ##
     // Tax at 19.6%
     $tax1 = new HIPAY_MAPI_Tax();
     $tax1->setTaxName('TVA (19.6)');
     $tax1->setTaxVal(19.6, true);
     $t = $tax1->check();
     if (!$t) {
         echo "An error occurred while creating a tax object";
         exit;
     }
     // Fixed tax of 3.50 euros
     $tax2 = new HIPAY_MAPI_Tax();
     $tax2->setTaxName('Taxe fixe');
     $tax2->setTaxVal(3.5, false);
     $t = $tax2->check();
     if (!$t) {
         echo "An error occurred while creating a tax object";
         exit;
     }
     // Tax at 5.5%
     $tax3 = new HIPAY_MAPI_Tax();
     $tax3->setTaxName('TVA (5.5)');
     $tax3->setTaxVal(5.5, true);
     $t = $tax3->check();
     if (!$t) {
         echo "An error occurred while creating a tax object";
         exit;
     }
     //		//## Affiliates ##
     //		// Affiliate who will receive 10% of all the items in the order
     //		$aff1 = new HIPAY_MAPI_Affiliate();
     //		$aff1->setCustomerId(331);
     //		$aff1->setAccountId(59074);
     //		$aff1->setValue(10.0,HIPAY_MAPI_TTARGET_ALL);
     //		$t=$aff1->check();
     //		if (!$t)
     //		{
     //			echo "An error occurred while creating an affiliate object";
     //			exit;
     //		}
     //		// Affiliate who will receive 15% of the amount of the products, insurance and delivery amounts
     //		$aff2 = new HIPAY_MAPI_Affiliate();
     //		$aff2->setCustomerId(332);
     //		$aff2->setAccountId(59075);
     //		$aff2->setValue(15.0,HIPAY_MAPI_TTARGET_ITEM | HIPAY_MAPI_TTARGET_INSURANCE | HIPAY_MAPI_TTARGET_SHIPPING);
     //		$t=$aff2->check();
     //		if (!$t)
     //		{
     //			echo "An error occurred while creating an affiliate object";
     //			exit;
     //		}
     // ##Products (order lines) ##
     // First product: 2 copies of a book at 12.5 Euros per unit on which two taxes are applied
     //(taxes $tax3 and $tax2)
     $item1 = new HIPAY_MAPI_Product();
     $item1->setName('The Fall of Hyperion');
     $item1->setInfo('Simmons, Dan – ISBN 0575076380');
     $item1->setquantity(2);
     $item1->setRef('JV005');
     $item1->setCategory(5);
     $item1->setPrice(12.5);
     $item1->setTax(array($tax3, $tax2));
     $t = $item1->check();
     if (!$t) {
         echo "An error occurred while creating a product object";
         exit;
     }
     // Second product: An example of a product at 2360 Euros, on which 3 taxes are applied
     //($tax1, $tax2 and $tax3)
     $item2 = new HIPAY_MAPI_Product();
     $item2->setName('PC Linux');
     $item2->setInfo('Computer 445');
     $item2->setquantity(1);
     $item2->setRef('PC445');
     $item2->setCategory(2);
     $item2->setPrice(2360);
     $item2->setTax(array($tax1, $tax2, $tax3));
     $t = $item2->check();
     if (!$t) {
         echo "An error occurred while creating a product object";
         exit;
     }
     // ## Order object ##
     $order = new HIPAY_MAPI_Order();
     // Order title and information
     $order->setOrderTitle('order on mywebsite.com');
     $order->setOrderInfo('best products');
     // The order category is 3 (Books)
     // Refer to annex 7 to see how to find out what category your site belongs to.
     $order->setOrderCategory(3);
     // The shipping costs are 1.50 Euros excluding taxes, and $tax1 is applied
     $order->setShipping(1.5, array($tax1));
     // The insurance costs are 2 Euros excluding taxes, and $tax1 and $tax3 are applied
     $order->setInsurance(2, array($tax3, $tax1));
     // The fixed costs are 2.25 Euros excluding taxes, and $tax3 is applied to this amount
     $order->setFixedCost(2.25, array($tax3));
     // This order has two affiliates, $aff1 and $aff2
     $order->setAffiliate(array($aff1, $aff2));
     $t = $order->check();
     if (!$t) {
         echo "An error occurred while creating a product object";
         exit;
     }
     // ## Payment object ##
     try {
         $payment = new HIPAY_MAPI_SimplePayment($params, $order, array($item1, $item2));
     } catch (Exception $e) {
         echo "Error" . $e->getMessage();
     }
     // ## XML representation of this order and sending the feed to the Hipay platform ##
     $xmlTx = $payment->getXML();
     $output = HIPAY_MAPI_SEND_XML::sendXML($xmlTx);
     // ## Processing the platform's response ##
     $r = HIPAY_MAPI_COMM_XML::analyzeResponseXML($output, &$url, &$err_msg);
     if ($r === true) {
         // The internet user is sent to the URL indicated by the Hipay platform
         //header('Location: '.$url) ;
         // echo $url;
         return $url;
     } else {
         // Une erreur est intervenue
         echo $err_msg;
         // $url_error = "/error.html";
         //header('Location: '.$url_error) ;
     }
 }
Ejemplo n.º 4
0
 /**
  * Erzeugt die Basisparameter für den Bezahlvorgang
  * 
  * @param HIPAY_MAPI_PaymentParams $params
  * @param string token
  */
 protected function setupParams(Mage_Sales_Model_Order $order, $token)
 {
     $websiteId = Mage::app()->getStore()->getStoreId();
     //Mage::app()->getStore()->getWebsiteId();
     $accountId = Mage::getStoreConfig('hipay/accountsettings/accountid', $websiteId);
     $merchantPassword = Mage::getStoreConfig('hipay/accountsettings/merchantpassword', $websiteId);
     $merchantSiteId = Mage::getStoreConfig('hipay/accountsettings/merchantsiteid', $websiteId);
     //$accountCurrency    = Mage::getStoreConfig('hipay/accountsettings/accountcurrency');
     $orderCurrency = $order->getOrderCurrency()->getData("currency_code");
     $ageClassification = Mage::getStoreConfig('hipay/accountsettings/ageclassification', $websiteId);
     $notificationEmail = Mage::getStoreConfig('hipay/accountsettings/notificationemail', $websiteId);
     $logoUrl = Mage::getStoreConfig('hipay/extendedaccountsettings/logourl', $websiteId);
     $itemAccountId = Mage::getStoreConfig('hipay/extendedaccountsettings/itemaccountid', $websiteId);
     $taxAccountId = "";
     //Mage::getStoreConfig('hipay/extendedaccountsettings/taxaccountid');
     $insuranceAccountId = "";
     //Mage::getStoreConfig('hipay/extendedaccountsettings/insuranceaccountid');
     $fixcostAccountId = "";
     //Mage::getStoreConfig('hipay/extendedaccountsettings/fixcostaccountid');
     $shippingAccountId = Mage::getStoreConfig('hipay/extendedaccountsettings/shippingaccountid', $websiteId);
     $itemAccountId = empty($itemAccountId) ? $accountId : $itemAccountId;
     $taxAccountId = empty($taxAccountId) ? $itemAccountId : $taxAccountId;
     $insuranceAccountId = empty($insuranceAccountId) ? $itemAccountId : $insuranceAccountId;
     $fixcostAccountId = empty($fixcostAccountId) ? $itemAccountId : $fixcostAccountId;
     $shippingAccountId = empty($shippingAccountId) ? $itemAccountId : $shippingAccountId;
     $nomLog = 'hipay-wallet-payment-' . date('Ymd') . '.log';
     Mage::log('############################', null, $nomLog);
     Mage::log('websiteId = ' . $websiteId, null, $nomLog);
     Mage::log('accountId = ' . $accountId, null, $nomLog);
     Mage::log('merchantPassword = '******'merchantSiteId = ' . $merchantSiteId, null, $nomLog);
     Mage::log('orderCurrency = ' . $orderCurrency, null, $nomLog);
     Mage::log('ageClassification = ' . $ageClassification, null, $nomLog);
     Mage::log('notificationEmail = ' . $notificationEmail, null, $nomLog);
     Mage::log('logoUrl = ' . $logoUrl, null, $nomLog);
     Mage::log('itemAccountId = ' . $itemAccountId, null, $nomLog);
     Mage::log('shippingAccountId = ' . $shippingAccountId, null, $nomLog);
     $params = new HIPAY_MAPI_PaymentParams();
     //The Hipay platform connection parameters. This is not the information used to connect to your Hipay
     //account, but the specific login and password used to connect to the payment platform.
     //The login is the ID of the hipay merchant account receiving the payment, and the password is
     //the « merchant password » set within your Hipay account (site info).
     $params->setLogin($accountId, $merchantPassword);
     // The amounts will be credited to the defined accounts
     $params->setAccounts($itemAccountId, $taxAccountId, $insuranceAccountId, $fixcostAccountId, $shippingAccountId);
     // The payment interface will be in German by default
     $params->setDefaultLang('de_DE');
     // The interface will be the Web interface
     $params->setMedia('WEB');
     //The order content is intended for people at least (ALL, 12+, 16+, 18+) years old.
     $params->setRating($ageClassification);
     // This is a single payment
     $params->setPaymentMethod(HIPAY_MAPI_METHOD_SIMPLE);
     // The capture take place immediately (HIPAY_MAPI_CAPTURE_IMMEDIATE), manually (HIPAY_MAPI_CAPTURE_MANUAL)
     // or delayed (0-7 -> number of days before capture)
     $params->setCaptureDay(HIPAY_MAPI_CAPTURE_IMMEDIATE);
     // The amounts are expressed in Euros, this has to be the same currency as the merchant's account.
     $params->setCurrency($orderCurrency);
     // The merchant-selected identifier for this order
     $params->setIdForMerchant($order->getRealOrderId());
     // Two data elements of type key=value are declared and will be returned to the merchant after the payment in the
     // notification data feed [C].
     //		$params->setMerchantDatas('id_client','2000');
     //		$params->setMerchantDatas('credit','10');
     // This order relates to the web site which the merchant declared in the Hipay platform.
     $params->setMerchantSiteId($merchantSiteId);
     // Set buyer email
     $params->setIssuerAccountLogin($order->getCustomerEmail());
     // If the payment is accepted, the user will be redirected to this page
     $urlOk = Mage::getUrl('hipay/mapi/success/');
     // creates URL 'http://www.mywebsite.com/hipay/mapi/success/'
     $params->setURLOk($urlOk . $token);
     // add security-token
     // If the payment is refused, the user will be redirected to this page
     $urlNok = Mage::getUrl('hipay/mapi/failed');
     // creates URL 'http://www.mywebsite.com/hipay/mapi/failed/'
     $params->setUrlNok($urlNok . $token);
     // add security-token
     // If the user cancels the payment, he will be redirected to this page
     $urlCancel = Mage::getUrl('hipay/mapi/cancel');
     // creates URL 'http://www.mywebsite.com/hipay/mapi/failed/'
     $params->setUrlCancel($urlCancel . $token);
     // add security-token
     // The email address used to send the notifications, on top of the http notifications.
     $params->setEmailAck($notificationEmail);
     // The merchant's site will be notified of the result of the payment by a call to the script
     // "listen_hipay_notification.php"
     $urlAck = Mage::getUrl('hipay/mapi/notification');
     // creates URL 'http://www.mywebsite.com/hipay/mapi/notfication'
     $params->setUrlAck($urlAck);
     // The background color of the interface will be #FFFFFF (default color recommended)
     $params->setBackgroundColor('#FFFFFF');
     //The merchant’s logo URL, this logo will be displayed on the payment pages.
     $params->setLogoUrl($logoUrl);
     if (!$params->check()) {
         $errorTxt = "Hipay: An error occurred while creating the HIPAY_MAPI_PaymentParams object";
         Mage::log($errorTxt);
         return null;
     }
     return $params;
 }