login_user = __GESTPAY_LOGIN_USER__; $this->password = __GESTPAY_PASSWORD__; $this->login_user_test = __GESTPAY_LOGIN_USER_TEST__; } public function Crypt($transaction_id, $firstname, $lastname, $email, $newamount) { switch (__GESTPAY_ACCOUNT_TYPE__) { case 0 : $account_type = 'BASIC'; break; case 1 : $account_type = 'ADVANCED'; break; case 2 : $account_type = 'PROFESSIONAL'; break; default : $account_type = 'BASIC'; break; } $gestpay_crypt = new GestPayCrypt(); // if (Configuration::get('GESTPAY_TESTMODE') == 'test') { if (__GESTPAY_TESTMODE__ == 1) { $merchant_code = __GESTPAY_MERCHANT_CODE_TEST__; } else { $merchant_code = __GESTPAY_MERCHANT_CODE__; } $currency = __CURRENCY__; // Euro $amount = number_format($newamount, 2, '.', ''); // Es. 1256.28 $customer_firstname = ucfirst(strtolower($firstname)) . " " . ucfirst(strtolower($lastname)); $customer_email = $email; // TODO use the laguages map DB table to map PrestaShop languages with GestPay languages switch (__LANG__) { case 'it' : $language = "1"; // Italian break; case 'en' : $language = "2"; // English break; case 'es' : $language = "3"; // Spanish break; case 'fr' : $language = "4"; // French break; case 'de' : $language = "5"; // German break; default : $language = "1"; // Default language is Italian break; } //$mycustominfo= "[PARAMETRI PERSONALIZZATI]"; //Es. "BV_CODCLIENTE=12*P1*BV_SESSIONID=398" if (($account_type == 'ADVANCED') or ($account_type == 'PROFESSIONAL')) { $gestpay_crypt->SetBuyerName($customer_firstname); $gestpay_crypt->SetBuyerEmail($customer_email); $gestpay_crypt->SetLanguage($language); } $gestpay_crypt->SetLanguage($language); $gestpay_crypt->SetShopLogin($merchant_code); $gestpay_crypt->SetCurrency($currency); $gestpay_crypt->SetAmount($amount); $gestpay_crypt->SetShopTransactionID($transaction_id); $gestpay_crypt->SetDomainName($this->getGestPayDomainName()); //$gestpay_crypt->SetCustomInfo($mycustominfo); $gestpay_crypt->Encrypt(); $error_description = $gestpay_crypt->GetErrorDescription(); if ($error_description != "") { echo "Encoding Error: " . $gestpay_crypt->GetErrorCode() . " " . $error_description . "
"; } else { $a = $gestpay_crypt->GetShopLogin(); $b = $gestpay_crypt->GetEncryptedString(); } return array('a' => $a, 'b' => $b); } /* public function validatePayment($a, $b) { global $smarty, $cookie; // begin daniele $this->id_country = $cookie->id_country; // end daniele $gestpay_decrypt = $this->deCrypt($a, $b); $shop_login = trim($gestpay_decrypt->GetShopLogin()); $currency = $gestpay_decrypt->GetCurrency(); $amount = floatval($gestpay_decrypt->GetAmount()); $shop_transaction_id = trim($gestpay_decrypt->GetShopTransactionID()); $buyer_name = trim($gestpay_decrypt->GetBuyerName()); $buyer_email = trim($gestpay_decrypt->GetBuyerEmail()); $transaction_result = trim($gestpay_decrypt->GetTransactionResult()); $authorization_code = trim($gestpay_decrypt->GetAuthorizationCode()); $error_code = trim($gestpay_decrypt->GetErrorCode()); $error_description = trim($gestpay_decrypt->GetErrorDescription()); $error_bank_transaction_id = trim($gestpay_decrypt->GetBankTransactionID()); $alert_code = trim($gestpay_decrypt->GetAlertCode()); $alert_description = trim($gestpay_decrypt->GetAlertDescription()); $custom_info = trim($gestpay_decrypt->GetCustomInfo()); $separatore = '
'; $text = ''; $buyer_name = utf8_encode($buyer_name); $error_description = utf8_encode($error_description); $alert_description = utf8_encode($alert_description); $custom_info = utf8_encode($custom_info); $buyer_name = str_replace('§', ' ', $buyer_name); $error_description = str_replace('§', ' ', $error_description); $alert_description = str_replace('§', ' ', $alert_description); $custom_info = str_replace('§', ' ', $custom_info); $text.='shop_transaction_id: ' . $shop_transaction_id . $separatore; $text.='buyer_name: ' . $buyer_name . $separatore; $text.='buyer_email: ' . $buyer_email . $separatore; $text.='transaction_result: ' . $transaction_result . $separatore; $text.='authorization_code: ' . $authorization_code . $separatore; $text.='error_code: ' . $error_code . $separatore; $text.='error_description: ' . $error_description . $separatore; $text.='error_bank_transaction_id: ' . $error_bank_transaction_id . $separatore; $text.='alert_code: ' . $alert_code . $separatore; $text.='alert_description: ' . $alert_description . $separatore; $text.='custom_info: ' . $custom_info . $separatore; if (!empty($shop_transaction_id)) { Tools::redirectLink('landing-response.php?result=true'); } else { Tools::redirectLink('landing-response.php?result=fail'); } } */ public function deCrypt($a, $b) { $gestpay_decrypt = new GestPayCrypt(); $gestpay_decrypt->SetShopLogin($a); $gestpay_decrypt->SetEncryptedString($b); $gestpay_decrypt->SetDomainName($this->getGestPayDomainName()); $gestpay_decrypt->Decrypt(); // Decrypt parameters return $gestpay_decrypt; } public function getGestPayUrl() { if (__GESTPAY_TESTMODE__ == 1) $url = 'https://testecomm.sella.it/gestpay/pagam.asp'; else $url = 'https://ecomm.sella.it/gestpay/pagam.asp'; return $url; } private function getGestPayDomainName() { if (__GESTPAY_TESTMODE__ == 1) $domain_name = 'testecomm.sella.it'; else $domain_name = 'ecomms2s.sella.it'; return $domain_name; } } ?> Cerimonia di Apertura Salone del Gusto e Terra Madre 2014
Le iscrizioni alla Cerimonia di apertura del Salone del Gusto e Terra Madre sono chiuse. Il Salone apre il 23 ottobre alle 11. Ti aspettiamo!