Skip to content

Commit

Permalink
Merge pull request #12 from OnTap/release0222
Browse files Browse the repository at this point in the history
Version 103.7.1
  • Loading branch information
DanGarner authored Mar 21, 2022
2 parents d983558 + 3cb7797 commit 35bcd90
Show file tree
Hide file tree
Showing 7 changed files with 67 additions and 24 deletions.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,12 @@
# Changelog
All notable changes to this project will be documented in this file.

## [103.7.1] - 2022-03-11
### Fixed
- EMV 3DS doesn't work if Website Code is used in the Base URL
- EMV 3DS doesn't work if "device.browser" is the required parameter for 3DS validation rules


## [103.7.0] - 2021-10-19
### Changed
- Add support for the "Enforce Unique Order Reference" and "Enforce Unique Merchant Transaction Reference" gateway features
Expand Down
5 changes: 3 additions & 2 deletions Controller/ThreedsecureV2/AuthenticatePayer.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2016-2020 Mastercard
* Copyright (c) 2016-2022 Mastercard
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -105,7 +105,8 @@ public function execute()
'payment' => $paymentDataObject,
'amount' => $quote->getBaseGrandTotal(),
'remote_ip' => $quote->getRemoteIp(),
'browserDetails' => $this->getRequest()->getParam('browserDetails')
'browser' => $this->getRequest()->getHeader('User-Agent'),
'browserDetails' => $this->getRequest()->getParam('browserDetails'),
]);

$payment->save();
Expand Down
20 changes: 18 additions & 2 deletions Gateway/Request/Authentication/DeviceBuilder.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2016-2020 Mastercard
* Copyright (c) 2016-2022 Mastercard
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -31,8 +31,9 @@ public function build(array $buildSubject)
{
return [
'device' => [
'browser' => $this->readBrowser($buildSubject),
'browserDetails' => $this->readBrowserDetails($buildSubject),
'ipAddress' => $this->readRemoteIp($buildSubject)
'ipAddress' => $this->readRemoteIp($buildSubject),
]
];
}
Expand Down Expand Up @@ -66,4 +67,19 @@ private function readRemoteIp(array $subject)

return $subject['remote_ip'];
}

/**
* Reads browser from subject
*
* @param array $subject
* @return string
*/
private function readBrowser(array $subject)
{
if (!isset($subject['browser'])) {
throw new InvalidArgumentException('Browser should be provided');
}

return $subject['browser'];
}
}
32 changes: 20 additions & 12 deletions Model/Ui/Hpf/ConfigProvider.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php
/**
* Copyright (c) 2016-2019 Mastercard
* Copyright (c) 2016-2022 Mastercard
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand Down Expand Up @@ -44,7 +44,7 @@ class ConfigProvider implements ConfigProviderInterface
*/
public function __construct(ConfigInterface $config, UrlInterface $urlBuilder)
{
$this->config = $config;
$this->config = $config;
$this->urlBuilder = $urlBuilder;
}

Expand All @@ -58,20 +58,28 @@ public function getConfig()
return [
'payment' => [
self::METHOD_CODE => [
'merchant_username' => $this->config->getMerchantId(),
'component_url' => $this->config->getComponentUrl(),
'debug' => (bool) $this->config->getValue('debug'),
'three_d_secure_version' => (int) $this->config->getValue('three_d_secure'),
'ccVaultCode' => static::CC_VAULT_CODE,
'check_url' => $this->urlBuilder->getUrl(
'merchant_username' => $this->config->getMerchantId(),
'component_url' => $this->config->getComponentUrl(),
'debug' => (bool)$this->config->getValue('debug'),
'three_d_secure_version' => (int)$this->config->getValue('three_d_secure'),
'ccVaultCode' => static::CC_VAULT_CODE,
'check_url' => $this->urlBuilder->getUrl(
'tns/threedsecure/check',
[
'method' => 'hpf',
'_secure' => 1
'method' => 'hpf',
'_secure' => 1,
]
),
]
]
'threedsecure_v2_initiate_authentication_url' => $this->urlBuilder->getUrl(
'tns/threedsecureV2/initiateAuthentication',
['_secure' => 1]
),
'threedsecure_v2_authenticate_payer_url' => $this->urlBuilder->getUrl(
'tns/threedsecureV2/authenticatePayer',
['_secure' => 1]
),
],
],
];
}
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,9 @@
"description": "Official Magento2 Plugin to integrate with MasterCard Payments",
"type": "magento2-module",
"license": "Apache-2.0",
"version": "103.7.0",
"version": "103.7.1",
"require": {
"magento/framework": "^104.0.0|^103.0.0|^102.0.0"
"magento/framework": "^102.0.0|^103.0.0"
},
"autoload": {
"files": [
Expand Down
14 changes: 11 additions & 3 deletions view/frontend/web/js/action/authenticate-payer.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Mastercard
* Copyright (c) 2016-2022 Mastercard
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,7 +25,13 @@ define(
'use strict';

return {
apiUrl: '/tns/threedsecureV2/authenticatePayer',
/**
* @returns {Object}
*/
getConfig: function () {
return window.checkoutConfig.payment['tns_hpf'];
},

/**
*
* @param {Object} payload
Expand All @@ -43,8 +49,10 @@ define(
* @returns {*}
*/
execute: function (payload, messageContainer) {
var config;

return $.post(this.apiUrl, payload)
config = this.getConfig();
return $.post(config.threedsecure_v2_authenticate_payer_url, payload)
.fail(
function (response) {
errorProcessor.process(response, messageContainer);
Expand Down
10 changes: 7 additions & 3 deletions view/frontend/web/js/action/initiate-authentication.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* Copyright (c) 2016-2020 Mastercard
* Copyright (c) 2016-2022 Mastercard
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
Expand All @@ -25,10 +25,14 @@ define(
'use strict';

return {
apiUrl: '/tns/threedsecureV2/initiateAuthentication',
getConfig: function () {
return window.checkoutConfig.payment['tns_hpf'];
},
execute: function (messageContainer) {
var config;

return $.post(this.apiUrl, {})
config = this.getConfig();
return $.post(config.threedsecure_v2_initiate_authentication_url, {})
.fail(
function (response) {
errorProcessor.process(response, messageContainer);
Expand Down

0 comments on commit 35bcd90

Please sign in to comment.