Skip to content

Commit

Permalink
Browse files Browse the repository at this point in the history
  • Loading branch information
Laurie Greysky committed Oct 21, 2022
1 parent 45d5525 commit f5ecee6
Show file tree
Hide file tree
Showing 9 changed files with 54 additions and 51 deletions.
1 change: 0 additions & 1 deletion Controller/Hostedpaymentpage/Challenge.php
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,6 @@ public function execute()
$metadata
);
}
$this->getResponse()->setNoCacheHeaders();
return $this->_pageFactory->create();
}
}
1 change: 0 additions & 1 deletion Controller/Hostedpaymentpage/Jwt.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,6 @@ public function __construct(
*/
public function execute()
{
$this->getResponse()->setNoCacheHeaders();
return $this->_pageFactory->create();
}
}
1 change: 0 additions & 1 deletion Controller/Hostedpaymentpage/Pay.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,6 @@ public function execute()
if (!$this->_getStatus()->isInitialised() || !$this->worldpayhelper->isIframeIntegration()) {
return $this->resultRedirectFactory->create()->setPath('checkout/cart', ['_current' => true]);
}
$this->getResponse()->setNoCacheHeaders();
return $this->pageFactory->create();
}

Expand Down
3 changes: 3 additions & 0 deletions Controller/ThreeDSecure/ChallengeAuthResponse.php
Original file line number Diff line number Diff line change
Expand Up @@ -111,6 +111,9 @@ public function execute()

$directOrderParams = $this->checkoutSession->getDirectOrderParams();
$threeDSecureParams = $this->checkoutSession->get3DschallengeData();
if(empty($threeDSecureParams)){
$threeDSecureParams = $this->checkoutSession->get3DS2Config();
}
$this->checkoutSession->unsDirectOrderParams();
$this->checkoutSession->uns3DschallengeData();
try {
Expand Down
2 changes: 1 addition & 1 deletion Logger/AccessWorldpayLogger.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ class AccessWorldpayLogger extends \Monolog\Logger
* @param string $message
* @param array $context
*/
public function addRecord($level, $message, array $context = []) : bool
public function addRecord(int $level, string $message, array $context = [], $datetime = null): bool
{
$ObjectManager = \Magento\Framework\App\ObjectManager::getInstance();
$logEnabled = (bool) $ObjectManager->get(
Expand Down
4 changes: 2 additions & 2 deletions view/frontend/layout/worldpay_hostedpaymentpage_jwt.xml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?xml version="1.0"?>
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="1column" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<page xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" layout="empty" xsi:noNamespaceSchemaLocation="urn:magento:framework:View/Layout/etc/page_configuration.xsd">
<referenceContainer name="content">
<block class="Sapient\AccessWorldpay\Block\Jwt" name="jwt_iframe" template="Sapient_AccessWorldpay::jwtiframe.phtml" />
<block class="Sapient\AccessWorldpay\Block\Jwt" name="jwt_iframe" template="Sapient_AccessWorldpay::jwtiframe.phtml" cacheable="false" />
</referenceContainer>
</page>
88 changes: 46 additions & 42 deletions view/frontend/web/js/view/payment/method-renderer/websdk-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -580,6 +580,7 @@ define(
// $("#SessionAlert").text("Session Expired. Please reload and enter the card details again.");fullScreenLoader.stopLoader(); $('#card-submit').prop('disabled', true); }, 60000);

if (sessionhref) {
fullScreenLoader.startLoader();
if(enteredCCType(document.getElementById("card-form").classList) == 'DINERS-SSL'
|| enteredCCType(document.getElementById("card-form").classList) == 'DANKORT-SSL'
|| !ccTypesEnabled[0].hasOwnProperty(enteredCCType(document.getElementById("card-form").classList))){
Expand All @@ -588,25 +589,26 @@ define(
}
if (self.threeDSEnabled()) {
window.sessionHref = sessionhref;
fullScreenLoader.startLoader();
if(callDdc) {
//window.sessionHref = sessionhref;
self.getDdcUrl();
callDdc = false;

}
if(callDdc) {
//window.sessionHref = sessionhref;
//self.getDdcUrl();
callDdc = false;
}
self.getDdcUrl(function(){
window.addEventListener("message", function(event) {
//fullScreenLoader.startLoader();
var data = JSON.parse(event.data);
//console.warn('Merchant received a message:', data);
if (data !== undefined && data.Status && window.sessionId !== data.SessionId) {
window.sessionId = data.SessionId;
fullScreenLoader.stopLoader();
self.placeOrder();

}
}, false);
fullScreenLoader.stopLoader();
//fullScreenLoader.startLoader();
var data = JSON.parse(event.data);
//console.warn('Merchant received a message:', data);
if (data !== undefined && data.Status && window.sessionId !== data.SessionId) {
window.sessionId = data.SessionId;
fullScreenLoader.stopLoader();
self.placeOrder();

}
}, false);
});

}else{
window.sessionHref = sessionhref;
fullScreenLoader.stopLoader();
Expand All @@ -620,20 +622,19 @@ define(
}
);
},
getDdcUrl : function () {
getDdcUrl : function (callback) {
var payload = {
cartId: quote.getQuoteId(),
paymentData: this.getData()
};
fullScreenLoader.startLoader();
storage.post(
urlBuilder.createUrl('/worldpay/payment/ddcrequest', {}),
JSON.stringify(payload),
true
).done(
function (response) {
createJwt();
fullScreenLoader.stopLoader();
callback();

}
).fail(
Expand Down Expand Up @@ -696,19 +697,21 @@ define(
if (self.threeDSEnabled() ) {
fullScreenLoader.startLoader();
if (callDdc) {
self.getDdcUrl();
//self.getDdcUrl();
callDdc = false;
}
window.addEventListener("message", function(event) {
var data = JSON.parse(event.data);
//console.warn('Merchant received a message:', data);
if (data !== undefined && data.Status) {
window.sessionId = data.SessionId;
fullScreenLoader.stopLoader();
self.placeOrder();
}
}, false);
fullScreenLoader.stopLoader();
self.getDdcUrl(function(){
window.addEventListener("message", function(event) {
var data = JSON.parse(event.data);
//console.warn('Merchant received a message:', data);
if (data !== undefined && data.Status) {
window.sessionId = data.SessionId;
fullScreenLoader.stopLoader();
self.placeOrder();
}
}, false);
});

}else {
fullScreenLoader.stopLoader();
self.placeOrder();
Expand All @@ -732,19 +735,20 @@ define(
if (self.threeDSEnabled() ) {
fullScreenLoader.startLoader();
if (callDdc) {
self.getDdcUrl();
//self.getDdcUrl();
callDdc = false;
}
window.addEventListener("message", function(event) {
var data = JSON.parse(event.data);
//console.warn('Merchant received a message:', data);
if (data !== undefined && data.Status) {
window.sessionId = data.SessionId;
fullScreenLoader.stopLoader();
self.placeOrder();
}
}, false);
fullScreenLoader.stopLoader();
self.getDdcUrl(function(){
window.addEventListener("message", function(event) {
var data = JSON.parse(event.data);
//console.warn('Merchant received a message:', data);
if (data !== undefined && data.Status) {
window.sessionId = data.SessionId;
fullScreenLoader.stopLoader();
self.placeOrder();
}
}, false);
});
}else {
fullScreenLoader.stopLoader();
self.placeOrder();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
<div class="container-cvv">
<section class="container">
<section class="card cvv">
<form class="card__form checkout" id="cvv-form"
data-bind="submit: prepareSavedcardPayment">
<form class="card__form checkout" id="cvv-form">
<section>
<!-- ko if: (hasVerification())-->
<section id="cvv-field" class="card__field card__field--cvv"></section>
Expand Down
2 changes: 1 addition & 1 deletion view/frontend/web/template/payment/websdk.html
Original file line number Diff line number Diff line change
Expand Up @@ -49,7 +49,7 @@
<section class="container websdkField">

<section class="card" id="worldpay_cc-newcard-form">
<form class="checkout" id="card-form" data-bind="submit: preparePayment">
<form class="checkout" id="card-form">
<section class="card__type"></section>


Expand Down

0 comments on commit f5ecee6

Please sign in to comment.