Skip to content

Commit 541881b

Browse files
committed
Merge branch '2.3-develop' of github.com:magento/magento2ce into borg-2.3
2 parents a31738a + b5dbf38 commit 541881b

File tree

58 files changed

+1583
-1267
lines changed

Some content is hidden

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

58 files changed

+1583
-1267
lines changed
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,62 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
namespace Magento\AuthorizenetGraphQl\Model;
9+
10+
use Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderInterface;
11+
use Magento\Framework\Stdlib\ArrayManager;
12+
use Magento\Framework\GraphQL\DataObjectConverter;
13+
14+
/**
15+
* DataProvider Model for Authorizenet
16+
*/
17+
class AuthorizenetDataProvider implements AdditionalDataProviderInterface
18+
{
19+
private const PATH_ADDITIONAL_DATA = 'input/payment_method/additional_data/authorizenet_acceptjs';
20+
21+
/**
22+
* @var ArrayManager
23+
*/
24+
private $arrayManager;
25+
26+
/**
27+
* AuthorizenetDataProvider constructor.
28+
* @param ArrayManager $arrayManager
29+
*/
30+
public function __construct(
31+
ArrayManager $arrayManager
32+
) {
33+
$this->arrayManager = $arrayManager;
34+
}
35+
36+
/**
37+
* Return additional data
38+
*
39+
* @param array $args
40+
* @return array
41+
*/
42+
public function getData(array $args): array
43+
{
44+
$additionalData = $this->arrayManager->get(static::PATH_ADDITIONAL_DATA, $args) ?? [];
45+
foreach ($additionalData as $key => $value) {
46+
$additionalData[$this->snakeCaseToCamelCase($key)] = $value;
47+
unset($additionalData[$key]);
48+
}
49+
return $additionalData;
50+
}
51+
52+
/**
53+
* Converts an input string from snake_case to camelCase.
54+
*
55+
* @param string $input
56+
* @return string
57+
*/
58+
private function snakeCaseToCamelCase($input)
59+
{
60+
return lcfirst(str_replace('_', '', ucwords($input, '_')));
61+
}
62+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,3 @@
1+
# AuthorizenetGraphQl
2+
3+
**AuthorizenetGraphQl** defines the data types needed to pass payment information data from the client to Magento.
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
{
2+
"name": "magento/module-authorizenet-graph-ql",
3+
"description": "N/A",
4+
"type": "magento2-module",
5+
"require": {
6+
"php": "~7.1.3||~7.2.0",
7+
"magento/framework": "*",
8+
"magento/module-quote-graph-ql": "*"
9+
},
10+
"suggest": {
11+
"magento/module-graph-ql": "*"
12+
},
13+
"license": [
14+
"OSL-3.0",
15+
"AFL-3.0"
16+
],
17+
"autoload": {
18+
"files": [
19+
"registration.php"
20+
],
21+
"psr-4": {
22+
"Magento\\AuthorizenetGraphQl\\": ""
23+
}
24+
}
25+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,16 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:ObjectManager/etc/config.xsd">
9+
<type name="Magento\QuoteGraphQl\Model\Cart\Payment\AdditionalDataProviderPool">
10+
<arguments>
11+
<argument name="dataProviders" xsi:type="array">
12+
<item name="authorizenet_acceptjs" xsi:type="object">Magento\AuthorizenetGraphQl\Model\AuthorizenetDataProvider</item>
13+
</argument>
14+
</arguments>
15+
</type>
16+
</config>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?xml version="1.0"?>
2+
<!--
3+
/**
4+
* Copyright © Magento, Inc. All rights reserved.
5+
* See COPYING.txt for license details.
6+
*/
7+
-->
8+
<config xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="urn:magento:framework:Module/etc/module.xsd">
9+
<module name="Magento_AuthorizenetGraphQl"/>
10+
</config>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
# Copyright © Magento, Inc. All rights reserved.
2+
# See COPYING.txt for license details.
3+
4+
input PaymentMethodAdditionalDataInput {
5+
authorizenet_acceptjs: AuthorizenetInput @doc(description: "Defines the required attributes for Authorize.Net payments")
6+
}
7+
8+
input AuthorizenetInput {
9+
opaque_data_descriptor: String! @doc(description: "Authorize.Net's description of the transaction request")
10+
opaque_data_value: String! @doc(description: "The nonce returned by Authorize.Net")
11+
cc_last_4: Int! @doc(description: "The last four digits of the credit or debit card")
12+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,10 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
declare(strict_types=1);
7+
8+
use Magento\Framework\Component\ComponentRegistrar;
9+
10+
ComponentRegistrar::register(ComponentRegistrar::MODULE, 'Magento_AuthorizenetGraphQl', __DIR__);

app/code/Magento/Braintree/Block/Paypal/Button.php

+28-2
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,8 @@
33
* Copyright © Magento, Inc. All rights reserved.
44
* See COPYING.txt for license details.
55
*/
6+
declare(strict_types=1);
7+
68
namespace Magento\Braintree\Block\Paypal;
79

810
use Magento\Braintree\Gateway\Config\PayPal\Config;
@@ -49,8 +51,6 @@ class Button extends Template implements ShortcutInterface
4951
private $payment;
5052

5153
/**
52-
* Constructor
53-
*
5454
* @param Context $context
5555
* @param ResolverInterface $localeResolver
5656
* @param Session $checkoutSession
@@ -98,6 +98,8 @@ public function getAlias()
9898
}
9999

100100
/**
101+
* Returns container id.
102+
*
101103
* @return string
102104
*/
103105
public function getContainerId()
@@ -106,6 +108,8 @@ public function getContainerId()
106108
}
107109

108110
/**
111+
* Returns locale.
112+
*
109113
* @return string
110114
*/
111115
public function getLocale()
@@ -114,6 +118,8 @@ public function getLocale()
114118
}
115119

116120
/**
121+
* Returns currency.
122+
*
117123
* @return string
118124
*/
119125
public function getCurrency()
@@ -122,6 +128,8 @@ public function getCurrency()
122128
}
123129

124130
/**
131+
* Returns amount.
132+
*
125133
* @return float
126134
*/
127135
public function getAmount()
@@ -130,6 +138,8 @@ public function getAmount()
130138
}
131139

132140
/**
141+
* Returns if is active.
142+
*
133143
* @return bool
134144
*/
135145
public function isActive()
@@ -139,6 +149,8 @@ public function isActive()
139149
}
140150

141151
/**
152+
* Returns merchant name.
153+
*
142154
* @return string
143155
*/
144156
public function getMerchantName()
@@ -147,6 +159,8 @@ public function getMerchantName()
147159
}
148160

149161
/**
162+
* Returns client token.
163+
*
150164
* @return string|null
151165
*/
152166
public function getClientToken()
@@ -155,10 +169,22 @@ public function getClientToken()
155169
}
156170

157171
/**
172+
* Returns action success.
173+
*
158174
* @return string
159175
*/
160176
public function getActionSuccess()
161177
{
162178
return $this->getUrl(ConfigProvider::CODE . '/paypal/review', ['_secure' => true]);
163179
}
180+
181+
/**
182+
* Gets environment value.
183+
*
184+
* @return string
185+
*/
186+
public function getEnvironment(): string
187+
{
188+
return $this->configProvider->getConfig()['payment'][ConfigProvider::CODE]['environment'];
189+
}
164190
}

app/code/Magento/Braintree/Gateway/Config/Config.php

+13-12
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,6 @@ class Config extends \Magento\Payment\Gateway\Config\Config
3030
const KEY_VERIFY_SPECIFIC = 'verify_specific_countries';
3131
const VALUE_3DSECURE_ALL = 0;
3232
const CODE_3DSECURE = 'three_d_secure';
33-
const KEY_KOUNT_MERCHANT_ID = 'kount_id';
3433
const FRAUD_PROTECTION = 'fraudprotection';
3534

3635
/**
@@ -173,6 +172,7 @@ public function get3DSecureSpecificCountries($storeId = null)
173172

174173
/**
175174
* Gets value of configured environment.
175+
*
176176
* Possible values: production or sandbox.
177177
*
178178
* @param int|null $storeId
@@ -183,17 +183,6 @@ public function getEnvironment($storeId = null)
183183
return $this->getValue(Config::KEY_ENVIRONMENT, $storeId);
184184
}
185185

186-
/**
187-
* Gets Kount merchant ID.
188-
*
189-
* @param int|null $storeId
190-
* @return string
191-
*/
192-
public function getKountMerchantId($storeId = null)
193-
{
194-
return $this->getValue(Config::KEY_KOUNT_MERCHANT_ID, $storeId);
195-
}
196-
197186
/**
198187
* Gets merchant ID.
199188
*
@@ -217,13 +206,25 @@ public function getMerchantAccountId($storeId = null)
217206
}
218207

219208
/**
209+
* Returns SDK url.
210+
*
220211
* @return string
221212
*/
222213
public function getSdkUrl()
223214
{
224215
return $this->getValue(Config::KEY_SDK_URL);
225216
}
226217

218+
/**
219+
* Gets Hosted Fields SDK Url
220+
*
221+
* @return string
222+
*/
223+
public function getHostedFieldsSdkUrl(): string
224+
{
225+
return $this->getValue('hosted_fields_sdk_url');
226+
}
227+
227228
/**
228229
* Checks if fraud protection is enabled.
229230
*
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,55 @@
1+
<?php
2+
/**
3+
* Copyright © Magento, Inc. All rights reserved.
4+
* See COPYING.txt for license details.
5+
*/
6+
namespace Magento\Braintree\Gateway\Request;
7+
8+
use Magento\Braintree\Gateway\SubjectReader;
9+
use Magento\Payment\Gateway\Request\BuilderInterface;
10+
11+
/**
12+
* Since we can't validate 3Dsecure for sequence multishipping orders based on vault tokens,
13+
* we skip 3D secure verification for vault transactions.
14+
* For common vault transaction original 3d secure verification builder is called.
15+
*/
16+
class VaultThreeDSecureDataBuilder implements BuilderInterface
17+
{
18+
/**
19+
* @var ThreeDSecureDataBuilder
20+
*/
21+
private $threeDSecureDataBuilder;
22+
23+
/**
24+
* @var SubjectReader
25+
*/
26+
private $subjectReader;
27+
28+
/**
29+
* Constructor
30+
*
31+
* @param ThreeDSecureDataBuilder $threeDSecureDataBuilder
32+
* @param SubjectReader $subjectReader
33+
*/
34+
public function __construct(
35+
ThreeDSecureDataBuilder $threeDSecureDataBuilder,
36+
SubjectReader $subjectReader
37+
) {
38+
$this->threeDSecureDataBuilder = $threeDSecureDataBuilder;
39+
$this->subjectReader = $subjectReader;
40+
}
41+
42+
/**
43+
* @inheritdoc
44+
*/
45+
public function build(array $buildSubject)
46+
{
47+
$paymentDO = $this->subjectReader->readPayment($buildSubject);
48+
$payment = $paymentDO->getPayment();
49+
if ($payment->getAdditionalInformation('is_multishipping')) {
50+
return [];
51+
}
52+
53+
return $this->threeDSecureDataBuilder->build($buildSubject);
54+
}
55+
}

app/code/Magento/Braintree/Model/Multishipping/PlaceOrder.php

+5
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
namespace Magento\Braintree\Model\Multishipping;
99

1010
use Magento\Braintree\Gateway\Command\GetPaymentNonceCommand;
11+
use Magento\Braintree\Gateway\Config\Config;
1112
use Magento\Braintree\Model\Ui\ConfigProvider;
1213
use Magento\Braintree\Observer\DataAssignObserver;
1314
use Magento\Braintree\Model\Ui\PayPal\ConfigProvider as PaypalConfigProvider;
@@ -118,6 +119,10 @@ private function setVaultPayment(OrderPaymentInterface $orderPayment, PaymentTok
118119
PaymentTokenInterface::CUSTOMER_ID,
119120
$customerId
120121
);
122+
$orderPayment->setAdditionalInformation(
123+
'is_multishipping',
124+
1
125+
);
121126
}
122127

123128
/**

0 commit comments

Comments
 (0)