public function getStandardCheckoutFormFields() { $order = $this->getOrder(); if (!$order instanceof Mage_Sales_Model_Order) { Mage::throwException($this->_getHelper()->__('Cannot retrieve order object')); } $billingAddress = $order->getBillingAddress(); $shippingAddress = $order->getShippingAddress(); $streets = $billingAddress->getStreet(); $street = isset($streets[0]) && $streets[0] != '' ? $streets[0] : (isset($streets[1]) && $streets[1] != '' ? $streets[1] : ''); if ($this->getConfig()->getDescription()) { $transDescription = $this->getConfig()->getDescription(); } else { $transDescription = Mage::helper('Avenues')->__('Order #%s', $order->getRealOrderId()); } if ($order->getCustomerEmail()) { $email = $order->getCustomerEmail(); } elseif ($billingAddress->getEmail()) { $email = $billingAddress->getEmail(); } else { $email = ''; } $fields = array('Merchant_Id' => $this->getConfig()->getAccountId(), 'WorkingKey' => $this->getConfigData('workingkey'), 'product_price' => $order->getBaseGrandTotal(), 'Redirect_Url' => Mage::getUrl('Avenues/standard/success', array('_secure' => true)), 'product_name' => $transDescription, 'language' => $this->getConfig()->getLanguage(), 'billing_cust_name' => $billingAddress->getFirstname() . ' ' . $billingAddress->getLastname(), 'billing_last_name' => $billingAddress->getLastname(), 'billing_cust_address' => $street, 'billing_cust_city' => $billingAddress->getCity(), 'billing_cust_state' => $billingAddress->getRegionCode(), 'billing_zip_code' => $billingAddress->getPostcode(), 'billing_cust_country' => $billingAddress->getCountryModel()->getName(), 'billing_cust_tel' => $billingAddress->getTelephone(), 'billing_cust_email' => $email, 'delivery_cust_name' => $shippingAddress->getFirstname() . ' ' . $shippingAddress->getLastname(), 'delivery_last_name' => $shippingAddress->getLastname(), 'delivery_cust_address' => $shippingAddress->getStreetFull(), 'delivery_cust_city' => $shippingAddress->getCity(), 'delivery_cust_state' => $shippingAddress->getRegionCode(), 'delivery_zip_code' => $shippingAddress->getPostcode(), 'delivery_cust_country' => $shippingAddress->getCountryModel()->getName(), 'delivery_cust_tel' => $shippingAddress->getTelephone(), 'cb_url' => $this->getNotificationURL(), 'cb_type' => 'P', 'decline_url' => $this->getFailureURL(), 'cs1' => $order->getRealOrderId(), 'Checksum' => getCheckSum($this->getConfig()->getAccountId(), $order->getBaseGrandTotal(), $order->getRealOrderId(), Mage::getUrl('Avenues/standard/success', array('_secure' => true)), $this->getConfigData('workingkey'))); if ($this->getConfig()->getDebug()) { $debug = Mage::getModel('Avenues/api_debug')->setRequestBody($this->getAvenuesUrl() . "\n" . print_r($fields, 1))->save(); $fields['cs2'] = $debug->getId(); } return $fields; }
/** * @see http://integrate-payment-gateway.blogspot.in/2012/01/ccavenue-payment-integration-php.html * @param Payment_Invoice $invoice * @return array */ public function singlePayment(Payment_Invoice $invoice) { $buyer = $invoice->getBuyer(); $Merchant_Id = $this->getParam('merchantid'); $WorkingKey = $this->getParam('workingkey'); $Amount = $invoice->getTotalWithTax(); $Order_Id = $invoice->getId(); $Redirect_Url = $this->getParam('redirect_url'); $Checksum = getCheckSum($Merchant_Id, $Amount, $Order_Id, $Redirect_Url, $WorkingKey); $data = array(); $data['Merchant_Id'] = $Merchant_Id; $data['Amount'] = $Amount; $data['Order_Id'] = $Order_Id; $data['Redirect_Url'] = $Redirect_Url; $data['Checksum'] = $Checksum; $data['TxnType'] = 'A'; $data['ActionID'] = 'TXN'; $data['billing_cust_name'] = $buyer->getFirstName() . ' ' . $buyer->getLastName(); $data['billing_cust_address'] = $buyer->getAddress(); $data['billing_cust_country'] = $buyer->getCountry(); $data['billing_cust_state'] = $buyer->getState(); $data['billing_cust_city'] = $buyer->getCity(); $data['billing_zip'] = $buyer->getZip(); $data['billing_zip_code'] = $buyer->getZip(); $data['billing_cust_tel'] = $buyer->getPhone(); $data['billing_cust_email'] = $buyer->getEmail(); $data['delivery_cust_name'] = $buyer->getFirstName() . ' ' . $buyer->getLastName(); $data['delivery_cust_address'] = $buyer->getAddress(); $data['delivery_cust_city'] = $buyer->getCity(); $data['delivery_cust_country'] = $buyer->getCountry(); $data['delivery_cust_state'] = $buyer->getState(); $data['delivery_cust_tel'] = $buyer->getPhone(); $data['delivery_cust_notes'] = $invoice->getTitle(); return $data; }
/** * */ function processThumb($request_data) { if (!preg_match('~^/content/thumbs/(?<size>\\d*[x-]\\d*)/(?<crop>\\d+x\\d+\\-\\d+x\\d+|nocrop)/(?<checksum>[\\da-z]{6})/(?<file>.+)~', $request_data[0], $matches)) { return false; } if (!preg_match('~(?<width>\\d*)(?<sign>[x-])(?<height>\\d*)~', $matches['size'], $size_data)) { return false; } if (getCheckSum(array($matches['size'], $matches['crop'], $matches['file'])) !== $matches['checksum']) { return false; } if (!file_exists($original_filename = STATIC_ORIGINAL_FILES_DIR . '/' . $matches['file'])) { return false; } $thumb_name = STATIC_DIR . $request_data[0]; // load autoloader include VENDOR_DIR . '/autoload.php'; // add library to include path set_include_path(get_include_path() . PATH_SEPARATOR . VENDOR_DIR); // imagine $imagine = new \Imagine\Imagick\Imagine(); $image = $imagine->open($original_filename); // get crop data if ($matches['crop'] !== 'nocrop') { if (!preg_match('~(\\d+)x(\\d+)\\-(\\d+)x(\\d+)~', $matches['crop'], $crop_data)) { return false; } $crop_point = new Imagine\Image\Point($crop_data[1], $crop_data[2]); $crop_box = new Imagine\Image\Box($crop_data[3] - $crop_data[1], $crop_data[4] - $crop_data[2]); $image->crop($crop_point, $crop_box); } if (!file_exists(dirname($thumb_name)) && !mkdir(dirname($thumb_name), 0755, true)) { return false; } // get resize data $width = $size_data['width']; $height = $size_data['height']; if ($width && $height) { $size = new Imagine\Image\Box($width, $height); } else { if ($width) { $size = $image->getSize()->widen($width); } else { if ($height) { $size = $image->getSize()->heighten($height); } } } if (!empty($size)) { if (!empty($size_data['sign']) && $size_data['sign'] === '-') { $image = $image->thumbnail($size, \Imagine\Image\ImageInterface::THUMBNAIL_INSET); $w_diff = $size->getWidth() - $image->getSize()->getWidth(); $h_diff = $size->getHeight() - $image->getSize()->getHeight(); $bg = $imagine->create($size); $image = $bg->paste($image, new Imagine\Image\Point($w_diff / 2, $h_diff / 2)); } else { $image = $image->thumbnail($size, \Imagine\Image\ImageInterface::THUMBNAIL_OUTBOUND); } } $options = array('quality' => 85); if (!$image->save($thumb_name, $options)) { return false; } if (!($image_data = getimagesize($thumb_name))) { return false; } // optimize if ($image_data['mime'] === 'image/jpeg') { exec("jpegtran -copy none -optimize" . (filesize($thumb_name) < 10240 ? '' : ' -progressive') . " -outfile {$thumb_name} {$thumb_name}"); } if ($image_data['mime'] === 'image/png') { exec("optipng -o5 -quiet -preserve {$thumb_name}"); } header('X-Accel-Redirect: ' . $_SERVER['REQUEST_URI']); header('Content-Type: ' . $image_data['mime']); }
} $amount = $total_payable_amount * $L_QTY0 - $_SESSION['deductable_ref_amt']; $Merchant_Id = "M_mypocket_13956"; //This id(also User Id) available at "Generate Working Key" of "Settings & Options" //$Amount = $_POST['AMT'] ;//your script should substitute the amount in the quotes provided here $Amount = $total_payable_amount * $qty - $_SESSION['deductable_ref_amt']; $getvalue = split(",", $_POST['CUSTOM']); $L_QTY0 = $getvalue[1]; $COUPONID = $getvalue[0]; $Order_Id = $_SESSION['userid'] . '-' . date('Ymdhis'); //your script should substitute the order description in the quotes provided here $Redirect_Url = DOCROOT . "/system/modules/gateway/ccavenue/redirecturl.php"; //your redirect URL where your customer will be redirected after authorisation from CCAvenue $WorkingKey = "c0aemnfjcifqimarvd"; //put in the 32 bit alphanumeric key in the quotes provided here.Please note that get this key ,login to your CCAvenue merchant account and visit the "Generate Working Key" section at the "Settings & Options" page. $Checksum = getCheckSum($Merchant_Id, $Amount, $Order_Id, $Redirect_Url, $WorkingKey); $billing_cust_name = $_SESSION["username"]; $billing_cust_address = $_POST["address1"]; $billing_cust_state = $_POST["state"]; $billing_cust_country = $_POST["countrycode"]; $billing_cust_tel = "34252354"; $billing_cust_email = $_SESSION["emailid"]; $delivery_cust_name = $_SESSION["username"]; $delivery_cust_address = $_POST["address1"]; $delivery_cust_state = $_POST["state"]; $delivery_cust_country = $_POST["country"]; $delivery_cust_tel = "422345432"; $delivery_cust_notes = "SUB-MERCHANT TEST"; $pay_mod_id = $_POST["pay_mod_id"]; $paymentType = $_POST["paymentType"]; $REFERRAL_AMOUNT = $_SESSION['deductable_ref_amt'];