// merge 1.4 (5397)

This commit is contained in:
fBrignoli
2011-04-22 16:00:58 +00:00
parent 0cd5856fe5
commit ff49083fb6
126 changed files with 3390 additions and 1430 deletions
+1 -1
View File
@@ -2,7 +2,7 @@
<module>
<name>trustedshops</name>
<displayName>Trusted Shops Customer Rating</displayName>
<version>1.1</version>
<version>1.2</version>
<description>Boost consumer confidence and turn more shoppers into buyers.</description>
<author></author>
<tab>payment_security</tab>
+9
View File
@@ -4,6 +4,12 @@ global $_MODULE;
$_MODULE = array();
$_MODULE['<{trustedshops}prestashop>display_products_02ecb4a4709d9bcc590f1a25fc82c0e2'] = 'Trusted Shops protección comprador (recomendado)';
$_MODULE['<{trustedshops}prestashop>display_products_b55aab8932a39ca85bb0a1b6eb83f83f'] = 'Protección comprador hasta';
$_MODULE['<{trustedshops}prestashop>display_products_a53a5a9f38f31d62a791717b943e02f3'] = 'EUR IVA incluído';
$_MODULE['<{trustedshops}prestashop>display_products_b3c25d2f94cf87ece3dbb2907318520c'] = 'La protección comprador Trusted Shops hace su compra en línea segura. Acepto que mi email sea trasferido y';
$_MODULE['<{trustedshops}prestashop>display_products_536a056b710e94b16169efd17a4a657b'] = 'guardado';
$_MODULE['<{trustedshops}prestashop>display_products_2dc4be4d5564180e6df95d5a5a679195'] = 'para el tratamiento de la protección comprador por Trusted Shops.';
$_MODULE['<{trustedshops}prestashop>display_products_229eb04083e06f419f9ac494329f957d'] = 'Condiciones';
$_MODULE['<{trustedshops}prestashop>display_products_4ccaceceffe4b5e58f6a7a7ed3ced4c4'] = 'para la protección del comprador.';
$_MODULE['<{trustedshops}prestashop>order-confirmation-tsbp-classic_7b5406da2d5f15923d6b01d3264c5619'] = 'Cuño Trusted Shops- Pulse aquí para comprobar';
$_MODULE['<{trustedshops}prestashop>order-confirmation-tsbp-classic_4052048c767f22e9071c3e6f404d00c6'] = 'Como miembro de Trusted Shops, le ofrecemos un servicio complementario excepcional: la garantía de reembolso Trusted Shops. ';
$_MODULE['<{trustedshops}prestashop>order-confirmation-tsbp-classic_f975f42362625cf21e592009ff4b3d7b'] = 'Inscríbase para obtener la garantía de reembolso de Trusted Shops. ';
@@ -85,6 +91,7 @@ $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_259060bb469ed1256c2e758e32
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_8512ae7d57b1396273f76fe6ed341a23'] = 'idioma';
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_f7ea4ac740662d2427d1ef1f2695206d'] = 'ha sido suprimido';
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_3fb2ea84b90d4ea9fab48ea356a2319b'] = 'Se ha añadido el login del certificado';
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_b18f5630d5ffdfcee5ab0a44ee6e1eb6'] = 'Tiene que crear un nombre de usuario y una contraseña antes de efectuar cualquier cambio.';
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_e32263743aac776e5e32fc385d8b669a'] = 'Trusted Shops es el sello de calidad europea para sitios de venta en línea con garantía de reembolso para sus clientes. En el momento de la certificación, su tienda está sometida a una auditoría que agrupa más de 1000 criterios diferentes que respetan las exigencias de las asociaciones de protección de los consumidores, así como las legislaciones nacionales y europeas. ';
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_2c786e15a571a442adf85460e6358883'] = '¡Más confianza implica más ventas!';
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_e06f60bb083e167516a94aafd5a3a2e2'] = 'El sello de calidad Trusted Shops es ideal para aumentar la confianza de los clientes en su tienda en línea. Cuanto más confíen los clientes en su sitio Wab, más compras realizarán el el mismo.';
@@ -92,6 +99,8 @@ $_MODULE['<{trustedshops}prestashop>tsbuyerprotection_8dd66ca6788218bd7d2ba7fe43
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_26286e2764ccde55c99d1b258315aa1a'] = 'Puede proponer a sus clientes en línea un argumento importante: la protección comprador Trusted Shops que asegura al cliente en caso de no reembolso o si no reciba la mercancía. Este seguro suplementario permite reducir la interrupción de los pedidos. ';
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_710142158c105c01ef807ce959cbc451'] = 'Una fidelización clientela fructuosa y durable';
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_f7e15d97ad927ef705de61e787883ada'] = 'Para aumentar las compras en línea, el sello de calidad Trusted Shops con protección comprador es un criterio de calidad durable para compras en línea seguras. Es una manera de transformar clientes únicos en clientes fieles. ';
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_7442a1e0ab5e2e26ca9363d226b93d13'] = 'Ambiente tipo';
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_8e77e16312de3f95afdf5b92b10232a2'] = 'En este momento está usando el modo:';
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_dc62561dd8d390e274487516e869fc93'] = 'Obtenir el link de registro';
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_5c93149208b3885248b960eb22e6ba49'] = 'Esta variable ha sido enviada por email por Tructed Shops';
$_MODULE['<{trustedshops}prestashop>tsbuyerprotection_233a96df2f68dbeafaa3126edadc1ce8'] = 'Identificación interna del software de la tienda en Trusted Shops';
+1
View File
@@ -8,6 +8,7 @@ $_MODULE['<{trustedshops}prestashop>display_products_a53a5a9f38f31d62a791717b943
$_MODULE['<{trustedshops}prestashop>display_products_b3c25d2f94cf87ece3dbb2907318520c'] = 'La protection acheteur Trusted Shops sécurise votre achat en ligne. J’accepte le transfert et la';
$_MODULE['<{trustedshops}prestashop>display_products_536a056b710e94b16169efd17a4a657b'] = 'sauvegarde';
$_MODULE['<{trustedshops}prestashop>display_products_2dc4be4d5564180e6df95d5a5a679195'] = 'de mon adresse email pour le traitement de la protection acheteur par Trusted Shops.';
$_MODULE['<{trustedshops}prestashop>display_products_229eb04083e06f419f9ac494329f957d'] = 'Conditions';
$_MODULE['<{trustedshops}prestashop>display_products_4ccaceceffe4b5e58f6a7a7ed3ced4c4'] = 'pour la protection acheteur.';
$_MODULE['<{trustedshops}prestashop>order-confirmation-tsbp-classic_7b5406da2d5f15923d6b01d3264c5619'] = 'Sceau Trusted Shops - Cliquez pour le verifier.';
$_MODULE['<{trustedshops}prestashop>order-confirmation-tsbp-classic_4052048c767f22e9071c3e6f404d00c6'] = 'En tant que membre Trusted Shops, nous vous offrons un service complémentaire exceptionnel: la garantie de remboursement Trusted Shops. Les frais relatifs à cette garantie sont entièrement à notre charge, alors n\'hésitez pas, il vous suffit de vous inscrire.';
+132 -131
View File
@@ -42,7 +42,7 @@ class TSBuyerProtection extends AbsTrustedShops
const DB_APPLI = 'ts_application_id';
const WEBSERVICE_BO = 'administration';
const WEBSERVICE_FO = 'front-end';
/**
* List of registration link, need to add parameters
* @see TSBuyerProtection::_getRegistrationLink()
@@ -54,7 +54,7 @@ class TSBuyerProtection extends AbsTrustedShops
'FR' => 'http://www.trustedshops.com/marchands/affiliation.html',
'PL' => 'http://www.trustedshops.pl/handlowcy/cennik.html',
);
/**
* Link to obtain the certificate about the shop.
* Use by seal of approval.
@@ -67,22 +67,22 @@ class TSBuyerProtection extends AbsTrustedShops
'FR' => 'http://www.trustedshops.fr',
'PL' => 'http://www.trustedshops.de/profil/#shop_name#_#shop_id#.html',
);
/**
* Available language for used TrustedShops Buyer Protection
* @see TSBuyerProtection::__construct()
* @var array
*/
private $available_languages = array('EN'=>'', 'FR'=>'', 'DE'=>'', 'PL'=>'', );
/**
* @todo : be sure : see TrustedShopsRating::__construct()
* @var array
*/
public $limited_countries = array('PL', 'GB', 'US', 'FR', 'DE');
/**
* Differents urls to call for Trusted Shops API
* Differents urls to call for Trusted Shops API
* @var array
*/
private static $webservice_urls = array(
@@ -95,12 +95,12 @@ class TSBuyerProtection extends AbsTrustedShops
'production' => 'https://protection.trustedshops.com/ts/protectionservices/ApplicationRequestService?wsdl',
),
);
// Configuration vars
// Configuration vars
private static $SHOPSW;
private static $ET_CID;
private static $ET_LID;
/**
* Its must look like :
* array(
@@ -113,19 +113,19 @@ class TSBuyerProtection extends AbsTrustedShops
private static $DEFAULT_LANG;
private static $CAT_ID;
private static $ENV_API;
/**
* save shop url
* @var string
*/
private $site_url;
/**
* Payment type used by Trusted Shops.
* @var array
*/
private static $payments_type;
public function __construct()
{
// need to set this in constructor to allow translation
@@ -177,16 +177,16 @@ class TSBuyerProtection extends AbsTrustedShops
}
}
}
public function install()
{
if (!method_exists('Tools', 'jsonDecode') || !method_exists('Tools', 'jsonEncode'))
return false;
foreach ($this->available_languages as $iso=>$lang)
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'CERTIFICATE_'.strtoupper($iso),
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'CERTIFICATE_'.strtoupper($iso),
Tools::htmlentitiesUTF8(Tools::jsonEncode(array('stateEnum'=>'', 'typeEnum'=>'', 'url'=>'', 'tsID'=>'', 'user'=>'', 'password'=>''))));
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'SHOPSW', '');
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'ET_CID', '');
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'ET_LID', '');
@@ -206,7 +206,7 @@ class TSBuyerProtection extends AbsTrustedShops
);
';
Db::getInstance()->Execute($req);
$req = 'CREATE TABLE IF NOT EXISTS `'._DB_PREFIX_.TSBuyerProtection::DB_APPLI.'` (
`id_application` INT NOT NULL PRIMARY KEY,
`ts_id` VARCHAR( 33 ) NOT NULL,
@@ -217,16 +217,16 @@ class TSBuyerProtection extends AbsTrustedShops
);
';
Db::getInstance()->Execute($req);
//add hidden category
$category = new Category();
$languages = Language::getLanguages(true);
foreach ($this->available_languages as $iso=>$lang)
foreach ($this->available_languages as $iso=>$lang)
{
$category->name[Language::getIdByIso(strtolower($iso))] = 'Trustedshops';
$category->link_rewrite[Language::getIdByIso(strtolower($iso))] = 'trustedshops';
}
// If the default lang is different than available languages :
// (Bug occurred otherwise)
if (!array_key_exists(Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT')), $this->available_languages))
@@ -234,7 +234,7 @@ class TSBuyerProtection extends AbsTrustedShops
$category->name[(int)Configuration::get('PS_LANG_DEFAULT')] = 'Trustedshops';
$category->link_rewrite[(int)Configuration::get('PS_LANG_DEFAULT')] = 'trustedshops';
}
$category->id_parent = 0;
$category->level_depth = 0;
$category->active = 0;
@@ -242,12 +242,12 @@ class TSBuyerProtection extends AbsTrustedShops
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'CAT_ID', intval($category->id));
return true;
}
public function uninstall()
{
foreach ($this->available_languages as $iso=>$lang)
Configuration::deleteByName(TSBuyerProtection::PREFIX_TABLE.'CERTIFICATE_'.strtoupper($iso));
$category = new Category((int)TSBuyerProtection::$CAT_ID);
$category->delete();
Configuration::deleteByName(TSBuyerProtection::PREFIX_TABLE.'CAT_ID');
@@ -257,7 +257,7 @@ class TSBuyerProtection extends AbsTrustedShops
Configuration::deleteByName(TSBuyerProtection::PREFIX_TABLE.'ENV_API');
return true;
}
/**
* Just for return the file path
* @return string
@@ -266,11 +266,11 @@ class TSBuyerProtection extends AbsTrustedShops
{
return $this->site_url.'modules/'.self::$module_name.'/cron_garantee.php';
}
/**
* This method is used to access of TrustedShops API
* from a SoapClient object.
*
*
* @uses TSBuyerProtection::$webservice_urls with TSBuyerProtection::$ENV_API
* To get the api url according to the environment (test or production)
* @param string $type
@@ -282,11 +282,11 @@ class TSBuyerProtection extends AbsTrustedShops
$client = new SoapClient($url);
return $client;
}
/**
* Checks the Trusted Shops IDs entered in the shop administration
* and returns the characteristics of the corresponding certificate.
*
*
* @uses TSBuyerProtection::_getClient()
* @param string $certificate certificate code already send by Trusted Shops
*/
@@ -307,13 +307,13 @@ class TSBuyerProtection extends AbsTrustedShops
} catch (SoapFault $fault) {
$this->errors[] = $this->l('Code #').$fault->faultcode.',<br />'.$this->l('message:').$fault->faultstring;
}
if(is_int($validation))
throw new TSBPException($validation, TSBPException::ADMINISTRATION);
if (!$validation OR array_key_exists($validation->stateEnum, $array_state))
{
if ($validation->stateEnum === 'TEST' || $validation->stateEnum === 'PRODUCTION')
if ($validation->stateEnum === 'TEST' || $validation->stateEnum === 'PRODUCTION' || $validation->stateEnum === 'INTEGRATION')
{
$this->confirmations[] = $array_state[$validation->stateEnum];
return $validation;
@@ -329,10 +329,10 @@ class TSBuyerProtection extends AbsTrustedShops
$this->errors[] = $this->l('Unknown error.');
}
}
/**
* Checks the shop's web service access credentials.
*
*
* @uses TSBuyerProtection::_getClient()
* @param string $ts_id
* @param string $user
@@ -349,14 +349,14 @@ class TSBuyerProtection extends AbsTrustedShops
}
if ($return < 0)
throw new TSBPException($return, TSBPException::ADMINISTRATION);
return true;
}
/**
* Returns the characteristics of the buyer protection products
* Returns the characteristics of the buyer protection products
* that are allocated individually to each certificate by Trusted Shops.
*
*
* @uses TSBuyerProtection::_getClient()
* @param string $ts_id
*/
@@ -372,10 +372,10 @@ class TSBuyerProtection extends AbsTrustedShops
return $items->item;
return false;
}
/**
* Check validity for params required for TSBuyerProtection::_requestForProtectionV2()
*
*
* @param array $params
*/
private function _requestForProtectionV2ParamsValidator(array $params)
@@ -413,7 +413,7 @@ class TSBuyerProtection extends AbsTrustedShops
if(isset($key['ereg']))
$bool_flag = !preg_match($key['ereg'], $params[$key['name']]) ? false : $bool_flag ;
}
if (!$bool_flag)
{
$this->errors[] = sprintf($this->l('The field %s is wrong, please ensure it was correctly filled.'), $key['name']);
@@ -421,13 +421,13 @@ class TSBuyerProtection extends AbsTrustedShops
}
}
return $bool_flag;
}
/**
* Create the Buyer Protection application by the web service.
* Applications are saved by Trusted Shops and are processed at regular intervals.
*
*
* @uses TSBuyerProtection::_getClient()
* @uses TSBuyerProtection::_requestForProtectionV2ParamsValidator()
* to check required params
@@ -445,13 +445,13 @@ class TSBuyerProtection extends AbsTrustedShops
WHERE `id_order` = "'.$params['shopOrderID'].'"
';
$order = Db::getInstance()->ExecuteS($sql);
// If an order was already added, no need to continue.
// Otherwise a new application is created by TrustedShops.
// this can occured when order confirmation page is reload.
if(isset($order[0]))
return false;
if ($testing_params)
{
try {
@@ -467,7 +467,7 @@ class TSBuyerProtection extends AbsTrustedShops
{
$date = date('Y-m-d H:i:s');
$sql = '
INSERT INTO `'._DB_PREFIX_.TSBuyerProtection::DB_APPLI.'`
INSERT INTO `'._DB_PREFIX_.TSBuyerProtection::DB_APPLI.'`
(
`id_application`,
`ts_id`,
@@ -485,7 +485,7 @@ class TSBuyerProtection extends AbsTrustedShops
)
';
Db::getInstance()->Execute($sql);
// To reset product quantity in database.
$sql = '
SELECT `id_product`
@@ -501,13 +501,13 @@ class TSBuyerProtection extends AbsTrustedShops
else
$this->errors[] = $this->l('Some parameters sending to "requestForProtectionV2" method are wrong or missing.');
}
/**
* With the getRequestState() method,
* the status of a guarantee application is requested
* the status of a guarantee application is requested
* and in the event of a successful transaction,
* the guarantee number is returned.
*
*
* @uses TSBuyerProtection::_getClient()
* @param array $params
* @throws TSBPException
@@ -527,22 +527,22 @@ class TSBuyerProtection extends AbsTrustedShops
}
return $code;
}
/**
* Check statut of last applications
* Check statut of last applications
* saved with TSBuyerProtection::_requestForProtectionV2()
*
*
* Negative value means an error occured.
* Error code are managed in TSBPException.
* @see (exception) TSBPException::_getFrontEndMessage() method
*
* Trusted Shops recommends that the request
*
* Trusted Shops recommends that the request
* should be automated by a cronjob with an interval of 10 minutes.
* @see /../cron_garantee.php
*
*
* A message is added to the sheet order in Back-office,
* @see Message class
*
*
* @uses TSBuyerProtection::_getRequestState()
* @uses Message class
* @return void
@@ -584,10 +584,10 @@ class TSBuyerProtection extends AbsTrustedShops
$msg->add();
}
}
/**
* Registration link to Trusted Shops
*
*
* @param string $shopsw
* @param string $et_cid
* @param string $et_lid
@@ -601,22 +601,22 @@ class TSBuyerProtection extends AbsTrustedShops
return $this->registration_link[$lang].sprintf('?shopsw=%s&et_cid=%s&et_lid=%s', urlencode($shopsw), urlencode($et_cid), urlencode($et_lid));
return false;
}
/**
* Method to display or redirect the subscription link.
*
*
* @param string $link
*/
private function _getRegistrationLink($link)
{
return '<script type="text/javascript" >$().ready(function(){window.open("'.$link.'");});</script>
<noscript><p><a href="'.$link.'" target="_blank" title="'.$this->l('Registration Link').'" class="link">'.$this->l('Click to get the Registration Link').'</a><p></noscript>';
}
/**
* saved paramter to acces of particular subscribtion link.
*
*
* @return string the registration link.
*/
private function _submitRegistrationLink()
@@ -625,7 +625,7 @@ class TSBuyerProtection extends AbsTrustedShops
TSBuyerProtection::$SHOPSW = (Validate::isCleanHtml(Tools::getValue('shopsw'))) ? Tools::getValue('shopsw') : '';
TSBuyerProtection::$ET_CID = (Validate::isCleanHtml(Tools::getValue('et_cid'))) ? Tools::getValue('et_cid') : '';
TSBuyerProtection::$ET_LID = (Validate::isCleanHtml(Tools::getValue('et_lid'))) ? Tools::getValue('et_lid') : '';
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'SHOPSW', TSBuyerProtection::$SHOPSW);
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'ET_CID', TSBuyerProtection::$ET_CID);
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'ET_LID', TSBuyerProtection::$ET_LID);
@@ -633,12 +633,12 @@ class TSBuyerProtection extends AbsTrustedShops
$this->confirmations[] = $this->l('Registration link has been created. Follow this link if you was not redirected ealier:').'&nbsp;<a href="'.$link_registration.'" class="link">&gt;'.$this->l('Link').'&lt;</a>';
return $link_registration;
}
/**
* Save in special database each buyer protection product for a certificate,
* Each Trusted Shops particular characteristics is saved.
* Create a product in Prestashop database to allow added each of them in cart.
*
*
* @param array|stdClass $protection_items
* @param string $ts_id
*/
@@ -651,12 +651,12 @@ class TSBuyerProtection extends AbsTrustedShops
LEFT JOIN `ps_product_lang` AS pl ON ts.`id_product` = pl.`id_product`
WHERE ts.`ts_id`="'.$ts_id.'"';
Db::getInstance()->Execute($sql);
foreach ($protection_items as $key=>$item)
{
//add hidden product
$product = new Product();
foreach ($this->available_languages as $iso=>$lang)
foreach ($this->available_languages as $iso=>$lang)
{
$language = Language::getIdByIso(strtolower($iso));
if ((int)$language !== 0)
@@ -665,7 +665,7 @@ class TSBuyerProtection extends AbsTrustedShops
$product->link_rewrite[$language] = 'trustedshops_garantee';
}
}
// If the default lang is different than available languages :
// (Bug occurred otherwise)
if (!array_key_exists(Language::getIsoById((int)Configuration::get('PS_LANG_DEFAULT')), $this->available_languages))
@@ -679,7 +679,7 @@ class TSBuyerProtection extends AbsTrustedShops
$product->active = true;
$product->id_tax = 0;
$product->add();
if ($product->id)
{
$sql = '
@@ -713,11 +713,11 @@ class TSBuyerProtection extends AbsTrustedShops
}
}
}
/**
* Check and add a Trusted Shops certificate in shop.
*
* @uses TSBuyerProtection::_getProtectionItems()
*
* @uses TSBuyerProtection::_getProtectionItems()
* to get all buyer protection products from Trusted Shops
* @uses TSBuyerProtection::_saveProtectionItems()
* to save buyer protection products in shop
@@ -734,7 +734,7 @@ class TSBuyerProtection extends AbsTrustedShops
if ($checked_certificate)
{
TSBuyerProtection::$CERTIFICATE[strtoupper($checked_certificate->certificationLanguage)] = array('stateEnum'=>$checked_certificate->stateEnum, 'typeEnum'=>$checked_certificate->typeEnum, 'url'=>$checked_certificate->url, 'tsID'=>$checked_certificate->tsID, 'user'=>'', 'password'=>'');
// update the configuration var
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'CERTIFICATE_'.strtoupper($checked_certificate->certificationLanguage), Tools::htmlentitiesUTF8(Tools::jsonEncode(TSBuyerProtection::$CERTIFICATE[strtoupper($checked_certificate->certificationLanguage)])));
$this->confirmations[] = $this->l('Certificate has been well added.');
@@ -752,11 +752,11 @@ class TSBuyerProtection extends AbsTrustedShops
}
return false;
}
/**
* Apply delete or edit action to a certificate
*
* @return boolean|array
*
* @return boolean|array
* - false if action concerned multiple certificate
* (in normal way, this never occured )
* - return required $certificate to edit.
@@ -771,7 +771,7 @@ class TSBuyerProtection extends AbsTrustedShops
$this->errors[] = $this->l('You must edit or delete a Certificate one per one');
return false;
}
// delete action :
if (is_array($delete) AND isset(TSBuyerProtection::$CERTIFICATE[$delete[0]]['tsID']))
{
@@ -782,7 +782,7 @@ class TSBuyerProtection extends AbsTrustedShops
.' "'.$certificate_to_delete.'" ('.$this->l('language').' : '.$delete[0].') '
.$this->l('has been well deleted');
}
// edit action :
if (is_array($edit))
{
@@ -792,12 +792,12 @@ class TSBuyerProtection extends AbsTrustedShops
}
return true;
}
/**
* Change the certificate values.
* concerns only excellence certificate
* concerns only excellence certificate
* for payment type, login and password values.
*
*
* @uses TSBuyerProtection::_checkLogin()
* @return true;
*/
@@ -816,7 +816,7 @@ class TSBuyerProtection extends AbsTrustedShops
foreach ($all_payment_type as $key=>$module_id)
TSBuyerProtection::$CERTIFICATE[$iso_lang]['payment_type'][(string)$key] = $module_id;
}
$check_login = false;
try {
$check_login = $this->_checkLogin(TSBuyerProtection::$CERTIFICATE[$iso_lang]['tsID'], $user, $password);
@@ -829,7 +829,7 @@ class TSBuyerProtection extends AbsTrustedShops
TSBuyerProtection::$CERTIFICATE[$iso_lang]['password'] = $password;
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'CERTIFICATE_'.$iso_lang, Tools::htmlentitiesUTF8(Tools::jsonEncode(TSBuyerProtection::$CERTIFICATE[$iso_lang])));
$this->confirmations[] = $this->l('Certificate login has been well added.');
}
}
else
@@ -838,7 +838,7 @@ class TSBuyerProtection extends AbsTrustedShops
}
return true;
}
/**
* Change the environment for working.
* Not use anymore but keeped
@@ -859,10 +859,10 @@ class TSBuyerProtection extends AbsTrustedShops
TSBuyerProtection::$ENV_API = $env_api;
Configuration::updateValue(TSBuyerProtection::PREFIX_TABLE.'ENV_API', TSBuyerProtection::$ENV_API);
}
/**
* Dispatch post process depends on each formular
*
*
* @return array depend on the needs about each formular.
*/
private function _preProcess()
@@ -878,10 +878,10 @@ class TSBuyerProtection extends AbsTrustedShops
$posts_return['change_certificate'] = $this->_submitChangeCertificate();
return $posts_return;
}
/**
* Display each formaular in back-office
*
*
* @see Module::getContent()
* @return string for displaying form.
*/
@@ -899,12 +899,12 @@ class TSBuyerProtection extends AbsTrustedShops
$out .= '<br />';
$out .= $this->_displayFormAddCertificate();
$out .= '<br />';
$bool_display_certificats = false;
if (is_array(self::$CERTIFICATE))
foreach (self::$CERTIFICATE as $certif)
$bool_display_certificats = (isset($certif['tsID']) && $certif['tsID'] != '')? true : $bool_display_certificats;
if ($bool_display_certificats)
$out .= $this->_displayFormCertificatesList();
if (isset($posts_return['edit_certificate']) && $posts_return['edit_certificate'] &&
@@ -1045,7 +1045,7 @@ class TSBuyerProtection extends AbsTrustedShops
$out .= '<input type="checkbox" name="certificate_delete[]" value="'.$lang.'" />';
} else {
$out .= $this->l('No need');
}
}
$out .= '
</td>
</tr>';
@@ -1060,16 +1060,16 @@ class TSBuyerProtection extends AbsTrustedShops
';
return $out;
}
/**
* Check if a module is payment module.
*
* Method instanciate a $module by its name,
* Module::getInstanceByName() rather than Module::getInstanceById()
*
* Method instanciate a $module by its name,
* Module::getInstanceByName() rather than Module::getInstanceById()
* is used for cache improvement and avoid an sql request.
*
*
* Method test if PaymentMethod::getCurrency() is a method from the module.
*
*
* @see Module::getInstanceByName() in classes/Module.php
* @param string $module name of the module
*/
@@ -1077,7 +1077,7 @@ class TSBuyerProtection extends AbsTrustedShops
{
$return = false;
$module = Module::getInstanceByName($module);
if (method_exists($module, 'getCurrency')){
$return = clone $module;
}
@@ -1106,7 +1106,7 @@ class TSBuyerProtection extends AbsTrustedShops
});
TSPayment.init();
});
</script>
<form action="'.$this->_makeFormAction($_SERVER['REQUEST_URI'], $this->id_tab).'" method="post" >
<fieldset>
@@ -1192,7 +1192,7 @@ class TSBuyerProtection extends AbsTrustedShops
/**
* For Excellence certificate display Buyer protection products.
* An error message if the certificate is not totally filled
*
*
* @param array $params
* @return string tpl content
*/
@@ -1200,15 +1200,15 @@ class TSBuyerProtection extends AbsTrustedShops
{
$lang = Language::getIsoById($params['cookie']->id_lang);
$lang = strtoupper($lang);
if (!isset(TSBuyerProtection::$CERTIFICATE[$lang]) ||
if (!isset(TSBuyerProtection::$CERTIFICATE[$lang]) ||
!isset(TSBuyerProtection::$CERTIFICATE[$lang]['typeEnum']))
return '';
// This hook is available only with EXCELLENCE certificate.
if(TSBuyerProtection::$CERTIFICATE[$lang]['typeEnum'] == 'CLASSIC' OR (TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'PRODUCTION' AND TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'TEST'))
if(TSBuyerProtection::$CERTIFICATE[$lang]['typeEnum'] == 'CLASSIC' OR (TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'INTEGRATION' AND TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'PRODUCTION' AND TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'TEST'))
return '';
// If login parameters missing for the certificate an error occured
if ((TSBuyerProtection::$CERTIFICATE[$lang]['user'] == '' OR TSBuyerProtection::$CERTIFICATE[$lang]['password'] == '') AND TSBuyerProtection::$CERTIFICATE[$lang]['typeEnum'] == 'EXCELLENCE')
{
@@ -1219,13 +1219,13 @@ class TSBuyerProtection extends AbsTrustedShops
.$this->l('Problem occurred with your language:').' "'.$lang
.'"</p>';
}
if (array_key_exists($lang, $this->available_languages))
{
$currency = new Currency((int)$params['cookie']->id_currency);
$sql = '
SELECT * FROM `'._DB_PREFIX_.TSBuyerProtection::DB_ITEMS.'`
WHERE 1
WHERE 1
AND ts_id ="'.TSBuyerProtection::$CERTIFICATE[$lang]['tsID'].'"
AND `protected_amount_decimal` >= "'.$params['cart']->getOrderTotal(true, Cart::BOTH).'"
AND `currency` = "'.$currency->iso_code.'"
@@ -1236,7 +1236,7 @@ class TSBuyerProtection extends AbsTrustedShops
{
$sql = '
SELECT * FROM `'._DB_PREFIX_.TSBuyerProtection::DB_ITEMS.'`
WHERE 1
WHERE 1
AND ts_id ="'.TSBuyerProtection::$CERTIFICATE[$lang]['tsID'].'"
AND `protected_amount_decimal` <= "'.$params['cart']->getOrderTotal(true, Cart::BOTH).'"
AND `currency` = "'.$currency->iso_code.'"
@@ -1252,11 +1252,11 @@ class TSBuyerProtection extends AbsTrustedShops
}
return $this->display(TSBuyerProtection::$module_name, 'display_products.tpl');
}
/**
* This prepare values to create the Trusted Shops web service
* for Excellence certificate.
*
*
* @see TSBuyerProtection::_requestForProtectionV2() method
* @param array $params
* @param string $lang
@@ -1267,32 +1267,32 @@ class TSBuyerProtection extends AbsTrustedShops
$currency = new Currency((int)$params['objOrder']->id_currency);
$order_products = $params['objOrder']->getProducts();
$order_item_ids = array();
foreach ($order_products as $product)
$order_item_ids[] = $product['product_id'];
$sql = '
SELECT * FROM `'._DB_PREFIX_.TSBuyerProtection::DB_ITEMS.'`
WHERE 1
WHERE 1
AND `id_product` IN ('.implode(',', $order_item_ids).')
AND `ts_id` ="'.TSBuyerProtection::$CERTIFICATE[$lang]['tsID'].'"
AND `currency` = "'.$currency->iso_code.'"
';
$item = Db::getInstance()->ExecuteS($sql);
// No items ? means no buyer protection products was bought.
if(empty($item))
return '';
// In normal context this never occured,
// In normal context this never occured,
// because of a buyer could never add multiple Buyer protection products.
if (count($item) > 1)
{
$this->errors[] = $this->l('A buyer can\'t buy multiple Buyer Protection Products.');
die($this->errors);
}
$item = $item[0];
$item = $item[0];
$customer = new Customer($params['objOrder']->id_customer);
$payment_module = Module::getInstanceByName($params['objOrder']->module);
$arr_params = array();
@@ -1317,17 +1317,17 @@ class TSBuyerProtection extends AbsTrustedShops
$arr_params['shopSystemVersion'] = 'Prestashop '._PS_VERSION_;
$arr_params['wsUser'] = TSBuyerProtection::$CERTIFICATE[$lang]['user'];
$arr_params['wsPassword'] = TSBuyerProtection::$CERTIFICATE[$lang]['password'];
$this->_requestForProtectionV2($arr_params);
$return = '';
if (!empty($this->errors))
$return = '<p style="color:red">'.implode('<br />', $this->errors).'</p>';
else
$return = '<p>'.$this->l('You will receive a mail by Trusted Shops about your garantie number.').'</p>';
$return = '<p>'.$this->l('You will receive a mail by Trusted Shops about your garantie number.').'</p>';
return $return;
}
/**
* Trusted Shops Buyer Protection is integrated at the end of the checkout
* as a form on the order confirmation page.
@@ -1335,7 +1335,7 @@ class TSBuyerProtection extends AbsTrustedShops
* the order data is processed to Trusted Shops.
* The customer confirms the Buyer Protection on the Trusted Shops site.
* The guarantee is then booked and the customer receives an email by Trusted Shops.
*
*
* @param array $params
* @param string $lang
* @return string tpl content
@@ -1344,7 +1344,7 @@ class TSBuyerProtection extends AbsTrustedShops
{
$customer = new Customer($params['objOrder']->id_customer);
$currency = new Currency((int)$params['objOrder']->id_currency);
$arr_params = array();
$arr_params['charset'] = 'UTF-8';
$arr_params['shop_id'] = TSBuyerProtection::$CERTIFICATE[$lang]['tsID'];
@@ -1362,12 +1362,12 @@ class TSBuyerProtection extends AbsTrustedShops
);
return $this->display(TSBuyerProtection::$module_name, 'order-confirmation-tsbp-classic.tpl');
}
/**
* Order confirmation displaying and actions depend on the certificate type.
*
*
* @uses TSBuyerProtection::_orderConfirmationClassic() for Classic certificate
* @uses TSBuyerProtection::_orderConfirmationExcellence for Excellence certificate.
* @uses TSBuyerProtection::_orderConfirmationExcellence for Excellence certificate.
* @param array $params
* @return string depend on which certificate is used.
*/
@@ -1375,15 +1375,16 @@ class TSBuyerProtection extends AbsTrustedShops
{
$lang = Language::getIsoById($params['objOrder']->id_lang);
$lang = strtoupper($lang);
// If certificate is a classic type or certificate login parameters missing
if (((TSBuyerProtection::$CERTIFICATE[$lang]['user'] == '' OR TSBuyerProtection::$CERTIFICATE[$lang]['password'] == '') AND TSBuyerProtection::$CERTIFICATE[$lang]['typeEnum'] == 'EXCELLENCE')
OR (TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'PRODUCTION' AND TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'TEST'))
OR (TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'INTEGRATION' AND TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'PRODUCTION' AND TSBuyerProtection::$CERTIFICATE[$lang]['stateEnum'] !== 'TEST'))
return '';
if(TSBuyerProtection::$CERTIFICATE[$lang]['typeEnum'] == 'CLASSIC')
return $this->_orderConfirmationClassic($params, $lang);
else
return $this->_orderConfirmationExcellence($params, $lang);
}
}
@@ -1,5 +1,5 @@
{*
* 2007-2011 PrestaShop
* 2007-2011 PrestaShop
*
* NOTICE OF LICENSE
*
@@ -24,6 +24,7 @@
* International Registered Trademark & Property of PrestaShop SA
*}
<style>
{literal}
input.myButtonTricksTS
{
font-size:9px !important;
@@ -31,6 +32,7 @@ input.myButtonTricksTS
cursor:pointer;
padding:3px;
}
{/literal}
</style>
<div class="trustedshops-form" style="text-align:center;border:1px solid #ccc;padding:10px;">
<div style="float:left;width:72px;">
@@ -58,3 +60,4 @@ input.myButtonTricksTS
</div>
</form>
</div>
+15 -14
View File
@@ -45,10 +45,10 @@ class TrustedShops extends Module
global $smarty;
$this->name = 'trustedshops';
$this->tab = 'payment_security';
$this->version = 1.1;
$this->version = 1.2;
parent::__construct();
if (empty(self::$objects_list))
{
TSBuyerProtection::setTranslationObject($this);
@@ -59,20 +59,20 @@ class TrustedShops extends Module
self::$objects_list[0]->setModuleName($this->name);
self::$objects_list[0]->setSmarty($smarty);
}
if (!extension_loaded('soap'))
$this->warnings[] = $this->l('This module requires the SOAP PHP extension to function properly.');
foreach (self::$objects_list as $object)
{
$this->limited_countries = array_merge($this->limited_countries, $object->limited_countries);
if(!empty($object->warnings))
$this->warnings = array_merge($this->warnings, $object->warnings);
}
if (!empty($this->warnings))
$this->warning = implode(',<br />', $this->warnings).'.';
$this->displayName = $this->l('Trusted Shops Customer Rating');
$this->description = $this->l('Boost consumer confidence and turn more shoppers into buyers.');
$this->confirmUninstall = $this->l('Are you sure you want to delete all your settings?');
@@ -85,7 +85,7 @@ class TrustedShops extends Module
{
$return = $object->install();
if (!$return)
break;
break;
}
$return = ($return) ? (parent::install() AND $this->registerHook('orderConfirmation') AND $this->registerHook('newOrder') AND $this->registerHook('rightColumn') AND $this->registerHook('paymentTop') AND $this->registerHook('orderConfirmation')) : $return;
$id_hook = Hook::get('payment');
@@ -100,7 +100,7 @@ class TrustedShops extends Module
{
$return = $object->uninstall();
if (!$return)
break;
break;
}
$return = ($return) ? parent::uninstall() : $return;
return $return;
@@ -122,14 +122,14 @@ class TrustedShops extends Module
foreach($tabs['title'] as $key=>$title)
$out .= '<li id="menuTab'.$key.'" class="menuTabButton'.( (int)$key === (int)Tools::getValue('id_tab') ? ' selected' : '' ).'">'.($key+1).'. '.$title.'</li>';
$out .= '</ul>';
// Display content Tabs
$out .= '<div id="tabList">';
foreach($tabs['content'] as $key=>$content)
$out .= '<div id="menuTab'.$key.'Sheet" class="tabItem'.( (int)$key === (int)Tools::getValue('id_tab') ? ' selected' : '' ).'">'.$content.'</div>';
$out .= '<br clear="left" />'.$this->displayCSSJSTab();
// Check If each object (display as Tab) contains errors message of
// Check If each object (display as Tab) contains errors message of
$this->checkObjectsErrorsOrConfirmations();
return ( !empty($this->errors) ? $this->displayErrors() : $this->displayConfirmations() ).$out;
}
@@ -162,10 +162,10 @@ class TrustedShops extends Module
</script>
';
}
/**
* Check If each object (display as Tab) contains errors message of
*
*
* @return void
*/
private function checkObjectsErrorsOrConfirmations()
@@ -231,3 +231,4 @@ class TrustedShops extends Module
return $return;
}
}