Skip to content

Commit

Permalink
Session Bug Fixed
Browse files Browse the repository at this point in the history
  • Loading branch information
prabalsslw committed Oct 8, 2020
0 parents commit 73edcb4
Show file tree
Hide file tree
Showing 36 changed files with 1,911 additions and 0 deletions.
61 changes: 61 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,61 @@
## SSLCommerz - Magento

SSLCOMMERZ-Online Payment Gateway For Bangladesh

This Module Work for Magento Version 2.3.x

### Installation Steps

Please follow these steps to install the SSLCOMMERZ Payment Gateway module.

Step 1: Download module from Github.

Step 2: Log in to your server using FTP or Cpanel.

Step 3: Upload Sslwireless (Magento 2 Payment Module) inside of app/code dirrectory.

Step 4: Now go to your server root and Upload cacheflush.php, updatemodule.php.

Step 5: Go to browser and run [www.example.com/updatemodule.php] to update your module.

Step 6: Go to browser again and run [www.example.com/cacheflush.php] to flush magento cache.

Step 7: Log in to your Magento admin account.

Step 8: Navigate to STORES > Configuration > ADVANCED > Advanced : and check Sslwireless_Sslcommerz is Disabled or Enabled. If status Disabled then Enable it and Click on Save Config button.

Step 9: Navigate to STORES > Configuration > SALES > Payment Methods > Other Payment Methods: > SSLCommerz Payment Gateway : then follow below steps

- Enabled : Yes (If No then Make it Yes).
- Title : Set your own title what you want to see in checkout page.
- New Order Status : Pending Payment.
- Test Mode : Yes (If No then Make it Yes).
- Allowed Shipping Methods : Your Shipping Methods if have any.
- Store/API ID : Your Valid Store/API ID Provided from SSL Wireless.
- Store/API Password : Your Store/API Password Provided from SSL Wireless.
- Payment from Applicable Countries : Default / If haven't any.
- Payment from Specific Countries : Default / If haven't any.
- Instructions : Your Instructions.
- Sort Order : It can be empty.

Now Click on Save Config button.

Step 10: Navigate to SYSTEM> Cache Management: Select all Cache type and click on Flush Magento Cache. Or you can do step 5 & 6 to update module and flush cache.

Step 11: Now you can test module is working or not. If you can see your payment option at checkout page then you have installed Module successfully :)

Step 12: Do a test transaction.

Thank You!

*** Note : If your are using Magento email service then you can use this module.

For any issue, feel free to contact any time.

- Author : SSLCommerz
- Developed By : Prabal Mallick
- Team-Email: [email protected]
- More info: https://www.sslcommerz.com


© 2019 SSLCOMMERZ ALL RIGHTS RESERVED
37 changes: 37 additions & 0 deletions Sslwireless/Sslcommerz/Block/Form/Sslcommerz.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Sslwireless\Sslcommerz\Block\Form;

/**
* Abstract class for Cash On Delivery and Bank Transfer payment method form
*/
class Sslcommerz extends \Magento\Payment\Block\Form
{
/**
* Instructions text
*
* @var string
*/
protected $_instructions;


// protected $_template = 'form/sslcommerz.phtml';

/**
* Get instructions text from config
*
* @return null|string
*/
public function getInstructions()
{
if ($this->_instructions === null) {
/** @var \Magento\Payment\Model\Method\AbstractMethod $method */
$method = $this->getMethod();
$this->_instructions = $method->getConfigData('instructions');
}
return $this->_instructions;
}
}
93 changes: 93 additions & 0 deletions Sslwireless/Sslcommerz/Block/Notification/Notification.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,93 @@
<?php

namespace Sslwireless\Sslcommerz\Block\Notification;

/**
* Abstract class for Cash On Delivery and Bank Transfer payment method form
*/
use \Magento\Framework\View\Element\Template;


class Notification extends Template
{
protected $Config;

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

/**
* @var \Magento\Customer\Model\Session
*/
protected $_customerSession;

/**
* @var \Magento\Sales\Model\OrderFactory
*/
protected $_orderFactory;

/**
* @var \Magento\Sales\Model\Order\Config
*/
protected $_orderConfig;

/**
* @var \Magento\Framework\App\Http\Context
*/
protected $httpContext;

public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Checkout\Model\Session $checkoutSession,
\Magento\Customer\Model\Session $customerSession,
\Magento\Sales\Model\OrderFactory $orderFactory,
\Magento\Sales\Model\Order\Config $orderConfig,
\Magento\Framework\App\Http\Context $httpContext,
\Sslwireless\Sslcommerz\Model\Sslcommerz $paymentConfig,
array $data = []
) {
parent::__construct($context, $data);
$this->_checkoutSession = $checkoutSession;
$this->_customerSession = $customerSession;
$this->_orderFactory = $orderFactory;
$this->_orderConfig = $orderConfig;
$this->_isScopePrivate = true;
$this->httpContext = $httpContext;
$this->Config = $paymentConfig;
}




protected $_template = 'success/success.phtml';

/**
* Get instructions text from config
*
* @return null|string
*/
public function getSuccessMsg()
{
return $this->Config->getSuccessMsg();
}

// public function getAmount()
// { $orderId = $this->_checkoutSession->getLastOrderId();
// if ($orderId)
// {
// $incrementId = $this->_checkoutSession->getLastRealOrderId();
// return $this->Config->getAmount($incrementId);
// }
// }

// public function getPostData()
// {
// $orderId = $this->_checkoutSession->getLastOrderId();
// if ($orderId)
// {
// $incrementId = $this->_checkoutSession->getLastRealOrderId();
// return $this->Config->getPostData($incrementId);
// }
// }
}
126 changes: 126 additions & 0 deletions Sslwireless/Sslcommerz/Block/Widget/Redirect.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,126 @@
<?php

namespace Sslwireless\Sslcommerz\Block\Widget;

/**
* Abstract class for Cash On Delivery and Bank Transfer payment method form
*/
use \Magento\Framework\View\Element\Template;


class Redirect extends Template
{
protected $Config;

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

/**
* @var \Magento\Customer\Model\Session
*/
protected $_customerSession;

/**
* @var \Magento\Sales\Model\OrderFactory
*/
protected $_orderFactory;

/**
* @var \Magento\Sales\Model\Order\Config
*/
protected $_orderConfig;

/**
* @var \Magento\Framework\App\Http\Context
*/
protected $httpContext;

public function __construct(
\Magento\Framework\View\Element\Template\Context $context,
\Magento\Checkout\Model\Session $checkoutSession,
\Magento\Customer\Model\Session $customerSession,
\Magento\Sales\Model\OrderFactory $orderFactory,
\Magento\Sales\Model\Order\Config $orderConfig,
\Magento\Framework\App\Http\Context $httpContext,
\Sslwireless\Sslcommerz\Model\Sslcommerz $paymentConfig,
array $data = []
) {
parent::__construct($context, $data);
$this->_checkoutSession = $checkoutSession;
$this->_customerSession = $customerSession;
$this->_orderFactory = $orderFactory;
$this->_orderConfig = $orderConfig;
$this->_isScopePrivate = true;
$this->httpContext = $httpContext;
$this->Config = $paymentConfig;
}




protected $_template = 'html/rk.phtml';

/**
* Get instructions text from config
*
* @return null|string
*/
public function getGateUrl(){
return $this->Config->getGateUrl();
}

public function getAmount()
{ $orderId = $this->_checkoutSession->getLastOrderId();
if ($orderId) {
$incrementId = $this->_checkoutSession->getLastRealOrderId();

return $this->Config->getAmount($incrementId);
}
}

public function getPostData()
{
$orderId = $this->_checkoutSession->getLastOrderId();
if ($orderId) {
$incrementId = $this->_checkoutSession->getLastRealOrderId();

return $this->Config->getPostData($incrementId);
}
}

public function getPaymentMethod()
{
return $this->Config->getPaymentMethod();
}

public function getConfigPaymentData()
{
return $this->Config->getConfigPaymentData();
}


// public function getChildHtml($name = '', $useCache = true){
// return "";
// }
// public function getChildHtml($name = '', $useCache = true)
// {
// $payment = $this->getRequest()->getPost('payment');
// $result = "";
// $deviceData = $this->getRequest()->getPost('device_data');

// if (isset($payment["cc_token"]) && $payment["cc_token"]) {
// $ccToken = $payment["cc_token"];
// $result .= "<input type='hidden' name='payment[cc_token]' value='$ccToken'>";
// }
// if (isset($payment['store_in_vault']) && $payment['store_in_vault']) {
// $storeInVault = $payment['store_in_vault'];
// $result .= "<input type='hidden' name='payment[store_in_vault]' value='$storeInVault'>";
// }
// if ($deviceData) {
// $result .= "<input type='hidden' name='device_data' value='$deviceData'>";
// }
// return $result;
// }
}
45 changes: 45 additions & 0 deletions Sslwireless/Sslcommerz/Controller/Payment/Cancel.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,45 @@
<?php
/**
* Copyright © 2015 Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Sslwireless\Sslcommerz\Controller\Payment;
use Magento\Framework\Controller\ResultFactory;

/**
* Responsible for loading page content.
*
* This is a basic controller that only loads the corresponding layout file. It may duplicate other such
* controllers, and thus it is considered tech debt. This code duplication will be resolved in future releases.
*/
class Cancel extends \Magento\Framework\App\Action\Action
{
/** @var \Magento\Framework\View\Result\PageFactory */
protected $resultPageFactory;

public function __construct(
\Magento\Framework\App\Action\Context $context,
\Magento\Framework\View\Result\PageFactory $resultPageFactory
) {
$this->resultPageFactory = $resultPageFactory;
parent::__construct($context);
}
/**
* Load the page defined in view/frontend/layout/samplenewpage_index_index.xml
*
* @return \Magento\Framework\View\Result\Page
*/
public function execute()
{
$paymentMethod = $this->_objectManager->create('Sslwireless\Sslcommerz\Model\Sslcommerz');

$data = $this->getRequest()->getPostValue();
$tran_id = $data['tran_id'];

$paymentMethod->errorAction($tran_id);

$resultRedirect = $this->resultFactory->create(ResultFactory::TYPE_REDIRECT);
return $resultRedirect->setPath('checkout/onepage/failure', ['_secure' => true]);
}
}
Loading

0 comments on commit 73edcb4

Please sign in to comment.