Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

V1.13 #438

Open
wants to merge 68 commits into
base: master
Choose a base branch
from
Open

V1.13 #438

Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
68 commits
Select commit Hold shift + click to select a range
f49fac1
Automatically set isCheckoutCart to true for modal (#400) (#404)
mbouchotoyst Jun 12, 2018
b13eab4
Refactoring medium impact (#386)
mbouchotoyst Jun 11, 2018
d8578f6
Restore permissions on files
mbouchotoyst Jun 12, 2018
dccb2d3
Travis deploy auto packing (#175)
mehdichaouch Jun 12, 2018
d8ed929
Fix internal errors
mehdichaouch Jun 19, 2018
1026db0
Prepare hooks for module compliance (#409)
mbouchotoyst Jun 19, 2018
f5ca06c
Set real order id in session after success
mbouchotoyst Jun 20, 2018
7213cb5
Product custom options (#121) (#222) (#117)
mehdichaouch Jun 22, 2018
abac1b5
Prefill form (#408)
mehdichaouch Jun 25, 2018
959f03c
Implements compliance for virtual quote (#220)
mehdichaouch Jun 25, 2018
fa5ca90
Change disable attribute on product (#164)
mehdichaouch Jun 26, 2018
11e287d
Implements compliance for bundle product (#360)
mehdichaouch Jun 26, 2018
fc0f214
Delete the stock management (#420)
mehdichaouch Jun 26, 2018
f3cb2cf
Update README.md with information on how to build package in local
mehdichaouch Jun 28, 2018
711110f
Compliance with catalog rules and sync quote items in cart estimate (…
mbouchotoyst Jun 25, 2018
369ca3c
Fix issue where final price calculation was not associated to the cus…
mbouchotoyst Jun 8, 2018
7c33223
Remove modal url and add preload (#400)
mehdichaouch Jun 29, 2018
6441662
Fix issue with file product custom options (#428)
mbouchotoyst Jul 2, 2018
bd864b8
Fix issue with free product price to zero
mbouchotoyst Jul 2, 2018
f0a03b7
Fix issue with free product price to zero
mbouchotoyst Jul 2, 2018
0df7891
Remove unused log
mbouchotoyst Jul 3, 2018
11c5570
Remove dead code
mbouchotoyst Jul 3, 2018
953143a
Fix issue related misbehaviour of Element.select native prototype and…
mbouchotoyst Jul 16, 2018
e68639c
Add sticky button for new ux (#431) (#432)
mbouchotoyst Jul 19, 2018
b8ec8de
Skip shipment when cart is not materialized (#430) (#433)
mbouchotoyst Jul 19, 2018
53fcf91
Fix issue if shipping method requested by oyst oneclick is not availa…
mbouchotoyst Jul 19, 2018
d0961db
Removal of patch for new ux
mbouchotoyst Jul 19, 2018
ce48f5c
moving customer creation in order creation part 1 (#434) (#435)
mbouchotoyst Jul 25, 2018
d96d91d
Change behaviour for sending configurable and custom attributes data …
mbouchotoyst Jul 25, 2018
b6b5742
Add logs in notification controller and take in consideration ORDER C…
mbouchotoyst Jul 26, 2018
a69ed4d
Fix internal errors
mbouchotoyst Jul 30, 2018
dccd177
Add image for free item product
mbouchotoyst Jul 31, 2018
8454561
remove travis deploy (#437)
mbouchotoyst Aug 1, 2018
65bc22d
fix internal error
mbouchotoyst Aug 1, 2018
06d635c
Fix travis reporting errors
mbouchotoyst Aug 1, 2018
7f1376a
Remove useless foreign key constraint
mbouchotoyst Aug 7, 2018
8556561
Implements basic oyst tracking
mbouchotoyst Aug 7, 2018
6c16d9e
Add error oyst log file
mbouchotoyst Aug 8, 2018
72e31be
add data for tracking
mbouchotoyst Aug 10, 2018
bf1be36
Add fix for shipments
mbouchotoyst Aug 20, 2018
f12173c
Handle order status fr payment accepted or fraud (#439)
mbouchotoyst Aug 22, 2018
884c990
Change handling collect shipping method from oyst notification
mbouchotoyst Aug 22, 2018
bdf2934
Fix issue related to shipments
mbouchotoyst Aug 27, 2018
ef01c40
Fix issue with shipments discounts
mbouchotoyst Sep 4, 2018
2d095a5
Update version
mbouchotoyst Sep 4, 2018
074e914
Fix issue due to new api uris
mbouchotoyst Sep 21, 2018
68ecf6f
Fix issue MAG-10 and issue with guest orders
mbouchotoyst Nov 12, 2018
353c145
Update version
mbouchotoyst Nov 12, 2018
c422165
Remove the control on delay fields
mbouchotoyst Nov 14, 2018
4556f1e
Fix issue MAG-17 and update version
mbouchotoyst Nov 15, 2018
45b4b00
Update version for Fix issue MAG-5 due to APi uris changes
mbouchotoyst Nov 19, 2018
a1f7c40
Fix issue where order can be passed as guest
mbouchotoyst Nov 20, 2018
4594341
Fix issue MAG-18
mbouchotoyst Nov 21, 2018
6693fdb
Remove order createAt as quote createdAt legacy
mbouchotoyst Nov 21, 2018
b80e13e
Fix issue MAG 20
mbouchotoyst Nov 23, 2018
c83aebc
Update version for JIRA 21
mbouchotoyst Nov 28, 2018
61b928e
Fix issue MAG 28 by allowing force button display
mbouchotoyst Dec 13, 2018
0345416
Fix issue MAG 29 et MAG 16
mbouchotoyst Dec 13, 2018
3d4578d
Remove of tracking tkr
mbouchotoyst Dec 13, 2018
bd3f374
Remove of check about country state in notification process
mbouchotoyst Dec 13, 2018
0810002
Optimize quote errors handling
mbouchotoyst Dec 14, 2018
2a4b590
Fix issue : add address validation in oyst checkout workflow
mbouchotoyst Dec 21, 2018
f277dbd
Delegate customer is guest handling on save order
mbouchotoyst Jan 4, 2019
d768dab
Issue MAG 21 for old oyst modules versions
mbouchotoyst Jan 4, 2019
3d553eb
Update version
mbouchotoyst Jan 4, 2019
8bb7677
Update version
mbouchotoyst Jan 4, 2019
7bbeb75
Refactoring for set properly tracker parameters
mbouchotoyst Feb 20, 2019
2e36cd5
Add possibility to review payment deny payment is offline
mbouchotoyst Mar 26, 2019
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 1 addition & 2 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ env:
global:
- MAGENTO_DB_ALLOWSAME=1
- SKIP_CLEANUP=1
- TEST_BASEDIR=.modman/oyst-magento/app/code/community/Oyst/Oyst/Test
matrix:
- MAGENTO_VERSION="magento-mirror-1.6.2.0"
- MAGENTO_VERSION="magento-mirror-1.7.0.2"
Expand All @@ -67,7 +66,7 @@ install:

script:
- mkdir -p build/logs
- curl --retry 2 --retry-delay 5 -H "Authorization":"token $GITHUB_TOKEN" -f -sSL https://raw.githubusercontent.com/mehdichaouch/MageTestStand/master/setup.sh | bash
- curl --retry 2 --retry-delay 5 -H "Authorization":"token $GITHUB_TOKEN" -f -sSL https://raw.githubusercontent.com/AOEpeople/MageTestStand//master/setup.sh | bash
## PHP CodeSniffer disable error on exit
- vendor/bin/phpcs --config-set ignore_warnings_on_exit 1
## PHP Copy/Paste Detector
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Oyst 1-Click plugin for Magento

[![Build Status](https://travis-ci.org/oystparis/oyst-1click-magento.svg?branch=master)](https://travis-ci.org/oystparis/oyst-1click-magento)
[![Latest Stable Version](https://img.shields.io/badge/latest-1.12.0-green.svg)](https://github.com/oystparis/oyst-1click-magento/releases)
[![Latest Stable Version](https://img.shields.io/badge/latest-1.13.0-green.svg)](https://github.com/oystparis/oyst-1click-magento/releases/latest)
[![Magento = 1.7.x.x](https://img.shields.io/badge/magento-1.7-blue.svg)](#)
[![Magento = 1.8.x.x](https://img.shields.io/badge/magento-1.8-blue.svg)](#)
[![Magento = 1.9.x.x](https://img.shields.io/badge/magento-1.9-blue.svg)](#)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ class Oyst_OneClick_Block_Adminhtml_Field_LogActions extends Mage_Adminhtml_Bloc
*/
public function __construct(array $args = array())
{
$this->_logFiles = array('system.log', 'exception.log', Oyst_OneClick_Helper_Data::MODULE_NAME . '.log');
$this->_logFiles = array('system.log', 'exception.log', Oyst_OneClick_Helper_Data::MODULE_NAME . '.log', 'error_oyst.log');
parent::__construct($args);
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -30,22 +30,26 @@ class Oyst_OneClick_Block_Adminhtml_System_Config_Form_Fieldset_Carrier_Mapping
*/
public function render(Varien_Data_Form_Element_Abstract $element)
{
$html = $this->_getHeaderHtml($element);
$val = $this->getAllCarrierCode();
if (isset($val) && !empty($val)) {
foreach ($val as $v) {
if (false !== strpos($v['value'], '_about')) {
continue;
}
try {
$html = $this->_getHeaderHtml($element);
$val = $this->getAllCarrierCode();
if (isset($val) && !empty($val)) {
foreach ($val as $v) {
if (false !== strpos($v['value'], '_about')) {
continue;
}

$html .= $this->getHeadingFieldHtml($element, $v);
$html .= $this->getMappingFieldHtml($element, $v);
$html .= $this->getDelayFieldHtml($element, $v);
$html .= $this->getNameFieldHtml($element, $v);
$html .= $this->getHeadingFieldHtml($element, $v);
$html .= $this->getMappingFieldHtml($element, $v);
$html .= $this->getDelayFieldHtml($element, $v);
$html .= $this->getNameFieldHtml($element, $v);
}
}
}

$html .= $this->_getFooterHtml($element);
$html .= $this->_getFooterHtml($element);
} catch (Exception $e) {
$html = '';
}

return $html;
}
Expand Down Expand Up @@ -185,7 +189,7 @@ protected function getDelayFieldHtml($fieldset, $group)
'default' => 1,
'inherit' => $inherit,
'value' => $data,
'class' => 'validate-number validate-oyst-shipment-delay',
//'class' => 'validate-number validate-oyst-shipment-delay',
'comment' => Mage::helper('oyst_oneclick')->__('Value in hours'),
'can_use_default_value' => $this->getForm()->canUseDefaultValue($e),
'can_use_website_value' => $this->getForm()->canUseWebsiteValue($e),
Expand Down
83 changes: 83 additions & 0 deletions app/code/community/Oyst/OneClick/Block/Checkout/Tracking.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,83 @@
<?php
/**
* This file is part of Oyst_OneClick for Magento.
*
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @author Oyst <plugin@oyst.com> <@oyst>
* @category Oyst
* @package Oyst_OneClick
* @copyright Copyright (c) 2017 Oyst (http://www.oyst.com)
*/

/**
* Checkout Tracking Block
*/
class Oyst_OneClick_Block_Checkout_Tracking extends Mage_Core_Block_Abstract
{
protected $_order;

protected function _toHtml()
{
if (!$this->getOrder()->getId()) {
return '';
}

return '<img src="'.$this->getTrackerBaseUrl().'?'.$this->getParameters().'&'.$this->getExtraParameters().'"/>';
}

protected function getOrder()
{
if (!isset($this->_order)) {
$this->_order = Mage::getModel('sales/order')->load(Mage::getSingleton('checkout/session')->getLastOrderId());
}

return $this->_order;
}

protected function getTrackerBaseUrl()
{
$isCustomEnvProd = Mage::getStoreConfig('oyst/oneclick/mode') == 'custom';

foreach(array('staging', 'sandbox', 'test') as $env) {
if (strpos(Mage::getStoreConfig('oyst/oneclick/api_url'), $env) !== false) {
$isCustomEnvProd = false;
break;
}
}

if (Mage::getStoreConfig('oyst/oneclick/mode') == 'prod' || $isCustomEnvProd) {
return 'https://tkr.11rupt.io/';
} else {
return 'https://staging-tkr.11rupt.eu/';
}
}

protected function getExtraParameters()
{
$extraParameters = array(
'extra_parameters[amount]='.$this->getOrder()->getGrandTotal(),
'extra_parameters[paymentMethod]='.$this->getOrder()->getPayment()->getMethod(),
'extra_parameters[currency]='.$this->getOrder()->getOrderCurrencyCode(),
'extra_parameters[referrer]='.urlencode(Mage::helper('core/url')->getCurrentUrl()),
'extra_parameters[userEmail]='.urlencode($this->getOrder()->getCustomerEmail()),
'extra_parameters[orderId]='.$this->getOrder()->getIncrementId(),
);

if ($this->getOrder()->getCustomerId()) {
$extraParameters['extra_parameters[userId]'] = $this->getOrder()->getCustomerId();
}

return implode('&', $extraParameters);
}

protected function getParameters()
{
$parameters = array(
'version=1',
'type=track',
'event=Confirmation%20Displayed'
);

return implode('&', $parameters);
}
}
22 changes: 7 additions & 15 deletions app/code/community/Oyst/OneClick/Block/OneClick.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,8 +40,11 @@ public function isButtonEnabled()
return false;
}

// TODO Change code attribute to avoid confusions
if ($this->getProduct()->getIsOneclickActiveOnProduct()) {
if (Mage::getStoreConfig('oyst/oneclick/force_button_display_on_product')) {
return true;
}

if ($this->getProduct()->getIsOneclickDisableOnProduct()) {
return false;
}

Expand Down Expand Up @@ -92,15 +95,15 @@ public function getButtonCustomization($path = '')
{
$buttonCustomization = '';

$genericCustomizationAttributes = array('theme', 'color', 'rounded', 'smart');
$genericCustomizationAttributes = array('theme', 'color', 'rounded', 'smart', 'sticky');

foreach ($genericCustomizationAttributes as $customizationAttribute) {
$config = Mage::getStoreConfig('oyst/oneclick/button_' . $customizationAttribute);
if (empty($config)) {
continue;
}

if (in_array($customizationAttribute, array('rounded', 'smart'))) {
if (in_array($customizationAttribute, array('rounded', 'smart', 'sticky'))) {
$config = filter_var($config, FILTER_VALIDATE_BOOLEAN) ? 'true' : 'false';
}

Expand All @@ -118,17 +121,6 @@ public function getButtonCustomization($path = '')
$buttonCustomization .= sprintf(" data-" . $customizationAttribute . "='%s'", $config);
}

$specificCustomizationAttributes = array('height', 'width');

foreach ($specificCustomizationAttributes as $customizationAttribute) {
$config = Mage::getStoreConfig('oyst/oneclick/' . $path . 'button_' . $customizationAttribute);
if (empty($config)) {
continue;
}

$buttonCustomization .= sprintf(" data-" . $customizationAttribute . "='%s'", $config);
}

return $buttonCustomization;
}

Expand Down
66 changes: 40 additions & 26 deletions app/code/community/Oyst/OneClick/Helper/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,10 @@ class Oyst_OneClick_Helper_Data extends Mage_Core_Helper_Abstract

const XML_PATH_RESTRICT_ALLOW_IPS = 'restrict_allow_ips';

const STATUS_OYST_PAYMENT_ACCEPTED = 'oyst_payment_accepted';

const STATUS_OYST_PAYMENT_FRAUD = 'oyst_payment_fraud';

/**
* Get config from Magento
*
Expand Down Expand Up @@ -56,8 +60,8 @@ public function getModuleVersion()
*/
public function getSdkVersion()
{
/** @var Oyst_OneClick_Model_Api $oystModel */
$oystModel = Mage::getModel('oyst_oneclick/api');
/** @var Oyst_OneClick_Model_ApiWrapper_Client $oystModel */
$oystModel = Mage::getModel('oyst_oneclick/apiWrapper_client');

return $oystModel->getSdkVersion();
}
Expand Down Expand Up @@ -109,8 +113,8 @@ public function setIsInitialized($identifier, $isInitialized = true)
public function isApiKeyValid()
{
try {
/** @var Oyst_OneClick_Model_Api $api */
$api = Mage::getModel('oyst_oneclick/api');
/** @var Oyst_OneClick_Model_ApiWrapper_Client $api */
$api = Mage::getModel('oyst_oneclick/apiWrapper_client');
$api->isApiKeyValid();
} catch (Exception $e) {
/** @var Oyst_OneClick_Helper_Data $oystHelper */
Expand Down Expand Up @@ -185,28 +189,6 @@ public function isPaymentMethodOyst(Mage_Sales_Model_Order $order)
return false !== strpos($order->getPayment()->getMethod(), $freepayPaymentMethod->getCode());
}

/**
* Get metadata string.
*
* @return null|string
*/
public function getTrackingMeta()
{
return '<script src="https://trk.10ru.pt"></script>' . PHP_EOL
. '<meta name="oyst_tracker_info_freepay_activated" content="'
. (int)Mage::getStoreConfigFlag('payment/oyst_freepay/active') . '">' . PHP_EOL
. '<meta name="oyst_tracker_info_freepay_apikey" content="'
. (int)Mage::getStoreConfigFlag('payment/oyst_abstract/api_login') . '">' . PHP_EOL
. '<meta name="oyst_tracker_environnement_freepay" content="'
. Mage::getStoreConfig('payment/oyst_abstract/mode') . '">' . PHP_EOL
. '<meta name="oyst_tracker_info_oneclick_activated" content="'
. (int)Mage::getStoreConfigFlag('oyst/oneclick/enable') . '">' . PHP_EOL
. '<meta name="oyst_tracker_info_oneclick_apikey" content="'
. (int)Mage::getStoreConfigFlag('oyst/oneclick/api_login') . '">' . PHP_EOL
. '<meta name="oyst_tracker_environnement_1click" content="'
. Mage::getStoreConfig('oyst/oneclick/mode') . '">' . PHP_EOL;
}

/**
* Checks for open refund transaction
*
Expand Down Expand Up @@ -284,4 +266,36 @@ public function isIpAllowed($storeId = null)

return $allow;
}

public function handleQuoteErrors(Mage_Sales_Model_Quote $quote)
{
if ($quote->getHasError()) {
$errorMessages = array();
foreach ($quote->getErrors() as $error) {
$errorMessages[] = $error->getCode();
}
throw new Mage_Checkout_Exception(implode('\n', $errorMessages));
}

return $this;
}

public function addQuoteExtraData($quote, $key, $value)
{
$extraData = json_decode($quote->getOystExtraData(), true);

if(empty($extraData)) {
$extraData = array();
}

$extraData[$key] = $value;

$quote->setOystExtraData(json_encode($extraData));
}

public function getSalesObjectExtraData($salesObject, $key)
{
$extraData = json_decode($salesObject->getOystExtraData(), true);
return isset($extraData[$key]) ? $extraData[$key] : null;
}
}
21 changes: 21 additions & 0 deletions app/code/community/Oyst/OneClick/Model/ApiWrapper/AbstractType.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php
/**
* This file is part of Oyst_OneClick for Magento.
*
* @license http://www.apache.org/licenses/LICENSE-2.0 Apache License, Version 2.0
* @author Oyst <plugin@oyst.com> <@oyst>
* @category Oyst
* @package Oyst_OneClick
* @copyright Copyright (c) 2017 Oyst (http://www.oyst.com)
*/

class Oyst_OneClick_Model_ApiWrapper_AbstractType extends Mage_Core_Model_Abstract
{
/** @var Oyst_OneClick_Model_ApiWrapper_Client $_oystClient */
protected $_oystClient;

public function __construct()
{
$this->_oystClient = Mage::getModel('oyst_oneclick/apiWrapper_client');
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -12,13 +12,11 @@
use Oyst\Api\OystApiClientFactory;
use Oyst\Api\OystCatalogApi;
use Oyst\Classes\OystUserAgent;
use Oyst\Api\OystPaymentApi;
use Oyst\Classes\OystPrice;

/**
* API Model
*/
class Oyst_OneClick_Model_Api extends Mage_Core_Model_Abstract
class Oyst_OneClick_Model_ApiWrapper_Client extends Mage_Core_Model_Abstract
{
/*
* API length
Expand Down
Loading