Skip to content

Commit

Permalink
graphQl-309: merge remote
Browse files Browse the repository at this point in the history
  • Loading branch information
Vitaliy Boyko committed May 8, 2019
2 parents 7305a43 + d82262c commit 6a8edac
Show file tree
Hide file tree
Showing 971 changed files with 27,453 additions and 5,685 deletions.
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -4335,7 +4335,7 @@ Tests:
* Fixed order placing with virtual product using Express Checkout
* Fixed the error during order placement with Recurring profile payment
* Fixed wrong redirect after customer registration during multishipping checkout
* Fixed inability to crate shipping labels
* Fixed inability to create shipping labels
* Fixed inability to switch language, if the default language is English
* Fixed an issue with incorrect XML appearing in cache after some actions on the frontend
* Fixed product export
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<block class="Magento\Backend\Block\Widget\Grid" name="adminhtml.notification.container.grid" as="grid">
<arguments>
<argument name="id" xsi:type="string">notificationGrid</argument>
<argument name="dataSource" xsi:type="object">Magento\AdminNotification\Model\ResourceModel\Grid\Collection</argument>
<argument name="dataSource" xsi:type="object" shared="false">Magento\AdminNotification\Model\ResourceModel\Grid\Collection</argument>
<argument name="default_dir" xsi:type="string">DESC</argument>
<argument name="default_sort" xsi:type="string">date_added</argument>
<argument name="save_parameters_in_session" xsi:type="string">1</argument>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
<block class="Magento\AdvancedSearch\Block\Adminhtml\Search\Grid" name="search.edit.grid" as="grid">
<arguments>
<argument name="id" xsi:type="string">catalog_search_grid</argument>
<argument name="dataSource" xsi:type="object">Magento\AdvancedSearch\Model\ResourceModel\Search\Grid\Collection</argument>
<argument name="dataSource" xsi:type="object" shared="false">Magento\AdvancedSearch\Model\ResourceModel\Search\Grid\Collection</argument>
<argument name="default_sort" xsi:type="string">name</argument>
<argument name="default_dir" xsi:type="string">ASC</argument>
<argument name="save_parameters_in_session" xsi:type="string">1</argument>
Expand Down
14 changes: 12 additions & 2 deletions app/code/Magento/Authorization/Model/Role.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,19 +51,29 @@ public function __construct(
}

/**
* {@inheritdoc}
* @inheritDoc
*
* @SuppressWarnings(PHPMD.SerializationAware)
* @deprecated Do not use PHP serialization.
*/
public function __sleep()
{
trigger_error('Using PHP serialization is deprecated', E_USER_DEPRECATED);

$properties = parent::__sleep();
return array_diff($properties, ['_resource', '_resourceCollection']);
}

/**
* {@inheritdoc}
* @inheritDoc
*
* @SuppressWarnings(PHPMD.SerializationAware)
* @deprecated Do not use PHP serialization.
*/
public function __wakeup()
{
trigger_error('Using PHP serialization is deprecated', E_USER_DEPRECATED);

parent::__wakeup();
$objectManager = \Magento\Framework\App\ObjectManager::getInstance();
$this->_resource = $objectManager->get(\Magento\Authorization\Model\ResourceModel\Role::class);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,15 +54,15 @@ public function validate(array $validationSubject): ResultInterface
if (isset($transactionResponse['messages']['message']['code'])) {
$errorCodes[] = $transactionResponse['messages']['message']['code'];
$errorMessages[] = $transactionResponse['messages']['message']['text'];
} elseif ($transactionResponse['messages']['message']) {
} elseif (isset($transactionResponse['messages']['message'])) {
foreach ($transactionResponse['messages']['message'] as $message) {
$errorCodes[] = $message['code'];
$errorMessages[] = $message['description'];
}
} elseif (isset($transactionResponse['errors'])) {
foreach ($transactionResponse['errors'] as $message) {
$errorCodes[] = $message['errorCode'];
$errorMessages[] = $message['errorCode'];
$errorMessages[] = $message['errorText'];
}
}

Expand All @@ -85,8 +85,10 @@ private function isResponseCodeAnError(array $transactionResponse): bool
?? $transactionResponse['errors'][0]['errorCode']
?? null;

return in_array($transactionResponse['responseCode'], [self::RESPONSE_CODE_APPROVED, self::RESPONSE_CODE_HELD])
&& $code
return !in_array($transactionResponse['responseCode'], [
self::RESPONSE_CODE_APPROVED, self::RESPONSE_CODE_HELD
])
|| $code
&& !in_array(
$code,
[
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,13 +15,18 @@
use PHPUnit\Framework\MockObject\MockObject;
use PHPUnit\Framework\TestCase;

/**
* Tests for the transaction response validator
*/
class TransactionResponseValidatorTest extends TestCase
{
private const RESPONSE_CODE_APPROVED = 1;
private const RESPONSE_CODE_HELD = 4;
private const RESPONSE_CODE_DENIED = 2;
private const RESPONSE_REASON_CODE_APPROVED = 1;
private const RESPONSE_REASON_CODE_PENDING_REVIEW_AUTHORIZED = 252;
private const RESPONSE_REASON_CODE_PENDING_REVIEW = 253;
private const ERROR_CODE_AVS_MISMATCH = 27;

/**
* @var ResultInterfaceFactory|MockObject
Expand Down Expand Up @@ -86,16 +91,6 @@ public function testValidateScenarios($transactionResponse, $isValid, $errorCode
public function scenarioProvider()
{
return [
// This validator only cares about successful edge cases so test for default behavior
[
[
'responseCode' => 'foo',
],
true,
[],
[]
],

// Test for acceptable reason codes
[
[
Expand Down Expand Up @@ -208,6 +203,29 @@ public function scenarioProvider()
['foo'],
['bar']
],
[
[
'responseCode' => self::RESPONSE_CODE_DENIED,
'errors' => [
[
'errorCode' => self::ERROR_CODE_AVS_MISMATCH,
'errorText' => 'bar'
]
]
],
false,
[self::ERROR_CODE_AVS_MISMATCH],
['bar']
],
// This validator only cares about successful edge cases so test for default behavior
[
[
'responseCode' => 'foo',
],
false,
[],
[]
],
];
}
}
Loading

0 comments on commit 6a8edac

Please sign in to comment.