diff --git a/Documentation/configuration.md b/Documentation/configuration.md index bd1b158..b824b75 100644 --- a/Documentation/configuration.md +++ b/Documentation/configuration.md @@ -23,95 +23,4 @@ In the Pagantis admin panel, we can set the following options: | Secret Key(*) | String. | Simulator is enabled | * Yes => Display the installments simulator (Default)
* No => Do not display the simulator -:information_source: - Your keys are located on your [Pagantis profile](https://bo.clearpay.com/shop) - - -## :clipboard: Advanced configuration: -While we recommend using the Pagantis module as is , you can customize some settings as shown below. - -You have to ways to edit your settings: -* [Database queries](./configuration.md#edit-your-settings-using-database-queries) -* [HTTP requests](./configuration.md#edit-your-settings-using-postman) - -##### List of settings and their description. - -> __Static__ values cannot be edited. - -| Field | Description

-| :------------- |:-------------| -| TITLE | Payment title to show in checkout page. By default:"Instant financing". -| SIMULATOR_DISPLAY_TYPE | Installments simulator on the product page. Static value: 'pgSDK.simulator.types.PRODUCT_PAGE'. -| SIMULATOR_DISPLAY_SKIN | Skin of the product page simulator. Recommended value: 'pgSDK.simulator.skins.BLUE'. -| SIMULATOR_START_INSTALLMENTS | Default number of installments to use in the simulator. -| SIMULATOR_DISPLAY_CSS_POSITION | The position where the simulator widget will be placed. Recommended value: 'pgSDK.simulator.positions.INNER'. -| SIMULATOR_CSS_PRICE_SELECTOR | CSS selector of the DOM element containing the total amount value. -| SIMULATOR_CSS_POSITION_SELECTOR | CSS Selector to place the widget. (Example: '#simulator', '.PgSimulator') -| SIMULATOR_CSS_QUANTITY_SELECTOR | CSS selector of the DOM element containing the quantity selector value. -| FORM_DISPLAY_TYPE | Allows you to select the way the Pagantis payment form is displayed site -| CLEARPAY_MIN_AMOUNT | Minimum amount to use the module and show the payment method in the checkout page and in product page. -| CLEARPAY_MAX_AMOUNT | Maximum amount to use the module and show the payment method in the checkout page and in product page. -| URL_OK | Location where user will be redirected after a successful payment. This string will be concatenated to the base url to build the full url -| URL_KO | Location where user will be redirected after a wrong payment. This string will be concatenated to the base url to build the full url -| ALLOWED_COUNTRIES | Array of country codes where Pagantis will be used as a payment method. - -##### Edit your settings using database queries -1 - Open your database management (Commonly Cpanel->phpmyadmin depending on your hosting solution) - -2 - Connect to prestashop database. - -3 - Launch a query to check if the table exists: - * Query: - ``` - SELECT * FROM clearpay_config; - ``` - - ![Step 3](./sql_step3.png?raw=true "Step 1") - -4 - Find the setting TITLE, in this example we are going to change 'Instant Financing' to 'New Title' - -5 - Launch the following query to edit the value: - * Query: - ``` - UPDATE clearpay_config set value='New title' WHERE config='TITLE'; - ``` - - ![Step 5](./sql_step5.png?raw=true "Step 5") - - -6 - After the modification, you can verify it with the following query : - * Query: - ``` - SELECT * FROM clearpay_config; - ``` - - ![Step 6](./sql_step6.png?raw=true "Step 6") - -7 - Finally you can see the result on checkout page -![Step 7](./sql_step7_.png?raw=true "Step 7") - - -##### Edit your settings using Postman - -1. Open the application -![Step 1](./postman_step1.png?raw=true "Step 1") - -2. Set the mode of the request -2.1 - Click on BODY tag -2.2 - Click on x-www-form-urlencoded -![Step 2](./postman_step2.png?raw=true "Step 2") - -3. Set your request -3.1 - On the upper-left side, you need to set a POST request -3.2 - Fill the url field with your domain, and your secret key which is located on your [Pagantis profile](https://bo.clearpay.com/shop). -3.3 - Set the config key to modify.[List of config keys](./configuration.md#list-of-settings-and-their-description). -3.4 - Set the value for the selected key -![Step 3](./postman_step3.png?raw=true "Step 3") - -4. Press SEND -![Step 4](./postman_step4.png?raw=true "Step 4") - -5. If everything works correctly, you should see the edited config as show below -![Step 5](./postman_step5.png?raw=true "Step 5") - -6. Finally you can see the result on checkout page -![Step 6](./postman_step6.png?raw=true "Step 6") \ No newline at end of file +:information_source: - Your keys are located on your [Pagantis profile](https://merchant.clearpay.com/) \ No newline at end of file diff --git a/Gruntfile.js b/Gruntfile.js index 5a355ad..b8f8c87 100644 --- a/Gruntfile.js +++ b/Gruntfile.js @@ -1,7 +1,7 @@ module.exports = function(grunt) { grunt.initConfig({ shell: { - rename: { + generateZip: { command: 'cp clearpay.zip clearpay-$(git rev-parse --abbrev-ref HEAD).zip \n' }, @@ -79,9 +79,8 @@ module.exports = function(grunt) { 'shell:composerProd', 'shell:autoindex', 'compress', - 'shell:rename', + 'shell:generateZip', 'shell:composerDev' ]); - //manually run the selenium test: "grunt shell:testPrestashop16" }; \ No newline at end of file diff --git a/README b/README deleted file mode 100644 index e69de29..0000000 diff --git a/clearpay.php b/clearpay.php index 8ea1162..f2600f6 100644 --- a/clearpay.php +++ b/clearpay.php @@ -20,15 +20,18 @@ */ class Clearpay extends PaymentModule { + /** Product Name */ + const PRODUCT_PAYMENT_NAME = "Clearpay"; + /** * Available currency */ - const CLEARPAY_AVAILABLE_CURRENCIES = 'EUR,GBP'; + const SIMULATOR_IS_ENABLED = true; /** * JS CDN URL */ - const CLEARPAY_JS_CDN_URL = 'https://js.sandbox.afterpay.com/afterpay-1.x.js'; + const CLEARPAY_JS_CDN_URL = 'https://js.afterpay.com/afterpay-1.x.js'; /** * @var string @@ -44,28 +47,31 @@ class Clearpay extends PaymentModule public $language; /** - * Default module advanced configuration values + * Default available countries for the different operational regions * * @var array */ - public $defaultConfigs = array( - 'CODE' =>'clearpay', - 'ALLOWED_COUNTRIES' => '["ES","FR","IT","GB"]', - 'SIMULATOR_DISPLAY_TYPE' => 'clearpay', - 'SIMULATOR_IS_ENABLED' => true, - 'SIMULATOR_CSS_SELECTOR' => 'default', - 'URL_OK' => '', - 'URL_KO' => '' + public $defaultCountriesPerRegion = array( + 'AU' => '["AU"]', + 'CA' => '["CA"]', + 'ES' => '["ES", "IT", "FR"]', + 'GB' => '["GB"]', + 'NZ' => '["NZ"]', + 'US' => '["US"]', ); /** - * Default available countries for the different operational regions + * Default API Version per region * * @var array */ - public $defaultCountriesPerRegion = array( - 'GB' => '["GB"]', - 'US' => '["US"]' + public $defaultApiVersionPerRegion = array( + 'AU' => 'v2', + 'CA' => 'v2', + 'ES' => 'v1', + 'GB' => 'v2', + 'NZ' => 'v2', + 'US' => 'v2', ); /** @@ -93,16 +99,16 @@ public function __construct() { $this->name = 'clearpay'; $this->tab = 'payments_gateways'; - $this->version = '1.0.5'; - $this->author = 'Clearpay'; + $this->version = '1.1.0'; + $this->author = $this->l('Clearpay'); $this->currencies = true; $this->currencies_mode = 'checkbox'; $this->module_key = '1da91d21c9c3427efd7530c2be29182d'; $this->ps_versions_compliancy = array('min' => '1.6', 'max' => _PS_VERSION_); $this->displayName = $this->l('Clearpay Payment Gateway'); - $this->description = $this->l('Buy now, pay later. Always interest-free. Reach new customers, increase your') . - $this->l(' conversion rate, recurrency and average order value ofering interest-free installments') . - $this->l(' in your eCommerce.'); + $this->description = $this->l('Buy now, pay later. Always interest-free. Reach new customers, ') . + $this->l('increase your conversion rate, recurrency and average order value ofering ') . + $this->l('interest-free installments in your eCommerce.'); $this->currency = 'EUR'; $this->currencySymbol = '€'; $context = Context::getContext(); @@ -134,8 +140,6 @@ public function install() $sql_file = dirname(__FILE__) . '/sql/install.sql'; $this->loadSQLFile($sql_file); - $this->populateEnvVariables(); - Configuration::updateValue('CLEARPAY_IS_ENABLED', 0); Configuration::updateValue('CLEARPAY_REGION', 'ES'); Configuration::updateValue('CLEARPAY_PUBLIC_KEY', ''); @@ -145,7 +149,12 @@ public function install() Configuration::updateValue('CLEARPAY_MIN_AMOUNT', null); Configuration::updateValue('CLEARPAY_MAX_AMOUNT', null); Configuration::updateValue('CLEARPAY_RESTRICTED_CATEGORIES', ''); - + Configuration::updateValue('CLEARPAY_ALLOWED_COUNTRIES', '["ES","FR","IT","GB"]'); + Configuration::updateValue('CLEARPAY_CSS_SELECTOR', 'default'); + Configuration::updateValue('CLEARPAY_CSS_SELECTOR_CART', 'default'); + Configuration::updateValue('CLEARPAY_URL_OK', ''); + Configuration::updateValue('CLEARPAY_URL_KO', ''); + Configuration::updateValue('CLEARPAY_LOGS', ''); $return = (parent::install() && $this->registerHook('paymentOptions') @@ -185,6 +194,13 @@ public function uninstall() Configuration::deleteByName('CLEARPAY_MIN_AMOUNT'); Configuration::deleteByName('CLEARPAY_MAX_AMOUNT'); Configuration::deleteByName('CLEARPAY_RESTRICTED_CATEGORIES'); + Configuration::deleteByName('CLEARPAY_ALLOWED_COUNTRIES'); + Configuration::deleteByName('CLEARPAY_CSS_SELECTOR'); + Configuration::deleteByName('CLEARPAY_CSS_SELECTOR_CART'); + Configuration::deleteByName('CLEARPAY_URL_OK'); + Configuration::deleteByName('CLEARPAY_URL_KO'); + Configuration::deleteByName('CLEARPAY_LOGS'); + $sql_file = dirname(__FILE__).'/sql/uninstall.sql'; $this->loadSQLFile($sql_file); @@ -211,32 +227,6 @@ public function loadSQLFile($sql_file) return $result; } - /** - * Populate DB variables on installation - */ - public function populateEnvVariables() - { - $sql_content = 'select * from ' . _DB_PREFIX_. 'clearpay_config'; - $dbConfigs = Db::getInstance()->executeS($sql_content); - - // Convert a multimple dimension array for SQL insert statements into a simple key/value - $simpleDbConfigs = array(); - foreach ($dbConfigs as $config) { - $simpleDbConfigs[$config['config']] = $config['value']; - } - $newConfigs = array_diff_key($this->defaultConfigs, $simpleDbConfigs); - if (!empty($newConfigs)) { - $data = array(); - foreach ($newConfigs as $key => $value) { - $data[] = array( - 'config' => $key, - 'value' => $value, - ); - } - Db::getInstance()->insert('clearpay_config', $data); - } - } - /** * Check amount of order > minAmount * Check valid currency @@ -249,22 +239,19 @@ public function isPaymentMethodAvailable() { $cart = $this->context->cart; $totalAmount = $cart->getOrderTotal(true, Cart::BOTH); - $currency = new Currency($cart->id_currency); - $availableCurrencies = explode(",", self::CLEARPAY_AVAILABLE_CURRENCIES); $isEnabled = Configuration::get('CLEARPAY_IS_ENABLED'); $displayMinAmount = Configuration::get('CLEARPAY_MIN_AMOUNT'); $displayMaxAmount = Configuration::get('CLEARPAY_MAX_AMOUNT'); $publicKey = Configuration::get('CLEARPAY_PUBLIC_KEY'); $secretKey = Configuration::get('CLEARPAY_SECRET_KEY'); - $allowedCountries = json_decode(Clearpay::getExtraConfig('ALLOWED_COUNTRIES', null)); + $allowedCountries = json_decode(Configuration::get('CLEARPAY_ALLOWED_COUNTRIES')); $language = $this->getCurrentLanguage(); $categoryRestriction = $this->isCartRestricted($this->context->cart); return ( $isEnabled && $totalAmount >= $displayMinAmount && $totalAmount <= $displayMaxAmount && - in_array($currency->iso_code, $availableCurrencies) && in_array(Tools::strtoupper($language), $allowedCountries) && !$categoryRestriction && $publicKey && @@ -292,14 +279,30 @@ private function getButtonTemplateVars(Cart $cart) /** * Header hook */ - public function hookHeader() + public function hookHeader($params) { + if ( + Context::getContext()->controller->php_self === 'product' || + Context::getContext()->controller->php_self === 'order' + ) { + echo ''; + } if (_PS_VERSION_ >= "1.7") { $this->context->controller->registerJavascript( sha1(mt_rand(1, 90000)), self::CLEARPAY_JS_CDN_URL, array('server' => 'remote') ); + } else { $this->context->controller->addJS(self::CLEARPAY_JS_CDN_URL); } @@ -346,25 +349,25 @@ public function hookPaymentOptions() Tools::strtoupper(Tools::substr($templateConfigs['ISO_COUNTRY_CODE'], 2, 4)); } $templateConfigs['CURRENCY'] = $this->currency; - $templateConfigs['MORE_HEADER1'] = $this->l('Always interest-free.'); - $templateConfigs['MORE_HEADER2'] = $this->l('No extra documentation. Instant aproval.'); $templateConfigs['TOTAL_AMOUNT'] = $totalAmount; - $moreInfo = $this->l('You will be redirected to Clearpay website to fill out your payment information.'); - $moreInfo .= ' ' .$this->l('You will be redirected to our site to complete your order. Please note: '); - $moreInfo .= ' ' . $this->l('Clearpay can only be used as a payment method for orders with a shipping'); - $moreInfo .= ' ' . $this->l('and billing address within the UK.'); - $templateConfigs['MOREINFO_ONE'] = $moreInfo; + $description = $this->l('You will be redirected to Clearpay to fill out your payment information.'); + $templateConfigs['DESCRIPTION'] = $description; $templateConfigs['TERMS_AND_CONDITIONS'] = $this->l('Terms and conditions'); $termsLink = $this->l('https://www.clearpay.co.uk/en-GB/terms-of-service'); $templateConfigs['TERMS_AND_CONDITIONS_LINK'] = $termsLink; - $templateConfigs['TERMS_AND_CONDITIONS_LINK'] = $this->l( - 'https://www.clearpay.co.uk/en-GB/terms-of-service' - ); + $templateConfigs['MORE_INFO_TEXT'] = $this->l('More info'); $templateConfigs['LOGO_TEXT'] = $this->l("Clearpay"); - $templateConfigs['ICON'] = Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/views/img/app_icon.png'); - $templateConfigs['LOGO_BADGE'] = Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/views/img/logo.png'); + $templateConfigs['ICON'] = 'https://static.afterpay.com/app/icon-128x128.png'; + $templateConfigs['LOGO_BADGE'] = 'https://static.afterpay.com/email/logo-clearpay-colour.png'; $templateConfigs['LOGO_OPC'] = Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/views/img/logo_opc.png'); $templateConfigs['PAYMENT_URL'] = $link->getModuleLink('clearpay', 'payment'); + $mobileViewLayout = Tools::strtolower('four-by-one'); + $isMobileLayout = $this->context->isMobile(); + if ($this->context->isMobile()){ + $mobileViewLayout = Tools::strtolower('two-by-two'); + } + $templateConfigs['AP_MOBILE_LAYOUT'] = $mobileViewLayout; + $templateConfigs['IS_MOBILE_LAYOUT'] = $isMobileLayout; $templateConfigs['PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3)); $this->context->smarty->assign($templateConfigs); @@ -418,26 +421,30 @@ private function getConfigForm() ), ) ); + $query = array( + array( + 'CLEARPAY_REGION_id' => 'ES', + 'CLEARPAY_REGION_name' => $this->l('Europe') + ), + array( + 'CLEARPAY_REGION_id' => 'GB', + 'CLEARPAY_REGION_name' => $this->l('United Kingdom') + ) + ); $inputs[] = array( 'name' => 'CLEARPAY_REGION', - 'type' => 'radio', + 'type' => 'select', 'label' => $this->l('API region'), 'prefix' => '', 'class' => 't', 'required' => true, - 'values' => array( - array( - 'id' => 'CLEARPAY_REGION_ID', - 'value' => 'ES', - 'label' => $this->l('Europe') - ), - array( - 'id' => 'CLEARPAY_REGION_ID', - 'value' => 'GB', - 'label' => $this->l('United Kingdom') - ) + 'options' => array( + 'query' => $query, + 'id' => 'CLEARPAY_REGION_id', + 'name' => 'CLEARPAY_REGION_name' ) ); + $inputs[] = array( 'name' => 'CLEARPAY_PUBLIC_KEY', 'suffix' => $this->l('ex: 400101010'), @@ -501,6 +508,9 @@ private function getConfigForm() 'type' => 'categories', 'label' => $this->l('Restricted Categories'), 'name' => 'CLEARPAY_RESTRICTED_CATEGORIES', + 'col' => 7, + 'desc' => $this->l('IMPORTANT: Only enable the categories where you DON\'T want to show Clearpay. ') . + $this->l('By default: UNCHECK ALL'), 'tree' => array( 'id' => 'CLEARPAY_RESTRICTED_CATEGORIES', 'selected_categories' => json_decode(Configuration::get('CLEARPAY_RESTRICTED_CATEGORIES')), @@ -509,6 +519,48 @@ private function getConfigForm() 'use_checkbox' => true, ), ); + $inputs[] = array( + 'name' => 'CLEARPAY_CSS_SELECTOR', + 'suffix' => $this->l('The default value is \'default\'.'), + 'desc' => $this->l('This property set the CSS selector needed to show the assets on the product page.') . + ' ' . $this->l('Only change this value if it doesn\'t appear properly.'), + 'type' => 'text', + 'size' => 128, + 'label' => $this->l('Product Page CSS Selector'), + 'col' => 8, + 'required' => false, + ); + $inputs[] = array( + 'name' => 'CLEARPAY_CSS_SELECTOR_CART', + 'suffix' => $this->l('The default value is \'default\'.'), + 'desc' => $this->l('This property set the CSS selector needed to show the assets on the cart page.') . + ' ' . $this->l('Only change this value if it doesn\'t appear properly.'), + 'type' => 'text', + 'size' => 128, + 'label' => $this->l('Cart Page CSS Selector'), + 'col' => 8, + 'required' => false, + ); + $inputs[] = array( + 'name' => 'CLEARPAY_LOGS', + 'type' => 'checkbox', + 'label' => $this->l('Debug mode'), + 'desc' => $this->l( + 'You can see these logs on the "Configure -> Advanced Parameters -> Logs" section' + ), + 'class' => 't', + 'values' => array( + 'query' => array( + array( + 'CLEARPAY_LOGS_id' => 'ACTIVE', + 'CLEARPAY_LOGS_name' => $this->l('Activate debug logs') + ) + ), + 'id' => 'CLEARPAY_LOGS_id', + 'name' => 'CLEARPAY_LOGS_name' + ) + ); + $return = array( 'form' => array( @@ -569,6 +621,9 @@ private function renderForm() $helper->fields_value['CLEARPAY_REGION'] = Configuration::get('CLEARPAY_REGION'); $helper->fields_value['CLEARPAY_MIN_AMOUNT'] = Configuration::get('CLEARPAY_MIN_AMOUNT'); $helper->fields_value['CLEARPAY_MAX_AMOUNT'] = Configuration::get('CLEARPAY_MAX_AMOUNT'); + $helper->fields_value['CLEARPAY_CSS_SELECTOR'] = Configuration::get('CLEARPAY_CSS_SELECTOR'); + $helper->fields_value['CLEARPAY_CSS_SELECTOR_CART'] = Configuration::get('CLEARPAY_CSS_SELECTOR_CART'); + $helper->fields_value['CLEARPAY_LOGS_ACTIVE'] = Configuration::get('CLEARPAY_LOGS'); return $helper->generateForm(array($this->getConfigForm())); } @@ -589,12 +644,19 @@ public function getContent() $settingsKeys[] = 'CLEARPAY_ENVIRONMENT'; $settingsKeys[] = 'CLEARPAY_REGION'; $settingsKeys[] = 'CLEARPAY_RESTRICTED_CATEGORIES'; + $settingsKeys[] = 'CLEARPAY_CSS_SELECTOR'; + $settingsKeys[] = 'CLEARPAY_CSS_SELECTOR_CART'; + $settingsKeys[] = 'CLEARPAY_LOGS_ACTIVE'; if (Tools::isSubmit('submit'.$this->name)) { foreach ($settingsKeys as $key) { - $value = Tools::getValue($key); - if (is_array($value)) { - $value = json_encode($value); + if (is_array(Tools::getValue($key))) { + $value = json_encode(Tools::getValue($key)); + } else { + $value = trim(Tools::getValue($key)); + } + if ($key === 'CLEARPAY_LOGS_ACTIVE') { + Configuration::updateValue('CLEARPAY_LOGS', $value); } Configuration::updateValue($key, $value); } @@ -624,49 +686,58 @@ public function getContent() ->setCountryCode(Configuration::get('CLEARPAY_REGION')) ; + $apiVersion = $this->getApiVersionPerRegion(Configuration::get('CLEARPAY_REGION')); $getConfigurationRequest = new Afterpay\SDK\HTTP\Request\GetConfiguration(); $getConfigurationRequest->setMerchantAccount($merchantAccount); - $getConfigurationRequest->setUri("/v1/configuration?include=activeCountries"); + $getConfigurationRequest->setUri("/$apiVersion/configuration?include=activeCountries"); $getConfigurationRequest->send(); $configuration = $getConfigurationRequest->getResponse()->getParsedBody(); if (isset($configuration->message) || is_null($configuration)) { $response = isset($configuration->message) ? $configuration->message : "NULL"; + $message = $this->displayError( - $this->l('Configuration request can not be done with the region and credentials provided.'). - ' ' . $this->l("Message received: ") . $response + $this->l('Configuration request can not be done with the region and credentials') . + $this->l(' provided. Message received: ') . $response ); Configuration::updateValue( 'CLEARPAY_MIN_AMOUNT', - 1 + 0 ); Configuration::updateValue( 'CLEARPAY_MAX_AMOUNT', - 1 + 0 ); } else { - if (isset($configuration[0]->minimumAmount)) { - Configuration::updateValue( - 'CLEARPAY_MIN_AMOUNT', - $configuration[0]->minimumAmount->amount - ); + if (is_array($configuration)) { + $configuration = $configuration[0]; } - if (isset($configuration[0]->maximumAmount)) { - Configuration::updateValue( - 'CLEARPAY_MAX_AMOUNT', - $configuration[0]->maximumAmount->amount - ); + $minAmount = 0; + if (isset($configuration->minimumAmount)) { + $minAmount = $configuration->minimumAmount->amount; + } + Configuration::updateValue( + 'CLEARPAY_MIN_AMOUNT', + $minAmount + ); + $maxAmount = 0; + if (isset($configuration->maximumAmount)) { + $maxAmount = $configuration->maximumAmount->amount; } - if (isset($configuration[0]->activeCountries)) { - self::setExtraConfig( - 'ALLOWED_COUNTRIES', - json_encode($configuration[0]->activeCountries) + Configuration::updateValue( + 'CLEARPAY_MAX_AMOUNT', + $maxAmount + ); + if (isset($configuration->activeCountries)) { + Configuration::updateValue( + 'CLEARPAY_ALLOWED_COUNTRIES', + json_encode($configuration->activeCountries) ); } else { $region = Configuration::get('CLEARPAY_REGION'); if (!empty($region) and is_string($region)) { - self::setExtraConfig( - 'ALLOWED_COUNTRIES', + Configuration::updateValue( + 'CLEARPAY_ALLOWED_COUNTRIES', $this->getCountriesPerRegion($region) ); } @@ -684,7 +755,7 @@ public function getContent() } } - $logo = Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/views/img/logo.png'); + $logo = 'https://static.afterpay.com/email/logo-clearpay-colour.png'; $tpl = $this->local_path.'views/templates/admin/config-info.tpl'; $header = $this->l('Clearpay Configuration Panel'); $button1 = $this->l('Contact us'); @@ -742,23 +813,28 @@ public function hookPayment($params) . $this->l(' with Clearpay'); } $templateConfigs['TITLE'] = $checkoutText; + $templateConfigs['CURRENCY'] = $this->currency; $templateConfigs['MORE_HEADER'] = $this->l('Instant approval decision - 4 interest-free payments of') . ' ' . $amountWithCurrency; $templateConfigs['TOTAL_AMOUNT'] = $totalAmount; - $templateConfigs['MOREINFO_ONE'] = $this->l( - 'You will be redirected to Clearpay website to fill out your - payment information. You will be redirected to our site to complete your order. Please note: Clearpay - can only be used as a payment method for orders with a shipping and billing address within the UK.' - ); + $description = $this->l('You will be redirected to Clearpay to fill out your payment information.'); + $templateConfigs['DESCRIPTION'] = $description; $templateConfigs['TERMS_AND_CONDITIONS'] = $this->l('Terms and conditions'); - $templateConfigs['TERMS_AND_CONDITIONS_LINK'] = $this->l( - 'https://www.clearpay.co.uk/en-GB/terms-of-service' - ); + $termsLink = $this->l('https://www.clearpay.co.uk/en-GB/terms-of-service'); + $templateConfigs['TERMS_AND_CONDITIONS_LINK'] = $termsLink; + $templateConfigs['MORE_INFO_TEXT'] = $this->l('More info'); $templateConfigs['LOGO_TEXT'] = $this->l("Clearpay"); - $templateConfigs['ICON'] = Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/views/img/app_icon.png'); - $templateConfigs['LOGO_BADGE'] = Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/views/img/logo.png'); + $templateConfigs['ICON'] = 'https://static.afterpay.com/app/icon-128x128.png'; + $templateConfigs['LOGO_BADGE'] = 'https://static.afterpay.com/email/logo-clearpay-colour.png'; $templateConfigs['LOGO_OPC'] = Media::getMediaPath(_PS_MODULE_DIR_.$this->name.'/views/img/logo_opc.png'); $templateConfigs['PAYMENT_URL'] = $link->getModuleLink('clearpay', 'payment'); + $mobileViewLayout = Tools::strtolower('four-by-one'); + $isMobileLayout = $this->context->isMobile(); + if ($this->context->isMobile()){ + $mobileViewLayout = Tools::strtolower('two-by-two'); + } + $templateConfigs['AP_MOBILE_LAYOUT'] = $mobileViewLayout; + $templateConfigs['IS_MOBILE_LAYOUT'] = $isMobileLayout; $templateConfigs['PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3)); $this->context->smarty->assign($templateConfigs); @@ -798,6 +874,10 @@ public function templateDisplay($templateName = '') $templateConfigs['DESCRIPTION_TEXT_TWO'] = $desc2; $categoryRestriction = $this->isCartRestricted($this->context->cart); $simulatorIsEnabled = true; + $templateConfigs['PRICE_SELECTOR'] = Configuration::get('CLEARPAY_CSS_SELECTOR_CART'); + if ($templateConfigs['PRICE_SELECTOR'] === 'default'|| $templateConfigs['PRICE_SELECTOR'] === '') { + $templateConfigs['PRICE_SELECTOR'] = '.cart-total .value'; + } } else { $productId = Tools::getValue('id_product'); if (!$productId) { @@ -806,16 +886,20 @@ public function templateDisplay($templateName = '') $categoryRestriction = $this->isProductRestricted($productId); $amount = Product::getPriceStatic($productId); $templateConfigs['AMOUNT'] = $amount; - $simulatorIsEnabled = Clearpay::getExtraConfig('SIMULATOR_IS_ENABLED'); + $simulatorIsEnabled = self::SIMULATOR_IS_ENABLED; + $templateConfigs['PRICE_SELECTOR'] = Configuration::get('CLEARPAY_CSS_SELECTOR'); + if ($templateConfigs['PRICE_SELECTOR'] === 'default'|| $templateConfigs['PRICE_SELECTOR'] === '') { + $templateConfigs['PRICE_SELECTOR'] = + '.current-price :not(span.discount,span.regular-price,span.discount-percentage)'; + if (version_compare(_PS_VERSION_, '1.7', 'lt')) { + $templateConfigs['PRICE_SELECTOR'] = '#our_price_display'; + } + } } $return = ''; $isEnabled = Configuration::get('CLEARPAY_IS_ENABLED'); - $cart = $this->context->cart; - $currency = new Currency($cart->id_currency); - $allowedCountries = json_decode(Clearpay::getExtraConfig('ALLOWED_COUNTRIES', null)); - - $availableCurrencies = explode(",", self::CLEARPAY_AVAILABLE_CURRENCIES); + $allowedCountries = json_decode(Configuration::get('CLEARPAY_ALLOWED_COUNTRIES')); $language = $this->getCurrentLanguage(); if ($isEnabled && $simulatorIsEnabled && @@ -823,7 +907,6 @@ public function templateDisplay($templateName = '') ($amount >= Configuration::get('CLEARPAY_MIN_AMOUNT') || $templateName === 'product.tpl') && ($amount <= Configuration::get('CLEARPAY_MAX_AMOUNT') || $templateName === 'product.tpl') && in_array(Tools::strtoupper($language), $allowedCountries) && - in_array($currency->iso_code, $availableCurrencies) && !$categoryRestriction ) { $templateConfigs['PS_VERSION'] = str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3)); @@ -844,15 +927,8 @@ public function templateDisplay($templateName = '') Tools::strtoupper(Tools::substr($templateConfigs['ISO_COUNTRY_CODE'], 2, 4)); } $templateConfigs['AMOUNT_WITH_CURRENCY'] = $templateConfigs['AMOUNT'] . $this->currencySymbol; - $templateConfigs['PRICE_SELECTOR'] = Clearpay::getExtraConfig('SIMULATOR_CSS_SELECTOR'); - if ($templateConfigs['PRICE_SELECTOR'] === 'default') { - $templateConfigs['PRICE_SELECTOR'] = '.current-price :not(span.discount)'; - if (version_compare(_PS_VERSION_, '1.7', 'lt')) { - $templateConfigs['PRICE_SELECTOR'] = '.our_price_display'; - } - if ($this->currency === 'GBP') { - $templateConfigs['AMOUNT_WITH_CURRENCY'] = $this->currencySymbol. $templateConfigs['AMOUNT']; - } + if ($this->currency === 'GBP') { + $templateConfigs['AMOUNT_WITH_CURRENCY'] = $this->currencySymbol. $templateConfigs['AMOUNT']; } $this->context->smarty->assign($templateConfigs); @@ -860,6 +936,26 @@ public function templateDisplay($templateName = '') __FILE__, 'views/templates/hook/' . $templateName ); + } else { + if ($isEnabled && $templateName === 'product.tpl' && Configuration::get('AFTERPAY_LOGS') === 'on') { + $logMessage = ''; + if (!$simulatorIsEnabled) { + $logMessage .= "Clearpay: Simulator is disabled by 'self::SIMULATOR_IS_ENABLED'. "; + } + if (!in_array(Tools::strtoupper($language), $allowedCountries)) { + $logMessage .= "Clearpay: Simulator is disabled by the allowedCountries, + current:$language and allowed:" . json_encode($allowedCountries) . '. '; + } + if ($categoryRestriction) { + $productCategories = json_encode(Product::getProductCategories($productId)); + $logMessage .= "Clearpay: Simulator is disabled by the Categories restriction, + current:$productCategories." + . "and not allowed:". Configuration::get('CLEARPAY_RESTRICTED_CATEGORIES'); + } + if (Configuration::get('CLEARPAY_LOGS') == 'on') { + PrestaShopLogger::addLog($logMessage, 2, null, "Clearpay", 1); + } + } } return $return; @@ -885,6 +981,7 @@ protected function isOPC() */ public function hookDisplayProductPriceBlock($params) { + // $params['type'] = weight | price | after_price if (isset($params['type']) && $params['type'] === 'after_price' && isset($params['smarty']) && isset($params['smarty']->template_resource) && ( @@ -944,9 +1041,17 @@ public function hookDisplayWrapperTop() $isDeclined = Tools::getValue('clearpay_declined'); $isMismatch = Tools::getValue('clearpay_mismatch'); $referenceId = Tools::getValue('clearpay_reference_id'); + $errorText1 = $this->l('Thanks for confirming your payment, however as your cart has changed we need a new ') . + $this->l(' confirmation. Please proceed to Clearpay and retry again in a few minutes'); + $errorText2 = $this->l('For more information, please contact the Clearpay Customer Service Team:'); + $declinedText1 = $this->l('We are sorry to inform you that your payment has been declined by Clearpay.'); $this->context->smarty->assign(array( 'REFERENCE_ID' => $referenceId, - 'PS_VERSION' => str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3)) + 'PS_VERSION' => str_replace('.', '-', Tools::substr(_PS_VERSION_, 0, 3)), + 'ERROR_TEXT1' => $errorText1, + 'ERROR_TEXT2' => $errorText2, + 'DECLINED_TEXT1' => $declinedText1, + )); if ($isDeclined == 'true') { $return = $this->displayError( @@ -977,12 +1082,18 @@ public function hookDisplayPaymentTop($params) /** * Hook Action for Order Status Update (handles Refunds) - * @param array $params + * @param $params * @return bool - * since 1.0.0 + * @throws \Afterpay\SDK\Exception\InvalidArgumentException + * @throws \Afterpay\SDK\Exception\NetworkException + * @throws \Afterpay\SDK\Exception\ParsingException */ public function hookActionOrderStatusUpdate($params) { + if (empty($order) || empty($order->payment) || $order->payment != self::PRODUCT_PAYMENT_NAME) { + return false; + } + $newOrderStatus = null; $order = null; if (!empty($params) && !empty($params['id_order'])) { @@ -1040,7 +1151,8 @@ public function hookActionOrderStatusUpdate($params) */ public function hookActionOrderSlipAdd($params) { - if (!empty($params) && !empty($params["order"]->id)) { + if (!empty($params) && !empty($params["order"]->id) && + !empty($params["order"]->payment) && $params["order"]->payment == self::PRODUCT_PAYMENT_NAME) { $order = new Order((int)$params["order"]->id); } else { return false; @@ -1111,47 +1223,6 @@ private function createRefundObject() return $clearpayRefund; } - - /** - * @param null $config - * @param string $default - * @return string - */ - public static function getExtraConfig($config = null, $default = '') - { - if (is_null($config)) { - return ''; - } - - $sql = 'SELECT value FROM '._DB_PREFIX_.'clearpay_config where config = \'' . pSQL($config) . '\' limit 1'; - if ($results = Db::getInstance(_PS_USE_SQL_SLAVE_)->ExecuteS($sql)) { - if (is_array($results) && count($results) === 1 && isset($results[0]['value'])) { - return $results[0]['value']; - } - } - - return $default; - } - - /** - * @param null $config - * @param string $value - * @return string - */ - public static function setExtraConfig($config = null, $value = '') - { - if (is_null($config)) { - return $value; - } - - Db::getInstance()->update( - 'clearpay_config', - array('value' => pSQL($value)), - 'config = \'' . pSQL($config) . '\'' - ); - return $value; - } - /** * Check logo exists in OPC module */ @@ -1171,7 +1242,11 @@ public function checkLogoExists() */ private function getCurrentLanguage() { - $allowedCountries = json_decode(Clearpay::getExtraConfig('ALLOWED_COUNTRIES', null)); + $language = 'EN'; + $allowedCountries = json_decode(Configuration::get('CLEARPAY_ALLOWED_COUNTRIES')); + if (is_null($allowedCountries)) { + return $language; + } $lang = Language::getLanguage($this->context->language->id); $langArray = explode("-", $lang['language_code']); if (count($langArray) != 2 && isset($lang['locale'])) { @@ -1180,6 +1255,7 @@ private function getCurrentLanguage() $language = Tools::strtoupper($langArray[count($langArray)-1]); // Prevent null language detection + if (in_array(Tools::strtoupper($language), $allowedCountries)) { return $language; } @@ -1207,7 +1283,19 @@ public function getCountriesPerRegion($region = '') if (isset($this->defaultCountriesPerRegion[$region])) { return $this->defaultCountriesPerRegion[$region]; } - return json_encode(array()); + return json_encode(array($region)); + } + + /** + * @param $region + * @return string + */ + public function getApiVersionPerRegion($region = '') + { + if (isset($this->defaultApiVersionPerRegion[$region])) { + return $this->defaultApiVersionPerRegion[$region]; + } + return json_encode(array($region)); } /** diff --git a/composer.lock b/composer.lock index 932dd05..1ea2eb1 100644 --- a/composer.lock +++ b/composer.lock @@ -12,12 +12,12 @@ "source": { "type": "git", "url": "https://github.com/afterpay/sdk-php.git", - "reference": "8c837cce2de5dfbd44b8573fdc3b261694ef1790" + "reference": "b7077341323982b94c3eaeb5934de0d193554f1a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/afterpay/sdk-php/zipball/8c837cce2de5dfbd44b8573fdc3b261694ef1790", - "reference": "8c837cce2de5dfbd44b8573fdc3b261694ef1790", + "url": "https://api.github.com/repos/afterpay/sdk-php/zipball/b7077341323982b94c3eaeb5934de0d193554f1a", + "reference": "b7077341323982b94c3eaeb5934de0d193554f1a", "shasum": "" }, "require-dev": { @@ -42,7 +42,7 @@ } ], "description": "Official Afterpay SDK for PHP", - "time": "2021-02-22T08:40:55+00:00" + "time": "2021-03-16T09:10:48+00:00" } ], "packages-dev": [ @@ -1507,7 +1507,7 @@ }, { "name": "symfony/process", - "version": "v4.4.19", + "version": "v4.4.20", "source": { "type": "git", "url": "https://github.com/symfony/process.git", @@ -1605,30 +1605,35 @@ }, { "name": "webmozart/assert", - "version": "1.9.1", + "version": "1.10.0", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/6964c76c7804814a842473e0c8fd15bab0f18e25", + "reference": "6964c76c7804814a842473e0c8fd15bab0f18e25", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", + "php": "^7.2 || ^8.0", "symfony/polyfill-ctype": "^1.8" }, "conflict": { "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" + "vimeo/psalm": "<4.6.1 || 4.6.2" }, "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "phpunit/phpunit": "^8.5.13" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -1650,7 +1655,7 @@ "check", "validate" ], - "time": "2020-07-08T17:02:28+00:00" + "time": "2021-03-09T10:59:23+00:00" } ], "aliases": [], diff --git a/config.xml b/config.xml index d5aaa60..8c90ac2 100644 --- a/config.xml +++ b/config.xml @@ -1,12 +1,12 @@ - clearpay - - - - - - 1 - 1 + clearpay + + + + + + 1 + 1 \ No newline at end of file diff --git a/controllers/front/AbstractController.php b/controllers/front/AbstractController.php index 2835ff2..0905cce 100644 --- a/controllers/front/AbstractController.php +++ b/controllers/front/AbstractController.php @@ -51,9 +51,11 @@ public function saveLog($message, $severity = 1) if (is_array($message)) { $message = json_encode($message); } - PrestaShopLogger::addLog($message, $severity, null, "Clearpay", 1); + if (Configuration::get('CLEARPAY_LOGS') == 'on' || $severity >= 3) { + PrestaShopLogger::addLog($message, $severity, null, "Clearpay", 1); + } } catch (\Exception $error) { - // Do nothing + PrestaShopLogger::addLog($error->getMessage(), $severity, null, "Clearpay", 2); } } } diff --git a/controllers/front/notify.php b/controllers/front/notify.php index 61c70dc..5475cf0 100644 --- a/controllers/front/notify.php +++ b/controllers/front/notify.php @@ -18,6 +18,9 @@ */ class ClearpayNotifyModuleFrontController extends AbstractController { + /** Product Name */ + const PRODUCT_NAME = "Clearpay"; + /** Cart tablename */ const CART_TABLE = 'clearpay_cart_process'; @@ -27,7 +30,7 @@ class ClearpayNotifyModuleFrontController extends AbstractController /** * Seconds to expire a locked request */ - const CONCURRENCY_TIMEOUT = 10; + const CONCURRENCY_TIMEOUT = 1; /** * mismatch amount threshold in cents @@ -50,11 +53,6 @@ class ClearpayNotifyModuleFrontController extends AbstractController */ protected $token; - /** - * @var string $productName - */ - protected $productName; - /** * @var int $merchantOrderId */ @@ -99,6 +97,19 @@ class ClearpayNotifyModuleFrontController extends AbstractController * @var mixed $config */ protected $config; + /** + * Default API Version per region + * + * @var array + */ + public $defaultApiVersionPerRegion = array( + 'AU' => 'v2', + 'CA' => 'v2', + 'ES' => 'v1', + 'GB' => 'v2', + 'NZ' => 'v2', + 'US' => 'v2', + ); /** * @var Object $jsonResponse @@ -117,6 +128,18 @@ public function __call($func, $params) } } + /** + * @param $region + * @return string + */ + public function getApiVersionPerRegion($region = '') + { + if (isset($this->defaultApiVersionPerRegion[$region])) { + return $this->defaultApiVersionPerRegion[$region]; + } + return json_encode(array($region)); + } + /** * @throws Exception */ @@ -155,7 +178,7 @@ public function postProcess() try { $this->unblockConcurrency($this->merchantCartId); } catch (\Exception $exception) { - $this->saveLog($exception->getMessage(), null, 2); + $this->saveLog($exception->getMessage(), 3); } return $this->finishProcess(false); @@ -185,16 +208,13 @@ public function prepareVariables() if ($this->merchantCartId == '') { throw new \Exception("Merchant cart id not provided in callback url"); } - $this->productName = "Clearpay"; $callbackOkUrl = $this->context->link->getPageLink('order-confirmation', null, null); $callbackKoUrl = $this->context->link->getPageLink('order', null, null, array('step'=>3)); $this->config = array( - 'urlOK' => (Clearpay::getExtraConfig('URL_OK') !== '') ? - Clearpay::getExtraConfig('URL_OK') : $callbackOkUrl, - 'urlKO' => (Clearpay::getExtraConfig('URL_KO') !== '') ? - Clearpay::getExtraConfig('URL_KO') : $callbackKoUrl, + 'urlOK' => $callbackOkUrl, + 'urlKO' => $callbackKoUrl, 'secureKey' => Tools::getValue('key'), ); @@ -202,6 +222,7 @@ public function prepareVariables() $this->config['privateKey'] = Configuration::get('CLEARPAY_SECRET_KEY'); $this->config['environment'] = Configuration::get('CLEARPAY_ENVIRONMENT'); $this->config['region'] = Configuration::get('CLEARPAY_REGION'); + $this->config['apiVersion'] = $this->getApiVersionPerRegion($this->config['region']); $this->merchantOrderId = $this->getMerchantOrderId(); @@ -219,7 +240,7 @@ public function prepareVariables() if (!($this->config['secureKey'] && Module::isEnabled(self::CODE))) { // This exception is only for Prestashop - throw new \Exception('Can\'t process Clearpay order, module may not be enabled'); + throw new \Exception('Can\'t process ' . self::PRODUCT_NAME . ' order, module may not be enabled'); } } @@ -271,7 +292,7 @@ private function getClearpayOrderId() $this->clearpayOrderId = Db::getInstance()->getValue($sql); if (empty($this->clearpayOrderId)) { - throw new \Exception("Clearpay order id not found on clearpay_orders table"); + throw new \Exception(self::PRODUCT_NAME . ' order id not found on clearpay_orders table'); } } @@ -296,14 +317,17 @@ private function getClearpayOrderCountryCode() private function getClearpayOrder() { $getOrderRequest = new ClearpayRequest(); + $uri = '/' . $this->config['apiVersion'] . '/'; + $uri .= ($this->config['apiVersion'] === 'v1') ? 'orders/' : 'checkouts/'; $getOrderRequest ->setMerchantAccount($this->clearpayMerchantAccount) - ->setUri("/v1/orders/" . $this->clearpayOrderId) + ->setUri($uri . $this->clearpayOrderId) ; $getOrderRequest->send(); if ($getOrderRequest->getResponse()->getHttpStatusCode() >= 400) { - throw new \Exception($this->l('Unable to retrieve order from Clearpay.') . $this->clearpayOrderId); + throw new \Exception($this->l('Unable to retrieve order from ') . self::PRODUCT_NAME . + ': ' . $this->clearpayOrderId); } $this->clearpayOrder = $getOrderRequest->getResponse()->getParsedBody(); } @@ -315,17 +339,23 @@ private function getClearpayOrder() */ public function validateAmount() { - $totalAmount = (string) $this->clearpayOrder->totalAmount->amount; + if ($this->config['apiVersion'] === 'v1') { + $cpAmount = $this->clearpayOrder->totalAmount->amount; + } else { + $cpAmount = $this->clearpayOrder->amount->amount; + } + $totalAmount = (string) $cpAmount; $merchantAmount = (string) ($this->merchantCart->getOrderTotal(true, Cart::BOTH)); if ($totalAmount != $merchantAmount) { - $numberClearpayAmount = (integer) (100 * $this->clearpayOrder->totalAmount->amount); + $numberClearpayAmount = (integer) (100 * $cpAmount); $numberMerchantAmount = (integer) (100 * $this->merchantCart->getOrderTotal(true, Cart::BOTH)); $amountDff = $numberMerchantAmount - $numberClearpayAmount; if (abs($amountDff) > self::MISMATCH_AMOUNT_THRESHOLD) { $this->mismatchError = true; $amountMismatchError = 'Amount mismatch in PrestaShop Cart #'. $this->merchantCartId . - ' compared with Clearpay Order: ' . $this->clearpayOrderId . - '. The Cart in PrestaShop has an amount of ' . $merchantAmount . ' and in Clearpay ' . $totalAmount; + ' compared with ' . self::PRODUCT_NAME . ' Order: ' . $this->clearpayOrderId . + '. The Cart in PrestaShop has an amount of: ' . $merchantAmount . ' and in ' . self::PRODUCT_NAME . + ' of: ' . $totalAmount; $this->saveLog($amountMismatchError, 3); throw new \Exception($amountMismatchError); @@ -358,7 +388,7 @@ public function checkMerchantOrderStatus() $results = Db::getInstance()->ExecuteS($sql); if (is_array($results) && count($results) === 1) { $exceptionMessage = sprintf( - "Order was already created [cartId=%s][Token=%s][clearpayOrderId=%s]", + "Order was already created [cartId=%s][Token=%s][" . self::PRODUCT_NAME . "=%s]", $this->merchantCartId, $this->token, $this->clearpayOrderId @@ -379,15 +409,16 @@ public function checkMerchantOrderStatus() private function captureClearpayPayment() { $immediatePaymentCaptureRequest = new ClearpayImmediatePaymentCaptureRequest(array( - 'token' => $this->clearpayOrder->token, - 'merchantReference' => $this->config['publicKey'] + 'token' => $this->clearpayOrder->token )); $immediatePaymentCaptureRequest->setMerchantAccount($this->clearpayMerchantAccount); + $uri = '/' . $this->config['apiVersion'] . '/payments/capture/'; + $immediatePaymentCaptureRequest->setUri($uri); $immediatePaymentCaptureRequest->send(); if ($immediatePaymentCaptureRequest->getResponse()->getHttpStatusCode() >= 400) { $this->paymentDeclined = true; throw new \Exception( - $this->l('Clearpay capture payment error, order token: ') . $this->token . '. ' . + self::PRODUCT_NAME . ' capture payment error, order token: ' . $this->token . '. ' . $immediatePaymentCaptureRequest->getResponse()->getParsedBody()->errorCode ); } @@ -395,7 +426,7 @@ private function captureClearpayPayment() if (!$immediatePaymentCaptureRequest->getResponse()->isApproved()) { $this->paymentDeclined = true; throw new \Exception( - $this->l('Clearpay capture payment error, the payment was not procesed successfully') + self::PRODUCT_NAME . ' capture payment error, the payment was not processed successfully' ); } } @@ -407,12 +438,17 @@ private function captureClearpayPayment() */ public function processMerchantOrder() { + if ($this->config['apiVersion'] === 'v1') { + $cpAmount = $this->clearpayOrder->totalAmount->amount; + } else { + $cpAmount = $this->clearpayOrder->amount->amount; + } try { $this->module->validateOrder( $this->merchantCartId, Configuration::get('PS_OS_PAYMENT'), - $this->clearpayOrder->totalAmount->amount, - $this->productName, + $cpAmount, + self::PRODUCT_NAME, 'clearpayOrderId: ' . $this->clearpayCapturedPaymentId, array('transaction_id' => $this->clearpayCapturedPaymentId), null, @@ -437,8 +473,8 @@ public function processMerchantOrder() $this->saveLog($exception->getMessage(), 2); } - $message = 'Clearpay Order CONFIRMED' . - '. Clearpay OrderId=' . $this->clearpayCapturedPaymentId . + $message = self::PRODUCT_NAME . ' Order CONFIRMED' . + '. ' . self::PRODUCT_NAME . ' OrderId=' . $this->clearpayCapturedPaymentId . '. Prestashop OrderId=' . $this->module->currentOrder; $this->saveLog($message, 1); } @@ -458,7 +494,8 @@ private function updateClearpayOrder() ->setRequestBody(json_encode(array("merchantReference" => $this->module->currentOrder))); $getOrderRequest->send(); if ($getOrderRequest->getResponse()->getHttpStatusCode() >= 400) { - throw new \Exception("Unable to retrieve order from Clearpay = $this->clearpayOrderId"); + throw new \Exception('Unable to retrieve order from ' . self::PRODUCT_NAME . + ' = ' . $this->clearpayOrderId); } $this->clearpayOrder = $getOrderRequest->getResponse()->getParsedBody(); @@ -476,11 +513,11 @@ private function updateClearpayOrder() public function rollbackMerchantOrder() { try { - $message = 'Clearpay Roolback method called: ' . - '. Clearpay OrderId=' . $this->clearpayOrderId . + $message = self::PRODUCT_NAME . ' Roolback method called: ' . + '. ' . self::PRODUCT_NAME . ' OrderId=' . $this->clearpayOrderId . '. Prestashop CartId=' . $this->merchantCartId . '. Prestashop OrderId=' . $this->merchantOrderId; - $this->saveLog($message, 3); + $this->saveLog($message, 2); if ($this->module->currentOrder) { $objOrder = new Order($this->module->currentOrder); $history = new OrderHistory(); @@ -488,25 +525,25 @@ public function rollbackMerchantOrder() $history->changeIdOrderState(8, (int)($objOrder->id)); } } catch (\Exception $exception) { - $this->saveLog('Error on Clearpay rollback Transaction: ' . - '. Clearpay OrderId=' . $this->clearpayOrderId . + $this->saveLog('Error on ' . self::PRODUCT_NAME . ' rollback Transaction: ' . + '. ' . self::PRODUCT_NAME . ' OrderId=' . $this->clearpayOrderId . '. Prestashop CartId=' . $this->merchantCartId . '. Prestashop OrderId=' . $this->merchantOrderId . - $exception->getMessage(), 3); + $exception->getMessage(), 2); } } /** * Lock the concurrency to prevent duplicated inputs - * @param $orderId + * @param $cartId * * @throws Exception */ - protected function blockConcurrency($orderId) + protected function blockConcurrency($cartId) { try { $table = self::CART_TABLE; - Db::getInstance()->insert($table, array('id' =>(int)$orderId, 'timestamp' =>(time()))); + Db::getInstance()->insert($table, array('id' =>(int)$cartId, 'timestamp' =>(time()))); } catch (\Exception $exception) { throw new \Exception($exception->getMessage()); } diff --git a/controllers/front/payment.php b/controllers/front/payment.php index 3013641..0075a59 100644 --- a/controllers/front/payment.php +++ b/controllers/front/payment.php @@ -21,221 +21,303 @@ class ClearpayPaymentModuleFrontController extends AbstractController protected $language; /** - * Process Post Request + * Default API Version per region * - * @throws \Exception + * @var array + */ + public $defaultApiVersionPerRegion = array( + 'AU' => 'v2', + 'CA' => 'v2', + 'ES' => 'v1', + 'GB' => 'v2', + 'NZ' => 'v2', + 'US' => 'v2', + ); + + /** + * @param $region + * @return string + */ + public function getApiVersionPerRegion($region = '') + { + if (isset($this->defaultApiVersionPerRegion[$region])) { + return $this->defaultApiVersionPerRegion[$region]; + } + return json_encode(array($region)); + } + + /** + * @return mixed + * @throws \Afterpay\SDK\Exception\InvalidArgumentException + * @throws \Afterpay\SDK\Exception\NetworkException + * @throws \Afterpay\SDK\Exception\ParsingException */ public function postProcess() { + $paymentObjData = array(); $context = Context::getContext(); - $currency = $context->currency->iso_code; + $paymentObjData['currency'] = $context->currency->iso_code; + $paymentObjData['region'] = Configuration::get('CLEARPAY_REGION'); - /** @var Cart $cart */ - $cart = $context->cart; - $shippingAddress = new Address($cart->id_address_delivery); - $shippingCountryObj = new Country($shippingAddress->id_country); - $shippingCountryCode = $shippingCountryObj->iso_code; - $shippingStateObj = new State($shippingAddress->id_state); - $shippingStateCode = ''; - if (!empty($shippingAddress->id_state)) { - $shippingStateCode = $shippingStateObj->iso_code; + /** @var Cart $paymentObjData['cart'] */ + $paymentObjData['cart'] = $context->cart; + $paymentObjData['shippingAddress'] = new Address($paymentObjData['cart']->id_address_delivery); + $shippingCountryObj = new Country($paymentObjData['shippingAddress']->id_country); + $paymentObjData['shippingCountryCode'] = $shippingCountryObj->iso_code; + $shippingStateObj = new State($paymentObjData['shippingAddress']->id_state); + $paymentObjData['shippingStateCode'] = ''; + if (!empty($paymentObjData['shippingAddress']->id_state)) { + $paymentObjData['shippingStateCode'] = $shippingStateObj->iso_code; } - $billingAddress = new Address($cart->id_address_invoice); - $billingCountryCode = Country::getIsoById($billingAddress->id_country); - $billingStateObj = new State($billingAddress->id_state); - $billingStateCode = ''; - if (!empty($billingAddress->id_state)) { - $billingStateCode = $billingStateObj->iso_code; + $paymentObjData['billingAddress'] = new Address($paymentObjData['cart']->id_address_invoice); + $paymentObjData['billingCountryCode'] = Country::getIsoById($paymentObjData['billingAddress']->id_country); + $billingStateObj = new State($paymentObjData['billingAddress']->id_state); + $paymentObjData['billingStateCode'] = ''; + if (!empty($paymentObjData['billingAddress']->id_state)) { + $paymentObjData['billingStateCode'] = $billingStateObj->iso_code; } + $paymentObjData['countryCode'] = $this->getCountryCode($paymentObjData); - $discountAmount = $cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS); + $paymentObjData['discountAmount'] = $paymentObjData['cart']->getOrderTotal(true, Cart::ONLY_DISCOUNTS); - /** @var Carrier $carrier */ - $carrier = new Carrier($cart->id_carrier); + /** @var Carrier $paymentObjData['carrier'] */ + $paymentObjData['carrier'] = new Carrier($paymentObjData['cart']->id_carrier); - /** @var Customer $customer */ - $customer = $context->customer; + /** @var Customer $paymentObjData['customer'] */ + $paymentObjData['customer'] = $context->customer; - if (!$cart->id) { + if (!$paymentObjData['cart']->id) { Tools::redirect('index.php?controller=order'); } - $urlToken = Tools::strtoupper(md5(uniqid(rand(), true))); - - $query = array( - 'id_cart' => $cart->id, - 'key' => $cart->secure_key, - ); + $paymentObjData['urlToken'] = Tools::strtoupper(md5(uniqid(rand(), true))); - $koUrl = $context->link->getPageLink( + $paymentObjData['koUrl'] = $context->link->getPageLink( 'order', null, null, array('step'=>3) ); - $cancelUrl = (Clearpay::getExtraConfig('URL_KO') !== '') ? Clearpay::getExtraConfig('URL_KO', null) : $koUrl; + $paymentObjData['cancelUrl'] = (!empty(Configuration::get('CLEARPAY_URL_KO'))) ? + Configuration::get('CLEARPAY_URL_KO') : $paymentObjData['koUrl']; + $paymentObjData['publicKey'] = Configuration::get('CLEARPAY_PUBLIC_KEY'); + $paymentObjData['secretKey'] = Configuration::get('CLEARPAY_SECRET_KEY'); + $paymentObjData['environment'] = Configuration::get('CLEARPAY_ENVIRONMENT'); - $publicKey = Configuration::get('CLEARPAY_PUBLIC_KEY'); - $secretKey = Configuration::get('CLEARPAY_SECRET_KEY'); - $environment = Configuration::get('CLEARPAY_ENVIRONMENT'); - - $okUrl = _PS_BASE_URL_SSL_.__PS_BASE_URI__ + $query = array( + 'id_cart' => $paymentObjData['cart']->id, + 'key' => $paymentObjData['cart']->secure_key, + ); + $paymentObjData['okUrl'] = _PS_BASE_URL_SSL_.__PS_BASE_URI__ .'index.php?canonical=true&fc=module&module=clearpay&controller=notify' - .'&token='.$urlToken . '&' . http_build_query($query) + .'&token='.$paymentObjData['urlToken'] . '&' . http_build_query($query) ; - \Afterpay\SDK\Model::setAutomaticValidationEnabled(true); - $createCheckoutRequest = new CreateCheckout(); - $clearpayMerchantAccount = new ClearpayMerchantAccount(); - $countryCode = $this->getCountryCode(); - $clearpayMerchantAccount - ->setMerchantId($publicKey) - ->setSecretKey($secretKey) - ->setApiEnvironment($environment) - ; - if (!is_null($countryCode)) { - $clearpayMerchantAccount->setCountryCode($countryCode); - } - - $createCheckoutRequest - ->setMerchant(array( - 'redirectConfirmUrl' => $okUrl, - 'redirectCancelUrl' => $cancelUrl - )) - ->setMerchantAccount($clearpayMerchantAccount) - ->setTotalAmount( - Clearpay::parseAmount($cart->getOrderTotal(true, Cart::BOTH)), - $currency - ) - ->setTaxAmount( - Clearpay::parseAmount( - $cart->getOrderTotal(true, Cart::BOTH) - $cart->getOrderTotal(false, Cart::BOTH) - ), - $currency - ) - ->setConsumer(array( - 'phoneNumber' => $billingAddress->phone, - 'givenNames' => $customer->firstname, - 'surname' => $customer->lastname, - 'email' => $customer->email - )) - ->setBilling(array( - 'name' => $billingAddress->firstname . " " . $billingAddress->lastname, - 'line1' => $billingAddress->address1, - 'line2' => $billingAddress->address2, - 'suburb' => $billingAddress->city, - 'state' => $billingStateCode, - 'postcode' => $billingAddress->postcode, - 'countryCode' => $billingCountryCode, - 'phoneNumber' => $billingAddress->phone - )) - ->setShipping(array( - 'name' => $shippingAddress->firstname . " " . $shippingAddress->lastname, - 'line1' => $shippingAddress->address1, - 'line2' => $shippingAddress->address2, - 'suburb' => $shippingAddress->city, - 'state' => $shippingStateCode, - 'postcode' => $shippingAddress->postcode, - 'countryCode' => $shippingCountryCode, - 'phoneNumber' => $shippingAddress->phone - )) - ->setShippingAmount( - Clearpay::parseAmount($cart->getTotalShippingCost()), - $currency - ) - ->setCourier(array( - 'shippedAt' => '', - 'name' => $carrier->name, - 'tracking' => '', - 'priority' => 'STANDARD' - )); + $url = $paymentObjData['cancelUrl']; + try { + \Afterpay\SDK\Model::setAutomaticValidationEnabled(true); + $clearpayPaymentObj = new CreateCheckout(); + $clearpayMerchantAccount = new ClearpayMerchantAccount(); + $clearpayMerchantAccount + ->setMerchantId($paymentObjData['publicKey']) + ->setSecretKey($paymentObjData['secretKey']) + ->setApiEnvironment($paymentObjData['environment']) + ; + if (!is_null($paymentObjData['countryCode'])) { + $clearpayMerchantAccount->setCountryCode($paymentObjData['countryCode']); + } - if (!empty($discountAmount)) { - $createCheckoutRequest->setDiscounts(array( - array( - 'displayName' => 'Shop discount', - 'amount' => array(Clearpay::parseAmount($discountAmount), $currency) + $clearpayPaymentObj + ->setMerchant(array( + 'redirectConfirmUrl' => $paymentObjData['okUrl'], + 'redirectCancelUrl' => $paymentObjData['cancelUrl'] + )) + ->setMerchantAccount($clearpayMerchantAccount) + ->setAmount( + Clearpay::parseAmount($paymentObjData['cart']->getOrderTotal(true, Cart::BOTH)), + $paymentObjData['currency'] ) - )); + ->setTaxAmount( + Clearpay::parseAmount( + $paymentObjData['cart']->getOrderTotal(true, Cart::BOTH) + - + $paymentObjData['cart']->getOrderTotal(false, Cart::BOTH) + ), + $paymentObjData['currency'] + ) + ->setConsumer(array( + 'phoneNumber' => $paymentObjData['billingAddress']->phone, + 'givenNames' => $paymentObjData['customer']->firstname, + 'surname' => $paymentObjData['customer']->lastname, + 'email' => $paymentObjData['customer']->email + )) + ->setBilling(array( + 'name' => $paymentObjData['billingAddress']->firstname . " " . + $paymentObjData['billingAddress']->lastname, + 'line1' => $paymentObjData['billingAddress']->address1, + 'line2' => $paymentObjData['billingAddress']->address2, + 'suburb' => $paymentObjData['billingAddress']->city, + 'area1' => $paymentObjData['billingAddress']->city, + 'state' => $paymentObjData['billingStateCode'], + 'region' => $paymentObjData['billingStateCode'], + 'postcode' => $paymentObjData['billingAddress']->postcode, + 'countryCode' => $paymentObjData['billingCountryCode'], + 'phoneNumber' => $paymentObjData['billingAddress']->phone + )) + ->setShipping(array( + 'name' => $paymentObjData['shippingAddress']->firstname . " " . + $paymentObjData['shippingAddress']->lastname, + 'line1' => $paymentObjData['shippingAddress']->address1, + 'line2' => $paymentObjData['shippingAddress']->address2, + 'suburb' => $paymentObjData['shippingAddress']->city, + 'area1' => $paymentObjData['shippingAddress']->city, + 'state' => $paymentObjData['shippingStateCode'], + 'region' => $paymentObjData['shippingStateCode'], + 'postcode' => $paymentObjData['shippingAddress']->postcode, + 'countryCode' => $paymentObjData['shippingCountryCode'], + 'phoneNumber' => $paymentObjData['shippingAddress']->phone + )) + ->setShippingAmount( + Clearpay::parseAmount($paymentObjData['cart']->getTotalShippingCost()), + $paymentObjData['currency'] + ) + ->setCourier(array( + 'shippedAt' => '', + 'name' => $paymentObjData['carrier']->name . '', + 'tracking' => '', + 'priority' => 'STANDARD' + )); + + if (!empty($paymentObjData['discountAmount'])) { + $clearpayPaymentObj->setDiscounts(array( + array( + 'displayName' => 'Shop discount', + 'amount' => array( + Clearpay::parseAmount($paymentObjData['discountAmount']), + $paymentObjData['currency'] + ) + ) + )); + } + + $items = $paymentObjData['cart']->getProducts(); + $products = array(); + foreach ($items as $item) { + $products[] = array( + 'name' => utf8_encode($item['name']), + 'sku' => $item['reference'], + 'quantity' => (int) $item['quantity'], + 'price' => array( + 'amount' => Clearpay::parseAmount($item['price_wt']), + 'currency' => $paymentObjData['currency'] + ) + ); + } + $clearpayPaymentObj->setItems($products); + + $apiVersion = $this->getApiVersionPerRegion($paymentObjData['region']); + if ($apiVersion === 'v1') { + $clearpayPaymentObj = $this->addPaymentV1Options($clearpayPaymentObj, $paymentObjData); + } else { + $clearpayPaymentObj = $this->addPaymentV2Options($clearpayPaymentObj, $paymentObjData); + } + + $header = $this->module->name . '/' . $this->module->version + . ' (Prestashop/' . _PS_VERSION_ . '; PHP/' . phpversion() . '; Merchant/' . $paymentObjData['publicKey'] + . ') ' . _PS_BASE_URL_SSL_.__PS_BASE_URI__; + $clearpayPaymentObj->addHeader('User-Agent', $header); + $clearpayPaymentObj->addHeader('Country', $paymentObjData['countryCode']); + } catch (\Exception $exception) { + $this->saveLog($exception->getMessage(), 3); + return Tools::redirect($url); } - $items = $cart->getProducts(); - $products = array(); - foreach ($items as $item) { - $products[] = array( - 'name' => utf8_encode($item['name']), - 'sku' => $item['reference'], - 'quantity' => (int) $item['quantity'], - 'price' => array( - 'amount' => Clearpay::parseAmount($item['price_wt']), - 'currency' => $currency - ) + if (!$clearpayPaymentObj->isValid()) { + $this->saveLog($clearpayPaymentObj->getValidationErrors(), 2); + return Tools::redirect($url); + } + + $endPoint = '/' . $apiVersion . '/'; + $endPoint .= ($apiVersion === 'v2') ? "checkouts": "orders"; + $clearpayPaymentObj->setUri($endPoint); + + $clearpayPaymentObj->send(); + $errorMessage = 'empty response'; + if ($clearpayPaymentObj->getResponse()->getHttpStatusCode() >= 400 + || isset($clearpayPaymentObj->getResponse()->getParsedBody()->errorCode) + ) { + if (isset($clearpayPaymentObj->getResponse()->getParsedBody()->message)) { + $errorMessage = $clearpayPaymentObj->getResponse()->getParsedBody()->message; + } + $errorMessage .= $this->l('. Status code: ') + . $clearpayPaymentObj->getResponse()->getHttpStatusCode() + ; + $this->saveLog( + $this->l('Error received when trying to create a order: ') . + $errorMessage . '. URL: ' . $clearpayPaymentObj->getApiEnvironmentUrl().$clearpayPaymentObj->getUri(), + 2 ); + + return Tools::redirect($url); } - $createCheckoutRequest->setItems($products); - $header = $this->module->name . '/' . $this->module->version - . '(Prestashop/' . _PS_VERSION_ . '; PHP/' . phpversion() . '; Merchant/' . $publicKey - . ') ' . _PS_BASE_URL_SSL_.__PS_BASE_URI__; - $createCheckoutRequest->addHeader('User-Agent', $header); - $createCheckoutRequest->addHeader('Country', $countryCode); - $url = $cancelUrl; - if ($createCheckoutRequest->isValid()) { - $createCheckoutRequest->send(); - $errorMessage = 'empty response'; - if ($createCheckoutRequest->getResponse()->getHttpStatusCode() >= 400 - || isset($createCheckoutRequest->getResponse()->getParsedBody()->errorCode) - ) { - if (isset($createCheckoutRequest->getResponse()->getParsedBody()->message)) { - $errorMessage = $createCheckoutRequest->getResponse()->getParsedBody()->message; - } - $errorMessage .= $this->l('. Status code: ') - . $createCheckoutRequest->getResponse()->getHttpStatusCode() - ; - $this->saveLog( - $this->l('Error received when trying to create a order: ') . - $errorMessage, - 2 - ); - } else { - try { - $url = $createCheckoutRequest->getResponse()->getParsedBody()->redirectCheckoutUrl; - $orderId = $createCheckoutRequest->getResponse()->getParsedBody()->token; - $countryCode = $this->getCountryCode(); - $cartId = pSQL($cart->id); - $orderId = pSQL($orderId); - $urlToken = pSQL($urlToken); - $countryCode = pSQL($countryCode); - $sql = "INSERT INTO `" . _DB_PREFIX_ . "clearpay_order` (`id`, `order_id`, `token`, `country_code`) - VALUES ('$cartId','$orderId', '$urlToken', '$countryCode')"; - $result = Db::getInstance()->execute($sql); - if (!$result) { - throw new \Exception('Unable to save clearpay-order-id in database: '. $sql); - } - } catch (\Exception $exception) { - $this->saveLog($exception->getMessage(), 3); - $url = $cancelUrl; - } + try { + $url = $clearpayPaymentObj->getResponse()->getParsedBody()->redirectCheckoutUrl; + $orderId = $clearpayPaymentObj->getResponse()->getParsedBody()->token; + $cartId = pSQL($paymentObjData['cart']->id); + $orderId = pSQL($orderId); + $urlToken = pSQL($paymentObjData['urlToken']); + $countryCode = pSQL($paymentObjData['countryCode']); + $sql = "INSERT INTO `" . _DB_PREFIX_ . "clearpay_order` (`id`, `order_id`, `token`, `country_code`) + VALUES ('$cartId','$orderId', '$urlToken', '$countryCode')"; + $result = Db::getInstance()->execute($sql); + if (!$result) { + throw new \Exception('Unable to save clearpay-order-id in database: '. $sql); } - } else { - $this->saveLog($createCheckoutRequest->getValidationErrors(), null, 2); + } catch (\Exception $exception) { + $this->saveLog($exception->getMessage(), 3); + $url = $paymentObjData['cancelUrl']; } - Tools::redirect($url); + return Tools::redirect($url); } /** - * @param null $shippingAddress - * @param null $billingAddress - * @return mixed + * @param CreateCheckout $clearpayPaymentObj + * @param array $paymentObjData + * @return CreateCheckout */ - private function getCountryCode() + private function addPaymentV1Options(CreateCheckout $clearpayPaymentObj, $paymentObjData) { - $context = Context::getContext(); - $cart = $context->cart; + $clearpayPaymentObj->setTotalAmount( + Clearpay::parseAmount($paymentObjData['cart']->getOrderTotal(true, Cart::BOTH)), + $paymentObjData['currency'] + ); + return $clearpayPaymentObj; + } - $allowedCountries = json_decode(Clearpay::getExtraConfig('ALLOWED_COUNTRIES', null)); + /** + * @param CreateCheckout $clearpayPaymentObj + * @param array $paymentObjData + * @return CreateCheckout + */ + private function addPaymentV2Options(CreateCheckout $clearpayPaymentObj, $paymentObjData) + { + $clearpayPaymentObj->setAmount( + Clearpay::parseAmount($paymentObjData['cart']->getOrderTotal(true, Cart::BOTH)), + $paymentObjData['currency'] + ); + return $clearpayPaymentObj; + } + + /** + * @param array $paymentObjData + * @return string|null + */ + private function getCountryCode($paymentObjData) + { + $allowedCountries = json_decode(Configuration::get('CLEARPAY_ALLOWED_COUNTRIES')); $lang = Language::getLanguage($this->context->language->id); $langArray = explode("-", $lang['language_code']); if (count($langArray) != 2 && isset($lang['locale'])) { @@ -247,16 +329,16 @@ private function getCountryCode() return $language; } - $shippingAddress = new Address($cart->id_address_delivery); + $shippingAddress = new Address($paymentObjData['cart']->id_address_delivery); if ($shippingAddress) { - $language = Country::getIsoById($shippingAddress->id_country); + $language = Country::getIsoById($paymentObjData['shippingAddress']->id_country); if (in_array(Tools::strtoupper($language), $allowedCountries)) { return $language; } } - $billingAddress = new Address($cart->id_address_invoice); + $billingAddress = new Address($paymentObjData['cart']->id_address_invoice); if ($billingAddress) { - $language = Country::getIsoById($billingAddress->id_country); + $language = Country::getIsoById($paymentObjData['billingAddress']->id_country); if (in_array(Tools::strtoupper($language), $allowedCountries)) { return $language; } diff --git a/docker-compose.yml b/docker-compose.yml index fdb7c23..8d03373 100644 --- a/docker-compose.yml +++ b/docker-compose.yml @@ -23,7 +23,7 @@ services: - "prestashop16-test.docker:127.0.0.1" prestashop17-test: container_name: prestashop17-test - image: prestashop/prestashop:1.7.6.9 + image: prestashop/prestashop:latest depends_on: - db17-test environment: @@ -44,7 +44,7 @@ services: - "prestashop17-test.docker:127.0.0.1" prestashop17-dev: container_name: prestashop17-dev - image: prestashop/prestashop:1.7.6.9 + image: prestashop/prestashop:latest depends_on: - db17-dev environment: diff --git a/sql/install.sql b/sql/install.sql index 6728931..9250af1 100644 --- a/sql/install.sql +++ b/sql/install.sql @@ -11,11 +11,4 @@ CREATE TABLE IF NOT EXISTS `PREFIX_clearpay_order` ( `country_code` varchar(2) NULL, `ps_order_id` varchar(60) NULL, PRIMARY KEY (`id`, `order_id`) - ) ENGINE = InnoDB; - -CREATE TABLE IF NOT EXISTS `PREFIX_clearpay_config` ( - `id` INT NOT NULL AUTO_INCREMENT, - `config` VARCHAR(60) NOT NULL, - `value` VARCHAR(5000) NOT NULL, - PRIMARY KEY (`id`) - ) ENGINE = InnoDB; + ) ENGINE = InnoDB; \ No newline at end of file diff --git a/sql/uninstall.sql b/sql/uninstall.sql index 9c60abc..65a47c3 100644 --- a/sql/uninstall.sql +++ b/sql/uninstall.sql @@ -1,3 +1,2 @@ DROP TABLE IF EXISTS `PREFIX_clearpay_cart_process`; DROP TABLE IF EXISTS `PREFIX_clearpay_order`; -DROP TABLE IF EXISTS `PREFIX_clearpay_config`; diff --git a/test/PagantisPrestashopTest.php b/test/ClearpayPrestashopTest.php similarity index 97% rename from test/PagantisPrestashopTest.php rename to test/ClearpayPrestashopTest.php index 9164a02..eac003b 100644 --- a/test/PagantisPrestashopTest.php +++ b/test/ClearpayPrestashopTest.php @@ -39,8 +39,8 @@ abstract class ClearpayPrestashopTest extends TestCase protected $configuration = array( 'username' => 'demo@prestashop.com', 'password' => 'prestashop_demo', - 'publicKey' => 'tk_05f3993ef51d41209c52eac7', - 'secretKey' => 'c580df9e0b7b40c3', + 'publicKey' => '800000001', + 'secretKey' => '27824l8tn9p3nxaernjd8r2zplprsoj3zi1i7ddcbuwy2d9pyezc4i6p4qup9o2qwkfrpsru71hizbyvon4z7br2uhxxl3lst8f9i6g1thyue1ihlynca73eiu7jlyhu', 'birthdate' => '05/05/1989', 'firstname' => 'Jøhn', 'lastname' => 'Dōès', diff --git a/test/PagantisWebDriver.php b/test/ClearpayWebDriver.php similarity index 86% rename from test/PagantisWebDriver.php rename to test/ClearpayWebDriver.php index 0af8147..9e662b6 100644 --- a/test/PagantisWebDriver.php +++ b/test/ClearpayWebDriver.php @@ -20,7 +20,7 @@ class ClearpayWebDriver extends RemoteWebDriver * * @return WebDriverWait */ - public function wait($timeout_in_second = 120, $interval_in_millisecond = 2000) + public function wait($timeout_in_second = 20, $interval_in_millisecond = 1000) { return new WebDriverWait( $this, diff --git a/test/advanced/PagantisPs15AdvancedTest.php b/test/advanced/PagantisPs15AdvancedTest.php deleted file mode 100644 index 2c7156b..0000000 --- a/test/advanced/PagantisPs15AdvancedTest.php +++ /dev/null @@ -1,79 +0,0 @@ -loginToBackOffice(); - $this->getClearpayBackOffice(); - - //2 elements exist: - $validatorSearch = WebDriverBy::id('CLEARPAY_PUBLIC_KEY'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($validatorSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - $validatorSearch = WebDriverBy::id('private_key'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($validatorSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - - /* no longer checked in multiproduct - //save with empty public Key - $this->findById('public_key')->clear(); - $this->findById('module_form')->submit(); - $validatorSearch = WebDriverBy::className('module_error'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($validatorSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - $this->assertContains('Please add a Clearpay API Public Key', $this->webDriver->getPageSource()); - $this->findById('public_key')->clear()->sendKeys($this->configuration['publicKey']); - - //save with empty private Key - $this->findById('private_key')->clear(); - $this->findById('module_form')->submit(); - $validatorSearch = WebDriverBy::className('module_error'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($validatorSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - $this->assertContains('Please add a Clearpay API Private Key', $this->webDriver->getPageSource()); - $this->findById('private_key')->clear()->sendKeys($this->configuration['secretKey']); - */ - - $this->quit(); - } - - /** - * @REQ17 BackOffice Panel should have visible Logo and links - * - * @throws \Exception - */ - public function testBackOfficeHasLogoAndLinkToClearpay() - { - //Change Title - $this->loginToBackOffice(); - $this->getClearpayBackOffice(); - $html = $this->webDriver->getPageSource(); - $this->assertContains('pg.png', $html); - $this->assertContains('Login Clearpay', $html); - $this->assertContains('https://bo.clearpay.com', $html); - $this->quit(); - } -} diff --git a/test/basic/BasicPs15Test.php b/test/basic/BasicPs15Test.php deleted file mode 100644 index 68906ea..0000000 --- a/test/basic/BasicPs15Test.php +++ /dev/null @@ -1,41 +0,0 @@ -webDriver->get(self::PS15URL); - $condition = WebDriverExpectedCondition::titleContains(self::TITLE); - $this->webDriver->wait()->until($condition); - $this->assertTrue((bool) $condition); - $this->quit(); - } - - /** - * @throws \Exception - */ - public function testBackOfficeTitlePrestashop15() - { - $this->webDriver->get(self::PS15URL.self::BACKOFFICE_FOLDER); - $condition = WebDriverExpectedCondition::titleContains(self::TITLE); - $this->webDriver->wait()->until($condition); - $this->assertTrue((bool) $condition); - $this->quit(); - } -} diff --git a/test/basic/BasicPs17Test.php b/test/basic/BasicPs17Test.php index f1c49ef..44bb36f 100644 --- a/test/basic/BasicPs17Test.php +++ b/test/basic/BasicPs17Test.php @@ -12,15 +12,20 @@ class BasicPs17Test extends AbstractPs17Selenium /** * Const title */ - const TITLE = 'PrestaShop'; + const PRODUCT_TITLE = 'Hummingbird printed t-shirt'; + + /** + * Const title + */ + const ADMIN_TITLE = 'PrestaShop (PrestaShop™)'; /** * @throws \Exception */ public function testTitlePrestashop17() { - $this->webDriver->get(self::PS17URL); - $condition = WebDriverExpectedCondition::titleContains(self::TITLE); + $this->webDriver->get(self::PS17URL.'/men/1-1-hummingbird-printed-t-shirt.html#/1-size-s/8-color-white'); + $condition = WebDriverExpectedCondition::titleContains(self::PRODUCT_TITLE); $this->webDriver->wait()->until($condition); $this->assertTrue((bool) $condition); $this->quit(); @@ -32,7 +37,7 @@ public function testTitlePrestashop17() public function testBackOfficeTitlePrestashop17() { $this->webDriver->get(self::PS17URL.self::BACKOFFICE_FOLDER); - $condition = WebDriverExpectedCondition::titleContains(self::TITLE); + $condition = WebDriverExpectedCondition::titleContains(self::ADMIN_TITLE); $this->webDriver->wait()->until($condition); $this->assertTrue((bool) $condition); $this->quit(); diff --git a/test/buy/PagantisPs15BuyTest.php b/test/buy/PagantisPs15BuyTest.php deleted file mode 100644 index ec504c1..0000000 --- a/test/buy/PagantisPs15BuyTest.php +++ /dev/null @@ -1,100 +0,0 @@ -loginToFrontend(); - $this->goToProduct(); - $this->addProduct(); - $this->goToCheckout(); - $this->verifyClearpay(); - $this->checkConcurrency(); - $this->checkClearpayOrderId(); - $this->checkAlreadyProcessed(); - $this->quit(); - } - - /** - * Check if with a empty parameter called order-received we can get a QuoteNotFoundException - */ - protected function checkConcurrency() - { - $notifyUrl = self::PS15URL.self::NOTIFICATION_FOLDER.'&id_cart='; - $this->assertNotEmpty($notifyUrl, $notifyUrl); - $response = Request::post($notifyUrl)->expects('json')->send(); - $this->assertNotEmpty($response->body->result, $response); - $this->assertNotEmpty($response->body->status_code, $response); - $this->assertNotEmpty($response->body->timestamp, $response); - $this->assertContains( - QuoteNotFoundException::ERROR_MESSAGE, - $response->body->result, - "PR=>".$response->body->result - ); - } - - /** - * Check if with a parameter called order-received set to a invalid identification, - * we can get a NoIdentificationException - */ - protected function checkClearpayOrderId() - { - $orderId=0; - $notifyUrl = self::PS15URL.self::NOTIFICATION_FOLDER.'&id_cart='.$orderId; - $this->assertNotEmpty($notifyUrl, $notifyUrl); - $response = Request::post($notifyUrl)->expects('json')->send(); - $this->assertNotEmpty($response->body->result, $response); - $this->assertNotEmpty($response->body->status_code, $response); - $this->assertNotEmpty($response->body->timestamp, $response); - $this->assertEquals( - $response->body->merchant_order_id, - $orderId, - $response->body->merchant_order_id.'!='. $orderId - ); - - $this->assertContains( - MerchantOrderNotFoundException::ERROR_MESSAGE, - $response->body->result, - "PR=>".$response->body->result - ); - } - /** - * Check if re-launching the notification we can get a AlreadyProcessedException - * - * @throws \Httpful\Exception\ConnectionErrorException - */ - protected function checkAlreadyProcessed() - { - $notifyUrl = self::PS15URL.self::NOTIFICATION_FOLDER.'&id_cart=6'; - $response = Request::post($notifyUrl)->expects('json')->send(); - $this->assertNotEmpty($response->body->result, $response); - $this->assertNotEmpty($response->body->status_code, $response); - $this->assertNotEmpty($response->body->timestamp, $response); - $this->assertContains( - MerchantOrderNotFoundException::ERROR_MESSAGE, - $response->body->result, - "PR51=>".$response->body->result - ); - } -} diff --git a/test/common/AbstractPs15Selenium.php b/test/common/AbstractPs15Selenium.php deleted file mode 100644 index 42b6c2d..0000000 --- a/test/common/AbstractPs15Selenium.php +++ /dev/null @@ -1,321 +0,0 @@ -webDriver->get(self::PS15URL.self::BACKOFFICE_FOLDER); - $emailElementSearch = WebDriverBy::id('email'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($emailElementSearch); - $this->waitUntil($condition); - $this->findById('email')->clear()->sendKeys($this->configuration['username']); - $this->findById('passwd')->clear()->sendKeys($this->configuration['password']); - $this->findById('login_form')->submit(); - $emailElementSearch = WebDriverBy::id('employee_infos'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($emailElementSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - } - - /** - * @require loginToBackOffice - * - * @throws \Exception - */ - public function uploadClearpay() - { - $this->webDriver->get(self::PS15URL.self::BACKOFFICE_FOLDER); - $this->findByLinkText('New module')->click(); - $this->findByLinkText('Add a new module')->click(); - $moduleInstallBlock = WebDriverBy::id('module_install'); - $fileInputSearch = $moduleInstallBlock->name('file'); - $fileInput = $this->webDriver->findElement($fileInputSearch); - $fileInput->setFileDetector(new LocalFileDetector()); - $fileInput->sendKeys(__DIR__.'/../../clearpay.zip'); - $submitButton = WebDriverBy::name('download'); - $condition = WebDriverExpectedCondition::elementToBeClickable($submitButton); - $this->waitUntil($condition); - $this->findByName('download')->click(); - $validatorSearch = WebDriverBy::id('anchorClearpay'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($validatorSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - } - - /** - * @param string $language - * @param string $languageName - * @throws \Facebook\WebDriver\Exception\NoSuchElementException - * @throws \Facebook\WebDriver\Exception\TimeOutException - * @throws \Facebook\WebDriver\Exception\UnexpectedTagNameException - */ - public function configureLanguagePack($language = '72', $languageName = 'Español (Spanish)') - { - $elementSearch = WebDriverBy::partialLinkText('Localization'); - $condition = WebDriverExpectedCondition::elementToBeClickable($elementSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - $this->findByLinkText('Localization')->click(); - - $this->webDriver-> - findElement(WebDriverBy::xpath("//li[@id='maintab14']/ul[@class='submenu' and 1]/li[1]/a[1]"))->click(); - - $elementSearch = WebDriverBy::id('iso_localization_pack'); - $condition = WebDriverExpectedCondition::elementToBeClickable($elementSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - - $languageInstallSelect = new WebDriverSelect($this->findById('iso_localization_pack')); - $languageInstallSelect->selectByVisibleText($language); - $this->findByName('submitLocalizationPack')->click(); - - $languageInstallSelect = new WebDriverSelect($this->findById('PS_LANG_DEFAULT')); - $languageInstallSelect->selectByVisibleText($languageName); - $this->webDriver->executeScript("document.getElementById('configuration_form').submit();"); - } - - - /** - * @require loginToBackOffice - * - * @throws \Exception - */ - public function getClearpayBackOffice() - { - $this->webDriver->get(self::PS15URL.self::BACKOFFICE_FOLDER); - $this->findByLinkText('New module')->click(); - $this->findById('maintab15')->click(); - $this->findByLinkText('Modules')->click(); - $this->findByName('quicksearch') - ->clear() - ->sendKeys('Clearpay') - ->sendKeys(WebDriverKeys::ENTER) - ; - $this->findByLinkText('Configure')->click(); - $verify = WebDriverBy::id('CLEARPAY_PUBLIC_KEY'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($verify); - $this->waitUntil($condition); - } - - /** - * @throws \Exception - */ - public function loginToFrontend() - { - $this->webDriver->get(self::PS15URL.self::COUNTRY_QUERYSTRING); - $loginButtonSearch = WebDriverBy::className('login'); - $condition = WebDriverExpectedCondition::elementToBeClickable($loginButtonSearch); - $this->webDriver->wait()->until($condition); - $this->assertTrue((bool) $condition); - $this->webDriver->findElement($loginButtonSearch)->click(); - $verifyElement = WebDriverBy::id('SubmitLogin'); - $condition = WebDriverExpectedCondition::elementToBeClickable($verifyElement); - $this->webDriver->wait()->until($condition); - $this->assertTrue((bool) $condition); - $loginButtonSearch = WebDriverBy::className('login'); - $condition = WebDriverExpectedCondition::elementToBeClickable($loginButtonSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - $this->webDriver->findElement($loginButtonSearch)->click(); - $submitLoginButtonSearch = WebDriverBy::id('SubmitLogin'); - $condition = WebDriverExpectedCondition::elementToBeClickable($submitLoginButtonSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - $this->findById('email')->sendKeys($this->configuration['email']); - $this->findById('passwd')->sendKeys($this->configuration['password']); - $this->findById('SubmitLogin')->click(); - $logoutButtonSearch = WebDriverBy::className('logout'); - $condition = WebDriverExpectedCondition::elementToBeClickable($logoutButtonSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - } - - /** - * @throws \Exception - */ - public function createAccount() - { - $this->webDriver->get(self::PS15URL.self::COUNTRY_QUERYSTRING); - $loginButtonSearch = WebDriverBy::className('login'); - $condition = WebDriverExpectedCondition::elementToBeClickable($loginButtonSearch); - $this->webDriver->wait()->until($condition); - $this->assertTrue((bool) $condition); - $this->webDriver->findElement($loginButtonSearch)->click(); - $verifyElement = WebDriverBy::id('SubmitLogin'); - $condition = WebDriverExpectedCondition::elementToBeClickable($verifyElement); - $this->webDriver->wait()->until($condition); - $this->assertTrue((bool) $condition); - $this->findById('email_create')->sendKeys($this->configuration['email']); - $this->findById('SubmitCreate')->click(); - $submitAccountSearch = WebDriverBy::id('customer_firstname'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($submitAccountSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - $this->findById('id_gender1')->click(); - $this->findById('customer_firstname')->clear()->sendKeys($this->configuration['firstname']); - $this->findById('customer_lastname')->sendKeys($this->configuration['lastname']); - $this->findById('passwd')->sendKeys($this->configuration['password']); - $this->findById('days')->sendKeys(1); - $this->findById('months')->sendKeys('January'); - $this->findById('years')->sendKeys(1990); - $this->findById('submitAccount')->click(); - $logoutButtonSearch = WebDriverBy::className('logout'); - $condition = WebDriverExpectedCondition::elementToBeClickable($logoutButtonSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - $this->webDriver->findElement($logoutButtonSearch)->click(); - } - - /** - * @param bool $addressExists - * @param bool $verifySimulator - * - * @throws \Exception - */ - public function goToCheckout($addressExists = false, $verifySimulator = true) - { - $shoppingCartSearch = WebDriverBy::id('shopping_cart'); - $this->webDriver->findElement($shoppingCartSearch)->click(); - $shoppingCartTitle = WebDriverBy::id('cart_title'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($shoppingCartTitle); - $this->assertTrue((bool) $condition); - $cartNavigation = WebDriverBy::className('cart_navigation'); - $nextButton = $cartNavigation->partialLinkText('Siguiente'); - $this->webDriver->findElement($nextButton)->click(); - try { - if ($addressExists) { - throw new \Exception('Address exists'); - } - $addressInputSearch = WebDriverBy::id('firstname'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($addressInputSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - $this->findById('company')->clear()->sendKeys($this->configuration['company']); - $this->findById('address1')->clear()->sendKeys('av.diagonal 579'); - $this->findById('postcode')->clear()->sendKeys($this->configuration['zip']); - $this->findById('city')->clear()->sendKeys($this->configuration['city']); - $stateSelect = new WebDriverSelect($this->findById('id_state')); - $stateSelect->selectByVisibleText($this->configuration['state']); - $this->findById('phone')->clear()->sendKeys($this->configuration['phone']); - $this->findById('phone_mobile')->clear()->sendKeys($this->configuration['phone']); - $this->findById('dni')->clear()->sendKeys($this->configuration['dni']); - $this->moveToElementAndClick($this->findById('submitAddress')); - $processAddress = WebDriverBy::name('processAddress'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($processAddress); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - } catch (\Exception $exception) { - $processAddress = WebDriverBy::name('processAddress'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($processAddress); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - } - $this->webDriver->findElement($processAddress)->click(); - $processCarrier = WebDriverBy::name('processCarrier'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($processCarrier); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - $this->findById('cgv')->click(); - $this->webDriver->findElement($processCarrier)->click(); - $hookPayment = WebDriverBy::id('HOOK_PAYMENT'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($hookPayment); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - if ($verifySimulator) { - $clearpaySimulatorClearpay = WebDriverBy::className('clearpaySimulatorClearpay'); - $condition = WebDriverExpectedCondition::presenceOfElementLocated($clearpaySimulatorClearpay); - $this->waitUntil($condition); - $this->assertTrue((bool)$condition); - } - } - - /** - * @requires goToProduct - * - * @throws \Exception - */ - public function addProduct() - { - $addToCartSearch = WebDriverBy::id('add_to_cart'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($addToCartSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - $this->webDriver->findElement($addToCartSearch)->click(); - $shoppingCartSearch = WebDriverBy::id('shopping_cart'); - $this->webDriver->findElement($shoppingCartSearch)->click(); - $shoppingCartTitle = WebDriverBy::id('cart_title'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($shoppingCartTitle); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - } - - /** - * @param bool $verifySimulator - * - * @throws \Exception - */ - public function goToProduct($verifySimulator = true) - { - $this->webDriver->get(self::PS15URL.self::COUNTRY_QUERYSTRING); - $this->findById('header_logo')->click(); - $featuredProductCenterSearch = WebDriverBy::id('featured-products_block_center'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($featuredProductCenterSearch); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - $product = $featuredProductCenterSearch->className('s_title_block'); - $this->webDriver->findElement($product)->click(); - if ($verifySimulator) { - $clearpaySimulatorClearpay = WebDriverBy::className('clearpaySimulatorClearpay'); - $condition = WebDriverExpectedCondition::presenceOfElementLocated($clearpaySimulatorClearpay); - $this->waitUntil($condition); - $this->assertTrue((bool)$condition); - // this sleep is to prevent simulator js render - sleep(5); - } - } - - /** - * Verify clearpay - * - * @throws \Exception - */ - public function verifyClearpay() - { - $clearpayCheckout = WebDriverBy::className('clearpay-checkout'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($clearpayCheckout); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - - var_dump("Pre title---->".$this->webDriver->getTitle()); - sleep(10); - // $this->webDriver->findElement($clearpayCheckout)->click(); - $this->webDriver->executeScript('document.querySelector(\'.clearpay-checkout\').click();'); - - $condition = WebDriverExpectedCondition::titleContains(self::TITLE); - $this->webDriver->wait()->until($condition, $this->webDriver->getCurrentURL()); - $this->assertTrue((bool)$condition, "PR32"); - - var_dump("out title---->".$this->webDriver->getTitle()); - SeleniumHelper::finishForm($this->webDriver); - sleep(10); - var_dump("Pos title---->".$this->webDriver->getTitle()); - } -} diff --git a/test/common/AbstractPs16Selenium.php b/test/common/AbstractPs16Selenium.php index 9cbf813..d6c799b 100644 --- a/test/common/AbstractPs16Selenium.php +++ b/test/common/AbstractPs16Selenium.php @@ -47,7 +47,7 @@ public function uploadClearpay() $fileInputSearch = $moduleInstallBlock->name('file'); $fileInput = $this->webDriver->findElement($fileInputSearch); $fileInput->setFileDetector(new LocalFileDetector()); - $fileInput->sendKeys(__DIR__.'/../../clearpay.zip'); + $fileInput->sendKeys(__DIR__.'/../../module.zip'); $submitButton = WebDriverBy::name('download'); $condition = WebDriverExpectedCondition::elementToBeClickable($submitButton); $this->waitUntil($condition); diff --git a/test/common/AbstractPs17Selenium.php b/test/common/AbstractPs17Selenium.php index 0e30e0d..eca0f47 100644 --- a/test/common/AbstractPs17Selenium.php +++ b/test/common/AbstractPs17Selenium.php @@ -42,19 +42,28 @@ public function loginToBackOffice() */ public function uploadClearpay() { - $this->webDriver->executeScript('document.querySelector(\'.onboarding-button-shut-down\').click();'); - sleep(10); + try { + $this->webDriver->executeScript('document.querySelector(\'.onboarding-button-shut-down\').click();'); + sleep(4); + } catch (\Exception $exception) { +// do noting + } $elementSearch = WebDriverBy::partialLinkText('Modules'); $condition = WebDriverExpectedCondition::elementToBeClickable($elementSearch); $this->waitUntil($condition); $this->assertTrue((bool) $condition); $this->findByLinkText('Modules')->click(); + $elementSearch = WebDriverBy::partialLinkText('Module Manager'); + $condition = WebDriverExpectedCondition::elementToBeClickable($elementSearch); + $this->waitUntil($condition); + $this->assertTrue((bool) $condition); + $this->findByLinkText('Module Manager')->click(); $this->findById('page-header-desc-configuration-add_module')->click(); $moduleInstallBlock = WebDriverBy::id('module_install'); $fileInputSearch = $moduleInstallBlock->className('dz-hidden-input'); $fileInput = $this->webDriver->findElement($fileInputSearch); $fileInput->setFileDetector(new LocalFileDetector()); - $fileInput->sendKeys(__DIR__.'/../../clearpay.zip'); + $fileInput->sendKeys(__DIR__.'/../../module.zip'); $validatorSearch = WebDriverBy::className('module-import-success-msg'); $condition = WebDriverExpectedCondition::visibilityOfElementLocated($validatorSearch); $this->webDriver->wait(90, 3000)->until($condition); @@ -71,14 +80,26 @@ public function uploadClearpay() */ public function configureLanguagePack($language = '72', $languageName = 'Español (Spanish)') { + try { + $this->findByLinkText('Stop the OnBoarding')->click(); + sleep(3); + } catch (\Exception $exception) { +// do noting + } $elementSearch = WebDriverBy::partialLinkText('International'); $condition = WebDriverExpectedCondition::elementToBeClickable($elementSearch); $this->waitUntil($condition); $this->assertTrue((bool) $condition); + $menu = $this->findById('subtab-AdminInternational'); + $this->moveToElementAndClick($menu->findElement( + WebDriverBy::partialLinkText('International') + )); $this->findByLinkText('International')->click(); - - // $languageInstallSelect = new WebDriverSelect($this->findById('iso_localization_pack')); - // $languageInstallSelect->selectByVisibleText($language); + $elementSearch = WebDriverBy::partialLinkText('Localization'); + $condition = WebDriverExpectedCondition::elementToBeClickable($elementSearch); + $this->waitUntil($condition); + $this->assertTrue((bool) $condition); + $this->findByLinkText('Localization')->click(); $this->findById('iso_localization_pack_chosen')->click(); $this->findByCss('.chosen-results .active-result[data-option-array-index="'. $language .'"]')->click(); diff --git a/test/controllers/PagantisPs15ControllerTest.php b/test/controllers/PagantisPs15ControllerTest.php deleted file mode 100644 index 0263f9f..0000000 --- a/test/controllers/PagantisPs15ControllerTest.php +++ /dev/null @@ -1,72 +0,0 @@ -expects('json')->send(); - $this->assertGreaterThan(0, count($response->body)); - $this->quit(); - } - - /** - * Test testSetConfig - */ - public function testSetConfig() - { - $configUrl = self::PS15URL.self::CONFIG_FOLDER.'&secret=c580df9e0b7b40c3'; - $body = array('TITLE' => 'changed'); - $response = Request::post($configUrl) - ->body($body, Mime::FORM) - ->expectsJSON() - ->send(); - $this->assertEquals('changed', $response->body->TITLE); - $this->quit(); - } - - /** - * Test testGetConfig - */ - public function testGetConfigs() - { - $configUrl = self::PS15URL.self::CONFIG_FOLDER.'&secret=c580df9e0b7b40c3'; - $response = Request::get($configUrl)->expects('json')->send(); - - foreach ($this->configs as $config) { - $this->assertArrayHasKey($config, (array) $response->body); - } - $this->quit(); - } -} \ No newline at end of file diff --git a/test/install/PagantisPs15InstallTest.php b/test/install/PagantisPs15InstallTest.php deleted file mode 100644 index 16697e5..0000000 --- a/test/install/PagantisPs15InstallTest.php +++ /dev/null @@ -1,55 +0,0 @@ -loginToBackOffice(); - $this->uploadClearpay(); - $this->configureClearpay(); - $this->configureLanguagePack('Spain', 'Español (Spanish)'); - $this->quit(); - } - - /** - * @throws \Exception - */ - public function configureClearpay() - { - $this->findByLinkText('Modules')->click(); - $this->findByLinkText('Modules')->click(); - $this->findByName('quicksearch')->clear()->sendKeys('Clearpay'); - try { - $this->findByLinkText('Install')->click(); - } catch (\Exception $exception) { - $this->findByLinkText('Configure')->click(); - } - - $this->findByCss('#CLEARPAY_IS_ENABLED_true + label')->click(); - $this->findById('CLEARPAY_PUBLIC_KEY')->clear()->sendKeys('tk_8517351ec6ae44b29f5dca6e'); - $this->findById('clearpay_private_key')->clear()->sendKeys('c580df9e0b7b40c3'); - $this->findByCss('#CLEARPAY_ENVIRONMENT_sandbox + label')->click(); - $this->webDriver->executeScript('window.scrollBy(0,250)'); - $this->findById('module_form')->submit(); - $confirmationSearch = WebDriverBy::className('module_confirmation'); - $condition = WebDriverExpectedCondition::textToBePresentInElement( - $confirmationSearch, - 'All changes have been saved' - ); - $this->webDriver->wait($condition); - $this->assertTrue((bool) $condition); - } -} diff --git a/test/install/PagantisPs17InstallTest.php b/test/install/PagantisPs17InstallTest.php index c9eb4b9..0b28229 100644 --- a/test/install/PagantisPs17InstallTest.php +++ b/test/install/PagantisPs17InstallTest.php @@ -30,10 +30,9 @@ public function testInstallAndConfigureClearpayInPrestashop17() public function configureClearpay() { $this->findByCss('#CLEARPAY_IS_ENABLED_on + label')->click(); - $this->findById('CLEARPAY_PUBLIC_KEY')->clear()->sendKeys('tk_8517351ec6ae44b29f5dca6e'); - $this->findById('clearpay_private_key')->clear()->sendKeys('c580df9e0b7b40c3'); - $this->findByCss('#CLEARPAY_ENVIRONMENT_sandbox + label')->click(); - $this->findById('module_form_submit_btn')->click(); + $this->findById('CLEARPAY_PUBLIC_KEY')->clear()->sendKeys($this->configuration['publicKey']); + $this->findById('CLEARPAY_SECRET_KEY')->clear()->sendKeys($this->configuration['secretKey']); + $this->findById('configuration_form_submit_btn')->click(); $confirmationSearch = WebDriverBy::className('module_confirmation'); $condition = WebDriverExpectedCondition::textToBePresentInElement( $confirmationSearch, diff --git a/test/register/PagantisPs15RegisterTest.php b/test/register/PagantisPs15RegisterTest.php deleted file mode 100644 index 6bcf4ce..0000000 --- a/test/register/PagantisPs15RegisterTest.php +++ /dev/null @@ -1,22 +0,0 @@ -createAccount(); - $this->loginToFrontend(); - $this->quit(); - } -} diff --git a/test/validate/ValidatePs15Test.php b/test/validate/ValidatePs15Test.php deleted file mode 100644 index 95b200d..0000000 --- a/test/validate/ValidatePs15Test.php +++ /dev/null @@ -1,61 +0,0 @@ -loginToBackOffice(); - $this->getClearpayBackOffice(); - $this->findById('module_form_submit_btn')->click(); - $confirmationSearch = WebDriverBy::className('module_confirmation'); - $condition = WebDriverExpectedCondition::textToBePresentInElement( - $confirmationSearch, - 'All changes have been saved' - ); - $this->webDriver->wait($condition); - $this->assertTrue((bool) $condition); - - $this->loginToFrontend(); - $this->goToProduct(); - $this->addProduct(); - $this->goToCheckout(true); - $clearpayCheckout = WebDriverBy::className('clearpay-checkout'); - $condition = WebDriverExpectedCondition::visibilityOfElementLocated($clearpayCheckout); - $this->waitUntil($condition); - $this->assertTrue((bool) $condition); - - var_dump("Validate Pre title---->".$this->webDriver->getTitle()); - sleep(10); - //$this->webDriver->findElement($clearpayCheckout)->click(); - $this->webDriver->executeScript('document.querySelector(\'.clearpay-checkout\').click();'); - - var_dump("validate out title---->".$this->webDriver->getTitle()); - SeleniumHelper::finishForm($this->webDriver); - sleep(10); - var_dump("validate Pos title---->".$this->webDriver->getTitle()); - - $confirmationMessage = WebDriverBy::id('order-confirmation'); - $condition = WebDriverExpectedCondition::presenceOfElementLocated( - $confirmationMessage - ); - $this->webDriver->wait($condition); - $this->assertTrue((bool) $condition); - $this->quit(); - } -} diff --git a/translations/es.php b/translations/es.php index 863a79e..39e5866 100644 --- a/translations/es.php +++ b/translations/es.php @@ -2,29 +2,26 @@ global $_MODULE; $_MODULE = array(); +$_MODULE['<{clearpay}prestashop>clearpay_98ac515fe72346b4b50e29401c2b3849'] = 'Clearpay'; $_MODULE['<{clearpay}prestashop>clearpay_e7e35f48cbce0859d908c6b61eafe05b'] = 'Pasarela de pago Clearpay'; -$_MODULE['<{clearpay}prestashop>clearpay_2a7b59da56de0531430d25536e9eb49e'] = 'Compra ahora, paga más tarde - 4 plazos. Sin intereses. Consigue nuevos clientes, aumenta tu'; -$_MODULE['<{clearpay}prestashop>clearpay_910cfd506ed458d25b19f76dc940e0f2'] = ' conversión, tu recurrencia de compra y tu ticket medio ofreciendoles cuotas'; -$_MODULE['<{clearpay}prestashop>clearpay_7194b53cf45110b8206f55295994d868'] = 'sin costes extras.'; +$_MODULE['<{clearpay}prestashop>clearpay_e29ce4b7c04f7fc98f1bfe66e0bd1daf'] = 'Compra ahora, paga más tarde - 4 plazos. Sin intereses. Consigue nuevos clientes,'; +$_MODULE['<{clearpay}prestashop>clearpay_689451a96ac8f98fc7d35fb2971c8c86'] = ' aumenta tu conversión, tu recurrencia de compra y tu ticket medio ofreciendoles '; +$_MODULE['<{clearpay}prestashop>clearpay_bf556a495a6d99f008fcf01ae7178134'] = ' cuotas sin costes extras.'; $_MODULE['<{clearpay}prestashop>clearpay_92d4773a9f32fc3333cb8238471cf763'] = 'Falta la extension de php: curl'; $_MODULE['<{clearpay}prestashop>clearpay_5984afe5af3bc7d4a01ba1d722c00a38'] = 'La versión mínima soportada de PHP es 5.3.0'; -$_MODULE['<{clearpay}prestashop>clearpay_8a04b447fe7942b43631e4bfe52b9026'] = 'O 4 pagos sin coste de'; +$_MODULE['<{clearpay}prestashop>clearpay_8a04b447fe7942b43631e4bfe52b9026'] = 'O 4 pagos de'; $_MODULE['<{clearpay}prestashop>clearpay_23a58bf9274bedb19375e527a0744fa9'] = 'con'; $_MODULE['<{clearpay}prestashop>clearpay_d1acd9ba7f1857100ab8a99b2632fb78'] = '4 pagos sin coste de'; -$_MODULE['<{clearpay}prestashop>clearpay_3491d10fe34b32b435ef500927c76ac9'] = 'Sin intereses.'; -$_MODULE['<{clearpay}prestashop>clearpay_020707fabdcc35960c2b5daf8793fcb8'] = ' Sin documentación. Respuesta inmediata'; -$_MODULE['<{clearpay}prestashop>clearpay_e104159863b26bfba1985c9560c37bff'] = 'Serás redirigido a la plataforma de Clearpay para completar tu información de pago.'; -$_MODULE['<{clearpay}prestashop>clearpay_f77a1168d9447933ed73d0444718fe7c'] = 'Después, serás redirigido a nuestro sitio web para completar tu pedido. Ten en cuenta:'; -$_MODULE['<{clearpay}prestashop>clearpay_f7092887404b3d677e618d93f1af6d2a'] = 'Clearpay solo se puede utilizar como método de pago para pedidos con una dirección de envío'; -$_MODULE['<{clearpay}prestashop>clearpay_6d3b446036b038238a3bad3b78d9b778'] = 'y facturación dentro de España.'; +$_MODULE['<{clearpay}prestashop>clearpay_dda982da36845de9d4d9e839d796b02b'] = 'Serás redirigido a la plataforma de Clearpay para completar tu información de pago. '; $_MODULE['<{clearpay}prestashop>clearpay_829f96defc7c51f96edf84b190ab864a'] = 'Términos y condiciones'; $_MODULE['<{clearpay}prestashop>clearpay_b5ae6cf49ae0a5bad90d427422424f17'] = 'https://www.clearpay.com/es/terms/'; +$_MODULE['<{clearpay}prestashop>clearpay_71948aa4f6e12cdaa5e2e63a5eb8f142'] = 'Más info'; $_MODULE['<{clearpay}prestashop>clearpay_253c609d642a8362c15b03bb808a7974'] = 'Habilitar el módulo'; $_MODULE['<{clearpay}prestashop>clearpay_93cba07454f06a4a960172bbd6e2a435'] = 'Si'; $_MODULE['<{clearpay}prestashop>clearpay_bafd7322c6e97d25b6299b5d6fe8920b'] = 'No'; -$_MODULE['<{clearpay}prestashop>clearpay_d76382dc9eac5a174bf648bb80f03b3d'] = 'API region'; $_MODULE['<{clearpay}prestashop>clearpay_912d59cdf1d3f551fae21f6f0062258f'] = 'Europa'; $_MODULE['<{clearpay}prestashop>clearpay_89f9c9f489be2a83cf57e53b9197d288'] = 'Reino Unido'; +$_MODULE['<{clearpay}prestashop>clearpay_d76382dc9eac5a174bf648bb80f03b3d'] = 'API region'; $_MODULE['<{clearpay}prestashop>clearpay_cb6d90975bcc4efd322d55d1cac9d97b'] = 'ej: 400101010 '; $_MODULE['<{clearpay}prestashop>clearpay_9ca9046c6da2b6c5c84b069bfb089e45'] = 'Identificador del Comercio'; $_MODULE['<{clearpay}prestashop>clearpay_7d0c843509c6c86df93087c8ba889278'] = 'Código alfanumérico de 128 caracteres'; @@ -37,12 +34,24 @@ $_MODULE['<{clearpay}prestashop>clearpay_397e921a4cf947e34e59c6994d721004'] = 'ej: 800'; $_MODULE['<{clearpay}prestashop>clearpay_038d292cb9ee99b8049a345e4765206f'] = 'Límite máximo'; $_MODULE['<{clearpay}prestashop>clearpay_b7ad6b8653eabcb10ec33b9273b920c7'] = 'Restringir para las categorías'; +$_MODULE['<{clearpay}prestashop>clearpay_21c7441ed0601019590fd546327a3bbe'] = 'IMPORTANTE: activa sólo aquellas categorías en las que NO quieres que se muestre Clearpay.'; +$_MODULE['<{clearpay}prestashop>clearpay_2918aea5b06929f5aefaadfd5752693b'] = 'Por defecto: Todas las categorías deben estar desmarcadas'; +$_MODULE['<{clearpay}prestashop>clearpay_025831e1d00dbece4a25c01015d131ab'] = 'El valor por defecto es \'default\''; +$_MODULE['<{clearpay}prestashop>clearpay_cfd00dbc208a6bd6f404334723c5db93'] = 'Esta propiedad establece el valor del selector CSS usado para mostrar el simulador en la página de producto.'; +$_MODULE['<{clearpay}prestashop>clearpay_f899cc1ba84847c04afe08fad606b87d'] = 'IMPORTANTE: sólo modificar este valor si el simulador no se muestra correctamente'; +$_MODULE['<{clearpay}prestashop>clearpay_d44cf5598860527b93814eb2e3300d67'] = 'Selector CSS de la página de producto'; +$_MODULE['<{clearpay}prestashop>clearpay_a9077b2151352603b83709aebc754aa5'] = 'Esta propiedad establece el valor del selector CSS usado para mostrar el simulador en la página del carrito.'; +$_MODULE['<{clearpay}prestashop>clearpay_32c828e32ca51b952ca6f10745fa9982'] = 'Selector CSS de la página ddel carrito'; +$_MODULE['<{clearpay}prestashop>clearpay_ec3028a12402ab7f43962a6f3a667b6e'] = 'Modo depuración'; +$_MODULE['<{clearpay}prestashop>clearpay_0b413e146adf4ce9936cc72858385237'] = 'Podrás ver estos logs en la sección \'Configuración -> Configuración Avanzada -> Logs\''; +$_MODULE['<{clearpay}prestashop>clearpay_8c9dd8097105094f866db128937f168d'] = 'Activar logs de depuración'; $_MODULE['<{clearpay}prestashop>clearpay_f4f70727dc34561dfde1a3c529b6205c'] = 'Ajustes'; $_MODULE['<{clearpay}prestashop>clearpay_c9cc8cce247e49bae79f15173ce97354'] = 'Guardar'; $_MODULE['<{clearpay}prestashop>clearpay_630f6dc397fe74e52d5189e2c80f282b'] = 'Volver al listado'; $_MODULE['<{clearpay}prestashop>clearpay_4723b04f6feabc299bb92f04a9a71bbf'] = 'El Identificador del Comercio y la Clave Secreta son obligatorias'; $_MODULE['<{clearpay}prestashop>clearpay_a7139ef55f3c52d2de726ec1bab7d5e8'] = 'Todos los cambios han sido actualizados'; -$_MODULE['<{clearpay}prestashop>clearpay_7dd615c475f4185cf30e57922d19cd8b'] = 'No se pudo consultar la configuración con la región y las credenciales escritas'; +$_MODULE['<{clearpay}prestashop>clearpay_44302c3ae2ab12cee13c614417feaed9'] = 'No se ha podido realizar la cosulta con las credenciales y la region '; +$_MODULE['<{clearpay}prestashop>clearpay_0b0a3e47a9223842cc166517c92d3764'] = ' especificada. Mensaje recibido: '; $_MODULE['<{clearpay}prestashop>clearpay_11ac9d0dc138307ce703233c432610af'] = 'Ha ocurrido un error al consultar la configuracion en '; $_MODULE['<{clearpay}prestashop>clearpay_f4be59c537cc3b780ad313c7828e5498'] = 'Panel de configuración de Clearpay'; $_MODULE['<{clearpay}prestashop>clearpay_02d4482d332e1aef3437cd61c9bcc624'] = 'Contáctanos'; @@ -56,28 +65,25 @@ $_MODULE['<{clearpay}prestashop>clearpay_361967d38d6dd34cc653ee337ec87b4a'] = ' haz click en el siguiente enlace para comenzar'; $_MODULE['<{clearpay}prestashop>clearpay_1f1c6e7dcfe28bd070a91a587e3f9acb'] = ' con Clearpay'; $_MODULE['<{clearpay}prestashop>clearpay_d3076b71ec8d810de3424e4faa089933'] = 'Respuesta inmediata - 4 pagos sin intereses de'; +$_MODULE['<{clearpay}prestashop>clearpay_f6af67905bf57e1665f2f20bafb55e2d'] = 'Serás redirigido a la plataforma de Clearpay para completar tu información de pago. Después, serás redirigido a nuestro sitio web para completar tu pedido. Ten en cuenta: Clearpay solo se puede utilizar como método de pago para pedidos con una dirección de envío y facturación dentro de España.'; $_MODULE['<{clearpay}prestashop>clearpay_b3b5419fab79330bd4da100076bfc14c'] = 'SABER MÁS'; $_MODULE['<{clearpay}prestashop>clearpay_ae5ab5fcf6628d51df510e3b6cf9d3d2'] = 'Compra ahora. Paga más tarde Sin intereses.'; $_MODULE['<{clearpay}prestashop>clearpay_5a7c0d5e2088ae7ad7d82a9dd24ccbd8'] = 'Con Clearpay puedes disfrutar tu compra ahora y pagar en 4 cuotas, '; $_MODULE['<{clearpay}prestashop>clearpay_c3ad0b0a2593e4840c191eaa109dfa3b'] = ' sin coste. Selecciona Clearpay en el check-out, '; $_MODULE['<{clearpay}prestashop>clearpay_89e8cfdffaeb291bbc71af49a705a6da'] = 'rellena un sencillo formulario, sin documentación adicional, y fracciona tu compra.'; -$_MODULE['<{clearpay}prestashop>notify_688ebc3b16d0e0dd2175b14eec35603d'] = 'Error al buscar la orden de Clearpay'; -$_MODULE['<{clearpay}prestashop>notify_55d530f5cf1bffaff87c30662844654a'] = 'Error al capturar el pago de Clearpay, order Token:'; -$_MODULE['<{clearpay}prestashop>notify_f8b7b087931a742c0589b78dd1f634c0'] = 'Error en la captura del pago de Clearpay, el pago no se procesó correctamente'; +$_MODULE['<{clearpay}prestashop>clearpay_7036c2fbf0d8039a1af78af1904bcb56'] = 'Gracias por confirmar tu pago, sin embargo, como tu carrito de compra ha sido actualizado, necesitamos una nueva '; +$_MODULE['<{clearpay}prestashop>clearpay_fc3ffe22cd6d197ebf784688a38d07d7'] = ' confirmación. Vuelve a intentarlo en unos minutos.'; +$_MODULE['<{clearpay}prestashop>clearpay_f1502472558e889a4e8b7d3d9215f0ae'] = 'Para obtener más información, contacta con el equipo de atención al cliente de Clearpay:'; +$_MODULE['<{clearpay}prestashop>clearpay_834771123e3b0f8abb1a27ae06a7f83e'] = 'Lamentamos informate que no hemos podido procesar tu pago. Para obtener más información, contacta con el equipo de atención al cliente de Clearpay:'; +$_MODULE['<{clearpay}prestashop>notify_2b1563550dabe1eae8162bc16d8fd1a9'] = 'Imposible recuperar la orden de '; $_MODULE['<{clearpay}prestashop>payment_483cb038032a2aa03302d43b727c52af'] = '. Código de estado:'; $_MODULE['<{clearpay}prestashop>payment_9b4b36239f45f5e838e126b7d6f77cbe'] = 'Se ha producido un error al crear la orden:'; $_MODULE['<{clearpay}prestashop>config-info_b3487ccef58efa1f9f510347f85210a2'] = 'https://www.clearpay.com/es/prestashop/?utm_source=prestashop&utm_medium=referral&utm_campaign=global_prestashop-lead-referrals_campaign&utm_content=contact-us'; $_MODULE['<{clearpay}prestashop>config-info_9d59871f213a2363b6fa87c96e20d6f8'] = 'https://developers.clearpay.com/docs/getting-started-with-clearpay-online'; -$_MODULE['<{clearpay}prestashop>payment-15_830a4bb0255e273df5154612248fe7d1'] = '¿Seguro que quieres salir?'; -$_MODULE['<{clearpay}prestashop>payment-17_830a4bb0255e273df5154612248fe7d1'] = '¿Seguro que quieres salir?'; $_MODULE['<{clearpay}prestashop>payment-declined_cf63759a63d47726c82e95a896e169fa'] = 'PAGO RECHAZADO'; -$_MODULE['<{clearpay}prestashop>payment-declined_834771123e3b0f8abb1a27ae06a7f83e'] = 'Lamentamos informate que no hemos podido procesar tu pago.'; -$_MODULE['<{clearpay}prestashop>payment-declined_f1502472558e889a4e8b7d3d9215f0ae'] = ' Para obtener más información, contacta con el equipo de atención al cliente de Clearpay:'; -$_MODULE['<{clearpay}prestashop>payment-declined_8d6d05253cb3b81eb272a5a36769e5c2'] = 'https://clearpay-europe.readme.io/docs/customer-support'; +$_MODULE['<{clearpay}prestashop>payment-declined_8d6d05253cb3b81eb272a5a36769e5c2'] = 'https://developers.clearpay.com/docs/customer-support'; $_MODULE['<{clearpay}prestashop>payment-declined_2272656fd21debb386cda29888825f75'] = 'Como referencia, el ID de pedido para esta transacción es:'; $_MODULE['<{clearpay}prestashop>payment-error_643d39ddaaa9572171348cbed25b7dee'] = 'ERROR EN EL PAGO'; $_MODULE['<{clearpay}prestashop>payment-error_45ced5829069c3dfcccc5f9c4bb768c6'] = 'Lamentamos informarte que se ha producido un error al procesar tu pago. '; -$_MODULE['<{clearpay}prestashop>payment-error_3439ef7349199d9a75a39c2a82ee6a69'] = 'Gracias por confirmar tu pago, sin embargo, como tu carrito de compra ha sido actualizado, necesitamos una nueva confirmación. Vuelve a intentarlo en unos minutos.'; -$_MODULE['<{clearpay}prestashop>payment-error_f1502472558e889a4e8b7d3d9215f0ae'] = 'Para obtener más información, contacta con el equipo de atención al cliente de Clearpay:'; -$_MODULE['<{clearpay}prestashop>payment-error_8d6d05253cb3b81eb272a5a36769e5c2'] = 'https://clearpay-europe.readme.io/docs/customer-support'; +$_MODULE['<{clearpay}prestashop>payment-error_8d6d05253cb3b81eb272a5a36769e5c2'] = 'https://developers.clearpay.com/docs/customer-support'; $_MODULE['<{clearpay}prestashop>payment-return_b4c2efa5d2e4f7b7145d5ec06c0895f6'] = ' ¡ Genial ! has completado tu compra. Ahora puedes continuar comprando o ver tus pedidos.'; diff --git a/translations/fr.php b/translations/fr.php index 0195917..dec8647 100644 --- a/translations/fr.php +++ b/translations/fr.php @@ -2,29 +2,26 @@ global $_MODULE; $_MODULE = array(); +$_MODULE['<{clearpay}prestashop>clearpay_98ac515fe72346b4b50e29401c2b3849'] = 'Clearpay'; $_MODULE['<{clearpay}prestashop>clearpay_e7e35f48cbce0859d908c6b61eafe05b'] = 'Clearpay Payment Gateway'; -$_MODULE['<{clearpay}prestashop>clearpay_2a7b59da56de0531430d25536e9eb49e'] = 'Achetez maintenant, payez plus tard. Toujours sans frais. Attirez de nouveaux clients, augmentez votre taux de conversion, la fréquence d\'achat et'; -$_MODULE['<{clearpay}prestashop>clearpay_910cfd506ed458d25b19f76dc940e0f2'] = ' a valeur moyenne des commandes en offrant des paiements en plusieurs fois'; -$_MODULE['<{clearpay}prestashop>clearpay_7194b53cf45110b8206f55295994d868'] = ' sans frais dans votre boutique.'; +$_MODULE['<{clearpay}prestashop>clearpay_e29ce4b7c04f7fc98f1bfe66e0bd1daf'] = 'Achetez maintenant, payez plus tard. Toujours sans frais. Attirez de nouveaux clients,'; +$_MODULE['<{clearpay}prestashop>clearpay_689451a96ac8f98fc7d35fb2971c8c86'] = ' augmentez votre taux de conversion, la fréquence d\'achat et la valeur moyenne des commandes en offrant des'; +$_MODULE['<{clearpay}prestashop>clearpay_bf556a495a6d99f008fcf01ae7178134'] = ' paiements en plusieurs fois sans frais dans votre boutique.'; $_MODULE['<{clearpay}prestashop>clearpay_92d4773a9f32fc3333cb8238471cf763'] = 'Il manque l\'extension php: curl'; $_MODULE['<{clearpay}prestashop>clearpay_5984afe5af3bc7d4a01ba1d722c00a38'] = 'La version PHP ci-dessous 5.3.0 n\'est pas supportée'; -$_MODULE['<{clearpay}prestashop>clearpay_8a04b447fe7942b43631e4bfe52b9026'] = 'Ou 4 paiements sans intérêts de'; -$_MODULE['<{clearpay}prestashop>clearpay_23a58bf9274bedb19375e527a0744fa9'] = 'avec'; +$_MODULE['<{clearpay}prestashop>clearpay_8a04b447fe7942b43631e4bfe52b9026'] = 'Ou 4 paiements de'; +$_MODULE['<{clearpay}prestashop>clearpay_23a58bf9274bedb19375e527a0744fa9'] = ' sans frais avec'; $_MODULE['<{clearpay}prestashop>clearpay_d1acd9ba7f1857100ab8a99b2632fb78'] = '4 paiements sans intérêts de'; -$_MODULE['<{clearpay}prestashop>clearpay_3491d10fe34b32b435ef500927c76ac9'] = 'Toujours sans frais.'; -$_MODULE['<{clearpay}prestashop>clearpay_020707fabdcc35960c2b5daf8793fcb8'] = ' Sans document à fournir. Approbation immédiate.'; -$_MODULE['<{clearpay}prestashop>clearpay_e104159863b26bfba1985c9560c37bff'] = 'Vers le site de Clearpay pour renseigner vos informations de paiement.'; -$_MODULE['<{clearpay}prestashop>clearpay_f77a1168d9447933ed73d0444718fe7c'] = 'Vous serez ensuite redirigé vers notre site pour finaliser votre commande. Veuillez noter que'; -$_MODULE['<{clearpay}prestashop>clearpay_f7092887404b3d677e618d93f1af6d2a'] = 'Clearpay ne peut être utilisé comme méthode de paiement que pour les commandes dont l\'adresse de livraison'; -$_MODULE['<{clearpay}prestashop>clearpay_6d3b446036b038238a3bad3b78d9b778'] = ' et de facturation est située en France.'; +$_MODULE['<{clearpay}prestashop>clearpay_dda982da36845de9d4d9e839d796b02b'] = 'Vous allez être redirigé vers Clearpay pour renseigner vos informations de paiement.'; $_MODULE['<{clearpay}prestashop>clearpay_829f96defc7c51f96edf84b190ab864a'] = 'Conditions générales'; $_MODULE['<{clearpay}prestashop>clearpay_b5ae6cf49ae0a5bad90d427422424f17'] = 'https://www.clearpay.com/fr/terms/'; +$_MODULE['<{clearpay}prestashop>clearpay_71948aa4f6e12cdaa5e2e63a5eb8f142'] = '_hide_'; $_MODULE['<{clearpay}prestashop>clearpay_253c609d642a8362c15b03bb808a7974'] = 'Le module est activé'; $_MODULE['<{clearpay}prestashop>clearpay_93cba07454f06a4a960172bbd6e2a435'] = 'Oui'; $_MODULE['<{clearpay}prestashop>clearpay_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Non'; -$_MODULE['<{clearpay}prestashop>clearpay_d76382dc9eac5a174bf648bb80f03b3d'] = 'API région'; $_MODULE['<{clearpay}prestashop>clearpay_912d59cdf1d3f551fae21f6f0062258f'] = 'L\'Europe'; $_MODULE['<{clearpay}prestashop>clearpay_89f9c9f489be2a83cf57e53b9197d288'] = 'Royaume-Uni'; +$_MODULE['<{clearpay}prestashop>clearpay_d76382dc9eac5a174bf648bb80f03b3d'] = 'API région'; $_MODULE['<{clearpay}prestashop>clearpay_cb6d90975bcc4efd322d55d1cac9d97b'] = 'ex: 400101010'; $_MODULE['<{clearpay}prestashop>clearpay_9ca9046c6da2b6c5c84b069bfb089e45'] = 'Identifiant du marchand'; $_MODULE['<{clearpay}prestashop>clearpay_7d0c843509c6c86df93087c8ba889278'] = '128 code alphanumérique'; @@ -37,12 +34,24 @@ $_MODULE['<{clearpay}prestashop>clearpay_397e921a4cf947e34e59c6994d721004'] = 'ex:800'; $_MODULE['<{clearpay}prestashop>clearpay_038d292cb9ee99b8049a345e4765206f'] = 'Limite de paiement maximale'; $_MODULE['<{clearpay}prestashop>clearpay_b7ad6b8653eabcb10ec33b9273b920c7'] = 'Catégories restreintes'; +$_MODULE['<{clearpay}prestashop>clearpay_21c7441ed0601019590fd546327a3bbe'] = 'IMPORTANT: n\'activez que les catégories dans lesquelles vous ne souhaitez PAS afficher Clearpay.'; +$_MODULE['<{clearpay}prestashop>clearpay_2918aea5b06929f5aefaadfd5752693b'] = 'Par défaut: UNMARK ALL'; +$_MODULE['<{clearpay}prestashop>clearpay_025831e1d00dbece4a25c01015d131ab'] = 'La valeur par défaut est «default».'; +$_MODULE['<{clearpay}prestashop>clearpay_cfd00dbc208a6bd6f404334723c5db93'] = 'Cette propriété définit le sélecteur CSS nécessaire pour afficher les actifs sur la page du produit.'; +$_MODULE['<{clearpay}prestashop>clearpay_f899cc1ba84847c04afe08fad606b87d'] = 'Ne modifiez cette valeur que si elle ne s\'affiche pas correctement.'; +$_MODULE['<{clearpay}prestashop>clearpay_d44cf5598860527b93814eb2e3300d67'] = 'Sélecteur CSS de la page produit'; +$_MODULE['<{clearpay}prestashop>clearpay_a9077b2151352603b83709aebc754aa5'] = 'Cette propriété définit le sélecteur CSS nécessaire pour afficher les actifs sur la page du panier.'; +$_MODULE['<{clearpay}prestashop>clearpay_32c828e32ca51b952ca6f10745fa9982'] = 'Sélecteur CSS de la page du panier'; +$_MODULE['<{clearpay}prestashop>clearpay_ec3028a12402ab7f43962a6f3a667b6e'] = 'Mode débogage'; +$_MODULE['<{clearpay}prestashop>clearpay_0b413e146adf4ce9936cc72858385237'] = 'Vous pouvez voir ces journaux dans la section \'Configurer -> Paramètres avancés -> Journaux\''; +$_MODULE['<{clearpay}prestashop>clearpay_8c9dd8097105094f866db128937f168d'] = 'Activer les journaux de débogage'; $_MODULE['<{clearpay}prestashop>clearpay_f4f70727dc34561dfde1a3c529b6205c'] = 'Paramètres'; $_MODULE['<{clearpay}prestashop>clearpay_c9cc8cce247e49bae79f15173ce97354'] = 'sauvegarder'; $_MODULE['<{clearpay}prestashop>clearpay_630f6dc397fe74e52d5189e2c80f282b'] = 'Retour à la liste'; $_MODULE['<{clearpay}prestashop>clearpay_4723b04f6feabc299bb92f04a9a71bbf'] = 'L\'ID du marchand et la clé secrète sont des champs obligatoires'; $_MODULE['<{clearpay}prestashop>clearpay_a7139ef55f3c52d2de726ec1bab7d5e8'] = 'Toutes les modifications ont été mises à jour'; -$_MODULE['<{clearpay}prestashop>clearpay_7dd615c475f4185cf30e57922d19cd8b'] = 'La demande de configuration ne peut pas être effectuée avec la région et les informations d\'identification fournies.'; +$_MODULE['<{clearpay}prestashop>clearpay_44302c3ae2ab12cee13c614417feaed9'] = 'La demande de configuration ne peut pas être effectuée avec la région et les informations d\'identification'; +$_MODULE['<{clearpay}prestashop>clearpay_0b0a3e47a9223842cc166517c92d3764'] = 'à condition de. Message reçu:'; $_MODULE['<{clearpay}prestashop>clearpay_11ac9d0dc138307ce703233c432610af'] = 'Une erreur s\'est produite lors de la récupération de la configuration depuis'; $_MODULE['<{clearpay}prestashop>clearpay_f4be59c537cc3b780ad313c7828e5498'] = 'Panneau de configuration Clearpay'; $_MODULE['<{clearpay}prestashop>clearpay_02d4482d332e1aef3437cd61c9bcc624'] = 'Nous contacter'; @@ -56,28 +65,25 @@ $_MODULE['<{clearpay}prestashop>clearpay_361967d38d6dd34cc653ee337ec87b4a'] = ' cliquez sur le lien suivant pour démarrer.'; $_MODULE['<{clearpay}prestashop>clearpay_1f1c6e7dcfe28bd070a91a587e3f9acb'] = ' avec Clearpay'; $_MODULE['<{clearpay}prestashop>clearpay_d3076b71ec8d810de3424e4faa089933'] = 'Réponse immédiate - 4 paiements sans intérêts de'; +$_MODULE['<{clearpay}prestashop>clearpay_f6af67905bf57e1665f2f20bafb55e2d'] = 'Vous serez redirigé vers le site de Clearpay pour renseigner vos informations de paiement. Vous serez ensuite redirigé vers notre site pour finaliser votre commande. Veuillez noter que Clearpay ne peut être utilisé comme méthode de paiement que pour les commandes dont l\'adresse de livraison et de facturation est située en France.'; $_MODULE['<{clearpay}prestashop>clearpay_b3b5419fab79330bd4da100076bfc14c'] = 'EN SAVOIR PLUS'; $_MODULE['<{clearpay}prestashop>clearpay_ae5ab5fcf6628d51df510e3b6cf9d3d2'] = 'Achetez maintenant. Payez plus tard. Sans frais.'; $_MODULE['<{clearpay}prestashop>clearpay_5a7c0d5e2088ae7ad7d82a9dd24ccbd8'] = 'Avec Clearpay, vous pouvez profiter de votre achat dès maintenant et le payer en 4 versements, '; $_MODULE['<{clearpay}prestashop>clearpay_c3ad0b0a2593e4840c191eaa109dfa3b'] = ' sans aucun coût caché. Choisissez Clearpay comme mode de paiement, '; $_MODULE['<{clearpay}prestashop>clearpay_89e8cfdffaeb291bbc71af49a705a6da'] = ' remplissez un court formulaire sans document à fournir, et payez plus tard, tout simplement.'; -$_MODULE['<{clearpay}prestashop>notify_688ebc3b16d0e0dd2175b14eec35603d'] = 'Impossible de récupérer la commande auprès de Clearpay.'; -$_MODULE['<{clearpay}prestashop>notify_55d530f5cf1bffaff87c30662844654a'] = 'Erreur de paiement de capture Clearpay, jeton de commande:'; -$_MODULE['<{clearpay}prestashop>notify_f8b7b087931a742c0589b78dd1f634c0'] = 'Erreur de paiement de capture Clearpay, le paiement n\'a pas été traité avec succès'; +$_MODULE['<{clearpay}prestashop>clearpay_7036c2fbf0d8039a1af78af1904bcb56'] = 'Nous vous remercions d\'avoir confirmé votre paiement. Cependant, votre panier ayant été actualisé, nous avons besoin d\'une nouvelle '; +$_MODULE['<{clearpay}prestashop>clearpay_fc3ffe22cd6d197ebf784688a38d07d7'] = ' confirmation de paiement. Poursuivez sur Clearpay et réessayez dans quelques minutes.'; +$_MODULE['<{clearpay}prestashop>clearpay_f1502472558e889a4e8b7d3d9215f0ae'] = 'Pour plus d\'informations, merci de contacter le service-client de Clearpay:'; +$_MODULE['<{clearpay}prestashop>clearpay_834771123e3b0f8abb1a27ae06a7f83e'] = 'Nous sommes navrés de vous informer que votre paiement a été refusé par Clearpay.'; +$_MODULE['<{clearpay}prestashop>notify_2b1563550dabe1eae8162bc16d8fd1a9'] = 'Impossible de récupérer la commande de'; $_MODULE['<{clearpay}prestashop>payment_483cb038032a2aa03302d43b727c52af'] = '. Code d\'état:'; $_MODULE['<{clearpay}prestashop>payment_9b4b36239f45f5e838e126b7d6f77cbe'] = 'Erreur reçue lors de la tentative de création d\'une commande:'; $_MODULE['<{clearpay}prestashop>config-info_b3487ccef58efa1f9f510347f85210a2'] = 'https://www.clearpay.com/fr/prestashop/?utm_source=prestashop&utm_medium=referral&utm_campaign=global_prestashop-lead-referrals_campaign&utm_content=contact-us'; $_MODULE['<{clearpay}prestashop>config-info_9d59871f213a2363b6fa87c96e20d6f8'] = 'https://developers.clearpay.com/docs/getting-started-with-clearpay-online'; -$_MODULE['<{clearpay}prestashop>payment-15_830a4bb0255e273df5154612248fe7d1'] = 'Tu veux vraiment partir?'; -$_MODULE['<{clearpay}prestashop>payment-17_830a4bb0255e273df5154612248fe7d1'] = 'Tu veux vraiment partir?'; $_MODULE['<{clearpay}prestashop>payment-declined_cf63759a63d47726c82e95a896e169fa'] = 'PAIEMENT REFUSÉ'; -$_MODULE['<{clearpay}prestashop>payment-declined_834771123e3b0f8abb1a27ae06a7f83e'] = 'Nous sommes navrés de vous informer que votre paiement a été refusé par Clearpay.'; -$_MODULE['<{clearpay}prestashop>payment-declined_f1502472558e889a4e8b7d3d9215f0ae'] = 'Pour plus d\'informations, merci de contacter le service-client de Clearpay : '; -$_MODULE['<{clearpay}prestashop>payment-declined_8d6d05253cb3b81eb272a5a36769e5c2'] = 'https://clearpay-europe.readme.io/docs/customer-support'; +$_MODULE['<{clearpay}prestashop>payment-declined_8d6d05253cb3b81eb272a5a36769e5c2'] = 'https://developers.clearpay.com/docs/customer-support'; $_MODULE['<{clearpay}prestashop>payment-declined_2272656fd21debb386cda29888825f75'] = 'Pour référence, le numéro de commande pour cette transaction est : '; $_MODULE['<{clearpay}prestashop>payment-error_643d39ddaaa9572171348cbed25b7dee'] = 'ERREUR DE PAIEMENT '; $_MODULE['<{clearpay}prestashop>payment-error_45ced5829069c3dfcccc5f9c4bb768c6'] = 'Nous sommes navrés de vous informer qu\'une erreur s\'est produite lors du traitement de votre paiement.'; -$_MODULE['<{clearpay}prestashop>payment-error_3439ef7349199d9a75a39c2a82ee6a69'] = 'Nous vous remercions d\'avoir confirmé votre paiement. Cependant, votre panier ayant été actualisé, nous avons besoin d\'une nouvelle confirmation de paiement. Poursuivez sur Clearpay et réessayez dans quelques minutes.'; -$_MODULE['<{clearpay}prestashop>payment-error_f1502472558e889a4e8b7d3d9215f0ae'] = 'Pour plus d\'informations, merci de contacter le service-client de Clearpay :'; -$_MODULE['<{clearpay}prestashop>payment-error_8d6d05253cb3b81eb272a5a36769e5c2'] = 'https://clearpay-europe.readme.io/docs/customer-support'; +$_MODULE['<{clearpay}prestashop>payment-error_8d6d05253cb3b81eb272a5a36769e5c2'] = 'https://developers.clearpay.com/docs/customer-support'; $_MODULE['<{clearpay}prestashop>payment-return_b4c2efa5d2e4f7b7145d5ec06c0895f6'] = 'Génial, vous avez terminé votre achat, vous pouvez continuer à acheter ou revenir à vos commandes.'; diff --git a/translations/it.php b/translations/it.php index 0b8930d..835adf8 100644 --- a/translations/it.php +++ b/translations/it.php @@ -2,29 +2,26 @@ global $_MODULE; $_MODULE = array(); +$_MODULE['<{clearpay}prestashop>clearpay_98ac515fe72346b4b50e29401c2b3849'] = 'Clearpay'; $_MODULE['<{clearpay}prestashop>clearpay_e7e35f48cbce0859d908c6b61eafe05b'] = 'Clearpay Payment Gateway'; -$_MODULE['<{clearpay}prestashop>clearpay_2a7b59da56de0531430d25536e9eb49e'] = 'Acquista ora, paga più tardi - 4 rate, sempre a interessi zero. Raggiungi nuovi clienti, aumenta il tasso di conversione e il ticket medio, incrementa il'; -$_MODULE['<{clearpay}prestashop>clearpay_910cfd506ed458d25b19f76dc940e0f2'] = ' tasso di ripetitività di acquisto dei tuoi clienti offrendo loro la possibilità di pagare a rate,'; -$_MODULE['<{clearpay}prestashop>clearpay_7194b53cf45110b8206f55295994d868'] = ' sempre a interessi zero.'; +$_MODULE['<{clearpay}prestashop>clearpay_e29ce4b7c04f7fc98f1bfe66e0bd1daf'] = 'Acquista ora, paga più tardi - 4 rate, sempre a interessi zero. Raggiungi nuovi clienti,'; +$_MODULE['<{clearpay}prestashop>clearpay_689451a96ac8f98fc7d35fb2971c8c86'] = ' aumenta il tasso di conversione e il ticket medio, incrementa il tasso di ripetitività di acquisto dei tuoi clienti offrendo loro la possibilità'; +$_MODULE['<{clearpay}prestashop>clearpay_bf556a495a6d99f008fcf01ae7178134'] = ' di pagare a rate, sempre a interessi zero.'; $_MODULE['<{clearpay}prestashop>clearpay_92d4773a9f32fc3333cb8238471cf763'] = 'Devi abilitare l\'estensione cURL sul tuo server per installare questo modulo'; $_MODULE['<{clearpay}prestashop>clearpay_5984afe5af3bc7d4a01ba1d722c00a38'] = 'La versione PHP successiva alla 5.3.0 non è supportata'; -$_MODULE['<{clearpay}prestashop>clearpay_8a04b447fe7942b43631e4bfe52b9026'] = 'O 4 pagamenti senza alcun costo da'; -$_MODULE['<{clearpay}prestashop>clearpay_23a58bf9274bedb19375e527a0744fa9'] = 'con'; +$_MODULE['<{clearpay}prestashop>clearpay_8a04b447fe7942b43631e4bfe52b9026'] = 'O 4 pagamenti da'; +$_MODULE['<{clearpay}prestashop>clearpay_23a58bf9274bedb19375e527a0744fa9'] = ' senza interessi con'; $_MODULE['<{clearpay}prestashop>clearpay_d1acd9ba7f1857100ab8a99b2632fb78'] = '4 pagamenti senza alcun costo da'; -$_MODULE['<{clearpay}prestashop>clearpay_3491d10fe34b32b435ef500927c76ac9'] = 'Sempre a interessi zero.'; -$_MODULE['<{clearpay}prestashop>clearpay_020707fabdcc35960c2b5daf8793fcb8'] = ' Nessun documento. Risposta immediata.'; -$_MODULE['<{clearpay}prestashop>clearpay_e104159863b26bfba1985c9560c37bff'] = 'Verrai reindirizzato alla piattaforma Clearpay per completare il modulo con le informazioni relative al pagamento.'; -$_MODULE['<{clearpay}prestashop>clearpay_f77a1168d9447933ed73d0444718fe7c'] = 'Successivamente, verrai reindirizzato al nostro sito web per completare il tuo acquisto. Ricorda:'; -$_MODULE['<{clearpay}prestashop>clearpay_f7092887404b3d677e618d93f1af6d2a'] = 'Clearpay può essere utilizzato come metodo di pagamento solo per gli acquisti con indirizzo di spedizione'; -$_MODULE['<{clearpay}prestashop>clearpay_6d3b446036b038238a3bad3b78d9b778'] = 'e fatturazione in Italia.'; +$_MODULE['<{clearpay}prestashop>clearpay_dda982da36845de9d4d9e839d796b02b'] = 'Verrai reindirizzato alla piattaforma Clearpay per completare il modulo con le informazioni relative al pagamento.'; $_MODULE['<{clearpay}prestashop>clearpay_829f96defc7c51f96edf84b190ab864a'] = 'Termini e Condizioni'; $_MODULE['<{clearpay}prestashop>clearpay_b5ae6cf49ae0a5bad90d427422424f17'] = 'https://www.clearpay.com/it/terms/'; +$_MODULE['<{clearpay}prestashop>clearpay_71948aa4f6e12cdaa5e2e63a5eb8f142'] = '_hide_'; $_MODULE['<{clearpay}prestashop>clearpay_253c609d642a8362c15b03bb808a7974'] = 'Il modulo è abilitato'; $_MODULE['<{clearpay}prestashop>clearpay_93cba07454f06a4a960172bbd6e2a435'] = 'Sì'; $_MODULE['<{clearpay}prestashop>clearpay_bafd7322c6e97d25b6299b5d6fe8920b'] = 'No'; -$_MODULE['<{clearpay}prestashop>clearpay_d76382dc9eac5a174bf648bb80f03b3d'] = 'Regione API'; $_MODULE['<{clearpay}prestashop>clearpay_912d59cdf1d3f551fae21f6f0062258f'] = 'Europa'; $_MODULE['<{clearpay}prestashop>clearpay_89f9c9f489be2a83cf57e53b9197d288'] = 'Regno Unito'; +$_MODULE['<{clearpay}prestashop>clearpay_d76382dc9eac5a174bf648bb80f03b3d'] = 'Regione API'; $_MODULE['<{clearpay}prestashop>clearpay_cb6d90975bcc4efd322d55d1cac9d97b'] = 'ex: 400101010'; $_MODULE['<{clearpay}prestashop>clearpay_9ca9046c6da2b6c5c84b069bfb089e45'] = 'ID Commerciante'; $_MODULE['<{clearpay}prestashop>clearpay_7d0c843509c6c86df93087c8ba889278'] = '128 codice alfanumerico'; @@ -37,12 +34,24 @@ $_MODULE['<{clearpay}prestashop>clearpay_397e921a4cf947e34e59c6994d721004'] = 'es:800'; $_MODULE['<{clearpay}prestashop>clearpay_038d292cb9ee99b8049a345e4765206f'] = 'Limite massimo di pagamento'; $_MODULE['<{clearpay}prestashop>clearpay_b7ad6b8653eabcb10ec33b9273b920c7'] = 'Categorie limitate'; +$_MODULE['<{clearpay}prestashop>clearpay_21c7441ed0601019590fd546327a3bbe'] = 'IMPORTANTE: abilita solo le categorie in cui NON vuoi mostrare Clearpay.'; +$_MODULE['<{clearpay}prestashop>clearpay_2918aea5b06929f5aefaadfd5752693b'] = 'Per impostazione predefinita: deseleziona tutto'; +$_MODULE['<{clearpay}prestashop>clearpay_025831e1d00dbece4a25c01015d131ab'] = 'Il valore predefinito è \'default\'.'; +$_MODULE['<{clearpay}prestashop>clearpay_cfd00dbc208a6bd6f404334723c5db93'] = 'Questa proprietà imposta il selettore CSS necessario per mostrare le risorse sulla pagina del prodotto.'; +$_MODULE['<{clearpay}prestashop>clearpay_f899cc1ba84847c04afe08fad606b87d'] = 'Modificare questo valore solo se non viene visualizzato correttamente.'; +$_MODULE['<{clearpay}prestashop>clearpay_d44cf5598860527b93814eb2e3300d67'] = 'Selettore CSS pagina prodotto'; +$_MODULE['<{clearpay}prestashop>clearpay_a9077b2151352603b83709aebc754aa5'] = 'Questa proprietà imposta il selettore CSS necessario per mostrare le risorse nella pagina del carrello.'; +$_MODULE['<{clearpay}prestashop>clearpay_32c828e32ca51b952ca6f10745fa9982'] = 'Selettore CSS pagina carrello'; +$_MODULE['<{clearpay}prestashop>clearpay_ec3028a12402ab7f43962a6f3a667b6e'] = 'Modalità di debug'; +$_MODULE['<{clearpay}prestashop>clearpay_0b413e146adf4ce9936cc72858385237'] = 'Puoi vedere questi log nella sezione \'Configura -> Parametri avanzati -> Log\''; +$_MODULE['<{clearpay}prestashop>clearpay_8c9dd8097105094f866db128937f168d'] = 'Attiva i registri di debug'; $_MODULE['<{clearpay}prestashop>clearpay_f4f70727dc34561dfde1a3c529b6205c'] = 'Impostazioni'; $_MODULE['<{clearpay}prestashop>clearpay_c9cc8cce247e49bae79f15173ce97354'] = 'Salva'; $_MODULE['<{clearpay}prestashop>clearpay_630f6dc397fe74e52d5189e2c80f282b'] = 'Torna alla lista'; $_MODULE['<{clearpay}prestashop>clearpay_4723b04f6feabc299bb92f04a9a71bbf'] = 'L\'ID commerciante e la chiave segreta sono campi obbligatori'; $_MODULE['<{clearpay}prestashop>clearpay_a7139ef55f3c52d2de726ec1bab7d5e8'] = 'Tutte le modifiche sono state salvate'; -$_MODULE['<{clearpay}prestashop>clearpay_7dd615c475f4185cf30e57922d19cd8b'] = 'La richiesta di configurazione non può essere eseguita con la regione e le credenziali fornite.'; +$_MODULE['<{clearpay}prestashop>clearpay_44302c3ae2ab12cee13c614417feaed9'] = 'La richiesta di configurazione non può essere eseguita con la regione e le credenziali'; +$_MODULE['<{clearpay}prestashop>clearpay_0b0a3e47a9223842cc166517c92d3764'] = ' fornito. Messaggio ricevuto:'; $_MODULE['<{clearpay}prestashop>clearpay_11ac9d0dc138307ce703233c432610af'] = 'Si è verificato un errore durante il recupero della configurazione da'; $_MODULE['<{clearpay}prestashop>clearpay_f4be59c537cc3b780ad313c7828e5498'] = 'Pannello di configurazione Clearpay'; $_MODULE['<{clearpay}prestashop>clearpay_02d4482d332e1aef3437cd61c9bcc624'] = 'Contattaci'; @@ -56,28 +65,25 @@ $_MODULE['<{clearpay}prestashop>clearpay_361967d38d6dd34cc653ee337ec87b4a'] = ' clicca sul seguente link per integrare Clearpay.'; $_MODULE['<{clearpay}prestashop>clearpay_1f1c6e7dcfe28bd070a91a587e3f9acb'] = ' con Clearpay'; $_MODULE['<{clearpay}prestashop>clearpay_d3076b71ec8d810de3424e4faa089933'] = 'Risposta immediata - 4 pagamenti senza alcun costo da'; +$_MODULE['<{clearpay}prestashop>clearpay_f6af67905bf57e1665f2f20bafb55e2d'] = 'Verrai reindirizzato alla piattaforma Clearpay per completare il modulo con le informazioni relative al pagamento. Successivamente, verrai reindirizzato al nostro sito web per completare il tuo acquisto. Ricorda: Clearpay può essere utilizzato come metodo di pagamento solo per gli acquisti con indirizzo di spedizione e fatturazione in Italia.'; $_MODULE['<{clearpay}prestashop>clearpay_b3b5419fab79330bd4da100076bfc14c'] = 'RICHIEDI MAGGIORI INFORMAZIONNI'; $_MODULE['<{clearpay}prestashop>clearpay_ae5ab5fcf6628d51df510e3b6cf9d3d2'] = 'Acquista ora, paga più tardi. Sempre a interessi zero.'; $_MODULE['<{clearpay}prestashop>clearpay_5a7c0d5e2088ae7ad7d82a9dd24ccbd8'] = 'Con Clearpay puoi acquistare ora e pagare in 4 rate di uguale importo ogni 14 giorni, '; $_MODULE['<{clearpay}prestashop>clearpay_c3ad0b0a2593e4840c191eaa109dfa3b'] = ' sempre a interessi zero. L\'unico requisito è essere residenti in Italia e possedere una carta di credito o di debito. '; $_MODULE['<{clearpay}prestashop>clearpay_89e8cfdffaeb291bbc71af49a705a6da'] = ' Cliccando su \'Paga con Clearpay\' verrai reindirizzato alla piattaforma Clearpay per completare il tuo acquisto.'; -$_MODULE['<{clearpay}prestashop>notify_688ebc3b16d0e0dd2175b14eec35603d'] = 'Impossibile recuperare l\'ordine da Clearpay.'; -$_MODULE['<{clearpay}prestashop>notify_55d530f5cf1bffaff87c30662844654a'] = 'Errore di pagamento acquisizione Clearpay, token ordine:'; -$_MODULE['<{clearpay}prestashop>notify_f8b7b087931a742c0589b78dd1f634c0'] = 'Errore di pagamento dell\'acquisizione Clearpay, il pagamento non è stato elaborato correttamente'; +$_MODULE['<{clearpay}prestashop>clearpay_7036c2fbf0d8039a1af78af1904bcb56'] = 'Ti ringraziamo per aver confermato il pagamento. Tuttavia, poiché il carrello è stato modificato, abbiamo nuovamente'; +$_MODULE['<{clearpay}prestashop>clearpay_fc3ffe22cd6d197ebf784688a38d07d7'] = ' bisogno di una tua conferma. Procedi su Clearpay e riprova fra qualche minuto.'; +$_MODULE['<{clearpay}prestashop>clearpay_f1502472558e889a4e8b7d3d9215f0ae'] = 'Per ulteriori informazioni, contatta il Servizio Clienti Clearpay al seguente indirizzo:'; +$_MODULE['<{clearpay}prestashop>clearpay_834771123e3b0f8abb1a27ae06a7f83e'] = 'Siamo spiacenti di comunicarti che il tuo pagamento è stato rifiutato da Clearpay.'; +$_MODULE['<{clearpay}prestashop>notify_2b1563550dabe1eae8162bc16d8fd1a9'] = 'Impossibile recuperare l\'ordine da'; $_MODULE['<{clearpay}prestashop>payment_483cb038032a2aa03302d43b727c52af'] = '. Codice di stato:'; $_MODULE['<{clearpay}prestashop>payment_9b4b36239f45f5e838e126b7d6f77cbe'] = 'Errore ricevuto durante il tentativo di creare un ordine:'; $_MODULE['<{clearpay}prestashop>config-info_b3487ccef58efa1f9f510347f85210a2'] = 'https://www.clearpay.com/it/prestashop/?utm_source=prestashop&utm_medium=referral&utm_campaign=global_prestashop-lead-referrals_campaign&utm_content=contact-us'; $_MODULE['<{clearpay}prestashop>config-info_9d59871f213a2363b6fa87c96e20d6f8'] = 'https://developers.clearpay.com/docs/getting-started-with-clearpay-online'; -$_MODULE['<{clearpay}prestashop>payment-15_830a4bb0255e273df5154612248fe7d1'] = 'Sicuro di voler partire?'; -$_MODULE['<{clearpay}prestashop>payment-17_830a4bb0255e273df5154612248fe7d1'] = 'Sicuro di voler partire?'; $_MODULE['<{clearpay}prestashop>payment-declined_cf63759a63d47726c82e95a896e169fa'] = 'PAGAMENTO RIFIUTATO'; -$_MODULE['<{clearpay}prestashop>payment-declined_834771123e3b0f8abb1a27ae06a7f83e'] = 'Siamo spiacenti di comunicarti che il tuo pagamento è stato rifiutato da Clearpay.'; -$_MODULE['<{clearpay}prestashop>payment-declined_f1502472558e889a4e8b7d3d9215f0ae'] = 'Per ulteriori informazioni, contatta il Servizio Clienti Cleapay:'; -$_MODULE['<{clearpay}prestashop>payment-declined_8d6d05253cb3b81eb272a5a36769e5c2'] = 'https://clearpay-europe.readme.io/docs/customer-support'; +$_MODULE['<{clearpay}prestashop>payment-declined_8d6d05253cb3b81eb272a5a36769e5c2'] = 'https://developers.clearpay.com/docs/customer-support'; $_MODULE['<{clearpay}prestashop>payment-declined_2272656fd21debb386cda29888825f75'] = 'L\'ID ordine di questa transazione da comunicare al Servizio Clienti Clearpay é:'; $_MODULE['<{clearpay}prestashop>payment-error_643d39ddaaa9572171348cbed25b7dee'] = 'ERRORE NEL PAGAMENTO'; $_MODULE['<{clearpay}prestashop>payment-error_45ced5829069c3dfcccc5f9c4bb768c6'] = 'Siamo spiacenti di comunicarti che si è verificato un errore durante l\'elaborazione del pagamento.'; -$_MODULE['<{clearpay}prestashop>payment-error_3439ef7349199d9a75a39c2a82ee6a69'] = 'Ti ringraziamo per aver confermato il pagamento. Tuttavia, poiché il carrello è stato modificato, abbiamo nuovamente bisogno di una tua conferma. Procedi su Clearpay e riprova fra qualche minuto.'; -$_MODULE['<{clearpay}prestashop>payment-error_f1502472558e889a4e8b7d3d9215f0ae'] = 'Per ulteriori informazioni, contatta il Servizio Clienti Clearpay al seguente indirizzo:'; -$_MODULE['<{clearpay}prestashop>payment-error_8d6d05253cb3b81eb272a5a36769e5c2'] = 'https://clearpay-europe.readme.io/docs/customer-support'; +$_MODULE['<{clearpay}prestashop>payment-error_8d6d05253cb3b81eb272a5a36769e5c2'] = 'https://developers.clearpay.com/docs/customer-support'; $_MODULE['<{clearpay}prestashop>payment-return_b4c2efa5d2e4f7b7145d5ec06c0895f6'] = 'Ottimo, hai completato l\'acquisto, puoi continuare a comprare o tornare ai tuoi ordini.'; diff --git a/views/img/app_icon.png b/views/img/app_icon.png deleted file mode 100644 index 2a43144..0000000 Binary files a/views/img/app_icon.png and /dev/null differ diff --git a/views/img/logo.png b/views/img/logo.png deleted file mode 100644 index 609f879..0000000 Binary files a/views/img/logo.png and /dev/null differ diff --git a/views/img/logo_opc.png b/views/img/logo_opc.png index 30b5b9a..656b6e3 100644 Binary files a/views/img/logo_opc.png and b/views/img/logo_opc.png differ diff --git a/views/templates/front/index.php b/views/templates/front/index.php deleted file mode 100644 index 5579072..0000000 --- a/views/templates/front/index.php +++ /dev/null @@ -1,35 +0,0 @@ - -* @copyright 2007-2016 PrestaShop SA -* @version Release: $Revision$ -* @license http://opensource.org/licenses/osl-3.0.php Open Software License (OSL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); -header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); - -header("Cache-Control: no-store, no-cache, must-revalidate"); -header("Cache-Control: post-check=0, pre-check=0", false); -header("Pragma: no-cache"); - -header("Location: ../"); diff --git a/views/templates/front/payment-15.tpl b/views/templates/front/payment-15.tpl deleted file mode 100644 index 8152f57..0000000 --- a/views/templates/front/payment-15.tpl +++ /dev/null @@ -1,26 +0,0 @@ -{* - * This file is part of the official Clearpay module for PrestaShop. - * - * @author Clearpay - * @copyright 2020 Clearpay - * @license proprietary - *} - \ No newline at end of file diff --git a/views/templates/front/payment-17.tpl b/views/templates/front/payment-17.tpl deleted file mode 100644 index d8039b0..0000000 --- a/views/templates/front/payment-17.tpl +++ /dev/null @@ -1,30 +0,0 @@ -{* - * This file is part of the official Clearpay module for PrestaShop. - * - * @author Clearpay - * @copyright 2020 Clearpay - * @license proprietary - *} - -{extends file='page.tpl'} -{block name="page_content"} - -{/block} \ No newline at end of file diff --git a/views/templates/hook/checkout.tpl b/views/templates/hook/checkout.tpl index 1008b93..c32e928 100755 --- a/views/templates/hook/checkout.tpl +++ b/views/templates/hook/checkout.tpl @@ -1,136 +1,219 @@ {* - * This file is part of the official Clearpay module for PrestaShop. + * This file is part of the official Afterpay module for PrestaShop. * - * @author Clearpay - * @copyright 2020 Clearpay + * @author Afterpay + * @copyright 2020 Afterpay * @license proprietary *} {if $PS_VERSION !== '1-7'} {/if} {if $PS_VERSION === '1-7'} -
-
-
-
-
- -
-
- {$MORE_HEADER1|escape:'htmlall':'UTF-8'} -
-
- {$MORE_HEADER2|escape:'htmlall':'UTF-8'} -
-
-
-
- {$MOREINFO_ONE|escape:'htmlall':'UTF-8'} -
- - - - {$TERMS_AND_CONDITIONS|escape:'htmlall':'UTF-8'} - -
-
-
-
+
+
+
+
+
+
+
+ +
+
+
+
+
+

{$DESCRIPTION|escape:'htmlall':'UTF-8'}

+
+
+ + +
+
+ {if $ISO_COUNTRY_CODE == 'es_ES' } + + {$TERMS_AND_CONDITIONS|escape:'htmlall':'UTF-8'} + + {if $IS_MOBILE_LAYOUT == "0"} +  |  + {else} +  -  + {/if} + + {$MORE_INFO_TEXT|escape:'htmlall':'UTF-8'} + + + {else} + + {$TERMS_AND_CONDITIONS|escape:'htmlall':'UTF-8'} + + {/if} +
+
+
+
+
+
{/if} \ No newline at end of file diff --git a/views/templates/hook/onepagecheckout.tpl b/views/templates/hook/onepagecheckout.tpl index 2e71270..62878a1 100755 --- a/views/templates/hook/onepagecheckout.tpl +++ b/views/templates/hook/onepagecheckout.tpl @@ -1,3 +1,10 @@ +{* + * This file is part of the official Afterpay module for PrestaShop. + * + * @author Afterpay + * @copyright 2020 Afterpay + * @license proprietary + *} {if $PS_VERSION !== '1-7'} @@ -123,43 +214,61 @@

{$TITLE|escape:'htmlall':'UTF-8'} - + + {$LOGO_TEXT|escape:'htmlall':'UTF-8'}

{/if} {if $PS_VERSION === '1-7'} -
-
-
-
-
- -
-
- {$MORE_HEADER1|escape:'htmlall':'UTF-8'} -
-
- {$MORE_HEADER2|escape:'htmlall':'UTF-8'} +
+
+
+
+
+
+
+ +
+
+
+
+
+

{$DESCRIPTION|escape:'htmlall':'UTF-8'}

+
+
+ + +
+
+ {if $ISO_COUNTRY_CODE == 'es_ES' } + + {$TERMS_AND_CONDITIONS|escape:'htmlall':'UTF-8'} + + {if $IS_MOBILE_LAYOUT == "0"} +  |  + {else} +  -  + {/if} + + {$MORE_INFO_TEXT|escape:'htmlall':'UTF-8'} + + {else} + + {$TERMS_AND_CONDITIONS|escape:'htmlall':'UTF-8'} + + {/if} +
+
-
-
- {$MOREINFO_ONE|escape:'htmlall':'UTF-8'} -
- - - - {$TERMS_AND_CONDITIONS|escape:'htmlall':'UTF-8'} - -
-
-
-{/if} + +{/if} \ No newline at end of file diff --git a/views/templates/hook/payment-declined.tpl b/views/templates/hook/payment-declined.tpl index 217dcbe..18b0360 100644 --- a/views/templates/hook/payment-declined.tpl +++ b/views/templates/hook/payment-declined.tpl @@ -31,9 +31,9 @@ {l s='PAYMENT DECLINED' mod='clearpay'}