Skip to content

Commit

Permalink
New release 2.1.6
Browse files Browse the repository at this point in the history
  • Loading branch information
elanatar committed Jan 17, 2020
1 parent 7894a6b commit 070d688
Show file tree
Hide file tree
Showing 51 changed files with 970 additions and 185 deletions.
Binary file added .DS_Store
Binary file not shown.
1 change: 1 addition & 0 deletions Block/.LCKChallenge.php~
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C:\xampp\htdocs\worldpay\vendor\sapient\module-worldpay\Block\Challenge.php
70 changes: 70 additions & 0 deletions Block/Challenge.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,70 @@
<?php
namespace Sapient\Worldpay\Block;

use Sapient\Worldpay\Helper\Data;

class Challenge extends \Magento\Framework\View\Element\Template
{
/**
* @var Sapient\Worldpay\Helper\Data;
*/

protected $helper;

/**
* @var \Magento\Checkout\Model\Session
*/
protected $checkoutSession;

/**
* Jwt constructor.
* @param \Magento\Backend\Block\Template\Context $context
* @param \Magento\Checkout\Model\Session $checkoutSession
* @param Data $helper
* @param array $data
*/

public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Magento\Checkout\Model\Session $checkoutSession,
Data $helper,
array $data = []
) {
$this->checkoutSession = $checkoutSession;
$this->_helper = $helper;
parent::__construct($context, $data);
}

public function getJwtIssuer()
{
return $this->_helper->isJwtIssuer();
}

public function getOrganisationalUnitId()
{
return $this->_helper->isOrganisationalUnitId();
}

public function getDdcUrl()
{
$ddcurl = '';
$mode = $this->_helper->getEnvironmentMode();
if($mode == 'Test Mode'){
$ddcurl = $this->_helper->isTestDdcUrl();
} else {
$ddcurl = $this->_helper->isProductionDdcUrl();
}
return $ddcurl;
}

public function challengeConfigs(){
$data['threeDSecureChallengeConfig'] = $this->checkoutSession->get3DS2Config();
$data['threeDSecureChallengeParams'] = $this->checkoutSession->get3Ds2Params();
$data['orderId'] = $this->checkoutSession->getAuthOrderId();
$data['redirectUrl'] = $this->getUrl('worldpay/threedsecure/challengeredirectresponse', ['_secure' => true]);
//$data['redirectUrl'] = $this->getUrl('worldpay/threedsecure/challengeauthresponse', ['_secure' => true]);
return $data;
}


}
32 changes: 32 additions & 0 deletions Block/Checkout/Hpp/ChallengeIframe.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
<?php
/**
* @copyright 2017 Sapient
*/
namespace Sapient\Worldpay\Block\Checkout\Hpp;

class ChallengeIframe extends \Magento\Framework\View\Element\Template
{
/**
* Constructor
*
* @param \Magento\Backend\Block\Template\Context $context
* @param array $data
*/
public function __construct(
\Magento\Backend\Block\Template\Context $context,
\Sapient\Worldpay\Model\Checkout\Hpp\Json\Config\Factory $configfactory,
array $data = []
) {
$this->configfactory = $configfactory;
parent::__construct($context, $data);

}

/**
*
* @return string
*/
public function getRedirectUrl(){
return $this->getUrl('worldpay/threedsecure/challengeauthresponse', ['_secure' => true]);
}
}
10 changes: 10 additions & 0 deletions Block/Form/Card.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,16 @@ public function saveCardEnabled()
{
return $this->configProvider->getIsSaveCardAllowed();
}

public function tokenizationEnabled()
{
return $this->worldpayhelper->getTokenization();
}

public function storedCredentialsEnabled()
{
return $this->worldpayhelper->getStoredCredentials();
}

public function requireCvcEnabled()
{
Expand Down
6 changes: 4 additions & 2 deletions Block/Savedcard.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,8 +44,10 @@ public function getSavedCard()
return false;
}
return $savedCardCollection = $this->_savecard->create()->getCollection()
->addFieldToSelect(array('card_brand','card_number','cardholder_name','card_expiry_month','card_expiry_year'))
->addFieldToFilter('customer_id', array('eq' => $customerId)); ;
->addFieldToSelect(array('card_brand','card_number',
'cardholder_name','card_expiry_month','card_expiry_year',
'transaction_identifier', 'token_code'))
->addFieldToFilter('customer_id', array('eq' => $customerId)); ;
}

/**
Expand Down
1 change: 1 addition & 0 deletions Controller/Hostedpaymentpage/.LCKChallenge.php~
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
C:\xampp\htdocs\worldpay\vendor\sapient\module-worldpay\Controller\Hostedpaymentpage\Challenge.php
19 changes: 19 additions & 0 deletions Controller/Hostedpaymentpage/Challenge.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
<?php
namespace Sapient\Worldpay\Controller\Hostedpaymentpage;

class Challenge extends \Magento\Framework\App\Action\Action
{
protected $_pageFactory;
public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $pageFactory)
{
$this->_pageFactory = $pageFactory;
return parent::__construct($context);
}

public function execute()
{
return $this->_pageFactory->create();
}
}
43 changes: 23 additions & 20 deletions Controller/Savedcard/Delete.php
Original file line number Diff line number Diff line change
Expand Up @@ -78,27 +78,30 @@ public function getStoreId()
public function execute()
{
$id = $this->getRequest()->getParam('id');
if ($id) {
try {
if ($id) {
try {
$model = $this->savecard->create();
$model->load($id);
if ($this->customerSession->getId()==$model->getCustomerId()) {
$tokenDeleteResponse = $this->_tokenService->getTokenDelete(
$model,
$this->customerSession->getCustomer(),
$this->getStoreId());

if ($tokenDeleteResponse->isSuccess()) {
// Delete Worldpay Token.
$this->_applyTokenDelete($model, $this->customerSession->getCustomer());
// Delete Vault Token.
$this->_applyVaultTokenDelete($model, $this->customerSession->getCustomer());
$model->load($id);
if ($this->customerSession->getId() == $model->getCustomerId()) {
if($model->getTokenCode()){
$tokenDeleteResponse = $this->_tokenService->getTokenDelete(
$model,
$this->customerSession->getCustomer(),
$this->getStoreId());
if ($tokenDeleteResponse->isSuccess()) {
// Delete Worldpay Token.
$this->_applyTokenDelete($model, $this->customerSession->getCustomer());
// Delete Vault Token.
$this->_applyVaultTokenDelete($model, $this->customerSession->getCustomer());
}
} else{
$model->delete($id);
}
$this->messageManager->addSuccess(__('Item is deleted successfully'));
} else {
$this->messageManager->addErrorMessage(__('Please try after some time'));
}
} catch (\Exception $e) {
$this->messageManager->addSuccess(__('Item is deleted successfully'));
} else {
$this->messageManager->addErrorMessage(__('Please try after some time'));
}
} catch (\Exception $e) {
$this->wplogger->error($e->getMessage());
if ($this->_tokenNotExistOnWorldpay($e->getMessage())) {
$this->_applyTokenDelete($model, $this->customerSession->getCustomer());
Expand All @@ -111,7 +114,7 @@ public function execute()
}
}
$this->_redirect('worldpay/savedcard/index');
}
}

/**
* @return bool
Expand Down
Loading

0 comments on commit 070d688

Please sign in to comment.