diff --git a/vendor/paypal/module-braintree-core/Gateway/Config/Config.php b/vendor/paypal/module-braintree-core/Gateway/Config/Config.php
index fbb016b1..5b1b511d 100755
--- a/vendor/paypal/module-braintree-core/Gateway/Config/Config.php
+++ b/vendor/paypal/module-braintree-core/Gateway/Config/Config.php
@@ -30,6 +30,7 @@ class Config extends \Magento\Payment\Gateway\Config\Config
const KEY_USE_CVV = 'useccv';
const KEY_USE_CVV_VAULT = 'useccv_vault';
const KEY_VERIFY_3DSECURE = 'verify_3dsecure';
+ const KEY_ALWAYS_REQUEST_3DS = 'always_request_3ds';
const KEY_THRESHOLD_AMOUNT = 'threshold_amount';
const KEY_VERIFY_ALLOW_SPECIFIC = 'verify_all_countries';
const KEY_VERIFY_SPECIFIC = 'verify_specific_countries';
@@ -190,6 +191,21 @@ public function isVerify3DSecure(): bool
);
}
+ /**
+ * Check if 3DS challenge requested for always
+ *
+ * @return bool
+ * @throws InputException
+ * @throws NoSuchEntityException
+ */
+ public function is3DSAlwaysRequested(): bool
+ {
+ return (bool) $this->getValue(
+ self::KEY_ALWAYS_REQUEST_3DS,
+ $this->storeConfigResolver->getStoreId()
+ );
+ }
+
/**
* Get threshold amount for 3d secure
*
diff --git a/vendor/paypal/module-braintree-core/Model/Ui/ConfigProvider.php b/vendor/paypal/module-braintree-core/Model/Ui/ConfigProvider.php
index 0eba4e86..541bc444 100644
--- a/vendor/paypal/module-braintree-core/Model/Ui/ConfigProvider.php
+++ b/vendor/paypal/module-braintree-core/Model/Ui/ConfigProvider.php
@@ -7,6 +7,7 @@
use Braintree\Result\Error;
use Braintree\Result\Successful;
+use Magento\Framework\HTTP\PhpEnvironment\RemoteAddress;
use PayPal\Braintree\Gateway\Request\PaymentDataBuilder;
use Magento\Checkout\Model\ConfigProviderInterface;
use PayPal\Braintree\Gateway\Config\Config;
@@ -57,6 +58,11 @@ class ConfigProvider implements ConfigProviderInterface
*/
private $icons = [];
+ /**
+ * @var RemoteAddress
+ */
+ private RemoteAddress $remoteAddress;
+
/**
* ConfigProvider constructor.
* @param Config $config
@@ -64,19 +70,22 @@ class ConfigProvider implements ConfigProviderInterface
* @param BraintreeAdapter $adapter
* @param CcConfig $ccConfig
* @param Source $assetSource
+ * @param RemoteAddress $remoteAddress
*/
public function __construct(
Config $config,
PayPalConfig $payPalConfig,
BraintreeAdapter $adapter,
CcConfig $ccConfig,
- Source $assetSource
+ Source $assetSource,
+ RemoteAddress $remoteAddress
) {
$this->config = $config;
$this->adapter = $adapter;
$this->paypalConfig = $payPalConfig;
$this->ccConfig = $ccConfig;
$this->assetSource = $assetSource;
+ $this->remoteAddress = $remoteAddress;
}
/**
@@ -115,8 +124,10 @@ public function getConfig(): array
],
Config::CODE_3DSECURE => [
'enabled' => $this->config->isVerify3DSecure(),
+ 'challengeRequested' => $this->config->is3DSAlwaysRequested(),
'thresholdAmount' => $this->config->getThresholdAmount(),
- 'specificCountries' => $this->config->get3DSecureSpecificCountries()
+ 'specificCountries' => $this->config->get3DSecureSpecificCountries(),
+ 'ipAddress' => $this->remoteAddress->getRemoteAddress()
]
]
];
diff --git a/vendor/paypal/module-braintree-core/etc/adminhtml/system.xml b/vendor/paypal/module-braintree-core/etc/adminhtml/system.xml
index 3a1a53e5..c2233935 100644
--- a/vendor/paypal/module-braintree-core/etc/adminhtml/system.xml
+++ b/vendor/paypal/module-braintree-core/etc/adminhtml/system.xml
@@ -748,16 +748,24 @@
Magento\Config\Model\Config\Source\Yesno
payment/braintree/verify_3dsecure
-
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ payment/braintree/always_request_3ds
+
+ 1
+
+
+
payment/braintree/threshold_amount
-
+
Magento\Payment\Model\Config\Source\Allspecificcountries
payment/braintree/verify_all_countries
-
+
PayPal\Braintree\Model\Adminhtml\System\Config\Country
1
diff --git a/vendor/paypal/module-braintree-core/view/base/requirejs-config.js b/vendor/paypal/module-braintree-core/view/base/requirejs-config.js
index 7eca11bd..89e48c6c 100755
--- a/vendor/paypal/module-braintree-core/view/base/requirejs-config.js
+++ b/vendor/paypal/module-braintree-core/view/base/requirejs-config.js
@@ -5,20 +5,20 @@
var config = {
map: {
'*': {
- braintree: 'https://js.braintreegateway.com/web/3.94.0/js/client.min.js',
+ braintree: 'https://js.braintreegateway.com/web/3.97.2/js/client.min.js'
}
},
paths: {
- "braintreePayPalCheckout": "https://js.braintreegateway.com/web/3.94.0/js/paypal-checkout.min",
- "braintreeHostedFields": "https://js.braintreegateway.com/web/3.94.0/js/hosted-fields.min",
- "braintreeDataCollector": "https://js.braintreegateway.com/web/3.94.0/js/data-collector.min",
- "braintreeThreeDSecure": "https://js.braintreegateway.com/web/3.94.0/js/three-d-secure.min",
- "braintreeApplePay": 'https://js.braintreegateway.com/web/3.94.0/js/apple-pay.min',
- "braintreeGooglePay": 'https://js.braintreegateway.com/web/3.94.0/js/google-payment.min',
- "braintreeVenmo": 'https://js.braintreegateway.com/web/3.94.0/js/venmo.min',
- "braintreeAch": "https://js.braintreegateway.com/web/3.94.0/js/us-bank-account.min",
- "braintreeLpm": "https://js.braintreegateway.com/web/3.94.0/js/local-payment.min",
+ "braintreePayPalCheckout": "https://js.braintreegateway.com/web/3.97.2/js/paypal-checkout.min",
+ "braintreeHostedFields": "https://js.braintreegateway.com/web/3.97.2/js/hosted-fields.min",
+ "braintreeDataCollector": "https://js.braintreegateway.com/web/3.97.2/js/data-collector.min",
+ "braintreeThreeDSecure": "https://js.braintreegateway.com/web/3.97.2/js/three-d-secure.min",
+ "braintreeApplePay": 'https://js.braintreegateway.com/web/3.97.2/js/apple-pay.min',
+ "braintreeGooglePay": 'https://js.braintreegateway.com/web/3.97.2/js/google-payment.min',
+ "braintreeVenmo": 'https://js.braintreegateway.com/web/3.97.2/js/venmo.min',
+ "braintreeAch": "https://js.braintreegateway.com/web/3.97.2/js/us-bank-account.min",
+ "braintreeLpm": "https://js.braintreegateway.com/web/3.97.2/js/local-payment.min",
"googlePayLibrary": "https://pay.google.com/gp/p/js/pay",
"braintreePayPalInContextCheckout": "https://www.paypalobjects.com/api/checkout"
}
diff --git a/vendor/paypal/module-braintree-core/view/frontend/web/js/view/payment/3d-secure.js b/vendor/paypal/module-braintree-core/view/frontend/web/js/view/payment/3d-secure.js
index f9eb4b41..94cca6a4 100755
--- a/vendor/paypal/module-braintree-core/view/frontend/web/js/view/payment/3d-secure.js
+++ b/vendor/paypal/module-braintree-core/view/frontend/web/js/view/payment/3d-secure.js
@@ -37,11 +37,40 @@ define([
/**
* convert Non-ASCII characters into unicode
+ *
* @param str
* @returns {string}
*/
escapeNonAsciiCharacters: function (str) {
- return str.split("").map(function (c) { return /[^\x00-\x7F]$/.test(c) ? c : c.split("").map(function (a) { return "\\u00" + a.charCodeAt().toString(16)}).join("")}).join("");
+ return str.split('').map(function (c) {
+ return /^[\x00-\x7F]$/.test(c) ? c : c.split('').map(function (a) {
+ return '\\u00' + a.charCodeAt(0).toString(16);
+ }).join('');
+ }).join('');
+ },
+
+ /**
+ * Check billing/shipping address line lengths
+ *
+ * @param errorMessage
+ * @param billingAddress
+ * @param shippingAddress
+ * @returns {*}
+ */
+ checkBillingLineLengths: function (errorMessage, billingAddress, shippingAddress) {
+ let lineError = null;
+
+ if (billingAddress.street[0].length > 50 || shippingAddress.street[0].length > 50) {
+ lineError = 'line1';
+ } else if (billingAddress.street[1].length > 50 || shippingAddress.street[1].length > 50) {
+ lineError = 'line2';
+ }
+
+ if (lineError) {
+ let error = `Billing/Shipping ${lineError} must be string and less than 50 characters.`;
+
+ return $t(`${error} Please update the address and try again.`);
+ }
},
/**
@@ -50,19 +79,30 @@ define([
* @returns {Object}
*/
validate: function (context) {
- let clientInstance = braintree.getApiClient(),
+ let self = this,
+ clientInstance = braintree.getApiClient(),
state = $.Deferred(),
totalAmount = parseFloat(quote.totals()['base_grand_total']).toFixed(2),
- billingAddress = quote.billingAddress();
+ billingAddress = quote.billingAddress(),
+ shippingAddress = quote.shippingAddress(),
+ setup3d;
+ // Handle billing address region code
if (billingAddress.regionCode == null) {
billingAddress.regionCode = undefined;
}
-
if (billingAddress.regionCode !== undefined && billingAddress.regionCode.length > 2) {
billingAddress.regionCode = undefined;
}
+ // Handle shipping address region code
+ if (shippingAddress.regionCode == null) {
+ shippingAddress.regionCode = undefined;
+ }
+ if (shippingAddress.regionCode !== undefined && shippingAddress.regionCode.length > 2) {
+ shippingAddress.regionCode = undefined;
+ }
+
// No 3d secure if using CVV verification on vaulted cards
if (quote.paymentMethod().method.indexOf('braintree_cc_vault_') !== -1) {
if (this.config.useCvvVault === true) {
@@ -76,12 +116,9 @@ define([
return state.promise();
}
- let firstName = this.escapeNonAsciiCharacters(billingAddress.firstname);
- let lastName = this.escapeNonAsciiCharacters(billingAddress.lastname);
-
fullScreenLoader.startLoader();
- let setup3d = function(clientInstance) {
+ setup3d = function(clientInstance) {
threeDSecure.create({
version: 2,
client: clientInstance
@@ -109,9 +146,11 @@ define([
amount: totalAmount,
nonce: context.paymentMethodNonce,
bin: context.creditCardBin,
+ collectDeviceData: true,
+ challengeRequested: self.getChallengeRequested(),
billingAddress: {
- givenName: firstName,
- surname: lastName,
+ givenName: self.escapeNonAsciiCharacters(billingAddress.firstname),
+ surname: self.escapeNonAsciiCharacters(billingAddress.lastname),
phoneNumber: billingAddress.telephone,
streetAddress: billingAddress.street[0],
extendedAddress: billingAddress.street[1],
@@ -120,6 +159,20 @@ define([
postalCode: billingAddress.postcode,
countryCodeAlpha2: billingAddress.countryId
},
+ additionalInformation: {
+ shippingGivenName: shippingAddress.firstname,
+ shippingSurname: shippingAddress.lastname,
+ shippingAddress: {
+ streetAddress: shippingAddress.street[0],
+ extendedAddress: shippingAddress.street[1],
+ locality: shippingAddress.city,
+ region: shippingAddress.regionCode,
+ postalCode: shippingAddress.postcode,
+ countryCodeAlpha2: shippingAddress.countryId
+ },
+ shippingPhone: shippingAddress.telephone,
+ ipAddress: self.getIpAddress()
+ },
onLookupComplete: function (data, next) {
next();
},
@@ -142,23 +195,15 @@ define([
fullScreenLoader.stopLoader();
if (err) {
- console.error("3DSecure validation failed", err);
+ console.error('3DSecure validation failed', err);
if (err.code === 'THREEDS_LOOKUP_VALIDATION_ERROR') {
- let errorMessage = err.details.originalError.details.originalError.error.message;
- if (errorMessage === 'Billing line1 format is invalid.' && billingAddress.street[0].length > 50) {
- return state.reject(
- $t('Billing line1 must be string and less than 50 characters. Please update the address and try again.')
- );
-
- } else if (errorMessage === 'Billing line2 format is invalid.' && billingAddress.street[1].length > 50) {
- return state.reject(
- $t('Billing line2 must be string and less than 50 characters. Please update the address and try again.')
- );
- }
- return state.reject($t(errorMessage));
- } else {
- return state.reject($t('Please try again with another form of payment.'));
+ let errorMessage = err.details.originalError.details.originalError.error.message,
+ error = self.checkBillingLineLengths(errorMessage, billingAddress, shippingAddress);
+
+ return error ? state.reject(error) : state.reject($t(errorMessage));
}
+
+ return state.reject($t('Please try again with another form of payment.'));
}
let liability = {
@@ -239,6 +284,22 @@ define([
}
return false;
+ },
+
+ /**
+ * @returns {Boolean}
+ */
+ getChallengeRequested: function () {
+ return this.config.challengeRequested;
+ },
+
+ /**
+ * Get the Customer's IP Address
+ *
+ * @returns {*}
+ */
+ getIpAddress: function () {
+ return this.config.ipAddress;
}
};
});