Skip to content

Commit b3892d2

Browse files
committed
Merge remote-tracking branch 'origin/develop' into MAGETWO-54458
2 parents e8376bf + 3bcc1c9 commit b3892d2

File tree

740 files changed

+24450
-5974
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

740 files changed

+24450
-5974
lines changed

app/code/Magento/Backend/Model/View/Result/Redirect.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,6 +10,7 @@
1010
use Magento\Backend\Model\UrlInterface;
1111
use Magento\Framework\App;
1212
use Magento\Framework\App\ActionFlag;
13+
use Magento\Framework\App\Response\HttpInterface as HttpResponseInterface;
1314

1415
class Redirect extends \Magento\Framework\Controller\Result\Redirect
1516
{
@@ -56,7 +57,7 @@ public function setRefererOrBaseUrl()
5657
/**
5758
* {@inheritdoc}
5859
*/
59-
protected function render(App\ResponseInterface $response)
60+
protected function render(HttpResponseInterface $response)
6061
{
6162
$this->session->setIsUrlNotice($this->actionFlag->get('', AbstractAction::FLAG_IS_URLS_CHECKED));
6263
return parent::render($response);

app/code/Magento/Backend/view/adminhtml/ui_component/design_config_form.xml

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,9 @@
6969
<item name="fit" xsi:type="boolean">false</item>
7070
<item name="label" xsi:type="string">Search String</item>
7171
<item name="showFallbackReset" xsi:type="boolean">false</item>
72+
<item name="validation" xsi:type="array">
73+
<item name="required-entry" xsi:type="boolean">true</item>
74+
</item>
7275
</item>
7376
</argument>
7477
</field>
@@ -82,6 +85,9 @@
8285
<item name="fit" xsi:type="boolean">false</item>
8386
<item name="label" xsi:type="string">Theme Name</item>
8487
<item name="showFallbackReset" xsi:type="boolean">false</item>
88+
<item name="validation" xsi:type="array">
89+
<item name="required-entry" xsi:type="boolean">true</item>
90+
</item>
8591
</item>
8692
</argument>
8793
</field>

app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/cells/action-delete.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,5 +11,5 @@
1111
title: $parent.deleteButtonLabel
1212
}
1313
">
14-
<span data-bind="text: $parent.deleteButtonLabel"></span>
14+
<span translate="$parent.deleteButtonLabel"></span>
1515
</button>

app/code/Magento/Backend/view/adminhtml/web/template/dynamic-rows/grid.html

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
class="action-secondary"
1717
type="button"
1818
click="processingAddChild.bind($data, false, false, false)">
19-
<span text="addButtonLabel"/>
19+
<span translate="addButtonLabel"/>
2020
</button>
2121
</div>
2222

@@ -30,7 +30,7 @@
3030
css="element.setClasses(element)"
3131
attr="'data-index': index">
3232
<label if="element.label" class="admin__field-label" attr="for: element.uid">
33-
<span text="element.label"/>
33+
<span translate="element.label"/>
3434
</label>
3535

3636
<div class="admin__field-control" data-role="grid-wrapper">
@@ -51,7 +51,7 @@
5151

5252
<th repeat="foreach: labels, item: '$label'"
5353
class="data-grid-th"
54-
text="$label().label"
54+
translate="$label().label"
5555
visible="$label().visible"
5656
disable="$label().disabled"
5757
css="setClasses($label())">

app/code/Magento/Braintree/Gateway/Command/CaptureStrategyCommand.php

Lines changed: 17 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -166,16 +166,25 @@ private function isExpiredAuthorization(OrderPaymentInterface $payment)
166166
*/
167167
private function isExistsCaptureTransaction(OrderPaymentInterface $payment)
168168
{
169-
$filters[] = $this->filterBuilder->setField('payment_id')
170-
->setValue($payment->getId())
171-
->create();
169+
$this->searchCriteriaBuilder->addFilters(
170+
[
171+
$this->filterBuilder
172+
->setField('payment_id')
173+
->setValue($payment->getId())
174+
->create(),
175+
]
176+
);
172177

173-
$filters[] = $this->filterBuilder->setField('txn_type')
174-
->setValue(TransactionInterface::TYPE_CAPTURE)
175-
->create();
178+
$this->searchCriteriaBuilder->addFilters(
179+
[
180+
$this->filterBuilder
181+
->setField('txn_type')
182+
->setValue(TransactionInterface::TYPE_CAPTURE)
183+
->create(),
184+
]
185+
);
176186

177-
$searchCriteria = $this->searchCriteriaBuilder->addFilters($filters)
178-
->create();
187+
$searchCriteria = $this->searchCriteriaBuilder->create();
179188

180189
$count = $this->transactionRepository->getList($searchCriteria)->getTotalCount();
181190
return (boolean) $count;

app/code/Magento/Braintree/Gateway/Response/RiskDataHandler.php

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,11 @@ class RiskDataHandler implements HandlerInterface
2424
*/
2525
const RISK_DATA_DECISION = 'riskDataDecision';
2626

27+
/**
28+
* Risk data Review status
29+
*/
30+
private static $statusReview = 'Review';
31+
2732
/**
2833
* @var SubjectReader
2934
*/
@@ -62,5 +67,10 @@ public function handle(array $handlingSubject, array $response)
6267

6368
$payment->setAdditionalInformation(self::RISK_DATA_ID, $transaction->riskData->id);
6469
$payment->setAdditionalInformation(self::RISK_DATA_DECISION, $transaction->riskData->decision);
70+
71+
// mark payment as fraud
72+
if ($transaction->riskData->decision === self::$statusReview) {
73+
$payment->setIsFraudDetected(true);
74+
}
6575
}
6676
}

app/code/Magento/Braintree/Test/Unit/Gateway/Command/CaptureStrategyCommandTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -374,7 +374,7 @@ private function buildSearchCriteria()
374374
->willReturnSelf();
375375

376376
$searchCriteria = new SearchCriteria();
377-
$this->searchCriteriaBuilder->expects(static::once())
377+
$this->searchCriteriaBuilder->expects(static::exactly(2))
378378
->method('addFilters')
379379
->willReturnSelf();
380380
$this->searchCriteriaBuilder->expects(static::once())

app/code/Magento/Braintree/Test/Unit/Gateway/Request/VaultCaptureDataBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function testBuild()
8080
$paymentExtension = $this->getMockBuilder(OrderPaymentExtension::class)
8181
->setMethods(['getVaultPaymentToken'])
8282
->disableOriginalConstructor()
83-
->getMock();
83+
->getMockForAbstractClass();
8484

8585
$paymentToken = $this->getMockBuilder(PaymentToken::class)
8686
->disableOriginalConstructor()

app/code/Magento/Braintree/Test/Unit/Gateway/Response/RiskDataHandlerTest.php

Lines changed: 57 additions & 61 deletions
Original file line numberDiff line numberDiff line change
@@ -5,12 +5,12 @@
55
*/
66
namespace Magento\Braintree\Test\Unit\Gateway\Response;
77

8-
use Braintree\RiskData;
98
use Braintree\Transaction;
10-
use Magento\Sales\Model\Order\Payment;
119
use Magento\Braintree\Gateway\Helper\SubjectReader;
1210
use Magento\Braintree\Gateway\Response\RiskDataHandler;
1311
use Magento\Payment\Gateway\Data\PaymentDataObjectInterface;
12+
use Magento\Sales\Model\Order\Payment;
13+
use PHPUnit_Framework_MockObject_MockObject as MockObject;
1414

1515
/**
1616
* Class RiskDataHandlerTest
@@ -25,99 +25,95 @@ class RiskDataHandlerTest extends \PHPUnit_Framework_TestCase
2525
private $riskDataHandler;
2626

2727
/**
28-
* @var SubjectReader|\PHPUnit_Framework_MockObject_MockObject
28+
* @var SubjectReader|MockObject
2929
*/
30-
private $subjectReaderMock;
30+
private $subjectReader;
3131

3232
/**
3333
* Set up
3434
*/
3535
protected function setUp()
3636
{
37-
$this->subjectReaderMock = $this->getMockBuilder(SubjectReader::class)
37+
$this->subjectReader = $this->getMockBuilder(SubjectReader::class)
3838
->disableOriginalConstructor()
39+
->setMethods(['readPayment', 'readTransaction'])
3940
->getMock();
4041

41-
$this->riskDataHandler = new RiskDataHandler($this->subjectReaderMock);
42+
$this->riskDataHandler = new RiskDataHandler($this->subjectReader);
4243
}
4344

4445
/**
45-
* Run test for handle method
46+
* Test for handle method
47+
* @covers \Magento\Braintree\Gateway\Response\RiskDataHandler::handle
48+
* @param string $riskDecision
49+
* @param boolean $isFraud
50+
* @dataProvider riskDataProvider
4651
*/
47-
public function testHandle()
52+
public function testHandle($riskDecision, $isFraud)
4853
{
49-
$paymentData = $this->getPaymentDataObjectMock();
50-
$transaction = $this->getBraintreeTransactionMock();
54+
/** @var Payment|MockObject $payment */
55+
$payment = $this->getMockBuilder(Payment::class)
56+
->disableOriginalConstructor()
57+
->setMethods(['setAdditionalInformation', 'setIsFraudDetected'])
58+
->getMock();
59+
/** @var PaymentDataObjectInterface|MockObject $paymentDO */
60+
$paymentDO = $this->getMock(PaymentDataObjectInterface::class);
61+
$paymentDO->expects(self::once())
62+
->method('getPayment')
63+
->willReturn($payment);
64+
65+
$transaction = Transaction::factory([
66+
'riskData' => [
67+
'id' => 'test-id',
68+
'decision' => $riskDecision
69+
]
70+
]);
5171

5272
$response = [
5373
'object' => $transaction
5474
];
5575
$handlingSubject = [
56-
'payment' =>$paymentData,
76+
'payment' => $paymentDO,
5777
];
5878

59-
$this->subjectReaderMock->expects(self::once())
79+
$this->subjectReader->expects(static::once())
6080
->method('readPayment')
6181
->with($handlingSubject)
62-
->willReturn($paymentData);
63-
$this->subjectReaderMock->expects(self::once())
82+
->willReturn($paymentDO);
83+
$this->subjectReader->expects(static::once())
6484
->method('readTransaction')
6585
->with($response)
6686
->willReturn($transaction);
6787

68-
$this->riskDataHandler->handle($handlingSubject, $response);
69-
}
70-
71-
/**
72-
* @return \PHPUnit_Framework_MockObject_MockObject
73-
*/
74-
private function getBraintreeTransactionMock()
75-
{
76-
$transaction = \Braintree\Transaction::factory([]);
77-
$transaction->_set(
78-
'riskData',
79-
RiskData::factory(
80-
[
81-
'id' => 'test-id',
82-
'decision' => 'test-decision',
83-
]
84-
)
85-
);
86-
87-
return $transaction;
88-
}
89-
90-
/**
91-
* @return \PHPUnit_Framework_MockObject_MockObject
92-
*/
93-
private function getPaymentDataObjectMock()
94-
{
95-
$mock = $this->getMockBuilder(PaymentDataObjectInterface::class)
96-
->getMockForAbstractClass();
88+
$payment->expects(static::at(0))
89+
->method('setAdditionalInformation')
90+
->with(RiskDataHandler::RISK_DATA_ID, 'test-id');
91+
$payment->expects(static::at(1))
92+
->method('setAdditionalInformation')
93+
->with(RiskDataHandler::RISK_DATA_DECISION, $riskDecision);
9794

98-
$mock->expects(static::once())
99-
->method('getPayment')
100-
->willReturn($this->getPaymentMock());
95+
if (!$isFraud) {
96+
$payment->expects(static::never())
97+
->method('setIsFraudDetected');
98+
} else {
99+
$payment->expects(static::once())
100+
->method('setIsFraudDetected')
101+
->with(true);
102+
}
101103

102-
return $mock;
104+
$this->riskDataHandler->handle($handlingSubject, $response);
103105
}
104106

105107
/**
106-
* @return \PHPUnit_Framework_MockObject_MockObject
108+
* Get list of variations to test fraud
109+
* @return array
107110
*/
108-
private function getPaymentMock()
111+
public function riskDataProvider()
109112
{
110-
$paymentMock = $this->getMockBuilder(Payment::class)
111-
->disableOriginalConstructor()
112-
->getMock();
113-
114-
$paymentMock->expects(self::at(0))
115-
->method('setAdditionalInformation')
116-
->with(RiskDataHandler::RISK_DATA_ID, 'test-id');
117-
$paymentMock->expects(self::at(1))
118-
->method('setAdditionalInformation')
119-
->with(RiskDataHandler::RISK_DATA_DECISION, 'test-decision');
120-
121-
return $paymentMock;
113+
return [
114+
['decision' => 'Not Evaluated', 'isFraud' => false],
115+
['decision' => 'Approve', 'isFraud' => false],
116+
['decision' => 'Review', 'isFraud' => true],
117+
];
122118
}
123119
}

app/code/Magento/Braintree/etc/adminhtml/system.xml

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -8,17 +8,14 @@
88
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:module:Magento_Config:etc/system_file.xsd">
99
<system>
1010
<section id="payment">
11-
<group id="braintree_section" translate="label" type="text" sortOrder="2" showInDefault="1" showInWebsite="1" showInStore="1">
12-
<label>Braintree</label>
13-
<comment><![CDATA[Accept credit/debit cards and PayPal in your Magento store. No setup or monthly fees and your customers never leave your store to complete the purchase.]]></comment>
14-
<attribute type="expanded">1</attribute>
15-
<fieldset_css>complex braintree-section</fieldset_css>
16-
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Group</frontend_model>
17-
<group id="braintree" translate="label" type="text" sortOrder="25" showInDefault="1" showInWebsite="1" showInStore="1">
18-
<label><![CDATA[&nbsp;]]></label>
11+
<group id="braintree_section" sortOrder="6" showInDefault="0" showInWebsite="0" showInStore="0">
12+
<group id="braintree" translate="label comment" type="text" showInDefault="1" showInWebsite="1" showInStore="1">
13+
<label>Braintree</label>
14+
<comment><![CDATA[Accept credit/debit cards and PayPal in your Magento store.<br/>No setup or monthly fees and your customers never leave your store to complete the purchase.]]></comment>
15+
<fieldset_css>complex braintree-section</fieldset_css>
1916
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Payment</frontend_model>
2017
<attribute type="activity_path">payment/braintree/active</attribute>
21-
<more_url>https://articles.braintreepayments.com/guides/magento/configuration</more_url>
18+
<attribute type="displayIn">recommended_solutions</attribute>
2219
<field id="active" translate="label" type="select" sortOrder="10" showInDefault="1" showInWebsite="1" showInStore="0">
2320
<label>Enable this Solution</label>
2421
<source_model>Magento\Config\Model\Config\Source\Yesno</source_model>
@@ -43,8 +40,11 @@
4340
<group id="braintree_required"/>
4441
</requires>
4542
</field>
43+
<group id="configuration_details" showInDefault="1" showInWebsite="1" showInStore="1" sortOrder="4">
44+
<comment>http://docs.magento.com/m2/ce/user_guide/payment/braintree.html</comment>
45+
<frontend_model>Magento\Paypal\Block\Adminhtml\System\Config\Fieldset\Hint</frontend_model>
46+
</group>
4647
<group id="braintree_required" translate="label" showInDefault="1" showInWebsite="1" sortOrder="5">
47-
<comment><![CDATA[<a href="https://www.braintreegateway.com/login" target="_blank">Click here to login to your existing Braintree account</a>. Or to setup a new account and accept payments on your website, <a href="https://apply.braintreegateway.com/signup/us" target="_blank">click here to signup for a Braintree account</a>.<br><br>Powered by <a href="https://www.braintreepayments.com/features/hosted-fields" target="_blank">Braintree v.zero with Hosted Fields</a> latest technology. Hosted Fields are small, transparent iframes that replace the sensitive credit card inputs in your checkout flow - helping you meet the latest data security requirements while ensuring your customization doesn't suffer. <a href="https://www.braintreepayments.com/features/hosted-fields" target="_blank">Find out more</a>.]]></comment>
4848
<label>Basic Braintree Settings</label>
4949
<attribute type="expanded">1</attribute>
5050
<frontend_model>Magento\Config\Block\System\Config\Form\Fieldset</frontend_model>

app/code/Magento/Braintree/etc/config.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,8 @@
2626
<can_void>1</can_void>
2727
<can_cancel>1</can_cancel>
2828
<can_edit>1</can_edit>
29+
<can_review_payment>1</can_review_payment>
30+
<can_deny_payment>1</can_deny_payment>
2931
<cctypes>AE,VI,MC,DI,JCB,CUP,DN,MI</cctypes>
3032
<useccv>1</useccv>
3133
<cctypes_braintree_mapper><![CDATA[{"american-express":"AE","discover":"DI","jcb":"JCB","mastercard":"MC","master-card":"MC","visa":"VI","maestro":"MI","diners-club":"DN","unionpay":"CUP"}]]></cctypes_braintree_mapper>

app/code/Magento/Braintree/etc/di.xml

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -133,6 +133,7 @@
133133
<item name="void" xsi:type="string">BraintreeVoidCommand</item>
134134
<item name="refund" xsi:type="string">BraintreeRefundCommand</item>
135135
<item name="cancel" xsi:type="string">BraintreeVoidCommand</item>
136+
<item name="deny_payment" xsi:type="string">BraintreeVoidCommand</item>
136137
</argument>
137138
</arguments>
138139
</virtualType>

app/code/Magento/Braintree/i18n/en_US.csv

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -164,4 +164,5 @@ Debug,Debug
164164
"europe_bank_accout","Europe bank account"
165165
"credit_card","Credit card"
166166
"apple_pay_card","Apple pay card"
167-
"android_pay_card","Android pay card"
167+
"android_pay_card","Android pay card"
168+
"Accept credit/debit cards and PayPal in your Magento store.<br/>No setup or monthly fees and your customers never leave your store to complete the purchase.","Accept credit/debit cards and PayPal in your Magento store.<br/>No setup or monthly fees and your customers never leave your store to complete the purchase."

app/code/Magento/Braintree/view/adminhtml/web/styles.css

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,5 +3,6 @@
33
* See COPYING.txt for license details.
44
*/
55

6-
.braintree-section .entry-edit-head > .config-heading .heading strong {padding-left:150px;background:url(images/braintree_logo.png) no-repeat 0 0 / 145px auto;line-height:36px;}
7-
.braintree-section .entry-edit-head > .config-heading:before {background: url("images/braintree_allinone.png") no-repeat 0 0 / 100% auto;content: "";display: inline;float: right;height: 35px;width: 280px;}
6+
.braintree-section .heading {display: inline-block; background: url("images/braintree_logo.png") no-repeat 0 50% / 18rem auto; padding-left: 20rem;}
7+
.braintree-section .button-container {display: inline-block; float: right;}
8+
.braintree-section .config-alt {background: url("images/braintree_allinone.png") no-repeat scroll 0 0 / 100% auto; height: 28px; margin: 0.5rem 0 0; width: 230px;}

app/code/Magento/Bundle/Helper/Catalog/Product/Configuration.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -142,6 +142,7 @@ public function getBundleOptions(ItemInterface $item)
142142
. $this->pricingHelper->currency(
143143
$this->getSelectionFinalPrice($item, $bundleSelection)
144144
);
145+
$option['has_html'] = true;
145146
}
146147
}
147148

0 commit comments

Comments
 (0)