PayZippy_Payment_Gateway - Version 0.1.0

Version Notes

Initial and Stable Release

Download this release

Release Info

Developer Cueblocks
Extension PayZippy_Payment_Gateway
Version 0.1.0
Comparing to
See all releases


Version 0.1.0

app/code/community/FlipKart/PayZippy/Block/Form.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Description of ExtensionsStatusManager
5
+ * @package FlipKart_PayZippy
6
+ * @company CueBlocks - http://www.cueblocks.com/
7
+ * @author Ravinder <ravinder.singh@cueblocks.com>
8
+ */
9
+
10
+ class FlipKart_PayZippy_Block_Form extends Mage_Payment_Block_Form {
11
+
12
+ protected function _construct()
13
+ {
14
+ parent::_construct();
15
+ $this->setTemplate('payzippy/form.phtml')->setRedirectMessage(
16
+ Mage::helper('payzippy')->__('You will be redirected to the PayZippy website when you place an order.')
17
+ );
18
+ }
19
+
20
+ /*
21
+ *Return all allowed payment methods for payzippy like EMI,Debit Card etc
22
+ */
23
+
24
+ public function getAllowedMethods() {
25
+ $available_methods = array();
26
+ $methods = Mage::getStoreConfig('payment/payzippy/payment_methods');
27
+ $methods = explode(',',$methods);
28
+ $label_codes = Mage::getSingleton('payzippy/system_config_source_payment_methods')->toOptionArray();
29
+ $availables = array();
30
+ foreach($methods as $method) {
31
+ foreach($label_codes as $label) {
32
+ if($label['value'] == $method) {
33
+ $availables[] = $label;
34
+ }
35
+ }
36
+ }
37
+ return $availables;
38
+ }
39
+
40
+ /*
41
+ *Return allowed bank names for either payment method Net banking or EMI
42
+ */
43
+
44
+ public function getBankNames($paymentMethod) {
45
+ $bankCodes = Mage::getStoreConfig('payment/payzippy/'.$paymentMethod);
46
+ $bankCodes = explode(',', $bankCodes);
47
+ $bankLabels = Mage::getSingleton('payzippy/system_config_source_payment_bank_names')->toOptionArray();
48
+ $availables = "";
49
+ foreach($bankCodes as $code) {
50
+ foreach($bankLabels as $label) {
51
+ if($label['value'] == $code) {
52
+ $availables.= '<option value="'.$label["value"].'">'.$label["label"].'</option>';
53
+ }
54
+ }
55
+ }
56
+ return $availables;
57
+ }
58
+ }
59
+ ?>
app/code/community/FlipKart/PayZippy/Block/Info.php ADDED
@@ -0,0 +1,60 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Description of ExtensionsStatusManager
5
+ * @package FlipKart_PayZippy
6
+ * @company CueBlocks - http://www.cueblocks.com/
7
+ * @author Ravinder <ravinder.singh@cueblocks.com>
8
+ */
9
+
10
+ class FlipKart_PayZippy_Block_Info extends Mage_Payment_Block_Info
11
+ {
12
+
13
+ /*
14
+ *Function transport selected option of payment method to progress bar on checkout
15
+ */
16
+
17
+ protected function _prepareSpecificInformation($transport = null)
18
+ {
19
+ if (null !== $this->_paymentSpecificInformation) {
20
+ return $this->_paymentSpecificInformation;
21
+ }
22
+ $info = $this->getInfo();
23
+ $transport = new Varien_Object();
24
+ $transport = parent::_prepareSpecificInformation($transport);
25
+ $transport->addData(array(
26
+ Mage::helper('payment')->__('Payment Method') => $info->getPayzippyPaymentMethod(),
27
+ ));
28
+
29
+ $bank_code = $info->getPayzippyBankName();
30
+ $bank_name = $this->getBankName($bank_code);
31
+ $emi_months = $info->getPayzippyEmiMonths();
32
+ if(! empty($bank_name)) {
33
+ $transport->addData(array(
34
+ Mage::helper('payment')->__('Bank Name') => $bank_name,
35
+ ));
36
+ }
37
+
38
+ if(! empty($emi_months)) {
39
+ $transport->addData(array(
40
+ Mage::helper('payment')->__('Emi Months') => $emi_months,
41
+ ));
42
+ }
43
+
44
+ return $transport;
45
+ }
46
+
47
+ /*
48
+ *Return Bank name from bank code
49
+ */
50
+
51
+ public function getBankName($code) {
52
+ $bank_labels = Mage::getSingleton('payzippy/system_config_source_payment_bank_names')->toOptionArray();
53
+ foreach ($bank_labels as $label) {
54
+ if($label['value'] == $code) {
55
+ return $label['label'];
56
+ }
57
+ }
58
+
59
+ }
60
+ }
app/code/community/FlipKart/PayZippy/Block/Redirect.php ADDED
@@ -0,0 +1,141 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Description of ExtensionsStatusManager
5
+ * @package FlipKart_PayZippy
6
+ * @company CueBlocks - http://www.cueblocks.com/
7
+ * @author Ravinder <ravinder.singh@cueblocks.com>
8
+ */
9
+
10
+ class FlipKart_PayZippy_Block_Redirect extends Mage_Checkout_Block_Onepage_Abstract
11
+ {
12
+
13
+ /*
14
+ *Prepare request parameters for API request
15
+ */
16
+
17
+ public function getRequestparams() {
18
+ $_order = Mage::getSingleton('sales/order');
19
+ $merchant_transaction_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();
20
+ $_order->loadByIncrementId($merchant_transaction_id);
21
+ $payment_data = $_order->getPayment()->getData();
22
+ $shipping_address = $_order->getShippingAddress();
23
+ $billing_address = $_order->getBillingAddress();
24
+ $customerid = $_order->getCustomerId();
25
+ $amount = $_order->getBaseGrandTotal();
26
+ $from_Currency = Mage::app()->getStore()->getCurrentCurrencyCode();
27
+ $orderItemDetails = $this->getItemDetails($_order,$from_Currency);
28
+
29
+ /* Required Variables*/
30
+
31
+ $params['currency'] = "INR";
32
+ $params['merchant_transaction_id'] = $merchant_transaction_id;
33
+ $params['buyer_email_address'] = $_order->getBillingAddress()->getEmail();
34
+ if($customerid != NULL && !isset($params['buyer_email_address'])) {
35
+ $params['buyer_email_address'] = Mage::getSingleton('customer/session')->getCustomer()->getEmail();
36
+ }
37
+ $params['merchant_id'] = Mage::helper('payzippy')->getConfigData('merchant_id');
38
+ $params['transaction_type'] = "SALE";
39
+ $params['transaction_amount'] = $this->convertCurrency($from_Currency,$params['currency'],$amount);
40
+ $params['ui_mode'] = "REDIRECT";
41
+ $params['hash_method'] = "MD5";
42
+ $params['merchant_key_id'] = Mage::helper('payzippy')->getConfigData('merchant_key_id');
43
+ $params['callback_url'] = Mage::getBaseUrl().'payzippy/payment/response';
44
+ $params['payment_method'] = $payment_data['payzippy_payment_method'];
45
+ if(!empty ($payment_data['payzippy_bank_name'])):
46
+ $params['bank_name'] = $payment_data['payzippy_bank_name'];
47
+ endif;
48
+ if(!empty ($payment_data['payzippy_emi_months'])):
49
+ $params['emi_months'] = $payment_data['payzippy_emi_months'];
50
+ endif;
51
+
52
+ /*Optional Variables*/
53
+
54
+ $params['buyer_phone_no'] = $billing_address->getData('telephone');
55
+ $params['shipping_address'] = str_replace(array("\r", "\n"), '', $shipping_address->getData('street'));
56
+ $params['is_user_logged_in'] = 'false';
57
+ if($customerid != NULL) {
58
+ $params['buyer_unique_id'] = $customerid;
59
+ $params['is_user_logged_in'] = 'true';
60
+ $params['address_count'] = count(Mage::getSingleton('customer/session')->getCustomer()->getAddresses());
61
+ }
62
+ $params['shipping_city'] = $shipping_address->getData('city');
63
+ $params['shipping_state'] = $shipping_address->getData('region');
64
+ $params['shipping_zip'] = $shipping_address->getData('postcode');
65
+ $params['shipping_country'] = Mage::getSingleton('directory/country')->load($shipping_address->getData('country_id'))->getName();
66
+ $params['billing_address'] = str_replace(array("\r", "\n"), '', $billing_address->getData('street'));
67
+ $params['billing_city'] = $billing_address->getData('city');
68
+ $params['billing_state'] = $billing_address->getData('region');
69
+ $params['billing_zip'] = $billing_address->getData('postcode');
70
+ $params['billing_country'] = Mage::getSingleton('directory/country')->load($billing_address->getData('country_id'))->getName();
71
+ if($this->isMobile()) {
72
+ $params['source'] = 'mobile';
73
+ } else {
74
+ $params['source'] = 'web';
75
+ }
76
+ $params['billing_name'] = $billing_address->getData('firstname');
77
+ $params['sales_channel'] = '';
78
+ $params['item_total'] = $orderItemDetails['item_total'];
79
+ $params['item_vertical'] = $orderItemDetails['item_vertical'];
80
+ $params['udf1'] = Mage::helper('payzippy')->getConfigData('udf1');
81
+ $params['udf2'] = Mage::helper('payzippy')->getConfigData('udf2');
82
+ $params['udf3'] = Mage::helper('payzippy')->getConfigData('udf3');
83
+ $params['udf4'] = Mage::helper('payzippy')->getConfigData('udf4');
84
+ $params['udf5'] = Mage::helper('payzippy')->getConfigData('udf5');
85
+
86
+ return $params;
87
+ }
88
+
89
+ /*
90
+ *Return ordered items price and categories
91
+ */
92
+
93
+ public function getItemDetails($order,$currency) {
94
+ $result = array();
95
+ $category_names = array();
96
+ foreach($order->getAllItems() as $item) {
97
+ $result['item_total'][] = $this->convertCurrency($currency,'INR',$item->getPrice());
98
+ $categories = Mage::getSingleton('catalog/product')->load($item->getProductId())->getCategoryCollection()->exportToArray();
99
+ foreach($categories as $category) {
100
+ $category_names[] = Mage::getSingleton('catalog/category')->load($category['entity_id'])->getName();
101
+ }
102
+ $category_list = implode(',',$category_names);
103
+ $result['item_vertical'] = $category_list;
104
+ }
105
+ $result['item_total'] = implode(',',$result['item_total']);
106
+ return $result;
107
+ }
108
+
109
+ /*
110
+ *Convert current currency to INR and finally rupees to paisa
111
+ */
112
+
113
+ public function convertCurrency($from_Currency,$to_Currency,$amount) {
114
+ // $url = 'http://www.google.com/ig/calculator?hl=en&q=' . $amount . $from_Currency . '=?' . $to_Currency;
115
+ // $ch = curl_init();
116
+ // $timeout = 0;
117
+ // curl_setopt ($ch, CURLOPT_URL, $url);
118
+ // curl_setopt ($ch, CURLOPT_RETURNTRANSFER, 1);
119
+ // curl_setopt($ch, CURLOPT_USERAGENT , "Mozilla/4.0 (compatible; MSIE 8.0; Windows NT 6.1)");
120
+ // curl_setopt ($ch, CURLOPT_CONNECTTIMEOUT, $timeout);
121
+ // $response = curl_exec($ch);
122
+ // curl_close($ch);
123
+ // $result_string = explode('"', $response);
124
+ // $final_result = $result_string['3'];
125
+ // $float_result = preg_replace("/[^0-9\.]/", '', $final_result);
126
+ $float_result = $amount;
127
+ return round($float_result,2)*100;
128
+ }
129
+
130
+ /*
131
+ *Detect device
132
+ */
133
+ public function isMobile()
134
+ {
135
+ if(preg_match('/(alcatel|amoi|android|avantgo|blackberry|benq|cell|cricket|docomo|elaine|htc|iemobile|iphone|ipad|ipaq|ipod|j2me|java|midp|mini|mmp|mobi|motorola|nec-|nokia|palm|panasonic|philips|phone|sagem|sharp|sie-|smartphone|sony|symbian|t-mobile|telus|up\.browser|up\.link|vodafone|wap|webos|wireless|xda|xoom|zte)/i', $_SERVER['HTTP_USER_AGENT']))
136
+ return true;
137
+ else
138
+ return false;
139
+ }
140
+ }
141
+ ?>
app/code/community/FlipKart/PayZippy/Helper/Data.php ADDED
@@ -0,0 +1,24 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ class FlipKart_PayZippy_Helper_Data extends Mage_Core_Helper_Abstract
3
+ {
4
+
5
+ /*
6
+ *Return system configuration values
7
+ */
8
+
9
+ public function getConfigData($value) {
10
+ return Mage::getStoreConfig('payment/payzippy/'.$value,Mage::app()->getStore());
11
+ }
12
+
13
+ /*
14
+ *Generate Hash
15
+ */
16
+
17
+ public function gethash($params,$secret_key) {
18
+ ksort($params);
19
+ $str = implode("|", $params);
20
+ $str.= '|'.$secret_key;
21
+ $hash = md5($str);
22
+ return $hash;
23
+ }
24
+ }
app/code/community/FlipKart/PayZippy/Model/Mysql4/Setup.php ADDED
@@ -0,0 +1,13 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Description of ExtensionsStatusManager
5
+ * @package FlipKart_PayZippy
6
+ * @company CueBlocks - http://www.cueblocks.com/
7
+ * @author Ravinder <ravinder.singh@cueblocks.com>
8
+ */
9
+
10
+ class FlipKart_PayZippy_Model_Mysql4_Setup extends Mage_Catalog_Model_Resource_Eav_Mysql4_Setup
11
+ {
12
+ }
13
+ ?>
app/code/community/FlipKart/PayZippy/Model/Standard.php ADDED
@@ -0,0 +1,76 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Description of ExtensionsStatusManager
5
+ * @package FlipKart_PayZippy
6
+ * @company CueBlocks - http://www.cueblocks.com/
7
+ * @author Ravinder <ravinder.singh@cueblocks.com>
8
+ */
9
+
10
+ class FlipKart_PayZippy_Model_Standard extends Mage_Payment_Model_Method_Abstract {
11
+
12
+ protected $_code = 'payzippy';
13
+ protected $_formBlockType = 'payzippy/form';
14
+ protected $_infoBlockType = 'payzippy/info';
15
+ protected $_isInitializeNeeded = true;
16
+ protected $_canUseInternal = true;
17
+ protected $_canUseForMultishipping = false;
18
+
19
+ public function getOrderPlaceRedirectUrl() {
20
+ return Mage::getUrl('payzippy/payment/redirect', array('_secure' => true));
21
+ }
22
+
23
+ /*
24
+ *Assign payment method data to info object
25
+ */
26
+
27
+ public function assignData($data)
28
+ {
29
+
30
+ if (!($data instanceof Varien_Object)) {
31
+ $data = new Varien_Object($data);
32
+ }
33
+ $info = $this->getInfoInstance();
34
+
35
+ $payment_method = $data->getPayzippyPaymentMethod();
36
+
37
+ $info->setPayzippyPaymentMethod($payment_method);
38
+
39
+ if($payment_method == 'NET' || $payment_method == 'EMI') {
40
+ $info->setPayzippyBankName($data->getPayzippyBankName());
41
+ }
42
+
43
+ if($payment_method == 'EMI') {
44
+ $info->setPayzippyEmiMonths($data->getPayzippyEmiMonths());
45
+ }
46
+
47
+ return $this;
48
+ }
49
+
50
+ /*
51
+ *Validate payment method's form fields
52
+ */
53
+
54
+
55
+ public function validate()
56
+ {
57
+ parent::validate();
58
+
59
+ $errorMsg = "";
60
+
61
+ $info = $this->getInfoInstance();
62
+
63
+ $payment_method = $info->getPayzippyPaymentMethod();
64
+
65
+ if(empty($payment_method)){
66
+ $errorCode = 'invalid_data';
67
+ $errorMsg = $this->_getHelper()->__('Payment Method is required field');
68
+ }
69
+
70
+ if($errorMsg){
71
+ Mage::throwException($errorMsg);
72
+ }
73
+ return $this;
74
+ }
75
+ }
76
+ ?>
app/code/community/FlipKart/PayZippy/Model/System/Config/Source/Payment/Bank/Names.php ADDED
@@ -0,0 +1,425 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Description of ExtensionsStatusManager
5
+ * @package FlipKart_PayZippy
6
+ * @company CueBlocks - http://www.cueblocks.com/
7
+ * @author Ravinder <ravinder.singh@cueblocks.com>
8
+ */
9
+
10
+ class FlipKart_PayZippy_Model_System_Config_Source_Payment_Bank_Names
11
+ {
12
+
13
+ /*
14
+ *Return all possible bank names and thier codes
15
+ */
16
+
17
+ public function toOptionArray()
18
+ {
19
+ $names = array();
20
+ $names[] =Array
21
+ (
22
+ 'value' => 'ALB',
23
+ 'label' => 'Allahabad Bank'
24
+
25
+ );
26
+ $names[] =Array
27
+ (
28
+ 'value' => 'AMEX',
29
+ 'label' => 'American Express'
30
+
31
+ );
32
+ $names[] =Array
33
+ (
34
+ 'value' => 'AND',
35
+ 'label' => 'Andhra Bank'
36
+
37
+ );
38
+ $names[] =Array
39
+ (
40
+ 'value' => 'AXIS',
41
+ 'label' => 'Axis Bank'
42
+
43
+ );
44
+ $names[] =Array
45
+ (
46
+ 'value' => 'BARC',
47
+ 'label' => 'Barclays Bank'
48
+
49
+ );
50
+ $names[] =Array
51
+ (
52
+ 'value' => 'BOB',
53
+ 'label' => 'Bank of Baroda'
54
+
55
+ );
56
+ $names[] =Array
57
+ (
58
+ 'value' => 'BOBAH',
59
+ 'label' => 'Bank of Bahrain and Kuwait'
60
+
61
+ );
62
+ $names[] =Array
63
+ (
64
+ 'value' => 'BOI',
65
+ 'label' => 'Bank of India'
66
+
67
+ );
68
+ $names[] =Array
69
+ (
70
+ 'value' => 'BOM',
71
+ 'label' => 'Bank of Maharashtra'
72
+
73
+ );
74
+ $names[] =Array
75
+ (
76
+ 'value' => 'BOP',
77
+ 'label' => 'Bank of Punjab'
78
+
79
+ );
80
+ $names[] =Array
81
+ (
82
+ 'value' => 'BOR',
83
+ 'label' => 'Bank of Rajasthan'
84
+
85
+ );
86
+ $names[] =Array
87
+ (
88
+ 'value' => 'CBI',
89
+ 'label' => 'Central Bank'
90
+
91
+ );
92
+ $names[] =Array
93
+ (
94
+ 'value' => 'CBPL',
95
+ 'label' => 'Centurion Bank of Punjab'
96
+
97
+ );
98
+ $names[] =Array
99
+ (
100
+ 'value' => 'CITIBANK',
101
+ 'label' => 'Citibank'
102
+
103
+ );
104
+ $names[] =Array
105
+ (
106
+ 'value' => 'CITIUB',
107
+ 'label' => 'City Union Bank'
108
+
109
+ );
110
+ $names[] =Array
111
+ (
112
+ 'value' => 'CNB',
113
+ 'label' => 'Canara Bank'
114
+
115
+ );
116
+ $names[] =Array
117
+ (
118
+ 'value' => 'COP',
119
+ 'label' => 'Corporation Bank'
120
+
121
+ );
122
+ $names[] =Array
123
+ (
124
+ 'value' => 'COSCB',
125
+ 'label' => 'Cosmos Co-op Bank'
126
+
127
+ );
128
+ $names[] =Array
129
+ (
130
+ 'value' => 'CSBL',
131
+ 'label' => 'Catholic Syrian Bank'
132
+
133
+ );
134
+ $names[] =Array
135
+ (
136
+ 'value' => 'CUBL',
137
+ 'label' => 'City Union Bank'
138
+
139
+ );
140
+ $names[] =Array
141
+ (
142
+ 'value' => 'DBL',
143
+ 'label' => 'Dhanalakshmi Bank'
144
+
145
+ );
146
+ $names[] =Array
147
+ (
148
+ 'value' => 'DBS',
149
+ 'label' => 'DBS Bank'
150
+
151
+ );
152
+ $names[] =Array
153
+ (
154
+ 'value' => 'DCB',
155
+ 'label' => 'Development Credit Bank'
156
+
157
+ );
158
+ $names[] =Array
159
+ (
160
+ 'value' => 'DCBL',
161
+ 'label' => 'Development Credit Bank'
162
+
163
+ );
164
+ $names[] =Array
165
+ (
166
+ 'value' => 'DEUNB',
167
+ 'label' => 'Deutsche Bank'
168
+
169
+ );
170
+ $names[] =Array
171
+ (
172
+ 'value' => 'DHNB',
173
+ 'label' => 'Dhanalakshmi Bank'
174
+
175
+ );
176
+ $names[] =Array
177
+ (
178
+ 'value' => 'DNB',
179
+ 'label' => 'Dena Bank'
180
+
181
+ );
182
+ $names[] =Array
183
+ (
184
+ 'value' => 'DONEC',
185
+ 'label' => 'Done Card'
186
+
187
+ );
188
+ $names[] =Array
189
+ (
190
+ 'value' => 'FED',
191
+ 'label' => 'Federal Bank'
192
+
193
+ );
194
+ $names[] =Array
195
+ (
196
+ 'value' => 'GE',
197
+ 'label' => 'GE Money'
198
+
199
+ );
200
+ $names[] =Array
201
+ (
202
+ 'value' => 'HDFC',
203
+ 'label' => 'HDFC Bank'
204
+
205
+ );
206
+ $names[] =Array
207
+ (
208
+ 'value' => 'HIB',
209
+ 'label' => 'Himalayan Bank'
210
+
211
+ );
212
+ $names[] =Array
213
+ (
214
+ 'value' => 'HSBC',
215
+ 'label' => 'HSBC'
216
+
217
+ );
218
+ $names[] =Array
219
+ (
220
+ 'value' => 'ICICI',
221
+ 'label' => 'ICICI Bank'
222
+
223
+ );
224
+ $names[] =Array
225
+ (
226
+ 'value' => 'IDBI',
227
+ 'label' => 'IDBI Bank'
228
+
229
+ );
230
+ $names[] =Array
231
+ (
232
+ 'value' => 'IIB',
233
+ 'label' => 'IndusInd Bank'
234
+
235
+ );
236
+ $names[] =Array
237
+ (
238
+ 'value' => 'INB',
239
+ 'label' => 'Indian Bank'
240
+
241
+ );
242
+ $names[] =Array
243
+ (
244
+ 'value' => 'ING',
245
+ 'label' => 'ING Vysya Bank'
246
+
247
+ );
248
+ $names[] =Array
249
+ (
250
+ 'value' => 'IOB',
251
+ 'label' => 'Indian Overseas Bank'
252
+
253
+ );
254
+ $names[] =Array
255
+ (
256
+ 'value' => 'JKB',
257
+ 'label' => 'J&K Bank'
258
+
259
+ );
260
+ $names[] =Array
261
+ (
262
+ 'value' => 'JPMC',
263
+ 'label' => 'JPMorgan Chase Bank'
264
+
265
+ );
266
+ $names[] =Array
267
+ (
268
+ 'value' => 'KMB',
269
+ 'label' => 'Kotak Bank'
270
+
271
+ );
272
+ $names[] =Array
273
+ (
274
+ 'value' => 'KTKB',
275
+ 'label' => 'Karnataka Bank'
276
+
277
+ );
278
+ $names[] =Array
279
+ (
280
+ 'value' => 'KVB',
281
+ 'label' => 'Karur Vysya Bank'
282
+
283
+ );
284
+ $names[] =Array
285
+ (
286
+ 'value' => 'LVB',
287
+ 'label' => 'Lakshmi Vilas Bank'
288
+
289
+ );
290
+ $names[] =Array
291
+ (
292
+ 'value' => 'NBL',
293
+ 'label' => 'Nabil Bank'
294
+
295
+ );
296
+ $names[] =Array
297
+ (
298
+ 'value' => 'OBC',
299
+ 'label' => 'Oriental Bank of Commerce'
300
+
301
+ );
302
+ $names[] =Array
303
+ (
304
+ 'value' => 'PMCB',
305
+ 'label' => 'Punjab & Maharashtra Co-op Bank'
306
+
307
+ );
308
+ $names[] =Array
309
+ (
310
+ 'value' => 'PNB',
311
+ 'label' => 'Punjab National Bank'
312
+
313
+ );
314
+ $names[] =Array
315
+ (
316
+ 'value' => 'RBL',
317
+ 'label' => 'Ratnakar Bank'
318
+
319
+ );
320
+ $names[] =Array
321
+ (
322
+ 'value' => 'RBS',
323
+ 'label' => 'RBS'
324
+
325
+ );
326
+ $names[] =Array
327
+ (
328
+ 'value' => 'SACOB',
329
+ 'label' => 'Saraswat Co-op Bank'
330
+
331
+ );
332
+ $names[] =Array
333
+ (
334
+ 'value' => 'SBH',
335
+ 'label' => 'State Bank of Hyderabad'
336
+
337
+ );
338
+ $names[] =Array
339
+ (
340
+ 'value' => 'SBI',
341
+ 'label' => 'State Bank of India'
342
+
343
+ );
344
+ $names[] =Array
345
+ (
346
+ 'value' => 'SBM',
347
+ 'label' => 'State Bank of Mysore'
348
+
349
+ );
350
+ $names[] =Array
351
+ (
352
+ 'value' => 'SBT',
353
+ 'label' => 'State Bank of Travancore'
354
+
355
+ );
356
+ $names[] =Array
357
+ (
358
+ 'value' => 'SIB',
359
+ 'label' => 'The South Indian Bank'
360
+
361
+ );
362
+ $names[] =Array
363
+ (
364
+ 'value' => 'STDC',
365
+ 'label' => 'Standard Chartered Bank'
366
+
367
+ );
368
+ $names[] =Array
369
+ (
370
+ 'value' => 'SVCB',
371
+ 'label' => 'Shamrao Vithal Co-op Bank'
372
+
373
+ );
374
+ $names[] =Array
375
+ (
376
+ 'value' => 'SYNBK',
377
+ 'label' => 'Syndicate Bank'
378
+
379
+ );
380
+ $names[] =Array
381
+ (
382
+ 'value' => 'TJSB',
383
+ 'label' => 'Thane Janata Sahakari Bank'
384
+
385
+ );
386
+ $names[] =Array
387
+ (
388
+ 'value' => 'TNMB',
389
+ 'label' => 'Tamil Nadu Merchantile Bank'
390
+
391
+ );
392
+ $names[] =Array
393
+ (
394
+ 'value' => 'UCO',
395
+ 'label' => 'UCO Bank'
396
+
397
+ );
398
+ $names[] =Array
399
+ (
400
+ 'value' => 'UNI',
401
+ 'label' => 'Union Bank of India'
402
+
403
+ );
404
+ $names[] =Array
405
+ (
406
+ 'value' => 'UNITD',
407
+ 'label' => 'United Bank of India',
408
+
409
+ );
410
+ $names[] =Array
411
+ (
412
+ 'value' => 'VJYA',
413
+ 'label' => 'Vijaya Bank'
414
+
415
+ );
416
+ $names[] =Array
417
+ (
418
+ 'value' => 'YES',
419
+ 'label' => 'Yes Bank'
420
+
421
+ );
422
+
423
+ return $names;
424
+ }
425
+ }
app/code/community/FlipKart/PayZippy/Model/System/Config/Source/Payment/Methods.php ADDED
@@ -0,0 +1,27 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Description of ExtensionsStatusManager
5
+ * @package FlipKart_PayZippy
6
+ * @company CueBlocks - http://www.cueblocks.com/
7
+ * @author Ravinder <ravinder.singh@cueblocks.com>
8
+ */
9
+
10
+ class FlipKart_PayZippy_Model_System_Config_Source_Payment_Methods
11
+ {
12
+
13
+ /*
14
+ *Return available payment methods for payzippy
15
+ */
16
+
17
+ public function toOptionArray()
18
+ {
19
+ $methods = array();
20
+ $methods[] = array('value' => 'CREDIT' ,'label' => 'Credit Card');
21
+ $methods[] = array('value' => 'DEBIT' ,'label' => 'Debit Card');
22
+ $methods[] = array('value' => 'EMI' ,'label' => 'Credit Card EMI');
23
+ $methods[] = array('value' => 'NET' ,'label' => 'Net Banking');
24
+
25
+ return $methods;
26
+ }
27
+ }
app/code/community/FlipKart/PayZippy/controllers/PaymentController.php ADDED
@@ -0,0 +1,95 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Description of ExtensionsStatusManager
5
+ * @package FlipKart_PayZippy
6
+ * @company CueBlocks - http://www.cueblocks.com/
7
+ * @author Ravinder <ravinder.singh@cueblocks.com>
8
+ */
9
+
10
+ class FlipKart_PayZippy_PaymentController extends Mage_Core_Controller_Front_Action
11
+ {
12
+
13
+ /*
14
+ *Triggered when place order button is clicked
15
+ */
16
+
17
+ public function redirectAction()
18
+ {
19
+ $this->getResponse()->setBody($this->getLayout()->createBlock('payzippy/redirect', 'payzippy', array(
20
+ 'template' => 'payzippy/redirect.phtml'
21
+ ))->toHtml());
22
+ ;
23
+ }
24
+
25
+ /*
26
+ *Handle response from API
27
+ */
28
+
29
+ public function responseAction()
30
+ {
31
+ $response = $this->getRequest()->getParams();
32
+
33
+ if(Mage::helper('payzippy')->getConfigData('debug')) {
34
+ Mage::log("Response:- ".print_r($response, true), Zend_Log::DEBUG, 'payzippy.log', true);
35
+ }
36
+ if (isset($response)) {
37
+ $validated = $response['transaction_response_code'];
38
+ $hash_recievd = $response['hash'];
39
+ $payzippy_transid = $response['payzippy_transaction_id'];
40
+ $payment_method = $response['payment_method'];
41
+ $trans_status = $response['transaction_status'];
42
+ $orderId = $response['merchant_transaction_id'];
43
+ $message = $response['transaction_response_message'];
44
+ $is_international = $response['is_international'];
45
+ $fraud_action = $response['fraud_action'];
46
+ $allow = array('SUCCESS','INITIATED','PENDING');
47
+ $comment = 'PayZippy Transaction Id : '.$payzippy_transid.'<br/>'.'Payment Method : '.$payment_method.'<br/>'.'Transaction Status : '.$trans_status.'<br/>'.'Transaction Response Code : '.$validated.'<br/>'.'Transaction Response Message : '.$message.'<br/>'.'Is_International : '.$is_international.'<br/>'.'Fraud Action : '.$fraud_action;
48
+ unset($response['hash']);
49
+ $hash_generated = Mage::helper('payzippy')->getHash($response,Mage::helper('payzippy')->getConfigData('secret_key'));
50
+
51
+ if (in_array($validated, $allow) && $hash_recievd == $hash_generated) {
52
+ // Payment was successful, so update the order's state, send order email and move to the success page
53
+ $order = Mage::getSingleton('sales/order');
54
+ $order->loadByIncrementId($orderId);
55
+ $order->setState(Mage_Sales_Model_Order::STATE_PROCESSING, true, $comment);
56
+
57
+ $order->sendNewOrderEmail();
58
+ $order->setEmailSent(true);
59
+
60
+ $order->save();
61
+
62
+ Mage::getSingleton('checkout/session')->unsQuoteId();
63
+
64
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/success', array(
65
+ '_secure' => true
66
+ ));
67
+ } else {
68
+ // There is a problem in the response we got
69
+ Mage::getSingleton('core/session')->addError($message);
70
+ $this->cancelAction($comment);
71
+ Mage_Core_Controller_Varien_Action::_redirect('checkout/onepage/failure', array(
72
+ '_secure' => true
73
+ ));
74
+ }
75
+ } else {
76
+ Mage_Core_Controller_Varien_Action::_redirect('');
77
+ }
78
+ }
79
+
80
+
81
+ /*
82
+ *Triggered to cancel the order
83
+ */
84
+
85
+ public function cancelAction($reason)
86
+ {
87
+ if (Mage::getSingleton('checkout/session')->getLastRealOrderId()) {
88
+ $order = Mage::getSingleton('sales/order')->loadByIncrementId(Mage::getSingleton('checkout/session')->getLastRealOrderId());
89
+ if ($order->getId()) {
90
+ // Flag the order as 'cancelled' and save it
91
+ $order->cancel()->setState(Mage_Sales_Model_Order::STATE_CANCELED, true, $reason)->save();
92
+ }
93
+ }
94
+ }
95
+ }
app/code/community/FlipKart/PayZippy/etc/config.xml ADDED
@@ -0,0 +1,70 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <FlipKart_PayZippy>
5
+ <version>0.1.0</version>
6
+ </FlipKart_PayZippy>
7
+ </modules>
8
+ <global>
9
+ <models>
10
+ <payzippy>
11
+ <class>FlipKart_PayZippy_Model</class>
12
+ </payzippy>
13
+ </models>
14
+ <helpers>
15
+ <payzippy>
16
+ <class>FlipKart_PayZippy_Helper</class>
17
+ </payzippy>
18
+ </helpers>
19
+ <blocks>
20
+ <payzippy>
21
+ <class>FlipKart_PayZippy_Block</class>
22
+ </payzippy>
23
+ </blocks>
24
+ <fieldsets>
25
+ <sales_convert_quote_payment>
26
+ <payzippy_payment_method>
27
+ <to_order_payment>*</to_order_payment>
28
+ </payzippy_payment_method>
29
+ <payzippy_bank_name>
30
+ <to_order_payment>*</to_order_payment>
31
+ </payzippy_bank_name>
32
+ <payzippy_emi_months>
33
+ <to_order_payment>*</to_order_payment>
34
+ </payzippy_emi_months>
35
+ </sales_convert_quote_payment>
36
+ </fieldsets>
37
+ <resources>
38
+ <payzippy_setup>
39
+ <setup>
40
+ <module>FlipKart_PayZippy</module>
41
+ <class>FlipKart_PayZippy_Model_Mysql4_Setup</class>
42
+ </setup>
43
+ </payzippy_setup>
44
+ </resources>
45
+ </global>
46
+ <default>
47
+ <payment>
48
+ <payzippy>
49
+ <model>payzippy/standard</model>
50
+ <active>0</active>
51
+ <order_status>pending</order_status>
52
+ <title>Payzippy</title>
53
+ <payment_action>sale</payment_action>
54
+ <allowspecific>0</allowspecific>
55
+ <sort_order>1</sort_order>
56
+ </payzippy>
57
+ </payment>
58
+ </default>
59
+ <frontend>
60
+ <routers>
61
+ <payzippy>
62
+ <use>standard</use>
63
+ <args>
64
+ <module>FlipKart_PayZippy</module>
65
+ <frontName>payzippy</frontName>
66
+ </args>
67
+ </payzippy>
68
+ </routers>
69
+ </frontend>
70
+ </config>
app/code/community/FlipKart/PayZippy/etc/system.xml ADDED
@@ -0,0 +1,176 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <sections>
4
+ <payment>
5
+ <groups>
6
+ <payzippy translate="label comment" module="payzippy">
7
+ <label>Payzippy</label>
8
+ <frontend_type>text</frontend_type>
9
+ <sort_order>100</sort_order>
10
+ <show_in_default>1</show_in_default>
11
+ <show_in_website>1</show_in_website>
12
+ <show_in_store>1</show_in_store>
13
+ <fields>
14
+ <active translate="label">
15
+ <label>Enabled</label>
16
+ <frontend_type>select</frontend_type>
17
+ <source_model>adminhtml/system_config_source_yesno</source_model>
18
+ <sort_order>10</sort_order>
19
+ <show_in_default>1</show_in_default>
20
+ <show_in_website>1</show_in_website>
21
+ <show_in_store>0</show_in_store>
22
+ </active>
23
+ <title translate="label">
24
+ <label>Title</label>
25
+ <frontend_type>text</frontend_type>
26
+ <sort_order>20</sort_order>
27
+ <show_in_default>1</show_in_default>
28
+ <show_in_website>1</show_in_website>
29
+ <show_in_store>1</show_in_store>
30
+ </title>
31
+ <merchant_id translate="label">
32
+ <label>Merchant Id</label>
33
+ <frontend_type>text</frontend_type>
34
+ <sort_order>21</sort_order>
35
+ <show_in_default>1</show_in_default>
36
+ <show_in_website>1</show_in_website>
37
+ <show_in_store>1</show_in_store>
38
+ </merchant_id>
39
+ <merchant_key_id translate="label">
40
+ <label>Merchant Key Id</label>
41
+ <frontend_type>text</frontend_type>
42
+ <sort_order>22</sort_order>
43
+ <show_in_default>1</show_in_default>
44
+ <show_in_website>1</show_in_website>
45
+ <show_in_store>1</show_in_store>
46
+ </merchant_key_id>
47
+ <secret_key translate="label">
48
+ <label>Secret Key</label>
49
+ <frontend_type>text</frontend_type>
50
+ <sort_order>23</sort_order>
51
+ <show_in_default>1</show_in_default>
52
+ <show_in_website>1</show_in_website>
53
+ <show_in_store>1</show_in_store>
54
+ </secret_key>
55
+ <udf1 translate="label">
56
+ <label>User defined field 1</label>
57
+ <frontend_type>text</frontend_type>
58
+ <sort_order>24</sort_order>
59
+ <show_in_default>1</show_in_default>
60
+ <show_in_website>1</show_in_website>
61
+ <show_in_store>1</show_in_store>
62
+ </udf1>
63
+ <udf2 translate="label">
64
+ <label>User defined field 2</label>
65
+ <frontend_type>text</frontend_type>
66
+ <sort_order>25</sort_order>
67
+ <show_in_default>1</show_in_default>
68
+ <show_in_website>1</show_in_website>
69
+ <show_in_store>1</show_in_store>
70
+ </udf2>
71
+ <udf3 translate="label">
72
+ <label>User defined field 3</label>
73
+ <frontend_type>text</frontend_type>
74
+ <sort_order>26</sort_order>
75
+ <show_in_default>1</show_in_default>
76
+ <show_in_website>1</show_in_website>
77
+ <show_in_store>1</show_in_store>
78
+ </udf3>
79
+ <udf4 translate="label">
80
+ <label>User defined field 4</label>
81
+ <frontend_type>text</frontend_type>
82
+ <sort_order>27</sort_order>
83
+ <show_in_default>1</show_in_default>
84
+ <show_in_website>1</show_in_website>
85
+ <show_in_store>1</show_in_store>
86
+ </udf4>
87
+ <udf5 translate="label">
88
+ <label>User defined field 5</label>
89
+ <frontend_type>text</frontend_type>
90
+ <sort_order>28</sort_order>
91
+ <show_in_default>1</show_in_default>
92
+ <show_in_website>1</show_in_website>
93
+ <show_in_store>1</show_in_store>
94
+ </udf5>
95
+ <payment_methods translate="label">
96
+ <label>Allowed payment methods</label>
97
+ <frontend_type>multiselect</frontend_type>
98
+ <source_model>payzippy/system_config_source_payment_methods</source_model>
99
+ <sort_order>29</sort_order>
100
+ <show_in_default>1</show_in_default>
101
+ <show_in_website>1</show_in_website>
102
+ <show_in_store>1</show_in_store>
103
+ </payment_methods>
104
+ <emi_bank_names translate="label">
105
+ <label>Allowed banks for EMI</label>
106
+ <frontend_type>multiselect</frontend_type>
107
+ <source_model>payzippy/system_config_source_payment_bank_names</source_model>
108
+ <sort_order>30</sort_order>
109
+ <show_in_default>1</show_in_default>
110
+ <show_in_website>1</show_in_website>
111
+ <show_in_store>1</show_in_store>
112
+ <comment>Will applicable only if credit card EMI is enabled</comment>
113
+ </emi_bank_names>
114
+ <net_bank_names translate="label">
115
+ <label>Allowed banks for Net banking</label>
116
+ <frontend_type>multiselect</frontend_type>
117
+ <source_model>payzippy/system_config_source_payment_bank_names</source_model>
118
+ <sort_order>31</sort_order>
119
+ <show_in_default>1</show_in_default>
120
+ <show_in_website>1</show_in_website>
121
+ <show_in_store>1</show_in_store>
122
+ <comment>Will applicable only if NET banking is enabled</comment>
123
+ </net_bank_names>
124
+ <order_status translate="label">
125
+ <label>New Order Status</label>
126
+ <frontend_type>select</frontend_type>
127
+ <source_model>adminhtml/system_config_source_order_status</source_model>
128
+ <sort_order>50</sort_order>
129
+ <show_in_default>1</show_in_default>
130
+ <show_in_website>1</show_in_website>
131
+ <show_in_store>0</show_in_store>
132
+ </order_status>
133
+ <allowspecific translate="label">
134
+ <label>Payment Applicable From</label>
135
+ <frontend_type>select</frontend_type>
136
+ <sort_order>61</sort_order>
137
+ <source_model>adminhtml/system_config_source_payment_allspecificcountries</source_model>
138
+ <show_in_default>1</show_in_default>
139
+ <show_in_website>1</show_in_website>
140
+ <show_in_store>0</show_in_store>
141
+ </allowspecific>
142
+ <specificcountry translate="label">
143
+ <label>Countries Payment Applicable From</label>
144
+ <frontend_type>multiselect</frontend_type>
145
+ <sort_order>70</sort_order>
146
+ <source_model>adminhtml/system_config_source_country</source_model>
147
+ <show_in_default>1</show_in_default>
148
+ <show_in_website>1</show_in_website>
149
+ <show_in_store>0</show_in_store>
150
+ <depends>
151
+ <allowspecific>1</allowspecific>
152
+ </depends>
153
+ </specificcountry>
154
+ <debug translate="label">
155
+ <label>Debug Mode</label>
156
+ <frontend_type>select</frontend_type>
157
+ <source_model>adminhtml/system_config_source_yesno</source_model>
158
+ <sort_order>71</sort_order>
159
+ <show_in_default>1</show_in_default>
160
+ <show_in_website>1</show_in_website>
161
+ <show_in_store>0</show_in_store>
162
+ </debug>
163
+ <sort_order translate="label">
164
+ <label>Sort Order</label>
165
+ <frontend_type>text</frontend_type>
166
+ <sort_order>100</sort_order>
167
+ <show_in_default>1</show_in_default>
168
+ <show_in_website>1</show_in_website>
169
+ <show_in_store>0</show_in_store>
170
+ </sort_order>
171
+ </fields>
172
+ </payzippy>
173
+ </groups>
174
+ </payment>
175
+ </sections>
176
+ </config>
app/code/community/FlipKart/PayZippy/sql/payzippy_setup/mysql4-install-0.1.0.php ADDED
@@ -0,0 +1,23 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * Description of ExtensionsStatusManager
5
+ * @package FlipKart_PayZippy
6
+ * @company CueBlocks - http://www.cueblocks.com/
7
+ * @author Ravinder <ravinder.singh@cueblocks.com>
8
+ */
9
+
10
+ $installer = $this;
11
+ $installer->startSetup();
12
+ $installer->run("
13
+
14
+ ALTER TABLE `{$installer->getTable('sales/quote_payment')}` ADD `payzippy_payment_method` VARCHAR( 255 ) NOT NULL ;
15
+ ALTER TABLE `{$installer->getTable('sales/quote_payment')}` ADD `payzippy_bank_name` VARCHAR( 255 ) ;
16
+ ALTER TABLE `{$installer->getTable('sales/quote_payment')}` ADD `payzippy_emi_months` VARCHAR( 255 ) ;
17
+
18
+ ALTER TABLE `{$installer->getTable('sales/order_payment')}` ADD `payzippy_payment_method` VARCHAR( 255 ) NOT NULL ;
19
+ ALTER TABLE `{$installer->getTable('sales/order_payment')}` ADD `payzippy_bank_name` VARCHAR( 255 );
20
+ ALTER TABLE `{$installer->getTable('sales/order_payment')}` ADD `payzippy_emi_months` VARCHAR( 255 );
21
+
22
+ ");
23
+ $installer->endSetup();
app/design/frontend/base/default/template/payzippy/form.phtml ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $_code=$this->getMethodCode();
3
+ $methods= $this->getAllowedMethods();
4
+ $emiBanks= $this->getBankNames('emi_bank_names');
5
+ $netBanks= $this->getBankNames('net_bank_names');
6
+ ?>
7
+ <ul class="form-list" id="payment_form_<?php echo $_code ?>" style="display:none;">
8
+ <li class="message">
9
+ <?php echo $this->getRedirectMessage();?>
10
+ </li>
11
+ <li>
12
+ <label for="<?php echo $_code ?>_payment_method" class="required"><em>*</em><?php echo $this->__('Payment Method') ?></label>
13
+ <div class="input-box">
14
+ <select title="<?php echo $this->__('Payment Method') ?>" class="input-select required-entry" id="<?php echo $_code ?>_payment_method" name="payment[payzippy_payment_method]" value="<?php echo $this->htmlEscape($this->getInfoData('payzippy_payment_method')) ?>" onchange="hideMethod()">
15
+ <option value=""><?php echo $this->__('--Please Select--')?></option>
16
+ <?php foreach($methods as $method):?>
17
+ <option value="<?php echo $method['value']?>"><?php echo $method['label']?></option>
18
+ <?php endforeach;?>
19
+ </select>
20
+ </div>
21
+ </li>
22
+ <li id="zippy_bank_name" style="display:none;">
23
+ <label for="<?php echo $_code ?>_bank_name" class="required"><em>*</em><?php echo $this->__('Bank Name') ?></label>
24
+ <div class="input-box">
25
+ <select title="<?php echo $this->__('Bank Name') ?>" class="input-select required-entry" id="<?php echo $_code ?>_bank_name" name="payment[payzippy_bank_name]" value="<?php echo $this->htmlEscape($this->getInfoData('payzippy_bank_name')) ?>">
26
+ <?php echo $emiBanks;?>
27
+ </select>
28
+ </div>
29
+ </li>
30
+ <li id="zippy_emi_months" style="display:none;">
31
+ <label for="<?php echo $_code ?>_emi_months" class="required"><em>*</em><?php echo $this->__('EMI Months') ?></label>
32
+ <div class="input-box">
33
+ <select title="<?php echo $this->__('EMI Months') ?>" class="input-select required-entry" id="<?php echo $_code ?>_payment_method" name="payment[payzippy_emi_months]" value="<?php echo $this->htmlEscape($this->getInfoData('payzippy_emi_months')) ?>">
34
+ <option value="3">3</option>
35
+ <option value="6">6</option>
36
+ <option value="9">9</option>
37
+ <option value="12">12</option>
38
+ </select>
39
+ </div>
40
+ </li>
41
+ </ul>
42
+ <script>
43
+ function hideMethod()
44
+ {
45
+ var emibankNames = '<?php echo $emiBanks?>';
46
+ var netbankNames = '<?php echo $netBanks?>';
47
+ var emiMonths = document.getElementById("zippy_emi_months");
48
+ var bankName = document.getElementById("zippy_bank_name");
49
+ var bankNameSelect = document.getElementById("<?php echo $_code ?>_bank_name");
50
+ var paymentMethod = document.getElementById("payzippy_payment_method");
51
+ if(paymentMethod.options[paymentMethod.selectedIndex].value == "EMI")
52
+ {
53
+ emiMonths.style.display="block";
54
+ bankNameSelect.innerHTML = '';
55
+ bankNameSelect.innerHTML = emibankNames;
56
+ bankName.style.display="block";
57
+ }
58
+
59
+ if(paymentMethod.options[paymentMethod.selectedIndex].value == "NET")
60
+ {
61
+ emiMonths.style.display="none";
62
+ bankNameSelect.innerHTML = '';
63
+ bankNameSelect.innerHTML = netbankNames;
64
+ bankName.style.display="block";
65
+
66
+
67
+ }
68
+
69
+ if(paymentMethod.options[paymentMethod.selectedIndex].value != "NET" && paymentMethod.options[paymentMethod.selectedIndex].value != "EMI")
70
+ {
71
+ emiMonths.style.display="none";
72
+ bankName.style.display="none";
73
+
74
+ }
75
+
76
+
77
+ }
78
+ </script>
app/design/frontend/base/default/template/payzippy/redirect.phtml ADDED
@@ -0,0 +1,19 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+ $secret_key = Mage::helper('payzippy')->getConfigData('secret_key');
3
+ $params = $this->getRequestParams();
4
+ $hash = Mage::helper('payzippy')->getHash($params,$secret_key);
5
+ $params['hash'] = $hash;
6
+ $session = Mage::getSingleton("core/session", array("name"=>"frontend"));
7
+ $session->setData($params['merchant_transaction_id'], $hash);
8
+ if(Mage::helper('payzippy')->getConfigData('debug')) {
9
+ Mage::log("Request:- ".print_r($params, true), Zend_Log::DEBUG, 'payzippy.log', true);
10
+ }
11
+ ?>
12
+ <form name="payzippyform" method="post" action="https://www.payzippy.com/payment/api/charging/v1">
13
+ <?php foreach($params as $param_name => $param_value):?>
14
+ <input type="hidden" name="<?php echo $param_name?>" value="<?php echo $param_value; ?>" />
15
+ <?php endforeach;?>
16
+ </form>
17
+ <script type="text/javascript">
18
+ document.payzippyform.submit();
19
+ </script>
app/etc/modules/FlipKart_PayZippy.xml ADDED
@@ -0,0 +1,12 @@
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <config>
3
+ <modules>
4
+ <FlipKart_PayZippy>
5
+ <active>true</active>
6
+ <codePool>community</codePool>
7
+ </FlipKart_PayZippy>
8
+ <depends>
9
+ <Mage_Payment />
10
+ </depends>
11
+ </modules>
12
+ </config>
package.xml ADDED
@@ -0,0 +1,26 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?xml version="1.0"?>
2
+ <package>
3
+ <name>PayZippy_Payment_Gateway</name>
4
+ <version>0.1.0</version>
5
+ <stability>stable</stability>
6
+ <license uri="http://opensource.org/licenses/osl-3.0.php">OSL v3.0</license>
7
+ <channel>community</channel>
8
+ <extends/>
9
+ <summary>Enable Credit/Debit Card, Net Banking, EMI and Wallet payments on your online store with PayZippy.</summary>
10
+ <description>PayZippy is an India based payment gateway provider which enables you to accept Credit/Debit Card, Net Banking, EMI and Wallet payments on your online store with the simplest and fastest integration.&#xD;
11
+ &#xD;
12
+ PayZippy's advantages:&#xD;
13
+ Higher Conversions - Benefit from our smart transaction routing and intuitive payment experience, that drives higher success rates and lower cart abandonments for your online store. &#xD;
14
+ User Experience Redefined - Let your customers enter their card details without leaving your website. Offer the fastest checkout experience by enabling your customers to use their cards saved in their PayZippy wallet.&#xD;
15
+ Great Merchant Support - We bring Flipkart's customer obsessed service and learnings from solving payment issues. We are available 9 AM to 9 PM, all days of the week.&#xD;
16
+ 100% Secure - PayZippy has undergone stringent security audits (including PCI DSS) by industry experts. PayZippy's real time risk engine analyses every transaction across 50+ risk parameters and notifies you about suspected fraudulent transactions by email/sms.&#xD;
17
+ Simple Transparent Pricing - No setup fee, no annual maintenance fee, no hidden charges. Pay less as you grow.&#xD;
18
+ If you have any queries or require more information about our service offering, feel free to reach out to us at contactus@payzippy.com.</description>
19
+ <notes>Initial and Stable Release</notes>
20
+ <authors><author><name>Cueblocks</name><user>Ravinder</user><email>ravinder.singh@cueblocks.com</email></author></authors>
21
+ <date>2013-08-30</date>
22
+ <time>11:46:16</time>
23
+ <contents><target name="magecommunity"><dir name="FlipKart"><dir name="PayZippy"><dir name="Block"><file name="Form.php" hash="639321ea25419f962538ac89381d2b51"/><file name="Info.php" hash="d7b2736958e1843501b6b2751329378b"/><file name="Redirect.php" hash="71dbcd1edf529cba68db40fd3dc204fa"/></dir><dir name="Helper"><file name="Data.php" hash="1b17cddfc16a49371c7fa804f3326660"/></dir><dir name="Model"><dir name="Mysql4"><file name="Setup.php" hash="8adc2ac49e33c5f85daeb4c107387e14"/></dir><file name="Standard.php" hash="cd14e0d14457ac5f95a55a99e605a56c"/><dir name="System"><dir name="Config"><dir name="Source"><dir name="Payment"><dir name="Bank"><file name="Names.php" hash="6740c20c072b0ce964203e84789cb9e7"/></dir><file name="Methods.php" hash="a32152f6f96fa082eecb3c186b085963"/></dir></dir></dir></dir></dir><dir name="controllers"><file name="PaymentController.php" hash="c289d0e8302b3286b52cf626253b461f"/></dir><dir name="etc"><file name="config.xml" hash="bc09910bc88a8db0d576ab3a31771254"/><file name="system.xml" hash="cea2262317135a8d712f9ea37c47faa0"/></dir><dir name="sql"><dir name="payzippy_setup"><file name="mysql4-install-0.1.0.php" hash="c69266c1d23fe4d66405835ea60c932e"/></dir></dir></dir></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="payzippy"><file name="form.phtml" hash="05dd9f7b97f98f58e3cbf4fd9d589cc4"/><file name="redirect.phtml" hash="0e2722a6012d1e6859d9275d4b09683d"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="FlipKart_PayZippy.xml" hash="6a9b3027607fb0c3212e9a829d61fa15"/></dir></target></contents>
24
+ <compatible/>
25
+ <dependencies><required><php><min>5.1.0</min><max>6.0.0</max></php></required></dependencies>
26
+ </package>