Skip to content

Commit

Permalink
New release 2.1.3
Browse files Browse the repository at this point in the history
  • Loading branch information
Elavarasan Natarajan committed Sep 19, 2019
1 parent 6952d8b commit 7ed6f3f
Show file tree
Hide file tree
Showing 9 changed files with 28 additions and 35 deletions.
3 changes: 1 addition & 2 deletions Controller/Hostedpaymentpage/Jwt.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ public function __construct(

public function execute()
{
//echo 'sanju';exit;
return $this->_pageFactory->create();
return $this->_pageFactory->create();
}
}
Binary file modified Worldpay User Document.pdf
Binary file not shown.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
"magento/module-quote": ">=100.0.0",
"magento/module-vault": ">=100.0.0"
},
"version": "2.1.2",
"version": "2.1.3",
"license":"proprietary",
"autoload":{
"files":[
Expand Down
4 changes: 2 additions & 2 deletions view/frontend/requirejs-config.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,10 +9,10 @@ var config = {
googlePay: 'https://pay.google.com/gp/p/js/pay.js',
hmacSha256: 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/hmac-sha256.js',
encBase64: 'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/components/enc-base64-min.js',
aes:'https://cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js',
"Magento_Checkout/js/sidebar": "Sapient_Worldpay/js/sidebar",
"Magento_Checkout/js/proceed-to-checkout": "Sapient_Worldpay/js/proceed-to-checkout",
"Magento_Checkout/template/minicart/content.html":
"Sapient_Worldpay/template/minicart/content.html",
"Magento_Checkout/template/minicart/content.html": "Sapient_Worldpay/template/minicart/content.html",
"Magento_Checkout/js/view/minicart": "Sapient_Worldpay/js/minicart"
}
}
Expand Down
11 changes: 9 additions & 2 deletions view/frontend/templates/jwtiframe.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@
$params = $this->getRequest()->getParams();
$ccNumber = '';
if($params){
$ccNumber = $params['cardNumber'];
$ccNumber = str_replace(' ', '+',$params['instrument']);
}
$jwtApiKey = $block->getJwtApiKey();
$jwtIssuer = $block->getJwtIssuer();
Expand All @@ -16,13 +16,20 @@ $environmentMode = $block->getEnvironmentMode();
?>

<form method="post" action="<?php echo $ddcUrl;?>" id="collectionForm" name="collectionForm">
<input type="hidden" name="Bin" id="first_bin" value="<?php echo $ccNumber;?>" />
<input type="hidden" name="Bin" id="first_bin" value="" />
<input type="hidden" name="JWT" id="first_jwt" value="" />
</form>

<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"></script>
<script src="//cdnjs.cloudflare.com/ajax/libs/crypto-js/3.1.2/rollups/aes.js"></script>
<script language="Javascript">
//Decrypt bin number
var cNum = "<?php echo $ccNumber?>";
var decrypted = CryptoJS.AES.decrypt(cNum, "123456");
var decodedBin = decrypted.toString(CryptoJS.enc.Utf8);
document.getElementById("first_bin").value = decodedBin;

var header = {
"typ": "JWT",
"alg": "HS256"
Expand Down
8 changes: 4 additions & 4 deletions view/frontend/templates/webpayment.phtml
Original file line number Diff line number Diff line change
Expand Up @@ -233,9 +233,9 @@ $cusToken = 'Bearer ' . $block->getCustomerToken();

request.show().then(function(instrumentResponse) {
orderCode = createOrder(instrumentResponse);
console.log('order created');
console.log(orderCode);
console.log('REDIRECTING');
//console.log('order created');
//console.log(orderCode);
//console.log('REDIRECTING');
if (instrumentResponse && orderCode){
// window.location.href = baseUrl + 'checkout/onepage/success';
window.location.href = baseUrl + 'worldpay/threedsecure/auth';
Expand Down Expand Up @@ -399,7 +399,7 @@ $cusToken = 'Bearer ' . $block->getCustomerToken();
xhttp.setRequestHeader("Authorization", token);
xhttp.send(jsonPaymentDetails);
var orderResponse = JSON.parse(xhttp.responseText);
console.log(orderResponse);
//console.log(orderResponse);

if(isNaN(orderResponse)){
window.location.href = baseUrl + 'checkout/cart?error=true';
Expand Down
2 changes: 1 addition & 1 deletion view/frontend/web/js/proceed-to-checkout.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ define([
onBuyClicked(request);
request = initPaymentRequest();

console.log(request);
//console.log(request);
} else {
location.href = this.options.url.checkout;
}
Expand Down
31 changes: 9 additions & 22 deletions view/frontend/web/js/view/payment/method-renderer/cc-method.js
Original file line number Diff line number Diff line change
Expand Up @@ -17,9 +17,10 @@ define(
'mage/storage',
'Magento_Checkout/js/model/full-screen-loader',
'hmacSha256',
'encBase64'
'encBase64',
'aes'
],
function (Component, $, quote, customer,validator, url, placeOrderAction, redirectOnSuccessAction,ko, setPaymentInformationAction, errorProcessor, urlBuilder, storage, fullScreenLoader, hmacSha256, encBase64) {
function (Component, $, quote, customer,validator, url, placeOrderAction, redirectOnSuccessAction,ko, setPaymentInformationAction, errorProcessor, urlBuilder, storage, fullScreenLoader, hmacSha256, encBase64, aes) {
'use strict';
//Valid card number or not.
var ccTypesArr = ko.observableArray([]);
Expand Down Expand Up @@ -76,7 +77,8 @@ define(

function createJwt(cardNumber){
var bin = cardNumber;
$('body').append('<iframe src="'+jwtUrl+'?cardNumber='+bin+'" name="jwt_frm" id="jwt_frm" style="display: none"></iframe>');
var encryptedBin = CryptoJS.AES.encrypt(bin, "123456");
$('body').append('<iframe src="'+jwtUrl+'?instrument='+encryptedBin+'" name="jwt_frm" id="jwt_frm" style="display: none"></iframe>');
}

// 3DS2 part End
Expand Down Expand Up @@ -410,7 +412,7 @@ define(
}
if (event.origin === envUrl) {
var data = JSON.parse(event.data);
console.warn('Merchant received a message:', data);
//console.warn('Merchant received a message:', data);
if (data !== undefined && data.Status) {
//window.sessionId = data.SessionId;

Expand Down Expand Up @@ -473,7 +475,7 @@ define(
}
if (event.origin === envUrl) {
var data = JSON.parse(event.data);
console.warn('Merchant received a message:', data);
//console.warn('Merchant received a message:', data);
if (data !== undefined && data.Status) {
// window.sessionId = data.SessionId;
window.sessionId = data.SessionId;
Expand All @@ -500,7 +502,7 @@ define(
}
if (event.origin === envUrl) {
var data = JSON.parse(event.data);
console.warn('Merchant received a message:', data);
//console.warn('Merchant received a message:', data);
if (data !== undefined && data.Status) {
//window.sessionId = data.SessionId;

Expand All @@ -522,10 +524,7 @@ define(
}
}else {
return $form.validation() && $form.validation('isValid');
}



}
},
afterPlaceOrder: function (data, event) {
if (this.isSavedCardPayment) {
Expand All @@ -536,18 +535,6 @@ define(
window.location.replace(url.build('worldpay/threedsecure/auth'));
}
},
threeDS2Enabled: function(){
return window.checkoutConfig.payment.ccform.isDynamic3DS2Enabled;
},
jwtIssuer: function(){
return window.checkoutConfig.payment.ccform.isJwtIssuer;
},
organisationalUnitId: function(){
return window.checkoutConfig.payment.ccform.isOrganisationalUnitId;
},
testDdcUrl: function(){
return window.checkoutConfig.payment.ccform.isTestDdcUrl;
},
});
}
);
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,7 @@ define(
})
.catch(function(err) {
// show error in developer console for debugging
console.log('payment client resposnse else condition');
//console.log('payment client resposnse else condition');
console.error(err);
return false;
});
Expand Down

0 comments on commit 7ed6f3f

Please sign in to comment.