Hi, I have almost done the plugin, all payment processing is working as expected but, the invoice is updated to Paid, However, I can see successful transaction from the ccavenue merchant page, It is problem of the status updating part of the script. Can somebody help me? The code is below Code: <?php /** * @table paysystems * @id ccavenue * @title ccavenue * @visible_link http://ccavenue.in/ * @recurring none * @logo_url ccavenue.png */ include_once("libFunctions.php"); class Am_Paysystem_ccavenue extends Am_Paysystem_Abstract{ const PLUGIN_STATUS = self::STATUS_BETA; const PLUGIN_REVISION = '4.3.3'; const LIVE_URL ='https://www.ccavenue.com/shopzone/cc_details.jsp'; protected $defaultTitle = 'ccavenue'; protected $defaultDescription = 'Pay by credit card / Debit Card / Net Banking'; public function getSupportedCurrencies() { return array('INR'); } public function _initSetupForm(Am_Form_Setup $form) { $form->addText('account_Id')->setLabel(array('Merchant Account Id')); $form->addText('secret')->setLabel(array('Merchant Secret Key')); // $form->addText('Return_Url')->setLabel(array('Return URL after Payment')); } public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result) { $u = $invoice->getUser(); $a = new Am_Paysystem_Action_Form(self::LIVE_URL); $vars = array(); $vars['Merchant_Id'] = $this->getConfig('account_Id'); $vars['Order_Id'] = $invoice->public_id; $vars['Amount'] = $invoice->first_total; $vars['Redirect_Url'] = $this->getReturnUrl(); $vars['WorkingKey'] = $this->getConfig('secret'); $vars['Currency'] = $invoice->currency; $vars['TxnType'] = 'A'; $vars['actionID'] = 'TXN'; foreach($vars as $k=>$v){ $a->$k = $v; } $a->billing_cust_notes = $invoice->getLineDescription(); $a->billing_cust_name = $u->name_f.' '.$u->name_l; $a->billing_cust_address = $u->street; $a->billing_cust_city = $u->city; $a->billing_cust_state = substr($u->state, -2); $a->billing_zip_code = $u->zip; $a->billing_cust_country = $u->country; $a->billing_cust_tel = $u->phone; $a->billing_cust_email = $u->email; $a->Checksum = getChecksum($a->Merchant_Id, $a->Order_Id, $a->Amount, $a->Redirect_Url, $a->WorkingKey); $vars = array_filter($vars); foreach($vars as $k => $v) { $a->ccaRequest .= "$k=$v". "&"; } $a->ccaRequest .= "Checksum=".$a->Checksum; exec("java -jar ccavutil.jar $a->WorkingKey \"$a->ccaRequest\" enc", $a->encRequest); $result->setAction($a); } public function createTransaction(Am_Request $request, Zend_Controller_Response_Http $response, array $invokeArgs) { } public function createThanksTransaction(\Am_Request $request, \Zend_Controller_Response_Http $response, array $invokeArgs) { return new Am_Paysystem_Transaction_ccavenue($this, $request, $response, $invokeArgs); } public function getRecurringType() { return self::REPORTS_NOT_RECURRING; } } class Am_Paysystem_Transaction_ccavenue extends Am_Paysystem_Transaction_Incoming { function __construct(Am_Paysystem_Abstract $plugin, Am_Request $request, Zend_Controller_Response_Http $response, $invokeArgs) { parent::__construct($plugin, $request, $response, $invokeArgs); } public function validateSource() { $WorkingKey = $plugin->getConfig('secret') ; //put in the 32 bit working key in the quotes provided here $encResponse=$_REQUEST["encResponse"]; exec("java -jar ccavutil.jar $WorkingKey \"$encResponse\" dec",$ccaResponse); $tok = strtok($ccaResponse[0],"&"); $param; $value; $allKeys = array(); $index=0; $MerchantId=""; $OrderId=""; $Amount=""; $AuthDesc=""; $avnChecksum=""; while ($tok !== false) { $temp = $tok; list($param,$value) = preg_split("/[\=]/",$temp,2); $allParams["$param"] = $value; $allKeys[$index++] = $param; $tok = strtok("&"); } if(array_key_exists("Merchant_Id",$allParams)) $MerchantId = $allParams["Merchant_Id"]; if(array_key_exists("Order_Id",$allParams)) $OrderId = $allParams["Order_Id"]; if(array_key_exists("Amount",$allParams)) $Amount = $allParams["Amount"]; if(array_key_exists("AuthDesc",$allParams)) $AuthDesc = $allParams["AuthDesc"]; if(array_key_exists("Checksum",$allParams)) $avnChecksum = $allParams["Checksum"]; $Checksum = verifyChecksum($MerchantId, $OrderId, $Amount, $AuthDesc, $WorkingKey, $avnChecksum); return true; } function findInvoiceId() { return $this->$allParams["nb_order_no"]; } public function getUniqId() { return $this->$allParams["nb_bid"]; } public function validateStatus() { return ($this->$Checksum && $this->$allParams["AuthDesc"] ==="Y")? true : false; } public function validateTerms() { return $this->$allParams["Amount"] == $this->invoice->first_total; } } ?>
@rviyengar Is this plugin working for older single currency or newer multi currency platform of ccavenue. The plugin is not working for me...
As I can see from plugin code it supports multiple currencies, so I believe it should work with new platform. In any way, please contact us in helpdesk we will check what could be wrong with plugin .
The plugin is written for older ccavenue platform. It has to be changed for newer ccavenue platform to get it working right. I got it customised through a programmer to work for me. It working fine for multi currency now.