Skip to content

Commit 3db5d79

Browse files
committed
MAGETWO-59661: [Github] PHP7 returns types incompatible with generate code #6106
- Resolved merge conflicts
2 parents e8909c9 + b67cf43 commit 3db5d79

File tree

37 files changed

+1106
-411
lines changed

37 files changed

+1106
-411
lines changed

app/code/Magento/Catalog/Model/ResourceModel/Product/Collection.php

Lines changed: 2 additions & 45 deletions
Original file line numberDiff line numberDiff line change
@@ -1841,55 +1841,12 @@ protected function _productLimitationJoinStore()
18411841
$this->getSelect()->columns('visibility', 'cat_index');
18421842
}
18431843

1844-
$fromPart = $this->getSelect()->getPart(\Magento\Framework\DB\Select::FROM);
1845-
if (!isset($fromPart['store_index'])) {
1846-
$this->getSelect()->joinLeft(
1847-
['store_index' => $this->getTable('store')],
1848-
'store_index.store_id = ' . $filters['store_table'] . '.store_id',
1849-
[]
1850-
);
1851-
}
1852-
if (!isset($fromPart['store_group_index'])) {
1853-
$this->getSelect()->joinLeft(
1854-
['store_group_index' => $this->getTable('store_group')],
1855-
'store_index.group_id = store_group_index.group_id',
1856-
[]
1857-
);
1858-
}
1859-
if (!isset($fromPart['store_cat_index'])) {
1860-
$this->getSelect()->joinLeft(
1861-
['store_cat_index' => $this->categoryProductIndexerFrontend->getMainTable()],
1862-
join(
1863-
' AND ',
1864-
[
1865-
'store_cat_index.product_id = e.entity_id',
1866-
'store_cat_index.store_id = ' . $filters['store_table'] . '.store_id',
1867-
'store_cat_index.category_id=store_group_index.root_category_id'
1868-
]
1869-
),
1870-
['store_visibility' => 'visibility']
1871-
);
1872-
}
18731844
// Avoid column duplication problems
18741845
$this->_resourceHelper->prepareColumnsList($this->getSelect());
18751846

1876-
$whereCond = join(
1877-
' OR ',
1878-
[
1879-
$this->getConnection()->quoteInto('cat_index.visibility IN(?)', $filters['visibility']),
1880-
$this->getConnection()->quoteInto('store_cat_index.visibility IN(?)', $filters['visibility'])
1881-
]
1882-
);
1883-
1847+
$whereCond = $this->getConnection()->quoteInto('cat_index.visibility IN(?)', $filters['visibility']);
18841848
$wherePart = $this->getSelect()->getPart(\Magento\Framework\DB\Select::WHERE);
1885-
$hasCond = false;
1886-
foreach ($wherePart as $cond) {
1887-
if ($cond == '(' . $whereCond . ')') {
1888-
$hasCond = true;
1889-
}
1890-
}
1891-
1892-
if (!$hasCond) {
1849+
if (array_search('(' . $whereCond . ')', $wherePart) === false) {
18931850
$this->getSelect()->where($whereCond);
18941851
}
18951852

app/code/Magento/Checkout/view/frontend/web/js/action/redirect-on-success.js

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,9 +8,10 @@
88
*/
99
define(
1010
[
11-
'mage/url'
11+
'mage/url',
12+
'Magento_Checkout/js/model/full-screen-loader'
1213
],
13-
function (url) {
14+
function (url, fullScreenLoader) {
1415
'use strict';
1516

1617
return {
@@ -20,6 +21,7 @@ define(
2021
* Provide redirect to page
2122
*/
2223
execute: function () {
24+
fullScreenLoader.startLoader();
2325
window.location.replace(url.build(this.redirectUrl));
2426
}
2527
};

app/code/Magento/Payment/view/frontend/web/transparent.js

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,8 +9,9 @@ define([
99
'mage/template',
1010
'Magento_Ui/js/modal/alert',
1111
'jquery/ui',
12-
'Magento_Payment/js/model/credit-card-validation/validator'
13-
], function ($, mageTemplate, alert) {
12+
'Magento_Payment/js/model/credit-card-validation/validator',
13+
'Magento_Checkout/js/model/full-screen-loader'
14+
], function ($, mageTemplate, alert, ui, validator, fullScreenLoader) {
1415
'use strict';
1516

1617
$.widget('mage.transparent', {
@@ -107,8 +108,8 @@ define([
107108
* {Function}
108109
*/
109110
beforeSend: function () {
110-
this.element.trigger('showAjaxLoader');
111-
}.bind(this),
111+
fullScreenLoader.startLoader();
112+
},
112113

113114
/**
114115
* {Function}
@@ -131,6 +132,8 @@ define([
131132
);
132133
this._postPaymentToGateway(preparedData);
133134
} else {
135+
fullScreenLoader.stopLoader(true);
136+
134137
msg = response['error_messages'];
135138

136139
if (this.options.context) {

app/code/Magento/Paypal/Block/Payflow/Advanced/Info.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,14 +3,14 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
namespace Magento\Paypal\Block\Payflow\Advanced;
67

78
/**
8-
* Payflow Advanced infoblock
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
9+
* @deprecated This class should not be used because parent class can handle client calls.
10+
* Class was not removed for backward compatibility.
11+
* @see \Magento\Paypal\Block\Payment\Info
1112
*/
12-
namespace Magento\Paypal\Block\Payflow\Advanced;
13-
1413
class Info extends \Magento\Paypal\Block\Payflow\Link\Info
1514
{
15+
1616
}

app/code/Magento/Paypal/Block/Payflow/Info.php

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,18 @@
55
*/
66
namespace Magento\Paypal\Block\Payflow;
77

8-
use Magento\Paypal\Model;
9-
108
/**
11-
* Payflow payment info
9+
* @deprecated This class should not be used because parent class can handle client calls.
10+
* Class was not removed for backward compatibility.
11+
* @see \Magento\Paypal\Block\Payment\Info
1212
*/
1313
class Info extends \Magento\Paypal\Block\Payment\Info
1414
{
1515
/**
1616
* Don't show CC type
1717
*
1818
* @return false
19+
* @deprecated unused
1920
*/
2021
public function getCcTypeName()
2122
{

app/code/Magento/Paypal/Block/Payflow/Link/Info.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -3,20 +3,20 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
namespace Magento\Paypal\Block\Payflow\Link;
67

78
/**
8-
* Payflow link infoblock
9-
*
10-
* @author Magento Core Team <core@magentocommerce.com>
9+
* @deprecated This class should not be used because parent class can handle client calls.
10+
* Class was not removed for backward compatibility.
11+
* @see \Magento\Paypal\Block\Payment\Info
1112
*/
12-
namespace Magento\Paypal\Block\Payflow\Link;
13-
1413
class Info extends \Magento\Paypal\Block\Payment\Info
1514
{
1615
/**
1716
* Don't show CC type
1817
*
1918
* @return false
19+
* @deprecated unused
2020
*/
2121
public function getCcTypeName()
2222
{

app/code/Magento/Paypal/Model/Payflow/Service/Response/Transaction.php

Lines changed: 19 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -6,14 +6,15 @@
66
namespace Magento\Paypal\Model\Payflow\Service\Response;
77

88
use Magento\Framework\DataObject;
9-
109
use Magento\Payment\Model\Method\Logger;
1110
use Magento\Paypal\Model\Payflow\Service\Response\Handler\HandlerInterface;
1211
use Magento\Framework\Session\Generic;
13-
use Magento\Payment\Model\InfoInterface;
12+
use Magento\Paypal\Model\Payflowpro;
1413
use Magento\Quote\Api\CartRepositoryInterface;
1514
use Magento\Paypal\Model\Payflow\Transparent;
1615
use Magento\Quote\Api\PaymentMethodManagementInterface;
16+
use Magento\Quote\Model\Quote\Payment;
17+
use Magento\Sales\Api\Data\OrderPaymentInterface;
1718

1819
/**
1920
* Class Transaction
@@ -51,8 +52,6 @@ class Transaction
5152
private $logger;
5253

5354
/**
54-
* Constructor
55-
*
5655
* @param Generic $sessionTransparent
5756
* @param CartRepositoryInterface $quoteRepository
5857
* @param Transparent $transparent
@@ -77,36 +76,43 @@ public function __construct(
7776
}
7877

7978
/**
80-
* Returns gateway response data object
79+
* Returns gateway response data object.
8180
*
8281
* @param array $gatewayTransactionResponse
8382
* @return DataObject
8483
*/
8584
public function getResponseObject($gatewayTransactionResponse)
8685
{
8786
$response = new DataObject();
88-
$response = $this->transparent->mapGatewayResponse($gatewayTransactionResponse, $response);
87+
$response = $this->transparent->mapGatewayResponse((array) $gatewayTransactionResponse, $response);
88+
8989
$this->logger->debug(
90-
$gatewayTransactionResponse,
91-
(array)$this->transparent->getDebugReplacePrivateDataKeys(),
92-
(bool)$this->transparent->getDebugFlag()
90+
(array) $gatewayTransactionResponse,
91+
(array) $this->transparent->getDebugReplacePrivateDataKeys(),
92+
(bool) $this->transparent->getDebugFlag()
9393
);
94+
9495
return $response;
9596
}
9697

9798
/**
98-
* Saves payment information in quote
99+
* Saves payment information in quote.
99100
*
100-
* @param Object $response
101+
* @param DataObject $response
101102
* @return void
103+
* @throws \InvalidArgumentException
102104
*/
103105
public function savePaymentInQuote($response)
104106
{
105107
$quote = $this->quoteRepository->get($this->sessionTransparent->getQuoteId());
106108

107-
/** @var InfoInterface $payment */
108109
$payment = $this->paymentManagement->get($quote->getId());
109-
$payment->setAdditionalInformation(Transparent::PNREF, $response->getPnref());
110+
if (!$payment instanceof Payment) {
111+
throw new \InvalidArgumentException("Variable must contain instance of \\Quote\\Payment.");
112+
}
113+
114+
$payment->setData(OrderPaymentInterface::CC_TYPE, $response->getData(OrderPaymentInterface::CC_TYPE));
115+
$payment->setAdditionalInformation(Payflowpro::PNREF, $response->getData(Payflowpro::PNREF));
110116

111117
$this->errorHandler->handle($payment, $response);
112118

app/code/Magento/Paypal/Model/Payflow/Transparent.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
*/
66
namespace Magento\Paypal\Model\Payflow;
77

8-
use Magento\Framework\DataObject;
98
use Magento\Payment\Helper\Formatter;
109
use Magento\Payment\Model\InfoInterface;
1110
use Magento\Paypal\Model\Payflowpro;
@@ -42,7 +41,7 @@ class Transparent extends Payflowpro implements TransparentInterface
4241
/**
4342
* @var string
4443
*/
45-
protected $_infoBlockType = \Magento\Paypal\Block\Payflow\Info::class;
44+
protected $_infoBlockType = \Magento\Paypal\Block\Payment\Info::class;
4645

4746
/**
4847
* @var ResponseValidator

app/code/Magento/Paypal/Model/Payflowadvanced.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ class Payflowadvanced extends \Magento\Paypal\Model\Payflowlink
3030
*
3131
* @var string
3232
*/
33-
protected $_infoBlockType = \Magento\Paypal\Block\Payflow\Advanced\Info::class;
33+
protected $_infoBlockType = \Magento\Paypal\Block\Payment\Info::class;
3434

3535
/**
3636
* Controller for callback urls

app/code/Magento/Paypal/Model/Payflowlink.php

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -11,6 +11,7 @@
1111
use Magento\Payment\Model\Method\AbstractMethod;
1212
use Magento\Payment\Model\Method\ConfigInterfaceFactory;
1313
use Magento\Paypal\Model\Payflow\Service\Response\Handler\HandlerInterface;
14+
use Magento\Sales\Api\Data\OrderPaymentInterface;
1415
use Magento\Sales\Model\Order\Email\Sender\OrderSender;
1516

1617
/**
@@ -46,7 +47,7 @@ class Payflowlink extends \Magento\Paypal\Model\Payflowpro
4647
/**
4748
* @var string
4849
*/
49-
protected $_infoBlockType = \Magento\Paypal\Block\Payflow\Link\Info::class;
50+
protected $_infoBlockType = \Magento\Paypal\Block\Payment\Info::class;
5051

5152
/**
5253
* Availability option
@@ -308,8 +309,9 @@ protected function _processOrder(\Magento\Sales\Model\Order $order)
308309
$response = $this->getResponse();
309310
$payment = $order->getPayment();
310311
$payment->setTransactionId($response->getPnref())->setIsTransactionClosed(0);
311-
$canSendNewOrderEmail = true;
312+
$payment->setCcType($response->getData(OrderPaymentInterface::CC_TYPE));
312313

314+
$canSendNewOrderEmail = true;
313315
if ($response->getResult() == self::RESPONSE_CODE_FRAUDSERVICE_FILTER ||
314316
$response->getResult() == self::RESPONSE_CODE_DECLINED_BY_FILTER
315317
) {

0 commit comments

Comments
 (0)