';
+ break;
+ }
+ }
+ $order = $this->getOrderById($result[0]['order_id']);
+ if($responseParamList['STATUS']=='TXN_SUCCESS'){
+ $autoInvoice = $this->getPaytmModel()->autoInvoiceGen();
+ if($autoInvoice=='authorize_capture'){
+ $payment = $order->getPayment();
+ $payment->setTransactionId($responseParamList['TXNID'])
+ ->setPreparedMessage(__('Paytm transaction has been successful.'))
+ ->setShouldCloseParentTransaction(true)
+ ->setIsTransactionClosed(0)
+ ->setAdditionalInformation(['One97','paytm'])
+ ->registerCaptureNotification(
+ $responseParamList['TXNAMOUNT'],
+ true
+ );
+ $invoice = $payment->getCreatedInvoice();
+ }
+ $comment = "Transaction has marked as successfull by checkStatus API.";
+ $order->setState("complete");
+ $order->setStatus($this->_paytmModel->getSuccessOrderStatus());
+ $order->setExtOrderId($result[0]['paytm_order_id']);
+ $order->addStatusToHistory($order->getStatus(), $comment);
+ $order->save();
+ $response=true;
+ }else if($responseParamList['STATUS']=="TXN_FAILURE"){
+ $comment = $responseParamList['RESPMSG'];
+ $order->setState("canceled")->setStatus($this->_paytmModel->getFailOrderStatus());
+ $order->addStatusToHistory($order->getStatus(), $comment);
+ $order->save();
+ }
+ }
+ }
+ }
+
+ $resultJson = $this->resultJsonFactory->create();
+ return $resultJson->setData(['response' => $response,'responseTableBody' => $responseTableBody]);
+ }
+ }
+?>
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/Controller/Standard/Redirect.php b/Magento_V2.3x/app/code/One97/Paytm/Controller/Standard/Redirect.php
new file mode 100755
index 0000000..e9f7e82
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/Controller/Standard/Redirect.php
@@ -0,0 +1,50 @@
+getOrder();
+ if ($order->getBillingAddress()) {
+ $order->setState("pending_payment")->setStatus("pending_payment");
+ $order->addStatusToHistory($order->getStatus(), "Customer was redirected to paytm.");
+ $order->save();
+ if($promo!=''){
+ $order->paytmPromoCode=$promo;
+ }
+ $data['inputForm']=$this->_paytmModel->buildPaytmRequest($order);
+ $data['actionURL']=$this->_paytmModel->getRedirectUrl();
+ $resultPage = $this->resultPageFactory->create();
+ $resultPage->getLayout()->initMessages();
+ $resultPage->getLayout()->getBlock('paytm_standard_redirect')->setName($data);
+ return $resultPage;
+ } else {
+ $this->_cancelPayment();
+ $this->_paytmSession->restoreQuote();
+ $this->getResponse()->setRedirect(
+ $this->getPaytmHelper()->getUrl('checkout')
+ );
+ }
+ }
+ }
+?>
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/Controller/Standard/Response.php b/Magento_V2.3x/app/code/One97/Paytm/Controller/Standard/Response.php
new file mode 100755
index 0000000..a37f523
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/Controller/Standard/Response.php
@@ -0,0 +1,220 @@
+ $val){
+ if($key != "CHECKSUMHASH"){
+ $comment .= $key . "=" . $val . ", \n ";
+ }
+ }
+ }
+
+ // var_dump($this->getPaytmHelper()::SAVE_PAYTM_RESPONSE);die;
+ $errorMsg = '';
+ $successFlag = false;
+ $resMessage=$this->getRequest()->getParam('RESPMSG');
+ $globalErrMass="Your payment has been failed!";
+ if(trim($resMessage)!=''){
+ $globalErrMass.=" Reason: ".$resMessage;
+ }
+ $returnUrl = $this->getPaytmHelper()->getUrl('/');
+ $orderMID = $this->getRequest()->getParam('MID');
+ $paytmOrderId = $this->getRequest()->getParam('ORDERID');
+ $magentoOrderIdArr=explode('_', $paytmOrderId);
+ $magentoOrderId=$magentoOrderIdArr[0];
+ $orderTXNID = $this->getRequest()->getParam('TXNID');
+ $paytmResponse=$this->getRequest()->getParams();
+ $paytmJsonResponse=json_encode($paytmResponse);
+
+ if(trim($paytmOrderId)!='' && trim($orderMID)!=''){
+ $order = $this->getOrderById($magentoOrderId);
+ $orderTotal = round($order->getGrandTotal(), 2);
+ $orderStatus = $this->getRequest()->getParam('STATUS');
+ $resCode = $this->getRequest()->getParam('RESPCODE');
+ $orderTxnAmount = $this->getRequest()->getParam('TXNAMOUNT');
+ $transactionResponse="";
+ $paytmJsonResponseOnPending='';
+ if($this->getPaytmModel()->validateResponse($request, $magentoOrderId)) {
+ if($this->getPaytmHelper()::SAVE_PAYTM_RESPONSE){
+ $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
+ $objDate = $objectManager->create('Magento\Framework\Stdlib\DateTime\DateTime');
+ $date = $objDate->gmtDate();
+ $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
+ $tableName = $resource->getTableName('paytm_order_data');
+ $sql = "UPDATE ".$tableName." SET transaction_id='".$orderTXNID."', paytm_response='".$paytmJsonResponse."', date_modified='".$date."' WHERE order_id='".$magentoOrderId."' AND paytm_order_id='".$paytmOrderId."'";
+ $this->updateTable($sql);
+ }
+ if($orderStatus == "TXN_SUCCESS"){
+ $requestParamList = array("MID" => $orderMID , "ORDERID" => $paytmOrderId);
+ $responseParamList=$this->checkStatusCall($requestParamList);
+ if(isset($responseParamList['STATUS'])){
+ if($responseParamList['STATUS'] == "PENDING"){
+ $transactionResponse="PENDING";
+ }else{
+ if($responseParamList['STATUS']=='TXN_SUCCESS' && $responseParamList['TXNAMOUNT']==$orderTxnAmount) {
+ $transactionResponse="PROCESSING";
+ } else{
+ $transactionResponse="CANCELED";
+ }
+ }
+ }else{
+ $transactionResponse="FRAUD";
+ }
+ }else{
+ if($orderStatus == "PENDING"){
+ $requestParamList = array("MID" => $orderMID , "ORDERID" => $paytmOrderId);
+ $responseParamList=$this->checkStatusCall($requestParamList);
+ if(isset($responseParamList['STATUS'])){
+ if($responseParamList['STATUS'] == "PENDING"){
+ $transactionResponse="PENDING";
+ }else{
+ if($responseParamList['STATUS']=='TXN_SUCCESS' && $responseParamList['TXNAMOUNT']==$orderTxnAmount) {
+ $transactionResponse="PROCESSING";
+ $paytmJsonResponseOnPending=json_encode($responseParamList);
+ } else{
+ $transactionResponse="CANCELED";
+ }
+ }
+ }else{
+ $transactionResponse="FRAUD";
+ }
+ }else{
+ $transactionResponse="CANCELED";
+ }
+ }
+ } else {
+ $transactionResponse="FRAUD_CHECKSUM_MISMATCH";
+ }
+
+ switch ($transactionResponse) {
+ case 'FRAUD':
+ $errorMsg = 'It seems some issue in server to server communication. Kindly connect with administrator.';
+ $comment .= "Fraud Detucted";
+ $order->setStatus($order::STATUS_FRAUD);
+ $returnUrl = $this->getPaytmHelper()->getUrl('checkout/onepage/failure');
+ break;
+ case "FRAUD_CHECKSUM_MISMATCH":
+ $errorMsg = $globalErrMass." Reason: Checksum Mismatch.";
+ $comment .= "Fraud Detucted";
+ $order->setState("canceled")->setStatus($order::STATUS_FRAUD);
+ $returnUrl = $this->getPaytmHelper()->getUrl('checkout/onepage/failure');
+ break;
+ case "CANCELED":
+ if($orderStatus == "PENDING"){
+ $errorMsg = 'Paytm Transaction Pending!';
+ if(trim($resMessage)==''){
+ $errorMsg.=" Reason: ".$resMessage;
+ }
+ $comment .= "Pending";
+ $order->setState("pending_payment")->setStatus("pending_payment");
+ }else{
+ $this->getPaytmHelper()->updateStockQty($order);
+ $errorMsg = $globalErrMass;
+ $comment .= $globalErrMass;
+ $order->setState("canceled")->setStatus($this->_paytmModel->getFailOrderStatus());
+ }
+ $returnUrl = $this->getPaytmHelper()->getUrl('checkout/onepage/failure');
+ break;
+ case "PROCESSING":
+ $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
+ $tableName = $resource->getTableName('paytm_order_data');
+ $paytmJsonResponseOnPending==''?$sql="UPDATE ".$tableName." SET status='1' WHERE order_id='".$magentoOrderId."' AND paytm_order_id='".$paytmOrderId."'":$sql = "UPDATE ".$tableName." SET status='1', paytm_response='".$paytmJsonResponseOnPending."' WHERE order_id='".$magentoOrderId."' AND paytm_order_id='".$paytmOrderId."'";
+ if($this->getPaytmHelper()::SAVE_PAYTM_RESPONSE){
+ $this->updateTable($sql);
+ }
+ $autoInvoice = $this->getPaytmModel()->autoInvoiceGen();
+ if($autoInvoice=='authorize_capture'){
+ $payment = $order->getPayment();
+ $payment->setTransactionId($orderTXNID)
+ ->setPreparedMessage(__('Paytm transaction has been successful.'))
+ ->setShouldCloseParentTransaction(true)
+ ->setIsTransactionClosed(0)
+ ->setAdditionalInformation(['One97','paytm'])
+ ->registerCaptureNotification(
+ $responseParamList['TXNAMOUNT'],
+ true
+ );
+ $invoice = $payment->getCreatedInvoice();
+ }
+ $successFlag = true;
+ $comment .= "Success ";
+ $order->setState("complete");
+ $order->setStatus($this->_paytmModel->getSuccessOrderStatus());
+ $order->setExtOrderId($paytmOrderId);
+ $returnUrl = $this->getPaytmHelper()->getUrl('checkout/onepage/success');
+ break;
+ case "PENDING":
+ $errorMsg = 'Paytm Transaction Pending!';
+ if(trim($resMessage)==''){
+ $errorMsg.=" Reason: ".$resMessage;
+ }
+ $comment .= "Pending";
+ $order->setState("pending_payment")->setStatus("pending_payment");
+ $returnUrl = $this->getPaytmHelper()->getUrl('checkout/onepage/failure');
+ break;
+
+ default:
+ # code...
+ break;
+ }
+ $order->addStatusToHistory($order->getStatus(), $comment);
+ $order->save();
+ if($successFlag){
+ $this->messageManager->addSuccess( __('Paytm transaction has been successful.') );
+ }else{
+ $this->messageManager->addError( __($errorMsg) );
+ }
+ }
+ $this->getResponse()->setRedirect($returnUrl);
+ }
+
+ /* Paytm transaction status S2S call */
+ public function checkStatusCall($requestParamList){
+ $response=array();
+ if(!empty($requestParamList)){
+ $StatusCheckSum = $this->getPaytmModel()->generateStatusChecksum($requestParamList);
+ $requestParamList['CHECKSUMHASH'] = $StatusCheckSum;
+ $check_status_url = $this->getPaytmModel()->getNewStatusQueryUrl();
+ $responseParamList=array();
+ $retry = $this->getPaytmHelper()::MAX_RETRY_COUNT;
+ do{
+ $response = $this->getPaytmHelper()->executecUrl($check_status_url, $requestParamList);
+ $retry++;
+ } while(empty($response) && $retry < $retry);
+ }
+ return $response;
+ }
+
+ public function updateTable($sql){
+ $updateDone=false;
+ if(trim($sql)!=''){
+ $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
+ $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
+ $connection = $resource->getConnection();
+ $sql = $sql;
+ $connection->query($sql);
+ $updateDone=true;
+ }
+ return $updateDone;
+ }
+ }
+?>
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/Helper/Data.php b/Magento_V2.3x/app/code/One97/Paytm/Helper/Data.php
new file mode 100755
index 0000000..d7c8fdc
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/Helper/Data.php
@@ -0,0 +1,261 @@
+session = $session;
+ $this->stockRegistry = $stockRegistry;
+ parent::__construct($context);
+ }
+
+ public function updateStockQty($order) {
+ $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
+ $stockItem = $objectManager->create('\Magento\CatalogInventory\Model\Stock\StockItemRepository');
+ $orderItems = $order->getAllItems();
+ foreach ($orderItems as $item) {
+ $product_id = $item->getProductId();
+
+ $sku = $item->getSku();
+ $current_qty = $this->stockRegistry->getStockItemBySku($sku)->getQty();
+ $order_qty = (int)$item->getQtyOrdered();
+ $update_stock_qty = $current_qty + $order_qty;
+
+ $stockItem = $this->stockRegistry->getStockItemBySku($sku);
+ $stockItem->setQty($update_stock_qty);
+ $stockItem->setIsInStock((bool)$update_stock_qty); // this line
+ $this->stockRegistry->updateStockItemBySku($sku, $stockItem);
+ }
+ }
+
+ public function cancelCurrentOrder($comment) {
+ $order = $this->session->getLastRealOrder();
+ if ($order->getId() && $order->getState() != Order::STATE_CANCELED) {
+ $order->registerCancellation($comment)->save();
+ return true;
+ }
+ return false;
+ }
+
+ public function restoreQuote() {
+ return $this->session->restoreQuote();
+ }
+
+ public function getUrl($route, $params = []) {
+ return $this->_getUrl($route, $params);
+ }
+
+ // PaytmChecksum.php start
+ private static $iv = "@@@@&&&###$$$$";
+
+ static public function encrypt($input, $key) {
+ $key = html_entity_decode($key);
+
+ if(function_exists('openssl_encrypt')){
+ $data = openssl_encrypt ( $input , "AES-128-CBC" , $key, 0, self::$iv );
+ } else {
+ $size = mcrypt_get_block_size(MCRYPT_RIJNDAEL_128, 'cbc');
+ $input = self::pkcs5Pad($input, $size);
+ $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', '');
+ mcrypt_generic_init($td, $key, self::$iv);
+ $data = mcrypt_generic($td, $input);
+ mcrypt_generic_deinit($td);
+ mcrypt_module_close($td);
+ $data = base64_encode($data);
+ }
+ return $data;
+ }
+
+ static public function decrypt($encrypted, $key) {
+ $key = html_entity_decode($key);
+
+ if(function_exists('openssl_decrypt')){
+ $data = openssl_decrypt ( $encrypted , "AES-128-CBC" , $key, 0, self::$iv );
+ } else {
+ $encrypted = base64_decode($encrypted);
+ $td = mcrypt_module_open(MCRYPT_RIJNDAEL_128, '', 'cbc', '');
+ mcrypt_generic_init($td, $key, self::$iv);
+ $data = mdecrypt_generic($td, $encrypted);
+ mcrypt_generic_deinit($td);
+ mcrypt_module_close($td);
+ $data = self::pkcs5Unpad($data);
+ $data = rtrim($data);
+ }
+ return $data;
+ }
+
+ static public function generateSignature($params, $key) {
+ if(!is_array($params) && !is_string($params)){
+ throw new Exception("string or array expected, ".gettype($params)." given");
+ }
+ if(is_array($params)){
+ $params = self::getStringByParams($params);
+ }
+ return self::generateSignatureByString($params, $key);
+ }
+
+ static public function verifySignature($params, $key, $checksum){
+ if(!is_array($params) && !is_string($params)){
+ throw new Exception("string or array expected, ".gettype($params)." given");
+ }
+ if(is_array($params)){
+ $params = self::getStringByParams($params);
+ }
+ return self::verifySignatureByString($params, $key, $checksum);
+ }
+
+ static private function generateSignatureByString($params, $key){
+ $salt = self::generateRandomString(4);
+ return self::calculateChecksum($params, $key, $salt);
+ }
+
+ static private function verifySignatureByString($params, $key, $checksum){
+ $paytm_hash = self::decrypt($checksum, $key);
+ $salt = substr($paytm_hash, -4);
+ return $paytm_hash == self::calculateHash($params, $salt) ? true : false;
+ }
+
+ static private function generateRandomString($length) {
+ $random = "";
+ srand((double) microtime() * 1000000);
+
+ $data = "9876543210ZYXWVUTSRQPONMLKJIHGFEDCBAabcdefghijklmnopqrstuvwxyz!@#$&_";
+
+ for ($i = 0; $i < $length; $i++) {
+ $random .= substr($data, (rand() % (strlen($data))), 1);
+ }
+
+ return $random;
+ }
+
+ static private function getStringByParams($params) {
+ ksort($params);
+ $params = array_map(function ($value){
+ return ($value == null) ? "" : $value;
+ }, $params);
+ return implode("|", $params);
+ }
+
+ static private function calculateHash($params, $salt){
+ $finalString = $params . "|" . $salt;
+ $hash = hash("sha256", $finalString);
+ return $hash . $salt;
+ }
+
+ static private function calculateChecksum($params, $key, $salt){
+ $hashString = self::calculateHash($params, $salt);
+ return self::encrypt($hashString, $key);
+ }
+
+ static private function pkcs5Pad($text, $blocksize) {
+ $pad = $blocksize - (strlen($text) % $blocksize);
+ return $text . str_repeat(chr($pad), $pad);
+ }
+
+ static private function pkcs5Unpad($text) {
+ $pad = ord($text{strlen($text) - 1});
+ if ($pad > strlen($text))
+ return false;
+ return substr($text, 0, -1 * $pad);
+ }
+ // PaytmChecksum.php end
+
+ // PaytmHelper.php start
+ /**
+ * exclude timestap with order id
+ */
+ public static function getTransactionURL($isProduction = 0){
+ if($isProduction == 1){
+ return Data::TRANSACTION_URL_PRODUCTION;
+ }else{
+ return Data::TRANSACTION_URL_STAGING;
+ }
+ }
+ /**
+ * exclude timestap with order id
+ */
+ public static function getTransactionStatusURL($isProduction = 0){
+ if($isProduction == 1){
+ return Data::TRANSACTION_STATUS_URL_PRODUCTION;
+ }else{
+ return Data::TRANSACTION_STATUS_URL_STAGING;
+ }
+ }
+
+ public static function getcURLversion(){
+ if(function_exists('curl_version')){
+ $curl_version = curl_version();
+ if(!empty($curl_version['version'])){
+ return $curl_version['version'];
+ }
+ }
+ return false;
+ }
+
+ public static function executecUrl($apiURL, $requestParamList) {
+ $responseParamList = array();
+ $JsonData = json_encode($requestParamList);
+ $postData = 'JsonData='.urlencode($JsonData);
+ $ch = curl_init($apiURL);
+ curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
+ curl_setopt($ch, CURLOPT_CONNECTTIMEOUT, Data::CONNECT_TIMEOUT);
+ curl_setopt($ch, CURLOPT_TIMEOUT, Data::TIMEOUT);
+
+ /*
+ ** default value is 2 and we also want to use 2
+ ** so no need to specify since older PHP version might not support 2 as valid value
+ ** see https://curl.haxx.se/libcurl/c/CURLOPT_SSL_VERIFYHOST.html
+ */
+ // curl_setopt ($ch, CURLOPT_SSL_VERIFYHOST, 2);
+
+ // TLS 1.2 or above required
+ // curl_setopt($ch, CURLOPT_SSLVERSION, CURL_SSLVERSION_TLSv1_2);
+
+ curl_setopt($ch, CURLOPT_HTTPHEADER, array(
+ 'Content-Type: application/json',
+ 'Content-Length: ' . strlen($postData))
+ );
+ $jsonResponse = curl_exec($ch);
+
+ if (!curl_errno($ch)) {
+ return json_decode($jsonResponse, true);
+ } else {
+ return false;
+ }
+ }
+ // PaytmHelper.php start
+ }
+?>
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/Model/EnvAction.php b/Magento_V2.3x/app/code/One97/Paytm/Model/EnvAction.php
new file mode 100755
index 0000000..25bdd86
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/Model/EnvAction.php
@@ -0,0 +1,13 @@
+ '0', 'label' => __('Staging')], ['value' => '1', 'label' => __('Production')]];
+ }
+
+ public function toArray() {
+ return [0 => __('No'), 1 => __('Yes')];
+ }
+ }
+?>
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/Model/PaymentAction.php b/Magento_V2.3x/app/code/One97/Paytm/Model/PaymentAction.php
new file mode 100755
index 0000000..d405307
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/Model/PaymentAction.php
@@ -0,0 +1,13 @@
+ 'authorize_capture', 'label' => __('Yes')], ['value' => 'capture', 'label' => __('No')]];
+ }
+
+ public function toArray() {
+ return [0 => __('No'), 1 => __('Yes')];
+ }
+ }
+?>
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/Model/Paytm.php b/Magento_V2.3x/app/code/One97/Paytm/Model/Paytm.php
new file mode 100755
index 0000000..069cb6a
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/Model/Paytm.php
@@ -0,0 +1,199 @@
+helper = $helper;
+ parent::__construct(
+ $context,
+ $registry,
+ $extensionFactory,
+ $customAttributeFactory,
+ $paymentData,
+ $scopeConfig,
+ $logger
+ );
+ $this->_minAmount = "0.50";
+ $this->_maxAmount = "1000000";
+ $this->urlBuilder = $urlBuilder;
+ }
+
+ public function initialize($paymentAction, $stateObject) {
+ $payment = $this->getInfoInstance();
+ $order = $payment->getOrder();
+ $order->setCanSendNewEmailFlag(false);
+ $stateObject->setState(\Magento\Sales\Model\Order::STATE_PENDING_PAYMENT);
+ $stateObject->setStatus('pending_payment');
+ $stateObject->setIsNotified(false);
+ }
+
+ /* this function check ammount limit */
+ public function isAvailable(\Magento\Quote\Api\Data\CartInterface $quote = null) {
+ if ($quote && (
+ $quote->getBaseGrandTotal() < $this->_minAmount || ($this->_maxAmount && $quote->getBaseGrandTotal() > $this->_maxAmount))
+ ) {
+ return false;
+ }
+ return parent::isAvailable($quote);
+ }
+
+ /* this function for currency check*/
+ public function canUseForCurrency($currencyCode) {
+ if (!in_array($currencyCode, $this->_supportedCurrencyCodes)) {
+ return false;
+ }
+ return true;
+ }
+
+ /* this function return Paytm redirect form post */
+ public function buildPaytmRequest($order) {
+ $paytmOrderId=$magentoOrderId=$order->getRealOrderId();
+ if($this->helper::APPEND_TIMESTAMP){
+ $paytmOrderId=$magentoOrderId.'_'.time();
+ }
+
+ if($this->helper::SAVE_PAYTM_RESPONSE){
+ $objectManager = \Magento\Framework\App\ObjectManager::getInstance();
+
+ $objDate = $objectManager->create('Magento\Framework\Stdlib\DateTime\DateTime');
+ $date = $objDate->gmtDate();
+
+ $resource = $objectManager->get('Magento\Framework\App\ResourceConnection');
+ $connection = $resource->getConnection();
+
+ $tableName = $resource->getTableName('paytm_order_data');
+ if(!$connection->isTableExists($tableName)){
+ $sql = "CREATE TABLE ".$tableName."(id INT(11) PRIMARY KEY AUTO_INCREMENT, order_id TEXT NOT NULL, paytm_order_id TEXT NOT NULL, transaction_id TEXT, status TINYINT(1) DEFAULT '0', paytm_response TEXT, date_added DATETIME, date_modified DATETIME )";
+ $connection->query($sql);
+ }
+ $tableName = $resource->getTableName('paytm_order_data');
+ $sql = "INSERT INTO ".$tableName."(order_id, paytm_order_id, date_added, date_modified) VALUES ('".$magentoOrderId."', '".$paytmOrderId."', '".$date."', '".$date."')";
+ $connection->query($sql);
+ }
+
+ $callBackUrl=$this->urlBuilder->getUrl('paytm/Standard/Response', ['_secure' => true]);
+ if($this->helper::CUSTOM_CALLBACK_URL!=''){
+ $callBackUrl=$this->helper::CUSTOM_CALLBACK_URL;
+ }
+ if($this->getConfigData("custom_callbackurl")=='1'){
+ $callBackUrl=$this->getConfigData("callback_url")!=''?$this->getConfigData("callback_url"):$callBackUrl;
+ }
+ $params = array(
+ 'MID' => trim($this->getConfigData("MID")),
+ 'TXN_AMOUNT' => round($order->getGrandTotal(), 2),
+ 'CHANNEL_ID' => $this->helper::CHANNEL_ID,
+ 'INDUSTRY_TYPE_ID' => trim($this->getConfigData("Industry_id")),
+ 'WEBSITE' => trim($this->getConfigData("Website")),
+ 'CUST_ID' => $order->getCustomerEmail(),
+ 'ORDER_ID' => $paytmOrderId,
+ 'EMAIL' => $order->getCustomerEmail(),
+ 'CALLBACK_URL' => trim($callBackUrl)
+ );
+ if(isset($order->paytmPromoCode)){
+ $params['PROMO_CAMP_ID']=$order->paytmPromoCode;
+ }
+ $checksum = $this->helper->generateSignature($params, $this->getConfigData("merchant_key"));
+ $params['CHECKSUMHASH'] = $checksum;
+
+ $version = $this->getLastUpdate();
+ $params['X-REQUEST-ID']=$this->helper::X_REQUEST_ID.str_replace('|', '_', str_replace(' ', '-', $version));
+ $inputForm='';
+ foreach ($params as $key => $value) {
+ $inputForm.="";
+ }
+ return $inputForm;
+ }
+
+ /* this function for checksum validation */
+ public function validateResponse($res,$order_id) {
+ $checksum = @$res["CHECKSUMHASH"];
+ unset($res["CHECKSUMHASH"]);
+ if ($this->helper->verifySignature($res,$this->getConfigData("merchant_key"),$checksum)) {
+ $result = true;
+ } else {
+ $result = false;
+ }
+ return $result;
+ }
+
+ /* this function for php curl version */
+ public function getcURLversion() {
+ return $this->helper->getcURLversion();
+ }
+
+ /* this function for php curl version */
+ public function getpluginversion() {
+ return $this->helper::PLUGIN_VERSION;
+ }
+
+ /* this function for genrating checksum */
+ public function generateStatusChecksum($requestParamList) {
+ $result = $this->helper->generateSignature($requestParamList,$this->getConfigData("merchant_key"));
+ return $result;
+ }
+
+ /* this function for return MID */
+ public function getMID() {
+ return $this->getConfigData("MID");
+ }
+
+ public function autoInvoiceGen() {
+ $result = $this->getConfigData("payment_action");
+ return $result;
+ }
+
+ /* this function return transaction URL from admin config */
+ public function getRedirectUrl() {
+ return $this->helper->getTransactionURL($this->getConfigData('environment'));
+ }
+
+ /* this function return transaction status URL from admin config */
+ public function getNewStatusQueryUrl() {
+ return $this->helper->getTransactionStatusURL($this->getConfigData('environment'));
+ }
+
+ /* this function return success order status */
+ public function getSuccessOrderStatus() {
+ return $this->getConfigData("success_order_status");
+ }
+
+ /* this function return fail order status */
+ public function getFailOrderStatus() {
+ return $this->getConfigData("fail_order_status");
+ }
+
+ /* this function return Magento version and last update date of plugin */
+ public function getLastUpdate(){
+ $objectManagerVs = \Magento\Framework\App\ObjectManager::getInstance();
+ $productMetadata = $objectManagerVs->get('Magento\Framework\App\ProductMetadataInterface');
+ $version = $productMetadata->getVersion();
+
+ $lastUpdated=date('d M Y',strtotime($this->helper::LAST_UPDATED));
+ return $version."|".$lastUpdated;
+ }
+ }
+?>
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/Model/PaytmConfigProvider.php b/Magento_V2.3x/app/code/One97/Paytm/Model/PaytmConfigProvider.php
new file mode 100755
index 0000000..79f3e3d
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/Model/PaytmConfigProvider.php
@@ -0,0 +1,27 @@
+method = $paymentHelper->getMethodInstance($this->methodCode);
+ $this->urlBuilder = $urlBuilder;
+ }
+
+ public function getConfig() {
+ return $this->method->isAvailable() ? [
+ 'payment' => [
+ 'paytm' => [
+ 'redirectUrl' => $this->urlBuilder->getUrl('paytm/Standard/Redirect', ['_secure' => true])
+ ]
+ ]
+ ] : [];
+ }
+ }
+?>
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/Model/SuccessFailStatus.php b/Magento_V2.3x/app/code/One97/Paytm/Model/SuccessFailStatus.php
new file mode 100755
index 0000000..97e6591
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/Model/SuccessFailStatus.php
@@ -0,0 +1,19 @@
+statusCollectionFactory = $statusCollectionFactory;
+ }
+
+ public function toOptionArray() {
+ $options = $this->statusCollectionFactory->create()->toOptionArray();
+ return $options;
+ }
+ }
+?>
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/Observer/SendMailOnOrderSuccess.php b/Magento_V2.3x/app/code/One97/Paytm/Observer/SendMailOnOrderSuccess.php
new file mode 100755
index 0000000..8cf5b37
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/Observer/SendMailOnOrderSuccess.php
@@ -0,0 +1,29 @@
+orderModel = $orderModel;
+ $this->orderSender = $orderSender;
+ $this->checkoutSession = $checkoutSession;
+ }
+
+ public function execute(\Magento\Framework\Event\Observer $observer) {
+ $orderIds = $observer->getEvent()->getOrderIds();
+ if(count($orderIds)) {
+ $this->checkoutSession->setForceOrderMailSentOnSuccess(true);
+ $order = $this->orderModel->create()->load($orderIds[0]);
+ $this->orderSender->send($order, true);
+ }
+ }
+ }
+?>
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/Plugin/Sales/Order/Email/Container/OrderIdentityPlugin.php b/Magento_V2.3x/app/code/One97/Paytm/Plugin/Sales/Order/Email/Container/OrderIdentityPlugin.php
new file mode 100755
index 0000000..cff67d7
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/Plugin/Sales/Order/Email/Container/OrderIdentityPlugin.php
@@ -0,0 +1,26 @@
+checkoutSession = $checkoutSession;
+ }
+
+ public function aroundIsEnabled(\Magento\Sales\Model\Order\Email\Container\OrderIdentity $subject, callable $proceed) {
+ $returnValue = $proceed();
+ $forceOrderMailSentOnSuccess = $this->checkoutSession->getForceOrderMailSentOnSuccess();
+ if(isset($forceOrderMailSentOnSuccess) && $forceOrderMailSentOnSuccess) {
+ if($returnValue)
+ $returnValue = false;
+ else
+ $returnValue = true;
+ $this->checkoutSession->unsForceOrderMailSentOnSuccess();
+ }
+ return $returnValue;
+ }
+ }
+?>
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/Setup/InstallSchema.php b/Magento_V2.3x/app/code/One97/Paytm/Setup/InstallSchema.php
new file mode 100755
index 0000000..60c1644
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/Setup/InstallSchema.php
@@ -0,0 +1,78 @@
+startSetup();
+ $conn = $setup->getConnection();
+ $tableName = $setup->getTable('paytm_order_data');
+ if($conn->isTableExists($tableName) != true){
+ $table = $conn->newTable($tableName)
+ ->addColumn(
+ 'id',
+ Table::TYPE_INTEGER,
+ null,
+ ['identity'=>true,'unsigned'=>true,'nullable'=>false,'primary'=>true],
+ 'ID'
+ )
+ ->addColumn(
+ 'order_id',
+ Table::TYPE_TEXT,
+ null,
+ ['nullable'=>false,'default'=>''],
+ 'Magento OrderId'
+ )
+ ->addColumn(
+ 'paytm_order_id',
+ Table::TYPE_TEXT,
+ null,
+ ['nullable'=>false,'default'=>''],
+ 'Paytm OrderId'
+ )
+ ->addColumn(
+ 'transaction_id',
+ Table::TYPE_TEXT,
+ null,
+ ['nullable'=>false,'default'=>''],
+ 'Paytm TransactionId'
+ )
+ ->addColumn(
+ 'status',
+ Table::TYPE_BOOLEAN,
+ null,
+ ['nullable'=>false,'default'=>'0'],
+ 'Transaction Status'
+ )
+ ->addColumn(
+ 'paytm_response',
+ Table::TYPE_TEXT,
+ null,
+ ['nullable'=>false,'default'=>''],
+ 'Paytm Response'
+ )
+ ->addColumn(
+ 'date_added',
+ Table::TYPE_DATETIME,
+ null,
+ ['nullable'=>false,'default'=>'0000-00-00 00:00:00'],
+ 'Created Dtae'
+ )
+ ->addColumn(
+ 'date_modified',
+ Table::TYPE_DATETIME,
+ null,
+ ['nullbale'=>false,'default'=>'0000-00-00 00:00:00'],
+ 'Modified Date'
+ )
+ ->setOption('charset','utf8');
+ $conn->createTable($table);
+ }
+ $setup->endSetup();
+ }
+ }
+?>
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/etc/adminhtml/system.xml b/Magento_V2.3x/app/code/One97/Paytm/etc/adminhtml/system.xml
new file mode 100755
index 0000000..1042490
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/etc/adminhtml/system.xml
@@ -0,0 +1,84 @@
+
+
+
+
+
+
+ Developer Docs
+
+ |
+ |
+ |
+
+ ]]>
+
+
+
+ Magento\Config\Model\Config\Source\Yesno
+ payment/paytm/active
+ paytmEnbDrpDwn
+
+
+
+ payment/paytm/title
+
+
+
+ One97\Paytm\Model\PaymentAction
+ payment/paytm/payment_action
+
+
+
+ One97\Paytm\Model\EnvAction
+ payment/paytm/environment
+
+
+
+ Provided By Paytm
+ payment/paytm/MID
+
+
+
+ Provided By Paytm
+ payment/paytm/merchant_key
+
+
+
+ Provided By Paytm
+ payment/paytm/Industry_id
+
+
+
+ Provided By Paytm
+ payment/paytm/Website
+
+
+
+ One97\Paytm\Model\SuccessFailStatus
+ payment/paytm/success_order_status
+
+
+
+ One97\Paytm\Model\SuccessFailStatus
+ payment/paytm/fail_order_status
+
+
+
+ validate-number
+ payment/paytm/sort_order
+
+
+
+ Magento\Payment\Model\Config\Source\Allspecificcountries
+ payment/paytm/allowspecific
+
+
+
+ Magento\Directory\Model\Config\Source\Country
+ payment/paytm/specificcountry
+
+
+
+
+
\ No newline at end of file
diff --git a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/config.xml b/Magento_V2.3x/app/code/One97/Paytm/etc/config.xml
old mode 100644
new mode 100755
similarity index 82%
rename from Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/config.xml
rename to Magento_V2.3x/app/code/One97/Paytm/etc/config.xml
index cc5fc1b..09f711c
--- a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/config.xml
+++ b/Magento_V2.3x/app/code/One97/Paytm/etc/config.xml
@@ -4,19 +4,18 @@
One97\Paytm\Model\Paytm
+ 0Paytm Walletauthorize_capture
- 0
- pending_paymentMIDmerchant_key0
-
-
+ Industry_id
- WEBWebsite
+ processing
+ canceled000
diff --git a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/frontend/di.xml b/Magento_V2.3x/app/code/One97/Paytm/etc/frontend/di.xml
old mode 100644
new mode 100755
similarity index 97%
rename from Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/frontend/di.xml
rename to Magento_V2.3x/app/code/One97/Paytm/etc/frontend/di.xml
index 2672f37..cdae513
--- a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/frontend/di.xml
+++ b/Magento_V2.3x/app/code/One97/Paytm/etc/frontend/di.xml
@@ -7,4 +7,4 @@
-
+
\ No newline at end of file
diff --git a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/frontend/events.xml b/Magento_V2.3x/app/code/One97/Paytm/etc/frontend/events.xml
old mode 100644
new mode 100755
similarity index 100%
rename from Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/frontend/events.xml
rename to Magento_V2.3x/app/code/One97/Paytm/etc/frontend/events.xml
diff --git a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/frontend/routes.xml b/Magento_V2.3x/app/code/One97/Paytm/etc/frontend/routes.xml
old mode 100644
new mode 100755
similarity index 100%
rename from Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/frontend/routes.xml
rename to Magento_V2.3x/app/code/One97/Paytm/etc/frontend/routes.xml
diff --git a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/module.xml b/Magento_V2.3x/app/code/One97/Paytm/etc/module.xml
old mode 100644
new mode 100755
similarity index 100%
rename from Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/module.xml
rename to Magento_V2.3x/app/code/One97/Paytm/etc/module.xml
diff --git a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/payment.xml b/Magento_V2.3x/app/code/One97/Paytm/etc/payment.xml
old mode 100644
new mode 100755
similarity index 100%
rename from Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/etc/payment.xml
rename to Magento_V2.3x/app/code/One97/Paytm/etc/payment.xml
diff --git a/Magento_V2.3x/app/code/One97/Paytm/registration.php b/Magento_V2.3x/app/code/One97/Paytm/registration.php
new file mode 100755
index 0000000..981e72b
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/registration.php
@@ -0,0 +1,7 @@
+
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/layout/adminhtml_system_config_edit.xml b/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/layout/adminhtml_system_config_edit.xml
new file mode 100755
index 0000000..168995f
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/layout/adminhtml_system_config_edit.xml
@@ -0,0 +1,14 @@
+
+
+
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/layout/sales_order_view.xml b/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/layout/sales_order_view.xml
new file mode 100755
index 0000000..50ac8f4
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/layout/sales_order_view.xml
@@ -0,0 +1,17 @@
+
+
+
+
+
+
+
+
+ custom_tabs
+
+ One97\Paytm\Block\Adminhtml\OrderEdit\Tab\View
+
+
+
+
+
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/templates/system/config/custom_js.phtml b/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/templates/system/config/custom_js.phtml
new file mode 100755
index 0000000..64f05ea
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/templates/system/config/custom_js.phtml
@@ -0,0 +1 @@
+
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/templates/tab/view/my_order_info.phtml b/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/templates/tab/view/my_order_info.phtml
new file mode 100755
index 0000000..83fafb2
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/templates/tab/view/my_order_info.phtml
@@ -0,0 +1,11 @@
+
+
+
+ getPaytmResponseHtml(true); ?>
+
+
+
+ getPaytmResponseHtml(); ?>
+
+
+
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/web/js/system/config/adminConfig.js b/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/web/js/system/config/adminConfig.js
new file mode 100755
index 0000000..8bbd344
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/web/js/system/config/adminConfig.js
@@ -0,0 +1,30 @@
+require(['jquery'],function($){
+ $(document).ready(function(){
+ var baseURL = $("#baseURLForPaytm").val();
+ var formId=$("#paytmLastUpdate").parents("form").attr("id");
+ var reqURL=baseURL+"paytm/Standard/Curlconfig?getlastUpdate=1";
+ $.ajax({
+ showLoader: true,
+ url: reqURL,
+ }).done(function (data) {
+ $("#phpCurlVersion").text("PHP cURL Version: "+data.phpCurlVersion);
+ $("#magentoVersion").text("Magento Version: "+data.version);
+ $("#paytmPluginVersion").text("Paytm Plugin Version: "+data.paytmPluginVersion);
+ $("#paytmLastUpdate").text("Last Updated: "+data.lastupdate);
+ });
+ $("#"+formId).submit(function(e){
+ var paytmEnable=$(".paytmEnbDrpDwn").val();
+ if(paytmEnable=="1"){
+ var currentURL=baseURL+"paytm/Standard/Curlconfig";
+ $.ajax({
+ showLoader: true,
+ url: currentURL,
+ }).done(function (data) {
+ if(data.responseTableBody!="All is done."){
+ alert(data.responseTableBody);
+ }
+ });
+ }
+ });
+ });
+});
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/web/js/tab/view/fetchstatus.js b/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/web/js/tab/view/fetchstatus.js
new file mode 100755
index 0000000..bb5185c
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/view/adminhtml/web/js/tab/view/fetchstatus.js
@@ -0,0 +1,16 @@
+require(['jquery'],function($){
+ $('.fetchStatusBtn').click(function(){
+ var currentURL=$(this).attr('moveURL');
+ $.ajax({
+ showLoader: true,
+ url: currentURL,
+ }).done(function (data) {
+ if($.trim(data.responseTableBody)!=''){
+ $('.paytmResponseTBody').html(data.responseTableBody);
+ }
+ if(data.response){
+ $('.fetchStatusBtn').remove();
+ }
+ });
+ });
+});
\ No newline at end of file
diff --git a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/view/frontend/layout/checkout_index_index.xml b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/layout/checkout_index_index.xml
old mode 100644
new mode 100755
similarity index 92%
rename from Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/view/frontend/layout/checkout_index_index.xml
rename to Magento_V2.3x/app/code/One97/Paytm/view/frontend/layout/checkout_index_index.xml
index ae357ef..0d701fd
--- a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/view/frontend/layout/checkout_index_index.xml
+++ b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/layout/checkout_index_index.xml
@@ -1,10 +1,4 @@
-
@@ -20,7 +14,6 @@
-
One97_Paytm/js/view/payment/one97-paytm
diff --git a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/view/frontend/layout/paytm_standard_curl_test.xml b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/layout/paytm_standard_curl_test.xml
old mode 100644
new mode 100755
similarity index 100%
rename from Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/view/frontend/layout/paytm_standard_curl_test.xml
rename to Magento_V2.3x/app/code/One97/Paytm/view/frontend/layout/paytm_standard_curl_test.xml
diff --git a/Magento_V2.3x/app/code/One97/Paytm/view/frontend/layout/paytm_standard_redirect.xml b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/layout/paytm_standard_redirect.xml
new file mode 100755
index 0000000..048f47f
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/layout/paytm_standard_redirect.xml
@@ -0,0 +1,9 @@
+
+
+
+
+
+
+
+
+
\ No newline at end of file
diff --git a/Magento_V2.3x/app/code/One97/Paytm/view/frontend/templates/form/paytm.phtml b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/templates/form/paytm.phtml
new file mode 100755
index 0000000..c51d1d4
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/templates/form/paytm.phtml
@@ -0,0 +1,4 @@
+getData(); ?>
+
\ No newline at end of file
diff --git a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/view/frontend/templates/info/paytm.phtml b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/templates/info/paytm.phtml
old mode 100644
new mode 100755
similarity index 100%
rename from Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/view/frontend/templates/info/paytm.phtml
rename to Magento_V2.3x/app/code/One97/Paytm/view/frontend/templates/info/paytm.phtml
diff --git a/Magento_V2.3x/app/code/One97/Paytm/view/frontend/web/js/view/payment/method-renderer/one97-paytm.js b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/web/js/view/payment/method-renderer/one97-paytm.js
new file mode 100755
index 0000000..7f46dc4
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/web/js/view/payment/method-renderer/one97-paytm.js
@@ -0,0 +1,45 @@
+define(
+ [
+ 'jquery',
+ 'Magento_Checkout/js/view/payment/default',
+ 'Magento_Checkout/js/action/place-order',
+ 'Magento_Checkout/js/action/select-payment-method',
+ 'Magento_Customer/js/model/customer',
+ 'Magento_Checkout/js/checkout-data',
+ 'Magento_Checkout/js/model/payment/additional-validators'
+ ],
+ function ($, Component, placeOrderAction, selectPaymentMethodAction, customer, checkoutData, additionalValidators) {
+ 'use strict';
+ return Component.extend({
+ defaults: {
+ template: 'One97_Paytm/payment/one97'
+ },
+ placeOrder: function (data, event) {
+ if (event) {
+ event.preventDefault();
+ }
+ var self = this,
+ placeOrder,
+ emailValidationResult = customer.isLoggedIn(),
+ loginFormSelector = 'form[data-role=email-with-possible-login]';
+ if (!customer.isLoggedIn()) {
+ $(loginFormSelector).validation();
+ emailValidationResult = Boolean($(loginFormSelector + ' input[name=username]').valid());
+ }
+ if (emailValidationResult && this.validate() && additionalValidators.validate()) {
+ this.isPlaceOrderActionAllowed(false);
+ placeOrder = placeOrderAction(this.getData(), false, this.messageContainer);
+
+ $.when(placeOrder).fail(function () {
+ self.isPlaceOrderActionAllowed(true);
+ }).done(this.afterPlaceOrder.bind(this));
+ return true;
+ }
+ return false;
+ },
+ afterPlaceOrder: function () {
+ $.mage.redirect(window.checkoutConfig.payment.paytm.redirectUrl);
+ }
+ });
+ }
+);
\ No newline at end of file
diff --git a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/view/frontend/web/js/view/payment/one97-paytm.js b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/web/js/view/payment/one97-paytm.js
old mode 100644
new mode 100755
similarity index 100%
rename from Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/view/frontend/web/js/view/payment/one97-paytm.js
rename to Magento_V2.3x/app/code/One97/Paytm/view/frontend/web/js/view/payment/one97-paytm.js
diff --git a/Magento_V2.3x/app/code/One97/Paytm/view/frontend/web/js/view/payment/redirectForm.js b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/web/js/view/payment/redirectForm.js
new file mode 100755
index 0000000..336b29e
--- /dev/null
+++ b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/web/js/view/payment/redirectForm.js
@@ -0,0 +1,5 @@
+require(['jquery'],function($){
+ $(document).ready(function(){
+ $('#paytmFormPost').submit();
+ });
+});
\ No newline at end of file
diff --git a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/view/frontend/web/template/payment/one97.html b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/web/template/payment/one97.html
old mode 100644
new mode 100755
similarity index 51%
rename from Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/view/frontend/web/template/payment/one97.html
rename to Magento_V2.3x/app/code/One97/Paytm/view/frontend/web/template/payment/one97.html
index 39bea29..43b35e1
--- a/Magento_v2.3.x/Magento Plugin V2.3.0/app/code/One97/Paytm/view/frontend/web/template/payment/one97.html
+++ b/Magento_V2.3x/app/code/One97/Paytm/view/frontend/web/template/payment/one97.html
@@ -7,9 +7,6 @@
-
-
-
@@ -17,29 +14,12 @@
-
+
-
-
Have Promo Code?
-
-
-
-
-
-
-
diff --git a/Magento_v1.x/LICENSE b/Magento_v1.x/LICENSE
deleted file mode 100644
index 23cb790..0000000
--- a/Magento_v1.x/LICENSE
+++ /dev/null
@@ -1,339 +0,0 @@
- GNU GENERAL PUBLIC LICENSE
- Version 2, June 1991
-
- Copyright (C) 1989, 1991 Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
- Everyone is permitted to copy and distribute verbatim copies
- of this license document, but changing it is not allowed.
-
- Preamble
-
- The licenses for most software are designed to take away your
-freedom to share and change it. By contrast, the GNU General Public
-License is intended to guarantee your freedom to share and change free
-software--to make sure the software is free for all its users. This
-General Public License applies to most of the Free Software
-Foundation's software and to any other program whose authors commit to
-using it. (Some other Free Software Foundation software is covered by
-the GNU Lesser General Public License instead.) You can apply it to
-your programs, too.
-
- When we speak of free software, we are referring to freedom, not
-price. Our General Public Licenses are designed to make sure that you
-have the freedom to distribute copies of free software (and charge for
-this service if you wish), that you receive source code or can get it
-if you want it, that you can change the software or use pieces of it
-in new free programs; and that you know you can do these things.
-
- To protect your rights, we need to make restrictions that forbid
-anyone to deny you these rights or to ask you to surrender the rights.
-These restrictions translate to certain responsibilities for you if you
-distribute copies of the software, or if you modify it.
-
- For example, if you distribute copies of such a program, whether
-gratis or for a fee, you must give the recipients all the rights that
-you have. You must make sure that they, too, receive or can get the
-source code. And you must show them these terms so they know their
-rights.
-
- We protect your rights with two steps: (1) copyright the software, and
-(2) offer you this license which gives you legal permission to copy,
-distribute and/or modify the software.
-
- Also, for each author's protection and ours, we want to make certain
-that everyone understands that there is no warranty for this free
-software. If the software is modified by someone else and passed on, we
-want its recipients to know that what they have is not the original, so
-that any problems introduced by others will not reflect on the original
-authors' reputations.
-
- Finally, any free program is threatened constantly by software
-patents. We wish to avoid the danger that redistributors of a free
-program will individually obtain patent licenses, in effect making the
-program proprietary. To prevent this, we have made it clear that any
-patent must be licensed for everyone's free use or not licensed at all.
-
- The precise terms and conditions for copying, distribution and
-modification follow.
-
- GNU GENERAL PUBLIC LICENSE
- TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
-
- 0. This License applies to any program or other work which contains
-a notice placed by the copyright holder saying it may be distributed
-under the terms of this General Public License. The "Program", below,
-refers to any such program or work, and a "work based on the Program"
-means either the Program or any derivative work under copyright law:
-that is to say, a work containing the Program or a portion of it,
-either verbatim or with modifications and/or translated into another
-language. (Hereinafter, translation is included without limitation in
-the term "modification".) Each licensee is addressed as "you".
-
-Activities other than copying, distribution and modification are not
-covered by this License; they are outside its scope. The act of
-running the Program is not restricted, and the output from the Program
-is covered only if its contents constitute a work based on the
-Program (independent of having been made by running the Program).
-Whether that is true depends on what the Program does.
-
- 1. You may copy and distribute verbatim copies of the Program's
-source code as you receive it, in any medium, provided that you
-conspicuously and appropriately publish on each copy an appropriate
-copyright notice and disclaimer of warranty; keep intact all the
-notices that refer to this License and to the absence of any warranty;
-and give any other recipients of the Program a copy of this License
-along with the Program.
-
-You may charge a fee for the physical act of transferring a copy, and
-you may at your option offer warranty protection in exchange for a fee.
-
- 2. You may modify your copy or copies of the Program or any portion
-of it, thus forming a work based on the Program, and copy and
-distribute such modifications or work under the terms of Section 1
-above, provided that you also meet all of these conditions:
-
- a) You must cause the modified files to carry prominent notices
- stating that you changed the files and the date of any change.
-
- b) You must cause any work that you distribute or publish, that in
- whole or in part contains or is derived from the Program or any
- part thereof, to be licensed as a whole at no charge to all third
- parties under the terms of this License.
-
- c) If the modified program normally reads commands interactively
- when run, you must cause it, when started running for such
- interactive use in the most ordinary way, to print or display an
- announcement including an appropriate copyright notice and a
- notice that there is no warranty (or else, saying that you provide
- a warranty) and that users may redistribute the program under
- these conditions, and telling the user how to view a copy of this
- License. (Exception: if the Program itself is interactive but
- does not normally print such an announcement, your work based on
- the Program is not required to print an announcement.)
-
-These requirements apply to the modified work as a whole. If
-identifiable sections of that work are not derived from the Program,
-and can be reasonably considered independent and separate works in
-themselves, then this License, and its terms, do not apply to those
-sections when you distribute them as separate works. But when you
-distribute the same sections as part of a whole which is a work based
-on the Program, the distribution of the whole must be on the terms of
-this License, whose permissions for other licensees extend to the
-entire whole, and thus to each and every part regardless of who wrote it.
-
-Thus, it is not the intent of this section to claim rights or contest
-your rights to work written entirely by you; rather, the intent is to
-exercise the right to control the distribution of derivative or
-collective works based on the Program.
-
-In addition, mere aggregation of another work not based on the Program
-with the Program (or with a work based on the Program) on a volume of
-a storage or distribution medium does not bring the other work under
-the scope of this License.
-
- 3. You may copy and distribute the Program (or a work based on it,
-under Section 2) in object code or executable form under the terms of
-Sections 1 and 2 above provided that you also do one of the following:
-
- a) Accompany it with the complete corresponding machine-readable
- source code, which must be distributed under the terms of Sections
- 1 and 2 above on a medium customarily used for software interchange; or,
-
- b) Accompany it with a written offer, valid for at least three
- years, to give any third party, for a charge no more than your
- cost of physically performing source distribution, a complete
- machine-readable copy of the corresponding source code, to be
- distributed under the terms of Sections 1 and 2 above on a medium
- customarily used for software interchange; or,
-
- c) Accompany it with the information you received as to the offer
- to distribute corresponding source code. (This alternative is
- allowed only for noncommercial distribution and only if you
- received the program in object code or executable form with such
- an offer, in accord with Subsection b above.)
-
-The source code for a work means the preferred form of the work for
-making modifications to it. For an executable work, complete source
-code means all the source code for all modules it contains, plus any
-associated interface definition files, plus the scripts used to
-control compilation and installation of the executable. However, as a
-special exception, the source code distributed need not include
-anything that is normally distributed (in either source or binary
-form) with the major components (compiler, kernel, and so on) of the
-operating system on which the executable runs, unless that component
-itself accompanies the executable.
-
-If distribution of executable or object code is made by offering
-access to copy from a designated place, then offering equivalent
-access to copy the source code from the same place counts as
-distribution of the source code, even though third parties are not
-compelled to copy the source along with the object code.
-
- 4. You may not copy, modify, sublicense, or distribute the Program
-except as expressly provided under this License. Any attempt
-otherwise to copy, modify, sublicense or distribute the Program is
-void, and will automatically terminate your rights under this License.
-However, parties who have received copies, or rights, from you under
-this License will not have their licenses terminated so long as such
-parties remain in full compliance.
-
- 5. You are not required to accept this License, since you have not
-signed it. However, nothing else grants you permission to modify or
-distribute the Program or its derivative works. These actions are
-prohibited by law if you do not accept this License. Therefore, by
-modifying or distributing the Program (or any work based on the
-Program), you indicate your acceptance of this License to do so, and
-all its terms and conditions for copying, distributing or modifying
-the Program or works based on it.
-
- 6. Each time you redistribute the Program (or any work based on the
-Program), the recipient automatically receives a license from the
-original licensor to copy, distribute or modify the Program subject to
-these terms and conditions. You may not impose any further
-restrictions on the recipients' exercise of the rights granted herein.
-You are not responsible for enforcing compliance by third parties to
-this License.
-
- 7. If, as a consequence of a court judgment or allegation of patent
-infringement or for any other reason (not limited to patent issues),
-conditions are imposed on you (whether by court order, agreement or
-otherwise) that contradict the conditions of this License, they do not
-excuse you from the conditions of this License. If you cannot
-distribute so as to satisfy simultaneously your obligations under this
-License and any other pertinent obligations, then as a consequence you
-may not distribute the Program at all. For example, if a patent
-license would not permit royalty-free redistribution of the Program by
-all those who receive copies directly or indirectly through you, then
-the only way you could satisfy both it and this License would be to
-refrain entirely from distribution of the Program.
-
-If any portion of this section is held invalid or unenforceable under
-any particular circumstance, the balance of the section is intended to
-apply and the section as a whole is intended to apply in other
-circumstances.
-
-It is not the purpose of this section to induce you to infringe any
-patents or other property right claims or to contest validity of any
-such claims; this section has the sole purpose of protecting the
-integrity of the free software distribution system, which is
-implemented by public license practices. Many people have made
-generous contributions to the wide range of software distributed
-through that system in reliance on consistent application of that
-system; it is up to the author/donor to decide if he or she is willing
-to distribute software through any other system and a licensee cannot
-impose that choice.
-
-This section is intended to make thoroughly clear what is believed to
-be a consequence of the rest of this License.
-
- 8. If the distribution and/or use of the Program is restricted in
-certain countries either by patents or by copyrighted interfaces, the
-original copyright holder who places the Program under this License
-may add an explicit geographical distribution limitation excluding
-those countries, so that distribution is permitted only in or among
-countries not thus excluded. In such case, this License incorporates
-the limitation as if written in the body of this License.
-
- 9. The Free Software Foundation may publish revised and/or new versions
-of the General Public License from time to time. Such new versions will
-be similar in spirit to the present version, but may differ in detail to
-address new problems or concerns.
-
-Each version is given a distinguishing version number. If the Program
-specifies a version number of this License which applies to it and "any
-later version", you have the option of following the terms and conditions
-either of that version or of any later version published by the Free
-Software Foundation. If the Program does not specify a version number of
-this License, you may choose any version ever published by the Free Software
-Foundation.
-
- 10. If you wish to incorporate parts of the Program into other free
-programs whose distribution conditions are different, write to the author
-to ask for permission. For software which is copyrighted by the Free
-Software Foundation, write to the Free Software Foundation; we sometimes
-make exceptions for this. Our decision will be guided by the two goals
-of preserving the free status of all derivatives of our free software and
-of promoting the sharing and reuse of software generally.
-
- NO WARRANTY
-
- 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY
-FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN
-OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES
-PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED
-OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
-MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS
-TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE
-PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING,
-REPAIR OR CORRECTION.
-
- 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING
-WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR
-REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES,
-INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING
-OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED
-TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY
-YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER
-PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE
-POSSIBILITY OF SUCH DAMAGES.
-
- END OF TERMS AND CONDITIONS
-
- How to Apply These Terms to Your New Programs
-
- If you develop a new program, and you want it to be of the greatest
-possible use to the public, the best way to achieve this is to make it
-free software which everyone can redistribute and change under these terms.
-
- To do so, attach the following notices to the program. It is safest
-to attach them to the start of each source file to most effectively
-convey the exclusion of warranty; and each file should have at least
-the "copyright" line and a pointer to where the full notice is found.
-
- {description}
- Copyright (C) {year} {fullname}
-
- This program is free software; you can redistribute it and/or modify
- it under the terms of the GNU General Public License as published by
- the Free Software Foundation; either version 2 of the License, or
- (at your option) any later version.
-
- This program is distributed in the hope that it will be useful,
- but WITHOUT ANY WARRANTY; without even the implied warranty of
- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- GNU General Public License for more details.
-
- You should have received a copy of the GNU General Public License along
- with this program; if not, write to the Free Software Foundation, Inc.,
- 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA.
-
-Also add information on how to contact you by electronic and paper mail.
-
-If the program is interactive, make it output a short notice like this
-when it starts in an interactive mode:
-
- Gnomovision version 69, Copyright (C) year name of author
- Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'.
- This is free software, and you are welcome to redistribute it
- under certain conditions; type `show c' for details.
-
-The hypothetical commands `show w' and `show c' should show the appropriate
-parts of the General Public License. Of course, the commands you use may
-be called something other than `show w' and `show c'; they could even be
-mouse-clicks or menu items--whatever suits your program.
-
-You should also get your employer (if you work as a programmer) or your
-school, if any, to sign a "copyright disclaimer" for the program, if
-necessary. Here is a sample; alter the names:
-
- Yoyodyne, Inc., hereby disclaims all copyright interest in the program
- `Gnomovision' (which makes passes at compilers) written by James Hacker.
-
- {signature of Ty Coon}, 1 April 1989
- Ty Coon, President of Vice
-
-This General Public License does not permit incorporating your program into
-proprietary programs. If your program is a subroutine library, you may
-consider it more useful to permit linking proprietary applications with the
-library. If this is what you want to do, use the GNU Lesser General
-Public License instead of this License.
diff --git a/Magento_v1.x/Magento Plugin V1.0/README.md b/Magento_v1.x/Magento Plugin V1.0/README.md
deleted file mode 100644
index 3dd3e9e..0000000
--- a/Magento_v1.x/Magento Plugin V1.0/README.md
+++ /dev/null
@@ -1,35 +0,0 @@
-# Magento 1.X:-
-
- 1. Download the plugin.
- 2. Extract the files from the downloaded folder.
- 3. Copy App and Skin folder from the required Magento version and place them into the root folder. If prompted to overwrite the files, click yes.
- 4. Login to Magento Admin Panel and choose Payments Methods
- System- > Configuration - > Payment Methods
- 5. Enable Paytm option from Payment Methods
- 6. Go to the Paytm PG Configuration and save below configuration
-
- * Enable Plugin - Yes
- * New Order Status - Processing
- * Title - Paytm PG
- * Merchant ID - MID provided by Paytm
- * Merchant Key - Key provided by Paytm
- * Transaction URL
- * Staging - https://securegw-stage.paytm.in/theia/processTransaction
- * Production - https://securegw.paytm.in/theia/processTransaction
- * Transaction Status URL
- * Staging - https://securegw-stage.paytm.in/merchant-status/getTxnStatus
- * Production - https://securegw.paytm.in/merchant-status/getTxnStatus
- * Website Name
- * WEBSTAGING for Staging
- * WEBPROD for Production
- * Custom Callback Url - No
- * Callback Url - customized callback url(this is visible when Custom Callback Url is yes)
- * Industry Type
- * Retail for staging
- * Industry type for Production will be provided by Paytm
-
- 7. Please note if you have Linux server, please make sure folder permission are set to 755 & file permission to 644.
- 8. Once plugin is installed, please logout from the admin panel and clear the cache of the Magento.
- 9. Your plug-in is installed now, you can now make payment with Paytm.
-
-# In case of any query, please contact to Paytm.
diff --git a/Magento_v1.x/Magento Plugin V1.0/app/code/community/One97/Paytm/Helper/Data.php b/Magento_v1.x/Magento Plugin V1.0/app/code/community/One97/Paytm/Helper/Data.php
deleted file mode 100644
index d2d4e0c..0000000
--- a/Magento_v1.x/Magento Plugin V1.0/app/code/community/One97/Paytm/Helper/Data.php
+++ /dev/null
@@ -1,177 +0,0 @@
-getArray2Str($arrayList);
- $salt = Mage::helper('paytm')->generateSalt_e(4);
- $finalString = $str . "|" . $salt;
- $hash = hash("sha256", $finalString);
- $hashString = $hash . $salt;
- $checksum = Mage::helper('paytm')->encrypt_e($hashString, $key);
- return $checksum;
-}
-
-function verifychecksum_e($arrayList, $key, $checksumvalue) {
- $arrayList = Mage::helper('paytm')->removeCheckSumParam($arrayList);
- ksort($arrayList);
- $str = Mage::helper('paytm')->getArray2StrForVerify($arrayList);
- $paytm_hash = Mage::helper('paytm')->decrypt_e($checksumvalue, $key);
- $salt = substr($paytm_hash, -4);
-
- $finalString = $str . "|" . $salt;
-
- $website_hash = hash("sha256", $finalString);
- $website_hash .= $salt;
-
- $validFlag = "FALSE";
- if ($website_hash == $paytm_hash) {
- $validFlag = "TRUE";
- } else {
- $validFlag = "FALSE";
- }
- return $validFlag;
-}
-
-function getArray2StrForVerify($arrayList) {
- $paramStr = "";
- $flag = 1;
- foreach ($arrayList as $key => $value) {
- if ($flag) {
- $paramStr .= Mage::helper('paytm')->checkString_e($value);
- $flag = 0;
- } else {
- $paramStr .= "|" . Mage::helper('paytm')->checkString_e($value);
- }
- }
- return $paramStr;
-}
-function getArray2Str($arrayList) {
- $findme = 'REFUND';
- $findmepipe = '|';
- $paramStr = "";
- $flag = 1;
- foreach ($arrayList as $key => $value) {
- $pos = strpos($value, $findme);
- $pospipe = strpos($value, $findmepipe);
- if ($pos !== false || $pospipe !== false)
- {
- continue;
- }
-
- if ($flag) {
- $paramStr .= Mage::helper('paytm')->checkString_e($value);
- $flag = 0;
- } else {
- $paramStr .= "|" . Mage::helper('paytm')->checkString_e($value);
- }
- }
- return $paramStr;
-}
-
-function redirect2PG($paramList, $key) {
- $hashString = Mage::helper('paytm')->getchecksumFromArray($paramList);
- $checksum = Mage::helper('paytm')->encrypt_e($hashString, $key);
-}
-
-function removeCheckSumParam($arrayList) {
- if (isset($arrayList["CHECKSUMHASH"])) {
- unset($arrayList["CHECKSUMHASH"]);
- }
- return $arrayList;
-}
-function callAPI($apiURL, $requestParamList)
-{
- $jsonResponse = "";
- $responseParamList = array();
- $JsonData = json_encode($requestParamList);
- $postData = 'JsonData=' . urlencode($JsonData);
- $ch = curl_init($apiURL);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- 'Content-Length: ' . strlen($postData)
- ));
- $jsonResponse = curl_exec($ch);
- $responseParamList = json_decode($jsonResponse, true);
- return $responseParamList;
-}
-function callNewAPI($apiURL, $requestParamList)
-{
- $jsonResponse = "";
- $responseParamList = array();
- $JsonData = json_encode($requestParamList);
- $postData = 'JsonData=' . urlencode($JsonData);
- $ch = curl_init($apiURL);
- curl_setopt($ch, CURLOPT_CUSTOMREQUEST, "POST");
- curl_setopt($ch, CURLOPT_POSTFIELDS, $postData);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
- curl_setopt($ch, CURLOPT_SSL_VERIFYHOST, 0);
- curl_setopt($ch, CURLOPT_SSL_VERIFYPEER, 0);
- curl_setopt($ch, CURLOPT_HTTPHEADER, array(
- 'Content-Type: application/json',
- 'Content-Length: ' . strlen($postData)
- ));
- $jsonResponse = curl_exec($ch);
- $responseParamList = json_decode($jsonResponse, true);
- return $responseParamList;
-}
-}
diff --git a/Magento_v1.x/Magento Plugin V1.0/app/code/community/One97/Paytm/Helper/Data2.php b/Magento_v1.x/Magento Plugin V1.0/app/code/community/One97/Paytm/Helper/Data2.php
deleted file mode 100644
index 091aaed..0000000
--- a/Magento_v1.x/Magento Plugin V1.0/app/code/community/One97/Paytm/Helper/Data2.php
+++ /dev/null
@@ -1,18 +0,0 @@
- _getCheckout();
- //get order singleton
- $order = Mage::getModel('sales/order');
- $order->loadByIncrementId($session->getLastRealOrderId());
- if (!$order->getId()) {
- Mage::throwException('No order for processing found');
- }
- //set order status
- if ($order->getState() != Mage_Sales_Model_Order::STATE_PENDING_PAYMENT) {
- $order->setState(
- Mage_Sales_Model_Order::STATE_PENDING_PAYMENT,
- $this->_getPendingPaymentStatus(),
- Mage::helper('paytm')->__('Customer was redirected to paytm.')
- )->save();
- }
- //save order and quote ids
- if ($session->getQuoteId() && $session->getLastSuccessQuoteId()) {
- $session->setpaytmQuoteId($session->getQuoteId());
- $session->setpaytmSuccessQuoteId($session->getLastSuccessQuoteId());
- $session->setpaytmRealOrderId($session->getLastRealOrderId());
- $session->getQuote()->setIsActive(false)->save();
- $session->clear();
- }
- //load basic blank page
- $this->loadLayout();
- $this->renderLayout();
- return;
- } catch (Mage_Core_Exception $e) {
- $this->_getCheckout()->addError($e->getMessage());
- } catch(Exception $e) {
- Mage::logException($e);
- }
- $this->_redirect('checkout/cart');
- }
-
- //handle callback values and takes appropriate action
- public function responseAction()
- {
- $session = $this->_getCheckout();
- $order = Mage::getModel('sales/order');
-
- $request = $this->_checkReturnedPost();
- try {
-
- Mage::log($request);
- $parameters = array();
- foreach($request as $key=>$value)
- {
- $parameters[$key] = $request[$key];
- }
- $session = $this->_getCheckout();
- $isValidChecksum = false;
- $txnstatus = false;
- $authStatus = false;
- $mer_encrypted = Mage::getStoreConfig('payment/paytm_cc/inst_key');
- $const = (string)Mage::getConfig()->getNode('global/crypt/key');
- $mer_decrypted= Mage::helper('paytm')->decrypt_e($mer_encrypted,$const);
-
- $merid_encrypted = Mage::getStoreConfig('payment/paytm_cc/inst_id');
- $const = (string)Mage::getConfig()->getNode('global/crypt/key');
- $merid_decrypted= Mage::helper('paytm')->decrypt_e($merid_encrypted,$const);
-
- //setting order status
- $order = Mage::getModel('sales/order');
-
- $order->loadByIncrementId($request['ORDERID']);
- if (!$order->getId()) {
- Mage::log('No order for processing found');
- }
-
-
- //check returned checksum
- if(isset($request['CHECKSUMHASH']))
- {
- $return = Mage::helper('paytm')->verifychecksum_e($parameters, $mer_decrypted, $request['CHECKSUMHASH']);
- if($return == "TRUE")
- $isValidChecksum = true;
-
- }
-
- if($request['STATUS'] == "TXN_SUCCESS"){
- $txnstatus = true;
- }
-
- $_testurl = NULL;
- $transaction_status_url = Mage::getStoreConfig('payment/paytm_cc/transaction_status_url');
- $const = (string)Mage::getConfig()->getNode('global/crypt/key');
- $_testurl= Mage::helper('paytm')->decrypt_e($transaction_status_url,$const);
-
- if($txnstatus && $isValidChecksum){
- // Create an array having all required parameters for status query.
- $requestParamList = array("MID" => $merid_decrypted , "ORDERID" => $request['ORDERID']);
-
- $StatusCheckSum = Mage::helper('paytm')->getChecksumFromArray($requestParamList, $mer_decrypted);
-
- $requestParamList['CHECKSUMHASH'] = $StatusCheckSum;
-
- // Call the PG's getTxnStatus() function for verifying the transaction status.
- $transaction_status_url = Mage::getStoreConfig('payment/paytm_cc/transaction_status_url');
- $const = (string)Mage::getConfig()->getNode('global/crypt/key');
- $check_status_url= Mage::helper('paytm')->decrypt_e($transaction_status_url,$const);
- $responseParamList = Mage::helper('paytm')->callNewAPI($check_status_url, $requestParamList);
- $authStatus = true;
- if($authStatus == false) {
- $this->_processCancel($request);
- } else {
- if($responseParamList['STATUS']=='TXN_SUCCESS' && $responseParamList['TXNAMOUNT']==$_POST['TXNAMOUNT']) {
- $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING,true)->save();
- $this->_processSale($request);
- $order_mail = new Mage_Sales_Model_Order();
- $incrementId = Mage::getSingleton('checkout/session')->getLastRealOrderId();
- $order_mail->loadByIncrementId($incrementId);
- $i = Mage::getVersion();
- $updatedVersion=false;
- if(strpos($i,"1.9")===0){
- $updatedVersion=true;
- }
- if(!$updatedVersion){ // above 1.9.0 version not support sendNewOrderEmail() fumction
- try{
- $order_mail->sendNewOrderEmail();
- } catch (Exception $ex) { }
- }
- } else {
- $this->_processFail($request);
- }
- }
- } else{
- $this->_processCancel($request);
- }
-
-
- } catch (Mage_Core_Exception $e) {
- $this->getResponse()->setBody(
- $this->getLayout()
- ->createBlock($this->_failureBlockType)
- ->setOrder($this->_order)
- ->toHtml()
- );
-
- $this->_processFail($request);
-
- }
- }
-
- //runs on success of payment
- public function successAction()
- {
- try {
- $session = $this->_getCheckout();
- $session->unspaytmRealOrderId();
- $session->setQuoteId($session->getpaytmQuoteId(true));
- // $session->setLastSuccessQuoteId($session->getpaytmSuccessQuoteId(true));
- $session->setLastSuccessQuoteId($session->getLastQuoteId());
- $this->_redirect('checkout/onepage/success');
- return;
- } catch (Mage_Core_Exception $e) {
- $this->_getCheckout()->addError($e->getMessage());
- } catch(Exception $e) {
- $this->_debug('paytm error: ' . $e->getMessage());
- Mage::logException($e);
- }
- $this->_redirect('checkout/cart');
-
- }
-
- public function failAction()
- {
- // set quote to active
- $session = $this->_getCheckout();
- if ($quoteId = $session->getpaytmQuoteId()) {
- $quote = Mage::getModel('sales/quote')->load($quoteId);
- if ($quote->getId()) {
- $quote->setIsActive(true)->save();
- $session->setQuoteId($quoteId);
- }
- }
- Mage::log("failed");
- $session->addError(Mage::helper('paytm')->__('The order has failed.'));
- $this->_redirect('checkout/cart');
-
- }
-
- //runs on cancel action
- public function cancelAction()
- {
- // set quote to active
- $session = $this->_getCheckout();
- $order = Mage::getModel('sales/order');
- $order->loadByIncrementId($session->getLastRealOrderId());
- if (!$order->getId()) {
- Mage::throwException('No order for processing found');
- }
- $order->setState(
- Mage_Sales_Model_Order::STATE_CANCELED,true)->save();
-
- if ($quoteId = $session->getpaytmQuoteId()) {
- $quote = Mage::getModel('sales/quote')->load($quoteId);
- if ($quote->getId()) {
- $quote->setIsActive(true)->save();
- $session->setQuoteId($quoteId);
- }
- }
- Mage::log("cancel");
- $session->addError(Mage::helper('paytm')->__('The order has been canceled.'));
- $this->_redirect('checkout/cart');
-
- }
-
- // Checking POST variables.
- protected function _checkReturnedPost()
- {
- // check request type
- if (!$this->getRequest()->isPost())
- Mage::throwException('Wrong request type.');
-
-
- // get request variables
- $request = $this->getRequest()->getPost();
- if (empty($request))
- Mage::throwException('Request doesn\'t contain POST elements.');
-
- Mage::log($request);
-
- // check order id
- if (empty($request['ORDERID']) )
- Mage::throwException('Missing or invalid order ID');
-
- // load order for further validation
- $this->_order = Mage::getModel('sales/order')->loadByIncrementId($request['ORDERID']);
- if (!$this->_order->getId())
- Mage::throwException('Order not found');
-
-
- return $request;
- }
-
- //if success process sale
- protected function _processSale($request)
- {
- $session = $this->_getCheckout();
- $order = Mage::getModel('sales/order');
- $order->loadByIncrementId($request['ORDERID']);
- //save transaction information
- $invoice = $order->prepareInvoice();
- $invoice->register()->capture();
- Mage::getModel('core/resource_transaction')
- ->addObject($invoice)
- ->addObject($invoice->getOrder())
- ->save();
-
-
- $order->addStatusToHistory(Mage::getStoreConfig('payment/paytm_cc/order_status'),Mage::helper('paytm')->__('Payment successful through Paytm PG'));
- $order->save();
-
-
- $this->getResponse()->setBody(
- $this->getLayout()
- ->createBlock($this->_successBlockType)
- ->setOrder($this->_order)
- ->toHtml()
- );
- }
-
- //cancel order if failure
- protected function _processFail($request)
- {
- // cancel order
- $request = $this->getRequest()->getPost();
- $this->_order = Mage::getModel('sales/order')->loadByIncrementId($request['ORDERID']);
- if ($this->_order->canCancel()) {
- $this->_order->cancel();
- $this->_order->addStatusToHistory(Mage_Sales_Model_Order::STATUS_FRAUD, Mage::helper('paytm')->__('Payment failed'));
- $this->_order->save();
- }
- $session = $this->_getCheckout();
- $session->addError(Mage::helper('paytm')->__('It seems some issue in server to server communication. Kindly connect with administrator.'));
- $this->_redirect('checkout/cart');
-
- }
-
- //cancel order if failure
- protected function _processCancel($request)
- {
- // cancel order
- $this->_order = Mage::getModel('sales/order')->loadByIncrementId($request['ORDERID']);
- if ($this->_order->canCancel()) {
- $this->_order->cancel();
- $this->_order->addStatusToHistory(Mage_Sales_Model_Order::STATE_CANCELED, Mage::helper('paytm')->__('Payment was canceled'));
- $this->_order->save();
- }
-
- $this->getResponse()->setBody(
- $this->getLayout()
- ->createBlock($this->_cancelBlockType)
- ->setOrder($this->_order)
- ->toHtml()
- );
- }
-
- protected function _getPendingPaymentStatus()
- {
- return Mage::helper('paytm')->getPendingPaymentStatus();
- }
-
- public function curltestAction() {
- $debug = array();
- if(!function_exists("curl_init")){
- $debug[0]["info"][] = "cURL extension is either not available or disabled. Check phpinfo for more info.";
-
- }else{
- // this site homepage URL
- $testing_urls=array();
-
- if(!empty($_GET)){
- foreach ($_GET as $key => $value) {
- $testing_urls[]=$value;
- }
- }else{
- $transaction_status_url = Mage::getStoreConfig('payment/paytm_cc/transaction_status_url');
- $const = (string)Mage::getConfig()->getNode('global/crypt/key');
- $check_status_url= Mage::helper('paytm')->decrypt_e($transaction_status_url,$const);
- $testing_urls = array(
- Mage::getBaseUrl(),
- "www.google.co.in",
- $check_status_url
- );
- }
-
- // loop over all URLs, maintain debug log for each response received
- foreach($testing_urls as $key=>$url){
-
- $debug[$key]["info"][] = "Connecting to " . $url . " using cURL";
-
- $ch = curl_init($url);
- curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
- $res = curl_exec($ch);
-
- if (!curl_errno($ch)) {
- $http_code = curl_getinfo($ch, CURLINFO_HTTP_CODE);
- $debug[$key]["info"][] = "cURL executed succcessfully.";
- $debug[$key]["info"][] = "HTTP Response Code: ". $http_code . "";
-
- // $debug[$key]["content"] = $res;
-
- } else {
- $debug[$key]["info"][] = "Connection Failed !!";
- $debug[$key]["info"][] = "Error Code: " . curl_errno($ch) . "";
- $debug[$key]["info"][] = "Error: " . curl_error($ch) . "";
- break;
- }
- curl_close($ch);
- }
- }
- foreach($debug as $k=>$v){
- echo "
diff --git a/README.md b/README.md
new file mode 100644
index 0000000..1e592d1
--- /dev/null
+++ b/README.md
@@ -0,0 +1,2 @@
+# Paytm Payment plugin for Magento
+* Developer Docs: https://developer.paytm.com/docs/eCommerce-plugin/magento/
\ No newline at end of file