Skip to content

Commit

Permalink
Merge pull request #67 from Worldpay/release-v2.4.2-p0821
Browse files Browse the repository at this point in the history
CodeSniffer updates
  • Loading branch information
chandan-PS authored Aug 25, 2021
2 parents ab2bdf3 + 2cad679 commit 543906d
Show file tree
Hide file tree
Showing 27 changed files with 329 additions and 232 deletions.
4 changes: 2 additions & 2 deletions Block/Checkout/Hpp/Iframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ class Iframe extends \Magento\Framework\View\Element\Template
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/
// @codingStandardsIgnoreLine

public function __construct(
\Magento\Backend\Block\Template\Context $context,
array $data = []
Expand All @@ -23,7 +23,7 @@ public function __construct(
/**
* Disable block output when integration mode is other than iframe
*/
// @codingStandardsIgnoreLine

protected function _beforeToHtml()
{
return parent::_beforeToHtml();
Expand Down
2 changes: 1 addition & 1 deletion Block/Sales/Order/Email/Items/Order/DefaultOrderPlugin.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ public function __construct(\Sapient\Worldpay\Helper\Recurring $recurringHelper)
public function afterGetItemOptions(\Magento\Sales\Block\Order\Email\Items\Order\DefaultOrder $subject, $result)
{

foreach ($subject->getOrder()->getAllItems() as $item) {
foreach ($subject->getOrder()->getAllItems() as $item) {
if ($item->getProductType() == 'grouped') {
return;
}
Expand Down
2 changes: 1 addition & 1 deletion Controller/Adminhtml/Recurring/Plan/Save.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function execute()
{
$data = $this->getRequest()->getPostValue();
//$productId = $this->getRequest()->getParam('product_id');
// @codingStandardsIgnoreLine

$url = parse_url($this->_redirect->getRefererUrl());
$path_parts=explode('/', $url['path']);
if (in_array('id', $path_parts)) {
Expand Down
4 changes: 1 addition & 3 deletions Controller/Applepay/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ public function execute()
define('PRODUCTION_CERTIFICATE_KEY_PASS', $certificationPassword);

define('PRODUCTION_MERCHANTIDENTIFIER', openssl_x509_parse(
// @codingStandardsIgnoreLine
file_get_contents(PRODUCTION_CERTIFICATE_PATH)
)['subject']['UID']);
define('PRODUCTION_DOMAINNAME', $domainName);
Expand All @@ -93,7 +92,7 @@ public function execute()
try {

$validation_url = $this->request->getParam('u');
// @codingStandardsIgnoreStart

if ("https" == parse_url($validation_url, PHP_URL_SCHEME) && substr(
parse_url($validation_url, PHP_URL_HOST),
-10
Expand All @@ -116,7 +115,6 @@ public function execute()
$result = curl_exec($ch);
//var_dump($result);
curl_close($ch);
// @codingStandardsIgnoreEnd

$resultJson = '';

Expand Down
55 changes: 27 additions & 28 deletions Controller/Hostedpaymentpage/Challenge.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,35 +22,34 @@ public function execute()
$skipSameSiteForIOs = $this->worldpayHelper->shouldSkipSameSiteNone($directOrderParams);

//$this->wplogger->info("SKIP same site value--->".print_r($skipSameSiteForIOs,true));
// @codingStandardsIgnoreStart
if($skipSameSiteForIOs) {
if (isset($_COOKIE['PHPSESSID'])) {
$phpsessId = $_COOKIE['PHPSESSID'];
$domain = parse_url($this->_url->getUrl(), PHP_URL_HOST);
setcookie("PHPSESSID", $phpsessId, [
// @codingStandardsIgnoreEnd
'expires' => time() + 3600,
'path' => '/',
'domain' => $domain,
'secure' => true,
'httponly' => true,
]);
}
}else {
if(isset($_COOKIE['PHPSESSID'])){
$phpsessId = $_COOKIE['PHPSESSID'];
$domain = parse_url($this->_url->getUrl(), PHP_URL_HOST);
setcookie("PHPSESSID", $phpsessId, [
'expires' => time() + 3600,
'path' => '/',
'domain' => $domain,
'secure' => true,
'httponly' => true,
'samesite' => 'None',
]);
}

if ($skipSameSiteForIOs) {
if (isset($_COOKIE['PHPSESSID'])) {
$phpsessId = $_COOKIE['PHPSESSID'];
$domain = parse_url($this->_url->getUrl(), PHP_URL_HOST);
setcookie("PHPSESSID", $phpsessId, [

'expires' => time() + 3600,
'path' => '/',
'domain' => $domain,
'secure' => true,
'httponly' => true,
]);
}
} else {
if (isset($_COOKIE['PHPSESSID'])) {
$phpsessId = $_COOKIE['PHPSESSID'];
$domain = parse_url($this->_url->getUrl(), PHP_URL_HOST);
setcookie("PHPSESSID", $phpsessId, [
'expires' => time() + 3600,
'path' => '/',
'domain' => $domain,
'secure' => true,
'httponly' => true,
'samesite' => 'None',
]);
}
}
// @codingStandardsIgnoreEnd

return $this->_pageFactory->create();
}
Expand Down
2 changes: 1 addition & 1 deletion Controller/Notification/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,7 +91,7 @@ public function execute()
public function _getRawBody()
{
if (null === $this->_rawBody) {
// @codingStandardsIgnoreLine

$body = file_get_contents('php://input');

if (strlen(trim($body)) > 0) {
Expand Down
2 changes: 1 addition & 1 deletion Controller/Redirectresult/Iframe.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function execute()
$currenturl = $this->_url->getCurrentUrl();
$redirecturl = str_replace("iframe/status/", "", $currenturl);
}
// @codingStandardsIgnoreLine

print_r('<script>window.top.location.href = "'.$redirecturl.'";</script>');
}

Expand Down
3 changes: 1 addition & 2 deletions Controller/Samsungpay/CallBack.php
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ public function execute()

if ($refId != '') {
try {
// @codingStandardsIgnoreStart

$curl = curl_init();

curl_setopt_array($curl, [
Expand All @@ -124,7 +124,6 @@ public function execute()

$json = curl_exec($curl);
curl_close($curl);
// @codingStandardsIgnoreEnd

$response = json_decode($json, true);

Expand Down
4 changes: 2 additions & 2 deletions Controller/Samsungpay/Index.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ public function execute()
$postFieldsJson = (json_encode($postFields));

try {
// @codingStandardsIgnoreStart

$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => $serviceUrl,
Expand All @@ -123,7 +123,7 @@ public function execute()
$response = curl_exec($curl);

curl_close($curl);
// @codingStandardsIgnoreEnd

$resultJson = '';
$resultJson = $this->resultFactory->create(ResultFactory::TYPE_JSON);
$resultJson->setData($response);
Expand Down
4 changes: 2 additions & 2 deletions Controller/Savedcard/AddnewcardPost.php
Original file line number Diff line number Diff line change
Expand Up @@ -578,7 +578,7 @@ protected function _getPaymentModel()
public function createEmptyQuote($tokenKey)
{
$token = 'Bearer '.$tokenKey;
// @codingStandardsIgnoreStart

$curl = curl_init();
$apiUrl = $this->_storeManager->getStore()->getUrl('rest/default/V1/carts/mine');
curl_setopt_array($curl, [
Expand All @@ -603,7 +603,7 @@ public function createEmptyQuote($tokenKey)
]);
$response = curl_exec($curl);
curl_close($curl);
// @codingStandardsIgnoreEnd

return $response;
}
}
70 changes: 35 additions & 35 deletions Controller/ThreeDSecure/Auth.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,38 +55,38 @@ public function execute()
$orderId = $this->checkoutSession->getAuthOrderId();
$iframe = false;
// Chrome 84 releted updates for 3DS
// @codingStandardsIgnoreStart

$skipSameSiteForIOs = $this->worldpayHelper->shouldSkipSameSiteNone($directOrderParams);
//$this->wplogger->info("SKIP same site value--->".print_r($skipSameSiteForIOs,true));
if($skipSameSiteForIOs) {
$this->wplogger->info("Inside skip same site block");
if (isset($_COOKIE['PHPSESSID'])) {
$phpsessId = $_COOKIE['PHPSESSID'];
$domain = parse_url($this->_url->getUrl(), PHP_URL_HOST);
setcookie("PHPSESSID", $phpsessId, [
// @codingStandardsIgnoreEnd
'expires' => time() + 3600,
'path' => '/',
'domain' => $domain,
'secure' => true,
'httponly' => true,
]);
}
}else {
$this->wplogger->info("Outside skip same site block");
//$this->wplogger->info("SKIP same site value--->".print_r($skipSameSiteForIOs,true));
if ($skipSameSiteForIOs) {
$this->wplogger->info("Inside skip same site block");
if (isset($_COOKIE['PHPSESSID'])) {
$phpsessId = $_COOKIE['PHPSESSID'];
$domain = parse_url($this->_url->getUrl(), PHP_URL_HOST);
setcookie("PHPSESSID", $phpsessId, [

'expires' => time() + 3600,
'path' => '/',
'domain' => $domain,
'secure' => true,
'httponly' => true,
]);
}
} else {
$this->wplogger->info("Outside skip same site block");

if(isset($_COOKIE['PHPSESSID'])){
$phpsessId = $_COOKIE['PHPSESSID'];
$domain = parse_url($this->_url->getUrl(), PHP_URL_HOST);
setcookie("PHPSESSID", $phpsessId, [
'expires' => time() + 3600,
'path' => '/',
'domain' => $domain,
'secure' => true,
'httponly' => true,
'samesite' => 'None',
]);
}
if (isset($_COOKIE['PHPSESSID'])) {
$phpsessId = $_COOKIE['PHPSESSID'];
$domain = parse_url($this->_url->getUrl(), PHP_URL_HOST);
setcookie("PHPSESSID", $phpsessId, [
'expires' => time() + 3600,
'path' => '/',
'domain' => $domain,
'secure' => true,
'httponly' => true,
'samesite' => 'None',
]);
}
}
//setcookie("PHPSESSID", $phpsessId, time() + 3600, "/; SameSite=None; Secure;");

Expand All @@ -101,13 +101,13 @@ public function execute()
// $phpsessId = $_COOKIE['PHPSESSID'];
// setcookie("PHPSESSID", $phpsessId, time() + 3600, "/; SameSite=None; Secure;");
$responseUrl = $this->_url->getUrl('worldpay/threedsecure/authresponse', ['_secure' => true]);
// @codingStandardsIgnoreLine

print_r('
<form name="theForm" id="form" method="POST" action=' . $redirectData->getUrl() . '>
<input type="hidden" name="PaReq" value=' . $redirectData->getPaRequest() . ' />
<input type="hidden" name="TermUrl" value=' . $responseUrl . ' />
</form>');
// @codingStandardsIgnoreLine

print_r('
<script language="Javascript">
document.getElementById("form").submit();
Expand All @@ -116,7 +116,7 @@ public function execute()
if ($iframe) {
$challengeUrl = $this->_url->getUrl("worldpay/hostedpaymentpage/challenge");
$imageurl = $this->_assetRepo->getUrl("Sapient_Worldpay::images/cc/worldpay_logo.png");
// @codingStandardsIgnoreLine

print_r('
<div id="challenge_window">
<div class="image-content" style="text-align: center;">
Expand All @@ -134,7 +134,7 @@ public function execute()
');
} else {
$authUrl = $this->_url->getUrl('worldpay/threedsecure/ChallengeAuthResponse', ['_secure' => true]);
// @codingStandardsIgnoreLine

print_r('
<form name= "challengeForm" id="challengeForm"
method= "POST"
Expand All @@ -150,7 +150,7 @@ public function execute()
back to the return URL after challenge complete
-->
</form>');
// @codingStandardsIgnoreLine

print_r('
<script src="//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/hmac-sha256.js"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/enc-base64-min.js">
Expand Down
Loading

0 comments on commit 543906d

Please sign in to comment.