diff --git a/Block/Jwt.php b/Block/Jwt.php
index 735fa30..1864726 100644
--- a/Block/Jwt.php
+++ b/Block/Jwt.php
@@ -25,6 +25,11 @@ public function __construct(
parent::__construct($context);
}
+ public function getJwtApiKey()
+ {
+ return $this->_helper->isJwtApiKey();
+ }
+
public function getJwtIssuer()
{
return $this->_helper->isJwtIssuer();
diff --git a/Controller/ThreeDSecure/Auth.php b/Controller/ThreeDSecure/Auth.php
index 2eae562..1fc87f6 100644
--- a/Controller/ThreeDSecure/Auth.php
+++ b/Controller/ThreeDSecure/Auth.php
@@ -86,7 +86,7 @@ public function execute()
},
"ObjectifyPayload": true
};
- var secret = "fa2daee2-1fbb-45ff-4444-52805d5cd9e0";
+ var secret = "'.$threeDSecureChallengeConfig["jwtApiKey"].'";
var stringifiedHeader = CryptoJS.enc.Utf8.parse(JSON.stringify(header));
var encodedHeader = base64url(stringifiedHeader);
diff --git a/Helper/Data.php b/Helper/Data.php
index 08cd418..6884566 100644
--- a/Helper/Data.php
+++ b/Helper/Data.php
@@ -415,6 +415,13 @@ public function isDynamic3DS2Enabled()
return (bool) $this->_scopeConfig->getValue('worldpay/general_config/enable_dynamic3DS2', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
}
+ public function isJwtApiKey() {
+ if ($this->isDynamic3DS2Enabled()) {
+ return $this->_scopeConfig->getValue('worldpay/general_config/jwt_api_key', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
+ }
+ return (bool) false;
+ }
+
public function isJwtIssuer() {
if ($this->isDynamic3DS2Enabled()) {
return $this->_scopeConfig->getValue('worldpay/general_config/jwt_issuer', \Magento\Store\Model\ScopeInterface::SCOPE_STORE);
diff --git a/Model/Authorisation/DirectService.php b/Model/Authorisation/DirectService.php
index eb46a80..b42eeab 100644
--- a/Model/Authorisation/DirectService.php
+++ b/Model/Authorisation/DirectService.php
@@ -117,8 +117,8 @@ private function _abortIfPaymentError($paymentUpdate)
// get 3ds2 params from the configuration and set to checkout session
public function get3DS2ConfigValues(){
$data = array();
- $data['jwtIssuer'] = $this->worldpayHelper->isJwtIssuer();
-
+ $data['jwtApiKey'] = $this->worldpayHelper->isJwtApiKey();
+ $data['jwtIssuer'] = $this->worldpayHelper->isJwtIssuer();
$data['organisationalUnitId'] = $this->worldpayHelper->isOrganisationalUnitId();
$mode = $this->worldpayHelper->getEnvironmentMode();
diff --git a/Model/Authorisation/TokenService.php b/Model/Authorisation/TokenService.php
index 1875d01..b8a65e3 100644
--- a/Model/Authorisation/TokenService.php
+++ b/Model/Authorisation/TokenService.php
@@ -115,8 +115,8 @@ private function _abortIfPaymentError($paymentUpdate)
// get 3ds2 params from the configuration and set to checkout session
public function get3DS2ConfigValues(){
$data = array();
- $data['jwtIssuer'] = $this->worldpayHelper->isJwtIssuer();
-
+ $data['jwtApiKey'] = $this->worldpayHelper->isJwtApiKey();
+ $data['jwtIssuer'] = $this->worldpayHelper->isJwtIssuer();
$data['organisationalUnitId'] = $this->worldpayHelper->isOrganisationalUnitId();
$mode = $this->worldpayHelper->getEnvironmentMode();
diff --git a/Model/WorldpayConfigProvider.php b/Model/WorldpayConfigProvider.php
index ec6850d..71a08fd 100644
--- a/Model/WorldpayConfigProvider.php
+++ b/Model/WorldpayConfigProvider.php
@@ -170,6 +170,7 @@ public function getConfig()
// 3DS2 Configurations
$config['payment']['ccform']['isDynamic3DS2Enabled'] = $this->worldpayHelper->isDynamic3DS2Enabled();
+ $config['payment']['ccform']['isJwtApiKey'] = $this->worldpayHelper->isJwtApiKey();
$config['payment']['ccform']['isJwtIssuer'] = $this->worldpayHelper->isJwtIssuer();
$config['payment']['ccform']['isOrganisationalUnitId'] = $this->worldpayHelper->isOrganisationalUnitId();
$config['payment']['ccform']['isTestDdcUrl'] = $this->worldpayHelper->isTestDdcUrl();
diff --git a/etc/adminhtml/system.xml b/etc/adminhtml/system.xml
index d3610ef..cae430d 100644
--- a/etc/adminhtml/system.xml
+++ b/etc/adminhtml/system.xml
@@ -65,11 +65,15 @@
Magento\Config\Model\Config\Source\Yesno
-
+
+
+ 1
+
+
1
-
+
1
@@ -77,34 +81,34 @@
1
-
+
1
-
+
1
Magento\Config\Model\Config\Source\Yesno
-
+
1
Sapient\Worldpay\Model\Config\Source\AuthenticationMethods
-
+
1
-
+
1
-
+
1
Sapient\Worldpay\Model\Config\Source\ChallengePreference
-
+
1
Sapient\Worldpay\Model\Config\Source\ChallengeWindowSize
diff --git a/view/frontend/templates/jwtiframe.phtml b/view/frontend/templates/jwtiframe.phtml
index d922628..b1c69e3 100644
--- a/view/frontend/templates/jwtiframe.phtml
+++ b/view/frontend/templates/jwtiframe.phtml
@@ -8,6 +8,7 @@ $ccNumber = '';
if($params){
$ccNumber = $params['cardNumber'];
}
+$jwtApiKey = $block->getJwtApiKey();
$jwtIssuer = $block->getJwtIssuer();
$organisationalUnitId = $block->getOrganisationalUnitId();
$ddcUrl = $block->getDdcUrl();
@@ -35,7 +36,7 @@ $environmentMode = $block->getEnvironmentMode();
"iss": "",
"OrgUnitId": ""
};
- var secret = "fa2daee2-1fbb-45ff-4444-52805d5cd9e0";
+ var secret = "";
var stringifiedHeader = CryptoJS.enc.Utf8.parse(JSON.stringify(header));
var encodedHeader = base64url(stringifiedHeader);