kash_gateway - Version 0.2.12

Version Notes

v0.2.6 - Support Online Refund

Download this release

Release Info

Developer Kash Corp.
Extension kash_gateway
Version 0.2.12
Comparing to
See all releases


Code changes from version 0.2.5 to 0.2.12

app/code/local/Kash/Gateway/Helper/Checkout.php DELETED
@@ -1,67 +0,0 @@
1
- <?php
2
-
3
- /**
4
- * Checkout helper
5
- */
6
- class Kash_Gateway_Helper_Checkout extends Mage_Core_Helper_Abstract
7
- {
8
- /**
9
- * Restore last active quote based on checkout session
10
- *
11
- * @return bool True if quote restored successfully, false otherwise
12
- */
13
- public function restoreQuote()
14
- {
15
- $order = $this->_getCheckoutSession()->getLastRealOrder();
16
- if ($order->getId()) {
17
- $quote = $this->_getQuote($order->getQuoteId());
18
- if ($quote->getId()) {
19
- $quote->setIsActive(1)
20
- ->setReservedOrderId(null)
21
- ->save();
22
- $this->_getCheckoutSession()
23
- ->replaceQuote($quote)
24
- ->unsLastRealOrderId();
25
- return true;
26
- }
27
- }
28
- return false;
29
- }
30
-
31
- /**
32
- * Cancel last placed order with specified comment message
33
- *
34
- * @param string $comment Comment appended to order history
35
- * @return bool True if order cancelled, false otherwise
36
- */
37
- public function cancelCurrentOrder($comment)
38
- {
39
- $order = $this->_getCheckoutSession()->getLastRealOrder();
40
- if ($order->getId() && $order->getState() != Mage_Sales_Model_Order::STATE_CANCELED) {
41
- $order->registerCancellation($comment)->save();
42
- return true;
43
- }
44
- return false;
45
- }
46
-
47
- /**
48
- * Return checkout session instance
49
- *
50
- * @return Mage_Checkout_Model_Session
51
- */
52
- protected function _getCheckoutSession()
53
- {
54
- return Mage::getSingleton('checkout/session');
55
- }
56
-
57
- /**
58
- * Return sales quote instance for specified ID
59
- *
60
- * @param int $quoteId Quote identifier
61
- * @return Mage_Sales_Model_Quote
62
- */
63
- protected function _getQuote($quoteId)
64
- {
65
- return Mage::getModel('sales/quote')->load($quoteId);
66
- }
67
- }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Kash/Gateway/Helper/Data.php CHANGED
@@ -1,10 +1,28 @@
1
  <?php
2
 
3
  /**
4
- * Payment module base helper
 
5
  *
6
- * @author Blue Badger <jonathan@badger.blue>
 
7
  */
8
- class Kash_Gateway_Helper_Data extends Mage_Core_Helper_Abstract {
 
 
 
 
 
 
 
 
 
 
 
9
 
10
- }
 
 
 
 
 
1
  <?php
2
 
3
  /**
4
+ * This is a special Helper class that gets loaded if Mage::helper() asks only
5
+ * for the namespace. E.g. Mage::helper('kash_gateway')
6
  *
7
+ * Mage_Core_Model_Config::getHelperClassName() will automatically change the
8
+ * requested 'kash_gateway' to 'kash_gateway/data'.
9
  */
10
+ class Kash_Gateway_Helper_Data extends Mage_Core_Helper_Abstract
11
+ {
12
+ /**
13
+ * Helper function to retrieve the logger.
14
+ * Use it via `Mage::helper('kash_gateway')->logger()`
15
+ */
16
+ public function logger()
17
+ {
18
+ $config = $this->config();
19
+ $logger = Mage::getModel('kash_gateway/logger', array($config->x_shop_name));
20
+ return $logger;
21
+ }
22
 
23
+ public function config()
24
+ {
25
+ $config = Mage::getModel('kash_gateway/config', array(Kash_Gateway_Model_Config::METHOD_GATEWAY_KASH));
26
+ return $config;
27
+ }
28
+ }
app/code/local/Kash/Gateway/Model/Api/Bb.php CHANGED
@@ -40,7 +40,8 @@ class Kash_Gateway_Model_Api_Bb extends Kash_Gateway_Model_Api_Abstract
40
  'Amount' => 'x_amount',
41
  'Result' => 'x_result',
42
  'Gateway Reference' => 'x_gateway_reference',
43
- 'Test mode' => 'x_test'
 
44
  );
45
 
46
  /**
@@ -115,18 +116,6 @@ class Kash_Gateway_Model_Api_Bb extends Kash_Gateway_Model_Api_Abstract
115
  'x_customer_shipping_phone' => 'telephone',
116
  );
117
 
118
- protected $logFile = null;
119
-
120
-
121
- public function __construct() {
122
- $logDir = Mage::getBaseDir("log");
123
- if (!is_dir($logDir)) {
124
- mkdir($logDir);
125
- chmod($logDir, 0750);
126
- }
127
- $this->logFile = $logDir . DIRECTORY_SEPARATOR . 'kash.log';
128
-
129
- }
130
  /**
131
  * Return request for API
132
  *
@@ -140,14 +129,15 @@ class Kash_Gateway_Model_Api_Bb extends Kash_Gateway_Model_Api_Abstract
140
  $request = $this->_importAddresses($request);
141
 
142
  $request['x_test'] = ($this->getXTest() === '1') ? 'true' : 'false';
143
- $request['x_version'] = '25';
144
  $request['x_plugin'] = 'magento';
145
 
146
  $date = Zend_Date::now();
147
  $request['x_timestamp'] = $date->getIso();
148
  $request['x_signature'] = $this->getSignature($request, $this->getHmacKey());
149
 
150
- $this->log('x_reference '.$request['x_reference'].': callSetBBCheckout()');
 
151
  return $request;
152
  }
153
 
@@ -163,7 +153,7 @@ class Kash_Gateway_Model_Api_Bb extends Kash_Gateway_Model_Api_Abstract
163
  ksort($request);
164
  $signature = '';
165
  foreach ($request as $key => $val) {
166
- if ($key === 'x_signature') {
167
  continue;
168
  }
169
  $signature .= $key . $val;
@@ -219,12 +209,6 @@ class Kash_Gateway_Model_Api_Bb extends Kash_Gateway_Model_Api_Abstract
219
  return $value;
220
  }
221
 
222
- protected function getXShopName()
223
- {
224
- $value = $this->_getDataOrConfig('x_shop_name');
225
- return $value;
226
- }
227
-
228
  protected function getXTest()
229
  {
230
  $value = $this->_getDataOrConfig('x_test');
@@ -241,39 +225,4 @@ class Kash_Gateway_Model_Api_Bb extends Kash_Gateway_Model_Api_Abstract
241
  {
242
  return $this->_getDataOrConfig('x_show_gateway_ref');
243
  }
244
-
245
-
246
- //log a message to our kash log
247
- public function log($msg) {
248
- file_put_contents($this->logFile, $this->getXShopName()." ".date('c')." ".print_r($msg, true)."\n", FILE_APPEND | LOCK_EX);
249
- }
250
-
251
- public function getLog() {
252
- $result = @file_get_contents($this->logFile);
253
- return $result===FALSE ? date('c')." Could not read kash log" : $result;
254
- }
255
-
256
- /**
257
- * Erase the log file once it's been sent to our server. In case it's been written to while
258
- * we're sending it back, erase only the first $length characters and leave the rest for next time.
259
- */
260
- public function resetLog($length) {
261
- $file = @fopen($this->logFile, "r+");
262
- if (!$file) {
263
- return;
264
- }
265
-
266
- if (flock($file, LOCK_EX)) {
267
- $contents = '';
268
- while (!feof($file)) {
269
- $contents .= fread($file, 8192);
270
- }
271
- ftruncate($file, 0);
272
- rewind($file);
273
- fwrite($file, substr($contents, $length));
274
- fflush($file);
275
- flock($file, LOCK_UN);
276
- }
277
- fclose($file);
278
- }
279
  }
40
  'Amount' => 'x_amount',
41
  'Result' => 'x_result',
42
  'Gateway Reference' => 'x_gateway_reference',
43
+ 'Test mode' => 'x_test',
44
+ Kash_Gateway_Model_Config::TRANSACTION_TYPE => 'x_transaction_type'
45
  );
46
 
47
  /**
116
  'x_customer_shipping_phone' => 'telephone',
117
  );
118
 
 
 
 
 
 
 
 
 
 
 
 
 
119
  /**
120
  * Return request for API
121
  *
129
  $request = $this->_importAddresses($request);
130
 
131
  $request['x_test'] = ($this->getXTest() === '1') ? 'true' : 'false';
132
+ $request['x_version'] = '0.2.12';
133
  $request['x_plugin'] = 'magento';
134
 
135
  $date = Zend_Date::now();
136
  $request['x_timestamp'] = $date->getIso();
137
  $request['x_signature'] = $this->getSignature($request, $this->getHmacKey());
138
 
139
+ $logger = Mage::helper('kash_gateway')->logger();
140
+ $logger->log('x_reference '.$request['x_reference'].': callSetBBCheckout()');
141
  return $request;
142
  }
143
 
153
  ksort($request);
154
  $signature = '';
155
  foreach ($request as $key => $val) {
156
+ if ($key === 'x_signature' || substr($key, 0, 2) !== "x_") {
157
  continue;
158
  }
159
  $signature .= $key . $val;
209
  return $value;
210
  }
211
 
 
 
 
 
 
 
212
  protected function getXTest()
213
  {
214
  $value = $this->_getDataOrConfig('x_test');
225
  {
226
  return $this->_getDataOrConfig('x_show_gateway_ref');
227
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
228
  }
app/code/local/Kash/Gateway/Model/Checkout.php CHANGED
@@ -60,7 +60,7 @@ class Kash_Gateway_Model_Checkout
60
  *
61
  * @var array
62
  */
63
- protected $_giropayUrls = array();
64
 
65
  /**
66
  * Customer ID
@@ -105,9 +105,9 @@ class Kash_Gateway_Model_Checkout
105
  * @param string $completeUrl - complete payment result
106
  * @return $this
107
  */
108
- public function prepareGiropayUrls($callbackUrl, $cancelUrl, $completeUrl)
109
  {
110
- $this->_giropayUrls = array($callbackUrl, $cancelUrl, $completeUrl);
111
  return $this;
112
  }
113
 
@@ -158,22 +158,23 @@ class Kash_Gateway_Model_Checkout
158
  */
159
  public function start()
160
  {
161
- $this->getApi()->log('quote '.$this->_quote->getId().': start()');
 
162
  $this->_quote->collectTotals();
163
 
164
  if (!$this->_quote->getGrandTotal() && !$this->_quote->hasNominalItems()) {
165
- $this->getApi()->log('quote '.$this->_quote->getId().': Error, quote has items, but no amount.');
166
  Mage::throwException(Mage::helper('kash_gateway')->__('Payment does not support processing orders with zero amount. To complete your purchase, proceed to the standard checkout process.'));
167
  }
168
 
169
  $this->_quote->reserveOrderId()->save();
170
- $this->getApi()->log('quote '.$this->_quote->getId().' reserved orderId/x_reference '.$this->_quote->getReservedOrderId());
171
 
172
  // prepare API
173
  $this->getApi()->setAmount($this->_quote->getGrandTotal())
174
  ->setCurrencyCode($this->_quote->getBaseCurrencyCode())
175
  ->setXInvoice($this->_quote->getReservedOrderId());
176
- list($callbackUrl, $cancelUrl, $completeUrl) = $this->_giropayUrls;
177
  $this->getApi()->addData(array(
178
  'x_url_callback' => $callbackUrl,
179
  'x_url_cancel' => $cancelUrl,
@@ -189,7 +190,7 @@ class Kash_Gateway_Model_Checkout
189
  $this->getApi()->setBillingAddress($billingAddress);
190
  }
191
  else {
192
- $this->getApi()->log('x_reference '.$this->_quote->getReservedOrderId().': Could not validate billing address');
193
  }
194
 
195
  // Set shipping address unless the product is a virtual product
@@ -261,7 +262,6 @@ class Kash_Gateway_Model_Checkout
261
 
262
  $this->setAdditionalInformation();
263
  $this->_ignoreAddressValidation();
264
- $this->_applyDiscount();
265
  $this->_quote->collectTotals();
266
  $service = Mage::getModel('sales/service_quote', $this->_quote);
267
  $service->submitAll();
@@ -372,7 +372,8 @@ class Kash_Gateway_Model_Checkout
372
  */
373
  protected function _prepareGuestQuote()
374
  {
375
- $this->getApi()->log('x_reference '.$this->_quote->getReservedOrderId().': Preparing a quote for a GUEST user.');
 
376
  $quote = $this->_quote;
377
  $quote->setCustomerId(null)
378
  ->setCustomerEmail($quote->getBillingAddress()->getEmail())
@@ -410,7 +411,8 @@ class Kash_Gateway_Model_Checkout
410
  */
411
  protected function _prepareNewCustomerQuote()
412
  {
413
- $this->getApi()->log('x_reference '.$this->_quote->getReservedOrderId().': preparing a new customer quote');
 
414
  $quote = $this->_quote;
415
  $billing = $quote->getBillingAddress();
416
  $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
@@ -470,7 +472,8 @@ class Kash_Gateway_Model_Checkout
470
  */
471
  protected function _prepareCustomerQuote()
472
  {
473
- $this->getApi()->log('x_reference '.$this->_quote->getReservedOrderId().': preparing a quote for an existing customer');
 
474
  $quote = $this->_quote;
475
  $billing = $quote->getBillingAddress();
476
  $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
@@ -510,7 +513,8 @@ class Kash_Gateway_Model_Checkout
510
  */
511
  protected function _involveNewCustomer()
512
  {
513
- $this->getApi()->log('x_reference '.$this->_quote->getReservedOrderId().': involve new customer, send them confirmation email.');
 
514
  $customer = $this->_quote->getCustomer();
515
  if ($customer->isConfirmationRequired()) {
516
  $customer->sendNewAccountEmail('confirmation');
@@ -590,75 +594,5 @@ class Kash_Gateway_Model_Checkout
590
  return false;
591
  }
592
  }
593
-
594
-
595
- /**
596
- * Apply Discount
597
- */
598
- public function _applyDiscount()
599
- {
600
- $xAmount = $this->getParams('x_amount');
601
- $shippingAmount = $this->_quote->getShippingAddress()->getBaseShippingAmount();
602
-
603
- $xAmount = $xAmount - $shippingAmount;
604
- $grandTotal = $this->_quote->getGrandTotal() - $shippingAmount;
605
-
606
- $percent = round((100 - $xAmount * 100 / $grandTotal), 2);
607
-
608
- $this->_quote->setCouponCode($this->_getCouponCode($percent));
609
- }
610
-
611
- /**
612
- * Get coupon
613
- * @param $percent
614
- * @return string code
615
- */
616
- protected function _getCouponCode($percent)
617
- {
618
- try {
619
- $coupon = Mage::getModel('salesrule/coupon')->loadByCode(Kash_Gateway_Model_Config::GATEWAY_KASH_DISCOUNT_CODE);
620
- if (!$coupon->isEmpty()) {
621
- $ruleCoupon = Mage::getModel('salesrule/rule')->load($coupon->getRuleId(), 'rule_id');
622
- if (!$ruleCoupon->isEmpty()) {
623
- $ruleCoupon->setDiscountAmount($percent);
624
- $ruleCoupon->save();
625
- return $ruleCoupon->getCouponCode();
626
- }
627
- }
628
- //when no discount
629
- $coupon = Mage::getModel('salesrule/coupon')->loadByCode(Kash_Gateway_Model_Config::GATEWAY_KASH_DISCOUNT_CODE);
630
- if (!$coupon->isEmpty()) {
631
- $ruleCoupon = Mage::getModel('salesrule/rule')->load($coupon->getRuleId(), 'rule_id');
632
- $ruleCoupon->delete();
633
- $coupon->delete();
634
- }
635
- $ruleCoupon = Mage::getModel('salesrule/rule');
636
- $ruleCoupon->setName('Discount for Kash Gateway')
637
- ->setDescription('this is a discount for the kash gateway')
638
- ->setFromDate(date('Y-m-d'))
639
- ->setCouponType(2)
640
- ->setCouponCode(Kash_Gateway_Model_Config::GATEWAY_KASH_DISCOUNT_CODE)
641
- ->setCustomerGroupIds(array(1))
642
- ->setIsActive(1)
643
- ->setStopRulesProcessing(0)
644
- ->setIsAdvanced(1)
645
- ->setProductIds('')
646
- ->setSortOrder(0)
647
- ->setSimpleAction('by_percent')
648
- ->setDiscountAmount($percent)
649
- ->setDiscountQty(null)
650
- ->setDiscountStep('0')
651
- ->setSimpleFreeShipping('0')
652
- ->setApplyToShipping('0')
653
- ->setIsRss(0)
654
- ->setWebsiteIds(array(1));
655
- $ruleCoupon->save();
656
- return $ruleCoupon->getCouponCode();
657
- } catch (Exception $ex) {
658
- $this->getApi()->log('Error: coupon exception');
659
- $this->getApi()->log($ex);
660
- Mage::logException($ex);
661
- }
662
- }
663
  }
664
 
60
  *
61
  * @var array
62
  */
63
+ protected $_callbackUrls = array();
64
 
65
  /**
66
  * Customer ID
105
  * @param string $completeUrl - complete payment result
106
  * @return $this
107
  */
108
+ public function setCallbackUrls($callbackUrl, $cancelUrl, $completeUrl)
109
  {
110
+ $this->_callbackUrls = array($callbackUrl, $cancelUrl, $completeUrl);
111
  return $this;
112
  }
113
 
158
  */
159
  public function start()
160
  {
161
+ $logger = Mage::helper('kash_gateway')->logger();
162
+ $logger->log('quote '.$this->_quote->getId().': start()');
163
  $this->_quote->collectTotals();
164
 
165
  if (!$this->_quote->getGrandTotal() && !$this->_quote->hasNominalItems()) {
166
+ $logger->log('quote '.$this->_quote->getId().': Error, quote has items, but no amount.');
167
  Mage::throwException(Mage::helper('kash_gateway')->__('Payment does not support processing orders with zero amount. To complete your purchase, proceed to the standard checkout process.'));
168
  }
169
 
170
  $this->_quote->reserveOrderId()->save();
171
+ $logger->log('quote '.$this->_quote->getId().' reserved orderId/x_reference '.$this->_quote->getReservedOrderId());
172
 
173
  // prepare API
174
  $this->getApi()->setAmount($this->_quote->getGrandTotal())
175
  ->setCurrencyCode($this->_quote->getBaseCurrencyCode())
176
  ->setXInvoice($this->_quote->getReservedOrderId());
177
+ list($callbackUrl, $cancelUrl, $completeUrl) = $this->_callbackUrls;
178
  $this->getApi()->addData(array(
179
  'x_url_callback' => $callbackUrl,
180
  'x_url_cancel' => $cancelUrl,
190
  $this->getApi()->setBillingAddress($billingAddress);
191
  }
192
  else {
193
+ $logger->log('x_reference '.$this->_quote->getReservedOrderId().': Could not validate billing address');
194
  }
195
 
196
  // Set shipping address unless the product is a virtual product
262
 
263
  $this->setAdditionalInformation();
264
  $this->_ignoreAddressValidation();
 
265
  $this->_quote->collectTotals();
266
  $service = Mage::getModel('sales/service_quote', $this->_quote);
267
  $service->submitAll();
372
  */
373
  protected function _prepareGuestQuote()
374
  {
375
+ $logger = Mage::helper('kash_gateway')->logger();
376
+ $logger->log('x_reference '.$this->_quote->getReservedOrderId().': Preparing a quote for a GUEST user.');
377
  $quote = $this->_quote;
378
  $quote->setCustomerId(null)
379
  ->setCustomerEmail($quote->getBillingAddress()->getEmail())
411
  */
412
  protected function _prepareNewCustomerQuote()
413
  {
414
+ $logger = Mage::helper('kash_gateway')->logger();
415
+ $logger->log('x_reference '.$this->_quote->getReservedOrderId().': preparing a new customer quote');
416
  $quote = $this->_quote;
417
  $billing = $quote->getBillingAddress();
418
  $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
472
  */
473
  protected function _prepareCustomerQuote()
474
  {
475
+ $logger = Mage::helper('kash_gateway')->logger();
476
+ $logger->log('x_reference '.$this->_quote->getReservedOrderId().': preparing a quote for an existing customer');
477
  $quote = $this->_quote;
478
  $billing = $quote->getBillingAddress();
479
  $shipping = $quote->isVirtual() ? null : $quote->getShippingAddress();
513
  */
514
  protected function _involveNewCustomer()
515
  {
516
+ $logger = Mage::helper('kash_gateway')->logger();
517
+ $logger->log('x_reference '.$this->_quote->getReservedOrderId().': involve new customer, send them confirmation email.');
518
  $customer = $this->_quote->getCustomer();
519
  if ($customer->isConfirmationRequired()) {
520
  $customer->sendNewAccountEmail('confirmation');
594
  return false;
595
  }
596
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
597
  }
598
 
app/code/local/Kash/Gateway/Model/Config.php CHANGED
@@ -20,15 +20,15 @@ class Kash_Gateway_Model_Config
20
  const METHOD_GATEWAY_KASH = 'kash_gateway';
21
 
22
  /**
23
- * URL for get request - BB Checkout
24
  * @var string
25
  */
26
- const REQUEST_GATEWAY_KASH = 'gateway/bb/getRequest';
27
 
28
  /**
29
- * Discount code
30
  */
31
- const GATEWAY_KASH_DISCOUNT_CODE ='discount_gatewaykash';
32
 
33
  /**
34
  * Current payment method code
20
  const METHOD_GATEWAY_KASH = 'kash_gateway';
21
 
22
  /**
23
+ * URL for get request
24
  * @var string
25
  */
26
+ const REQUEST_GATEWAY_KASH = 'kash_gateway/offsite/getRequest';
27
 
28
  /**
29
+ * Transaction type
30
  */
31
+ const TRANSACTION_TYPE = 'x_transaction_type';
32
 
33
  /**
34
  * Current payment method code
app/code/local/Kash/Gateway/Model/Logger.php ADDED
@@ -0,0 +1,59 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ class Kash_Gateway_Model_Logger
4
+ {
5
+ protected $logFile = null;
6
+ protected $shopName = '';
7
+
8
+ public function __construct($params = array())
9
+ {
10
+ if ($params) {
11
+ $this->shopName = array_shift($params);
12
+ }
13
+
14
+ $logDir = Mage::getBaseDir("log");
15
+ if (!is_dir($logDir)) {
16
+ mkdir($logDir);
17
+ chmod($logDir, 0750);
18
+ }
19
+ $this->logFile = $logDir . DIRECTORY_SEPARATOR . 'kash.log';
20
+ }
21
+
22
+ //log a message to our kash.log
23
+ public function log($msg)
24
+ {
25
+ file_put_contents($this->logFile, $this->shopName." ".date('c')." ".print_r($msg, true)."\n", FILE_APPEND | LOCK_EX);
26
+ }
27
+
28
+ public function getLog()
29
+ {
30
+ $result = @file_get_contents($this->logFile);
31
+ return $result===FALSE ? date('c')." Could not read kash log" : $result;
32
+ }
33
+
34
+ /**
35
+ * Erase the log file once it's been sent to our server. In case it's been
36
+ * written to while we're sending it back, erase only the first $length
37
+ * characters and leave the rest for next time.
38
+ */
39
+ public function resetLog($length)
40
+ {
41
+ $file = @fopen($this->logFile, "r+");
42
+ if (!$file) {
43
+ return;
44
+ }
45
+
46
+ if (flock($file, LOCK_EX)) {
47
+ $contents = '';
48
+ while (!feof($file)) {
49
+ $contents .= fread($file, 8192);
50
+ }
51
+ ftruncate($file, 0);
52
+ rewind($file);
53
+ fwrite($file, substr($contents, $length));
54
+ fflush($file);
55
+ flock($file, LOCK_UN);
56
+ }
57
+ fclose($file);
58
+ }
59
+ }
app/code/local/Kash/Gateway/Model/Observer.php CHANGED
@@ -2,46 +2,6 @@
2
 
3
  class Kash_Gateway_Model_Observer extends Varien_Object
4
  {
5
- /**
6
- * Do not show discount in admin panel
7
- *
8
- * @param Varien_Object $observer
9
- * @return Mage_Centinel_Model_Observer
10
- */
11
- public function coreCollectionAbstractLoadBefore($observer)
12
- {
13
- if (Mage::app()->getRequest()->getRouteName() == 'adminhtml' &&
14
- Mage::app()->getRequest()->getControllerName() == 'promo_quote'
15
- ) {
16
- if ($observer->getCollection() instanceof Mage_SalesRule_Model_Resource_Rule_Collection) {
17
- $select = $observer->getCollection()->getSelect();
18
- $select->where('code NOT IN (?)', Kash_Gateway_Model_Config::GATEWAY_KASH_DISCOUNT_CODE);
19
- $select->orWhere('code IS NULL');
20
- }
21
- }
22
- return $this;
23
- }
24
-
25
- /**
26
- * Do not take the coupon with frontend for customers
27
- *
28
- * @param Varien_Object $observer
29
- * @return Mage_Centinel_Model_Observer
30
- */
31
- public function salesQuoteCollectTotalsBefore($observer)
32
- {
33
- $quote = $observer->getQuote();
34
- $discount = $quote->getCouponCode();
35
- if ($discount === Kash_Gateway_Model_Config::GATEWAY_KASH_DISCOUNT_CODE) {
36
- $params = Mage::app()->getRequest()->getParams();
37
- $param = array_key_exists('coupon_code', $params) ? $params['coupon_code'] : null;
38
- if (Mage::app()->getRequest()->getRouteName() == 'checkout' ||
39
- $param == $discount) {
40
- $quote->setCouponCode('');
41
- }
42
- }
43
- }
44
-
45
  /**
46
  * Listen for when an order is completed, then send that order's payment details and amount
47
  * for analytics
@@ -57,7 +17,7 @@ class Kash_Gateway_Model_Observer extends Varien_Object
57
 
58
  //standardize the 'kash' type, leave others as they are
59
  if ($payment == 'kash_gateway') {
60
- $payment = 'kash';
61
  }
62
 
63
  $config = Mage::getModel('kash_gateway/config', array(Kash_Gateway_Model_Config::METHOD_GATEWAY_KASH));
@@ -65,8 +25,9 @@ class Kash_Gateway_Model_Observer extends Varien_Object
65
 
66
  $url = $config->post_url.'/reporting';
67
 
68
- $api->log("order ".$order->getIncrementId()." paid with: ".$payment);
69
- $log = $api->getLog();
 
70
 
71
  $data = array(
72
  'x_account_id' => $config->x_account_id,
@@ -91,7 +52,7 @@ class Kash_Gateway_Model_Observer extends Varien_Object
91
 
92
  //If the server did not return an error, erase the part of the log we just sent.
93
  if ($result !== FALSE) {
94
- $api->resetLog(strlen($log));
95
  }
96
  }
97
 
@@ -102,14 +63,10 @@ class Kash_Gateway_Model_Observer extends Varien_Object
102
  */
103
  public function logOrderSave($observer) {
104
  $order = $observer->getOrder();
105
-
106
- $config = Mage::getModel('kash_gateway/config', array(Kash_Gateway_Model_Config::METHOD_GATEWAY_KASH));
107
- $api = Mage::getModel('kash_gateway/api_bb')->setConfigObject($config);
108
-
109
- $api->log('order '.$order->getIncrementId().': was saved, state is: '.$order->getState());
110
  }
111
 
112
-
113
  /**
114
  * Listen for when an a quote is converted to an order and log it
115
  *
@@ -118,12 +75,8 @@ class Kash_Gateway_Model_Observer extends Varien_Object
118
  public function logQuoteToOrder($observer) {
119
  $order = $observer->getOrder();
120
  $quote = $observer->getQuote();
121
-
122
- $config = Mage::getModel('kash_gateway/config', array(Kash_Gateway_Model_Config::METHOD_GATEWAY_KASH));
123
- $api = Mage::getModel('kash_gateway/api_bb')->setConfigObject($config);
124
-
125
- $api->log('quote '.$quote->getId().': was converted to order '.$order->getIncrementId());
126
-
127
  }
128
 
129
  }
2
 
3
  class Kash_Gateway_Model_Observer extends Varien_Object
4
  {
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
5
  /**
6
  * Listen for when an order is completed, then send that order's payment details and amount
7
  * for analytics
17
 
18
  //standardize the 'kash' type, leave others as they are
19
  if ($payment == 'kash_gateway') {
20
+ $payment = $order->getPayment()->getAdditionalInformation(Kash_Gateway_Model_Config::TRANSACTION_TYPE);
21
  }
22
 
23
  $config = Mage::getModel('kash_gateway/config', array(Kash_Gateway_Model_Config::METHOD_GATEWAY_KASH));
25
 
26
  $url = $config->post_url.'/reporting';
27
 
28
+ $logger = Mage::helper('kash_gateway')->logger();
29
+ $logger->log("order ".$order->getIncrementId()." paid with: ".$payment);
30
+ $log = $logger->getLog();
31
 
32
  $data = array(
33
  'x_account_id' => $config->x_account_id,
52
 
53
  //If the server did not return an error, erase the part of the log we just sent.
54
  if ($result !== FALSE) {
55
+ $logger->resetLog(strlen($log));
56
  }
57
  }
58
 
63
  */
64
  public function logOrderSave($observer) {
65
  $order = $observer->getOrder();
66
+ $logger = Mage::helper('kash_gateway')->logger();
67
+ $logger->log('order '.$order->getIncrementId().': was saved, state is: '.$order->getState());
 
 
 
68
  }
69
 
 
70
  /**
71
  * Listen for when an a quote is converted to an order and log it
72
  *
75
  public function logQuoteToOrder($observer) {
76
  $order = $observer->getOrder();
77
  $quote = $observer->getQuote();
78
+ $logger = Mage::helper('kash_gateway')->logger();
79
+ $logger->log('quote '.$quote->getId().': was converted to order '.$order->getIncrementId());
 
 
 
 
80
  }
81
 
82
  }
app/code/local/Kash/Gateway/Model/{Method/Bb.php → Offsite.php} RENAMED
@@ -1,17 +1,16 @@
1
  <?php
2
 
3
- /** *
4
- * Payment BB Module
5
- *
6
- * @author Blue Badger <jonathan@badger.blue>
7
- */
8
- class Kash_Gateway_Model_Method_Bb extends Mage_Payment_Model_Method_Abstract
9
  {
10
  protected $_code = Kash_Gateway_Model_Config::METHOD_GATEWAY_KASH;
11
  protected $_formBlockType = 'kash_gateway/form_bb';
12
  protected $_infoBlockType = 'kash_gateway/adminhtml_info';
13
 
14
  protected $_canUseInternal = false;
 
 
15
 
16
  /**
17
  * Config instance
@@ -64,7 +63,7 @@ class Kash_Gateway_Model_Method_Bb extends Mage_Payment_Model_Method_Abstract
64
  * Also updates store ID in config object
65
  *
66
  * @param Mage_Core_Model_Store|int $store
67
- * @return Kash_Gateway_Model_Method_Bb
68
  */
69
  public function setStore($store)
70
  {
@@ -97,7 +96,7 @@ class Kash_Gateway_Model_Method_Bb extends Mage_Payment_Model_Method_Abstract
97
  */
98
  public function getCheckoutRedirectUrl()
99
  {
100
- return Mage::getUrl('kash_gateway/bb/start', array('_secure'=>true));
101
  }
102
 
103
  /**
@@ -108,4 +107,30 @@ class Kash_Gateway_Model_Method_Bb extends Mage_Payment_Model_Method_Abstract
108
  return true;
109
  }
110
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
111
  }
1
  <?php
2
 
3
+ require_once(Mage::getModuleDir('kashlib', 'Kash_Gateway').'/kashlib/KashApi.php');
4
+
5
+ class Kash_Gateway_Model_Offsite extends Mage_Payment_Model_Method_Abstract
 
 
 
6
  {
7
  protected $_code = Kash_Gateway_Model_Config::METHOD_GATEWAY_KASH;
8
  protected $_formBlockType = 'kash_gateway/form_bb';
9
  protected $_infoBlockType = 'kash_gateway/adminhtml_info';
10
 
11
  protected $_canUseInternal = false;
12
+ protected $_canRefund = true;
13
+ protected $_canRefundInvoicePartial = true;
14
 
15
  /**
16
  * Config instance
63
  * Also updates store ID in config object
64
  *
65
  * @param Mage_Core_Model_Store|int $store
66
+ * @return Kash_Gateway_Model_Offsite
67
  */
68
  public function setStore($store)
69
  {
96
  */
97
  public function getCheckoutRedirectUrl()
98
  {
99
+ return Mage::getUrl('kash_gateway/offsite/start', array('_secure'=>true));
100
  }
101
 
102
  /**
107
  return true;
108
  }
109
 
110
+ /**
111
+ * Refund specified amount for payment
112
+ *
113
+ * @param Varien_Object $payment
114
+ * @param float $amount
115
+ *
116
+ * @return Mage_Payment_Model_Abstract
117
+ */
118
+ public function refund(Varien_Object $payment, $amount)
119
+ {
120
+ $kashTransactionId = $payment->getCreditmemo()->getInvoice()->getTransactionId();
121
+ $logger = Mage::helper('kash_gateway')->logger();
122
+ $logger->log('refunding $' . $amount . ' for ' . $kashTransactionId);
123
+
124
+ $gatewayUrl = $this->_config->post_url;
125
+ $serverKey = $this->_config->server_key;
126
+ $kashApi = new KashApi($gatewayUrl, $serverKey);
127
+
128
+ $result = $kashApi->refund($kashTransactionId, $amount);
129
+ if ($result->statusCode !== 200) {
130
+ Mage::throwException(Mage::helper('kash_gateway')->__($result->body->message));
131
+ }
132
+
133
+ return $this;
134
+ }
135
+
136
  }
app/code/local/Kash/Gateway/controllers/{BbController.php → OffsiteController.php} RENAMED
@@ -1,11 +1,9 @@
1
  <?php
2
 
3
  /**
4
- * Bb Checkout Controller
5
- *
6
- * @author Blue Badger <jonathan@badger.blue>
7
  */
8
- class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
9
  {
10
  /**
11
  * @var Kash_Gateway_Model_Checkout
@@ -58,8 +56,10 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
58
  /**
59
  * Get form for requesting form
60
  */
61
- public function startAction(){
62
- $this->api->log('quote '.$this->_getQuote()->getId().': startAction()');
 
 
63
  $paymentParams = $this->getPaymentRequest();
64
  if(!$paymentParams){
65
  return;
@@ -78,7 +78,8 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
78
  */
79
  public function getRequestAction()
80
  {
81
- $this->api->log('quote '.$this->_getQuote()->getId().': getRequestAction()');
 
82
  try {
83
  $paymentParams = $this->getPaymentRequest();
84
  if(!$paymentParams){
@@ -99,7 +100,7 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
99
  } catch (Mage_Core_Exception $e) {
100
  $this->_getCheckoutSession()->addError($e->getMessage());
101
  } catch (Exception $e) {
102
- $this->api->log($e);
103
  $this->_getCheckoutSession()->addError($this->__('Unable to start BB Checkout.'));
104
  Mage::logException($e);
105
  }
@@ -112,7 +113,8 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
112
  */
113
  public function cancelAction()
114
  {
115
- $this->api->log('x_reference '.$this->_getQuote()->getReservedOrderId().': cancelAction()');
 
116
  $this->_initToken(false);
117
  $this->_redirect('checkout/cart');
118
  }
@@ -123,7 +125,8 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
123
  public function callbackAction()
124
  {
125
  $param = Mage::app()->getRequest()->getParam('x_reference');
126
- $this->api->log('x_reference '.$param.': callbackAction()');
 
127
 
128
  $quote = Mage::getModel('sales/quote')->load($param, 'reserved_order_id');
129
  $this->_quote = $quote;
@@ -133,10 +136,11 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
133
  'config' => $this->_config,
134
  'quote' => $quote,
135
  ));
136
- $this->api->log('x_reference '.$this->_getQuote()->getReservedOrderId().': quote is active? '.$quote->getIsActive());
137
 
138
  $params = Mage::app()->getRequest()->getParams();
139
  $this->_checkout->setParams($params);
 
140
 
141
  $this->_checkout->loginUser();
142
 
@@ -149,21 +153,21 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
149
  $order = $this->_checkout->getOrder();
150
 
151
  if ($order->getIncrementId() == $param) {
152
- $this->invoiceOrder($order);
153
  $connection->commit();
154
  }
155
  else {
156
- $this->api->log('x_reference '.$param.': The new order id is not the expected order id! Rolling back');
157
  $connection->rollback();
158
  }
159
  } catch (Exception $e) {
160
- $this->api->log('x_reference '.$param. ': Error, rolling back');
161
- $this->api->log($e);
162
  $connection->rollback();
163
  }
164
  }
165
  else {
166
- $this->api->log('x_reference '.$param.': Checks failed, will not try and create order');
167
  }
168
  }
169
 
@@ -172,20 +176,21 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
172
  */
173
  public function completeAction()
174
  {
175
- $this->api->log('completeAction()');
 
176
  try {
177
  if (!$this->_initCheckout(true)) {
178
  $this->getResponse()->setRedirect(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));
179
  return;
180
  }
181
  if (!$this->_checkout->checkSignature()) {
182
- $this->api->log('x_reference '.$this->_checkout->getParams('x_reference').': All requests and responses must be signed/verified using HMAC-SHA256');
183
  Mage::getSingleton('checkout/session')->addError('Not valid signature');
184
  $this->_redirect('checkout/cart');
185
  return;
186
  }
187
  if (!$this->_checkout->checkResult()) {
188
- $this->api->log('x_reference '.$this->_checkout->getParams('x_reference').': Result not completed');
189
  Mage::getSingleton('checkout/session')->addError('Kash Gateway not completed');
190
  $this->_redirect('checkout/cart');
191
  return;
@@ -223,8 +228,8 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
223
  } catch (Mage_Core_Exception $e) {
224
  Mage::getSingleton('checkout/session')->addError($e->getMessage());
225
  } catch (Exception $e) {
226
- $this->api->log('x_reference '.$xref.': Could not complete action');
227
- $this->api->log($e);
228
  Mage::getSingleton('checkout/session')->addError($this->__('Unable to process Kash Gateway Checkout approval.'));
229
  Mage::logException($e);
230
  }
@@ -261,7 +266,8 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
261
  Mage::getSingleton('checkout/session')->addError(
262
  $this->__('Unable to initialize Kash Gateway Checkout review.')
263
  );
264
- $this->api->log('Could not review order');
 
265
  Mage::logException($e);
266
  }
267
  $this->_redirect('checkout/cart');
@@ -272,9 +278,10 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
272
  *
273
  * @param $order Mage_Sales_Model_Order
274
  */
275
- protected function invoiceOrder($order)
276
  {
277
- $this->api->log('order '.$order->getIncrementId().': Invoicing order');
 
278
  if ($order->getState() == Mage_Sales_Model_Order::STATE_NEW) {
279
  try {
280
  if (!$order->canInvoice()) {
@@ -283,7 +290,8 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
283
  }
284
  $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
285
 
286
- $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_OFFLINE);
 
287
  $invoice->register();
288
 
289
  $invoice->getOrder()->setCustomerNoteNotify(false);
@@ -297,8 +305,8 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
297
 
298
  $transactionSave->save();
299
  } catch (Exception $e) {
300
- $this->api->log('order '.$order->getIncrementId().': Could not invoice order.');
301
- $this->api->log($e);
302
  $order->addStatusHistoryComment('Kash Gateway: Exception occurred during automatically Invoice action. Exception message: ' . $e->getMessage(), false);
303
  $order->save();
304
  }
@@ -315,11 +323,12 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
315
  */
316
  protected function _initToken($setToken = null)
317
  {
 
318
  if (null !== $setToken) {
319
  if (false === $setToken) {
320
  // security measure for avoid unsetting token twice
321
  if (!$this->_getSession()->getBBCheckoutToken()) {
322
- $this->api->log('checkout token does not exist');
323
  Mage::throwException($this->__('Payment Kash Gateway Checkout Token does not exist.'));
324
  }
325
  $this->_getSession()->unsBBCheckoutToken();
@@ -330,7 +339,7 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
330
  }
331
  if ($setToken = $this->getRequest()->getParam('x_reference')) {
332
  if ($setToken !== $this->_getSession()->getBBCheckoutToken()) {
333
- $this->api->log('wrong token');
334
  Mage::throwException($this->__('Wrong Payment Kash Gateway Checkout Token specified.'));
335
  }
336
  } else {
@@ -397,11 +406,12 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
397
  */
398
  protected function _initCheckout($callback = false)
399
  {
 
400
  $quote = $this->_getQuote();
401
  if (!$callback && (!$quote->hasItems() || $quote->getHasError())) {
402
- $this->api->log('x_reference '.$quote->getReservedOrderId().': Unable to initialize Checkout');
403
- $this->api->log($quote->hasItems());
404
- $this->api->log($quote->getHasError());
405
  Mage::log(Mage::helper('kash_gateway')->__('Unable to initialize Kash Gateway Checkout.'));
406
  return null;
407
  }
@@ -419,8 +429,10 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
419
  /**
420
  * Make params for Payment BB
421
  */
422
- protected function getPaymentRequest(){
423
- $this->api->log('quote '.$this->_getQuote()->getId().': setting payment request');
 
 
424
  $this->_initCheckout();
425
 
426
  if ($this->_getQuote()->getIsMultiShipping()) {
@@ -450,11 +462,10 @@ class Kash_Gateway_BbController extends Mage_Core_Controller_Front_Action
450
  return null;
451
  }
452
 
453
- // giropay
454
- $this->_checkout->prepareGiropayUrls(
455
- Mage::getUrl('gateway/bb/callback', array('_secure'=>true)),
456
- Mage::getUrl('gateway/bb/cancel', array('_secure'=>true)),
457
- Mage::getUrl('gateway/bb/complete', array('_secure'=>true))
458
  );
459
 
460
  $params = $this->_checkout->start();
1
  <?php
2
 
3
  /**
4
+ * Offsite Checkout Controller
 
 
5
  */
6
+ class Kash_Gateway_OffsiteController extends Mage_Core_Controller_Front_Action
7
  {
8
  /**
9
  * @var Kash_Gateway_Model_Checkout
56
  /**
57
  * Get form for requesting form
58
  */
59
+ public function startAction()
60
+ {
61
+ $logger = Mage::helper('kash_gateway')->logger();
62
+ $logger->log('quote '.$this->_getQuote()->getId().': startAction()');
63
  $paymentParams = $this->getPaymentRequest();
64
  if(!$paymentParams){
65
  return;
78
  */
79
  public function getRequestAction()
80
  {
81
+ $logger = Mage::helper('kash_gateway')->logger();
82
+ $logger->log('quote '.$this->_getQuote()->getId().': getRequestAction()');
83
  try {
84
  $paymentParams = $this->getPaymentRequest();
85
  if(!$paymentParams){
100
  } catch (Mage_Core_Exception $e) {
101
  $this->_getCheckoutSession()->addError($e->getMessage());
102
  } catch (Exception $e) {
103
+ $logger->log($e);
104
  $this->_getCheckoutSession()->addError($this->__('Unable to start BB Checkout.'));
105
  Mage::logException($e);
106
  }
113
  */
114
  public function cancelAction()
115
  {
116
+ $logger = Mage::helper('kash_gateway')->logger();
117
+ $logger->log('x_reference '.$this->_getQuote()->getReservedOrderId().': cancelAction()');
118
  $this->_initToken(false);
119
  $this->_redirect('checkout/cart');
120
  }
125
  public function callbackAction()
126
  {
127
  $param = Mage::app()->getRequest()->getParam('x_reference');
128
+ $logger = Mage::helper('kash_gateway')->logger();
129
+ $logger->log('x_reference '.$param.': callbackAction()');
130
 
131
  $quote = Mage::getModel('sales/quote')->load($param, 'reserved_order_id');
132
  $this->_quote = $quote;
136
  'config' => $this->_config,
137
  'quote' => $quote,
138
  ));
139
+ $logger->log('x_reference '.$this->_getQuote()->getReservedOrderId().': quote is active? '.$quote->getIsActive());
140
 
141
  $params = Mage::app()->getRequest()->getParams();
142
  $this->_checkout->setParams($params);
143
+ $kashTransactionId = $this->_checkout->getParams('x_gateway_reference');
144
 
145
  $this->_checkout->loginUser();
146
 
153
  $order = $this->_checkout->getOrder();
154
 
155
  if ($order->getIncrementId() == $param) {
156
+ $this->invoiceOrder($order, $kashTransactionId);
157
  $connection->commit();
158
  }
159
  else {
160
+ $logger->log('x_reference '.$param.': The new order id is not the expected order id! Rolling back');
161
  $connection->rollback();
162
  }
163
  } catch (Exception $e) {
164
+ $logger->log('x_reference '.$param. ': Error, rolling back');
165
+ $logger->log($e);
166
  $connection->rollback();
167
  }
168
  }
169
  else {
170
+ $logger->log('x_reference '.$param.': Checks failed, will not try and create order');
171
  }
172
  }
173
 
176
  */
177
  public function completeAction()
178
  {
179
+ $logger = Mage::helper('kash_gateway')->logger();
180
+ $logger->log('completeAction()');
181
  try {
182
  if (!$this->_initCheckout(true)) {
183
  $this->getResponse()->setRedirect(Mage::getBaseUrl(Mage_Core_Model_Store::URL_TYPE_WEB));
184
  return;
185
  }
186
  if (!$this->_checkout->checkSignature()) {
187
+ $logger->log('x_reference '.$this->_checkout->getParams('x_reference').': All requests and responses must be signed/verified using HMAC-SHA256');
188
  Mage::getSingleton('checkout/session')->addError('Not valid signature');
189
  $this->_redirect('checkout/cart');
190
  return;
191
  }
192
  if (!$this->_checkout->checkResult()) {
193
+ $logger->log('x_reference '.$this->_checkout->getParams('x_reference').': Result not completed');
194
  Mage::getSingleton('checkout/session')->addError('Kash Gateway not completed');
195
  $this->_redirect('checkout/cart');
196
  return;
228
  } catch (Mage_Core_Exception $e) {
229
  Mage::getSingleton('checkout/session')->addError($e->getMessage());
230
  } catch (Exception $e) {
231
+ $logger->log('x_reference '.$xref.': Could not complete action');
232
+ $logger->log($e);
233
  Mage::getSingleton('checkout/session')->addError($this->__('Unable to process Kash Gateway Checkout approval.'));
234
  Mage::logException($e);
235
  }
266
  Mage::getSingleton('checkout/session')->addError(
267
  $this->__('Unable to initialize Kash Gateway Checkout review.')
268
  );
269
+ $logger = Mage::helper('kash_gateway')->logger();
270
+ $logger->log('Could not review order');
271
  Mage::logException($e);
272
  }
273
  $this->_redirect('checkout/cart');
278
  *
279
  * @param $order Mage_Sales_Model_Order
280
  */
281
+ protected function invoiceOrder($order, $kashTransactionId)
282
  {
283
+ $logger = Mage::helper('kash_gateway')->logger();
284
+ $logger->log('order '.$order->getIncrementId().': Invoicing order');
285
  if ($order->getState() == Mage_Sales_Model_Order::STATE_NEW) {
286
  try {
287
  if (!$order->canInvoice()) {
290
  }
291
  $invoice = Mage::getModel('sales/service_order', $order)->prepareInvoice();
292
 
293
+ $invoice->setRequestedCaptureCase(Mage_Sales_Model_Order_Invoice::CAPTURE_ONLINE);
294
+ $invoice->setTransactionId($kashTransactionId);
295
  $invoice->register();
296
 
297
  $invoice->getOrder()->setCustomerNoteNotify(false);
305
 
306
  $transactionSave->save();
307
  } catch (Exception $e) {
308
+ $logger->log('order '.$order->getIncrementId().': Could not invoice order.');
309
+ $logger->log($e);
310
  $order->addStatusHistoryComment('Kash Gateway: Exception occurred during automatically Invoice action. Exception message: ' . $e->getMessage(), false);
311
  $order->save();
312
  }
323
  */
324
  protected function _initToken($setToken = null)
325
  {
326
+ $logger = Mage::helper('kash_gateway')->logger();
327
  if (null !== $setToken) {
328
  if (false === $setToken) {
329
  // security measure for avoid unsetting token twice
330
  if (!$this->_getSession()->getBBCheckoutToken()) {
331
+ $logger->log('checkout token does not exist');
332
  Mage::throwException($this->__('Payment Kash Gateway Checkout Token does not exist.'));
333
  }
334
  $this->_getSession()->unsBBCheckoutToken();
339
  }
340
  if ($setToken = $this->getRequest()->getParam('x_reference')) {
341
  if ($setToken !== $this->_getSession()->getBBCheckoutToken()) {
342
+ $logger->log('wrong token');
343
  Mage::throwException($this->__('Wrong Payment Kash Gateway Checkout Token specified.'));
344
  }
345
  } else {
406
  */
407
  protected function _initCheckout($callback = false)
408
  {
409
+ $logger = Mage::helper('kash_gateway')->logger();
410
  $quote = $this->_getQuote();
411
  if (!$callback && (!$quote->hasItems() || $quote->getHasError())) {
412
+ $logger->log('x_reference '.$quote->getReservedOrderId().': Unable to initialize Checkout');
413
+ $logger->log($quote->hasItems());
414
+ $logger->log($quote->getHasError());
415
  Mage::log(Mage::helper('kash_gateway')->__('Unable to initialize Kash Gateway Checkout.'));
416
  return null;
417
  }
429
  /**
430
  * Make params for Payment BB
431
  */
432
+ protected function getPaymentRequest()
433
+ {
434
+ $logger = Mage::helper('kash_gateway')->logger();
435
+ $logger->log('quote '.$this->_getQuote()->getId().': setting payment request');
436
  $this->_initCheckout();
437
 
438
  if ($this->_getQuote()->getIsMultiShipping()) {
462
  return null;
463
  }
464
 
465
+ $this->_checkout->setCallbackUrls(
466
+ Mage::getUrl('kash_gateway/offsite/callback', array('_secure'=>true)),
467
+ Mage::getUrl('kash_gateway/offsite/cancel', array('_secure'=>true)),
468
+ Mage::getUrl('kash_gateway/offsite/complete', array('_secure'=>true))
 
469
  );
470
 
471
  $params = $this->_checkout->start();
app/code/local/Kash/Gateway/data/kash_gateway_setup/data-upgrade-0.0.1-0.0.2.php DELETED
@@ -1,40 +0,0 @@
1
- <?php
2
-
3
- /* @var $installer Mage_Core_Model_Resource_Setup */
4
- $installer = $this;
5
-
6
- $installer->startSetup();
7
-
8
- try{
9
- $coupon = Mage::getModel('salesrule/coupon')->loadByCode(Kash_Gateway_Model_Config::GATEWAY_KASH_DISCOUNT_CODE);
10
- if(!$coupon->isEmpty()){
11
- $ruleCoupon = Mage::getModel('salesrule/rule')->load($coupon->getRuleId(), 'rule_id');
12
- $ruleCoupon->delete();
13
- $coupon->delete();
14
- }
15
- $ruleCoupon = Mage::getModel('salesrule/rule');
16
- $ruleCoupon->setName('Discount for Payment BB')
17
- ->setDescription('this is a discount for payment bb')
18
- ->setFromDate(date('Y-m-d'))
19
- ->setCouponType(2)
20
- ->setCouponCode(Kash_Gateway_Model_Config::GATEWAY_KASH_DISCOUNT_CODE)
21
- ->setCustomerGroupIds(array(1))
22
- ->setIsActive(1)
23
- ->setStopRulesProcessing(0)
24
- ->setIsAdvanced(1)
25
- ->setProductIds('')
26
- ->setSortOrder(0)
27
- ->setSimpleAction('by_percent')
28
- //->setDiscountAmount(100)
29
- ->setDiscountQty(null)
30
- ->setDiscountStep('0')
31
- ->setSimpleFreeShipping('0')
32
- ->setApplyToShipping('0')
33
- ->setIsRss(0)
34
- ->setWebsiteIds(array(1));
35
- $ruleCoupon->save();
36
- }catch (Exception $ex){
37
- Mage::logException($ex);
38
- }
39
-
40
- $installer->endSetup();
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
app/code/local/Kash/Gateway/data/kash_gateway_setup/data-upgrade-0.2.11-0.2.12.php ADDED
@@ -0,0 +1,17 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /* @var $installer Mage_Core_Model_Resource_Setup */
4
+ $installer = $this;
5
+
6
+ $installer->startSetup();
7
+ try{
8
+ $coupon = Mage::getModel('salesrule/coupon')->loadByCode('discount_gatewaykash');
9
+ if(!$coupon->isEmpty()){
10
+ $ruleCoupon = Mage::getModel('salesrule/rule')->load($coupon->getRuleId(), 'rule_id');
11
+ $ruleCoupon->delete();
12
+ $coupon->delete();
13
+ }
14
+ }catch (Exception $ex){
15
+ Mage::logException($ex);
16
+ }
17
+ $installer->endSetup();
app/code/local/Kash/Gateway/etc/config.xml CHANGED
@@ -1,13 +1,33 @@
1
  <?xml version="1.0"?>
 
 
2
  <config>
 
3
  <modules>
 
 
 
 
 
 
4
  <Kash_Gateway>
5
- <version>0.2.5</version>
6
  </Kash_Gateway>
7
  </modules>
 
 
8
  <global>
 
9
  <models>
 
 
 
 
10
  <kash_gateway>
 
 
 
 
11
  <class>Kash_Gateway_Model</class>
12
  <resourceModel>kash_gateway_resource</resourceModel>
13
  </kash_gateway>
@@ -15,6 +35,7 @@
15
  <class>Kash_Gateway_Model_Resource</class>
16
  </kash_gateway_resource>
17
  </models>
 
18
  <blocks>
19
  <kash_gateway>
20
  <class>Kash_Gateway_Block</class>
@@ -25,11 +46,17 @@
25
  </rewrite>
26
  </adminhtml>
27
  </blocks>
 
28
  <helpers>
29
  <kash_gateway>
 
 
 
 
30
  <class>Kash_Gateway_Helper</class>
31
  </kash_gateway>
32
  </helpers>
 
33
  <resources>
34
  <kash_gateway_setup>
35
  <setup>
@@ -37,6 +64,7 @@
37
  </setup>
38
  </kash_gateway_setup>
39
  </resources>
 
40
  <fieldsets>
41
  <sales_convert_quote_payment>
42
  <x_gateway_reference>
@@ -46,36 +74,28 @@
46
  </fieldsets>
47
  </global>
48
 
49
- <frontend>
50
- <layout>
51
- <updates>
52
- <kash_gateway>
53
- <file>kash/gateway.xml</file>
54
- </kash_gateway>
55
- </updates>
56
- </layout>
57
- </frontend>
58
-
59
- <adminhtml>
60
- <events>
61
- <core_collection_abstract_load_before>
62
- <observers>
63
- <kash_gateway>
64
- <type>model</type>
65
- <class>kash_gateway/observer</class>
66
- <method>coreCollectionAbstractLoadBefore</method>
67
- </kash_gateway>
68
- </observers>
69
- </core_collection_abstract_load_before>
70
- </events>
71
- </adminhtml>
72
-
73
  <default>
74
  <payment>
 
 
 
 
75
  <kash_gateway>
 
 
 
 
 
 
 
 
 
76
  <active>0</active>
77
  <bbtypes>AE,VI,MC,DI</bbtypes>
78
- <model>kash_gateway/method_bb</model>
79
  <order_status>processing</order_status>
80
  <title>Direct Debit or Credit Card</title>
81
  <post_url>https://gateway.withkash.com/</post_url>
@@ -85,26 +105,26 @@
85
  </payment>
86
  </default>
87
 
 
88
  <frontend>
 
 
 
 
 
 
 
89
  <routers>
90
  <kash_gateway>
91
  <use>standard</use>
92
  <args>
93
  <module>Kash_Gateway</module>
94
- <frontName>gateway</frontName>
95
  </args>
96
  </kash_gateway>
97
  </routers>
98
  <events>
99
- <sales_quote_collect_totals_before>
100
- <observers>
101
- <kash_gateway>
102
- <type>model</type>
103
- <class>kash_gateway/observer</class>
104
- <method>salesQuoteCollectTotalsBefore</method>
105
- </kash_gateway>
106
- </observers>
107
- </sales_quote_collect_totals_before>
108
  <checkout_onepage_controller_success_action>
109
  <observers>
110
  <kash_gateway>
@@ -114,6 +134,11 @@
114
  </kash_gateway>
115
  </observers>
116
  </checkout_onepage_controller_success_action>
 
 
 
 
 
117
  <sales_order_save_after>
118
  <observers>
119
  <kash_gateway>
@@ -123,6 +148,8 @@
123
  </kash_gateway>
124
  </observers>
125
  </sales_order_save_after>
 
 
126
  <sales_convert_quote_to_order>
127
  <observers>
128
  <kash_gateway>
1
  <?xml version="1.0"?>
2
+
3
+ <!-- The root node for a Magento module configuration -->
4
  <config>
5
+
6
  <modules>
7
+ <!--
8
+ This tag must match the namespace and module name exactly, but
9
+ with slash replaced with underscore.
10
+
11
+ Our namespace is "Kash" and our module name is "Gateway".
12
+ -->
13
  <Kash_Gateway>
14
+ <version>0.2.12</version>
15
  </Kash_Gateway>
16
  </modules>
17
+
18
+ <!-- Configure module's behaviour in the `global` area -->
19
  <global>
20
+ <!-- Defining models -->
21
  <models>
22
+ <!--
23
+ Unique identifier in the model's node.
24
+ By convention, we put the module's name in lowercase.
25
+ -->
26
  <kash_gateway>
27
+ <!--
28
+ The path to our models directory, with directory separators
29
+ replaced by underscores.
30
+ -->
31
  <class>Kash_Gateway_Model</class>
32
  <resourceModel>kash_gateway_resource</resourceModel>
33
  </kash_gateway>
35
  <class>Kash_Gateway_Model_Resource</class>
36
  </kash_gateway_resource>
37
  </models>
38
+
39
  <blocks>
40
  <kash_gateway>
41
  <class>Kash_Gateway_Block</class>
46
  </rewrite>
47
  </adminhtml>
48
  </blocks>
49
+
50
  <helpers>
51
  <kash_gateway>
52
+ <!--
53
+ The path to our Helper directory, with directory separators
54
+ replaced by underscores.
55
+ -->
56
  <class>Kash_Gateway_Helper</class>
57
  </kash_gateway>
58
  </helpers>
59
+
60
  <resources>
61
  <kash_gateway_setup>
62
  <setup>
64
  </setup>
65
  </kash_gateway_setup>
66
  </resources>
67
+
68
  <fieldsets>
69
  <sales_convert_quote_payment>
70
  <x_gateway_reference>
74
  </fieldsets>
75
  </global>
76
 
77
+ <!--
78
+ Default values for our module's configuration. The values here serve as
79
+ defaults for the fields defined in `system.xml`.
80
+ -->
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
81
  <default>
82
  <payment>
83
+ <!--
84
+ Unique identifier in the model's node.
85
+ By convention, we put the module's name in lowercase.
86
+ -->
87
  <kash_gateway>
88
+ <!--
89
+ This specifies the class Magneto will talk to for
90
+ information about this payment method.
91
+
92
+ It's in lower case and with slash replaced with
93
+ underscore.
94
+ -->
95
+ <model>kash_gateway/offsite</model>
96
+
97
  <active>0</active>
98
  <bbtypes>AE,VI,MC,DI</bbtypes>
 
99
  <order_status>processing</order_status>
100
  <title>Direct Debit or Credit Card</title>
101
  <post_url>https://gateway.withkash.com/</post_url>
105
  </payment>
106
  </default>
107
 
108
+ <!-- Configure module's behaviour in the `frontend` area -->
109
  <frontend>
110
+ <layout>
111
+ <updates>
112
+ <kash_gateway>
113
+ <file>kash/gateway.xml</file>
114
+ </kash_gateway>
115
+ </updates>
116
+ </layout>
117
  <routers>
118
  <kash_gateway>
119
  <use>standard</use>
120
  <args>
121
  <module>Kash_Gateway</module>
122
+ <frontName>kash_gateway</frontName>
123
  </args>
124
  </kash_gateway>
125
  </routers>
126
  <events>
127
+ <!-- Event emitted by `app/code/core/Mage/Checkout/controllers/OnepageController.php` -->
 
 
 
 
 
 
 
 
128
  <checkout_onepage_controller_success_action>
129
  <observers>
130
  <kash_gateway>
134
  </kash_gateway>
135
  </observers>
136
  </checkout_onepage_controller_success_action>
137
+
138
+ <!--
139
+ "_save_after" event emitted by `app/code/core/Mage/Core/Model/Abstract.php`
140
+ `_eventPrefix` defined in `app/code/core/Mage/Sales/Model/Order.php`
141
+ -->
142
  <sales_order_save_after>
143
  <observers>
144
  <kash_gateway>
148
  </kash_gateway>
149
  </observers>
150
  </sales_order_save_after>
151
+
152
+ <!-- Event emitted by `app/code/core/Mage/Sales/Model/Convert/Quote.php` -->
153
  <sales_convert_quote_to_order>
154
  <observers>
155
  <kash_gateway>
app/code/local/Kash/Gateway/kashlib/KashApi.php ADDED
@@ -0,0 +1,78 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ <?php
2
+
3
+ /**
4
+ * This is a reusable component to talk to kash_api.
5
+ */
6
+ class KashApi
7
+ {
8
+ private static $apiUrlProd = 'https://api.withkash.com/v1';
9
+
10
+ protected $_gatewayUrl;
11
+ protected $_serverKey;
12
+
13
+ public function __construct($gatewayUrl, $serverKey)
14
+ {
15
+ $this->_gatewayUrl = $gatewayUrl;
16
+ $this->_serverKey = $serverKey;
17
+ }
18
+
19
+ public function refund($kashTransactionId, $refundAmount)
20
+ {
21
+ $requestHeaders = array(
22
+ 'Authorization: Basic ' . base64_encode($this->_serverKey . ':')
23
+ );
24
+
25
+ $url = self::$apiUrlProd;
26
+ if (strpos($this->_gatewayUrl, 'februalia') !== false) {
27
+ $url = str_replace('withkash', 'februalia', $url);
28
+ }
29
+ else if ($this->gatewayUrl === 'http://kash-gateway') {
30
+ $url = 'http://kash-api:8080';
31
+ }
32
+ $url .= '/refunds';
33
+
34
+ $requestPayload = array(
35
+ 'amount' => $refundAmount * 100,
36
+ 'transaction_id' => $kashTransactionId
37
+ );
38
+
39
+ // create a new cURL resource
40
+ $ch = curl_init($url);
41
+
42
+ // set URL and other appropriate options
43
+ curl_setopt($ch, CURLOPT_POST ,1);
44
+ curl_setopt($ch, CURLOPT_POSTFIELDS, $requestPayload);
45
+ curl_setopt($ch, CURLOPT_HTTPHEADER, $requestHeaders);
46
+ curl_setopt($ch, CURLOPT_RETURNTRANSFER, 1);
47
+ curl_setopt($ch, CURLOPT_HEADER, 1);
48
+
49
+ // Execute the request.
50
+ $rawResponse = curl_exec($ch);
51
+ $result = null;
52
+ $errorMessage = null;
53
+ if ($rawResponse === FALSE) {
54
+ $errorMessage = curl_error($ch);
55
+ }
56
+ else {
57
+ $statusCode = curl_getinfo($ch, CURLINFO_HTTP_CODE);
58
+ $headerSize = curl_getinfo($ch, CURLINFO_HEADER_SIZE);
59
+ $headers = substr($rawResponse, 0, $headerSize);
60
+ $rawBody = substr($rawResponse, $headerSize);
61
+ $body = json_decode($rawBody);
62
+
63
+ $result = new stdClass();
64
+ $result->statusCode = $statusCode;
65
+ $result->headers = $headers;
66
+ $result->body = $body;
67
+ $result->rawBody = $rawBody;
68
+ }
69
+
70
+ // close cURL resource, and free up system resources
71
+ curl_close($ch);
72
+
73
+ if (!$result) {
74
+ throw new Exception($errorMessage);
75
+ }
76
+ return $result;
77
+ }
78
+ }
app/design/adminhtml/default/default/template/kash/info/default.phtml CHANGED
@@ -9,10 +9,12 @@
9
  <table>
10
  <?php if ($_specificInfo = $this->getAdditionalInformation()): ?>
11
  <?php foreach ($_specificInfo as $_label => $_value): ?>
12
- <tr>
13
- <td><?php echo $this->escapeHtml($_label) ?>:</td>
14
- <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n")) ?></td>
15
- </tr>
 
 
16
  <?php endforeach; ?>
17
  <?php endif; ?>
18
 
9
  <table>
10
  <?php if ($_specificInfo = $this->getAdditionalInformation()): ?>
11
  <?php foreach ($_specificInfo as $_label => $_value): ?>
12
+ <?php if ($_label !== Kash_Gateway_Model_Config::TRANSACTION_TYPE): ?>
13
+ <tr>
14
+ <td><?php echo $this->escapeHtml($_label) ?>:</td>
15
+ <td><?php echo nl2br(implode($this->getValueAsArray($_value, true), "\n")) ?></td>
16
+ </tr>
17
+ <?php endif; ?>
18
  <?php endforeach; ?>
19
  <?php endif; ?>
20
 
app/design/frontend/base/default/layout/kash/gateway.xml CHANGED
@@ -22,7 +22,7 @@
22
 
23
  </default>
24
 
25
- <kash_gateway_bb_start>
26
  <remove name="before_body_end"/>
27
  <reference name="head">
28
  <action method="addCss"><stylesheet>css/kash/start.css</stylesheet></action>
@@ -38,9 +38,9 @@
38
  template="kash/container.phtml"/>
39
  </reference>
40
  </reference>
41
- </kash_gateway_bb_start>
42
 
43
- <kash_gateway_bb_review>
44
  <remove name="right"/>
45
  <remove name="left"/>
46
 
@@ -81,5 +81,5 @@
81
  </action>
82
  </reference>
83
  <block type="core/text_list" name="additional.product.info"/>
84
- </kash_gateway_bb_review>
85
  </layout>
22
 
23
  </default>
24
 
25
+ <kash_gateway_offsite_start>
26
  <remove name="before_body_end"/>
27
  <reference name="head">
28
  <action method="addCss"><stylesheet>css/kash/start.css</stylesheet></action>
38
  template="kash/container.phtml"/>
39
  </reference>
40
  </reference>
41
+ </kash_gateway_offsite_start>
42
 
43
+ <kash_gateway_offsite_review>
44
  <remove name="right"/>
45
  <remove name="left"/>
46
 
81
  </action>
82
  </reference>
83
  <block type="core/text_list" name="additional.product.info"/>
84
+ </kash_gateway_offsite_review>
85
  </layout>
app/design/frontend/base/default/template/kash/container.phtml CHANGED
@@ -1,5 +1,5 @@
1
  <script type="text/javascript">
2
  window.onload = function () {
3
- document.getElementsByTagName('form')[0].submit();
4
  };
5
  </script>
1
  <script type="text/javascript">
2
  window.onload = function () {
3
+ document.getElementById("request-gateway-kash").submit();
4
  };
5
  </script>
app/design/frontend/base/default/template/kash/payment/redirect.phtml CHANGED
@@ -5,6 +5,7 @@
5
  ?>
6
  <ul class="form-list" id="payment_form_<?php echo $this->getMethodCode() ?>">
7
  <li class="form-alt">
 
8
  <a id="kash_direct_debit_link"
9
  href="//www.withkash.com/what-is-direct-debit"
10
  title="What is Direct Debit"
5
  ?>
6
  <ul class="form-list" id="payment_form_<?php echo $this->getMethodCode() ?>">
7
  <li class="form-alt">
8
+ <img id="kash_gateway_logo" src="//cdn.withkash.com/wc-assets/gatewaylogo.png" alt="Credit/Direct Debit Logo" width="200px">
9
  <a id="kash_direct_debit_link"
10
  href="//www.withkash.com/what-is-direct-debit"
11
  title="What is Direct Debit"
app/etc/modules/Kash_Gateway.xml CHANGED
@@ -2,8 +2,14 @@
2
  <config>
3
  <modules>
4
  <Kash_Gateway>
 
 
5
  <active>true</active>
 
 
6
  <codePool>local</codePool>
 
 
7
  <depends>
8
  <Mage_Payment/>
9
  </depends>
2
  <config>
3
  <modules>
4
  <Kash_Gateway>
5
+
6
+ <!-- Whether our module is active: true or false -->
7
  <active>true</active>
8
+
9
+ <!-- Which code pool to use: core, community or local -->
10
  <codePool>local</codePool>
11
+
12
+ <!-- Our dependencies (also in Namespace_ModuleName format) -->
13
  <depends>
14
  <Mage_Payment/>
15
  </depends>
package.xml CHANGED
@@ -1,7 +1,7 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>kash_gateway</name>
4
- <version>0.2.5</version>
5
  <stability>stable</stability>
6
  <license>MITL</license>
7
  <channel>community</channel>
@@ -18,11 +18,150 @@
18
  You will need a Kash account in order to use this gateway. Please contact info@withkash.com for any questions.&lt;br /&gt;&#xD;
19
  &lt;br /&gt;&#xD;
20
  Direct Debit payment works by having the customers use their bank account to pay. Your customers can have the option to pay using a credit card as well. You can choose to either charge the credit card processing fee to the customer, or pay for the fee yourself like you do currently.</description>
21
- <notes>v0.2.2 - Initial Release</notes>
22
- <authors><author><name>Kash Corp.</name><user>Kash Corp</user><email>info@withkash.com</email></author></authors>
23
- <date>2015-12-08</date>
24
- <time>23:53:50</time>
25
- <contents><target name="mageskin"><dir name="frontend"><dir name="base"><dir name="default"><dir name="css"><dir name="kash"><file name="lightwindow.css" hash="543637b1312fd4b72696f18c14fc7a54"/><file name="start.css" hash="d310d178769035d366ebb2caff9bd4a3"/><file name="._lightwindow.css" hash="6bac7309b1e370cf137d882ba90d6510"/></dir></dir><dir name="js"><dir name="kash"><file name="lightwindow.js" hash="d94daf37446ba2fd00222de24c7cf9b6"/><file name="._lightwindow.js" hash="6bac7309b1e370cf137d882ba90d6510"/></dir></dir></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Kash_Gateway.xml" hash="03365c54da611a023ea2a12c6404c455"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="layout"><dir name="kash"><file name="gateway.xml" hash="62ce90320a5d09cc8334e512c3cda3b3"/></dir></dir><dir name="template"><dir name="kash"><file name="container.phtml" hash="9dafeab90d16b221ab8684990ef62ec3"/><file name="form.phtml" hash="0b4b05f427474b08d1c52cfc09fc3485"/><file name="js.phtml" hash="3a1b1a96fd25b4035f41dbe95633f229"/><dir name="payment"><file name="mark.phtml" hash="96ac85ef2f73ec0953dee53cd3d7d0a7"/><file name="redirect.phtml" hash="9cd530bec26cc5f76ab01cfb57095c32"/><dir name="review"><file name="details.phtml" hash="ff2ad65893e66920a4cc8b098dc397c1"/></dir><file name="review.phtml" hash="ef1d435a2bc0e9daff56594a715bed1a"/></dir></dir></dir></dir></dir></dir><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="template"><dir name="kash"><dir name="info"><file name="default.phtml" hash="79bcf1003e40c03ec35c383ec4ca5236"/></dir></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Kash"><dir name="Gateway"><dir name="Block"><dir name="Adminhtml"><file name="Info.php" hash="186ac575a69755543d649d2174f43474"/><dir name="Sales"><dir name="Order"><file name="Grid.php" hash="757f5028ff98d3c375cf3345675d55b7"/></dir></dir></dir><dir name="Form"><file name="Bb.php" hash="2516cb64469800cfc450710250317d72"/></dir><dir name="Review"><file name="Details.php" hash="9a077c6688f913bd4f9fee74fad68b7e"/></dir><file name="Review.php" hash="a2a24914d577262188c491898c77307e"/></dir><dir name="Helper"><file name="Checkout.php" hash="89863d74391a81e7336073a8c9634ce8"/><file name="Data.php" hash="cc0eb77c1be47e1d4e846033cc2aed9a"/></dir><dir name="Model"><dir name="Api"><file name="Abstract.php" hash="99ed019c3e8e13caf90fa248e608c9ea"/><file name="Bb.php" hash="3cabc71ab5f616b0614fa3d628e9dc4a"/></dir><file name="Cart.php" hash="ced06fca31abf3fbe20e3e2eb430cfea"/><file name="Checkout.php" hash="bed98494d4bb1d93b6e6758555d98450"/><file name="Config.php" hash="5299275ecc589f56c9bc9c9123e39405"/><dir name="Method"><file name="Bb.php" hash="6cd0683fa597d31d830ae7787b0284cd"/></dir><file name="Observer.php" hash="eede09fb15543e8a535820612104e520"/><file name="Session.php" hash="1778fbe493d2ceb81d8a20b58a21ce3c"/></dir><dir name="controllers"><file name="BbController.php" hash="3ab8fcfabbc52474eb7f161fc91c5986"/></dir><dir name="data"><dir name="kash_gateway_setup"><file name="data-install-0.0.1.php" hash="5fe91e15bc5e6269eadcc50f8991250a"/><file name="data-upgrade-0.0.1-0.0.2.php" hash="632331f77e2238438e1bddfe4c2b82bf"/></dir></dir><dir name="etc"><file name="config.xml" hash="9538e1037a44f4280726f537f0a9d3e5"/><file name="system.xml" hash="3667ceed76bc0a905af96e7b4adbf2b0"/></dir><dir name="sql"><dir name="kash_gateway_setup"><file name="install-0.0.1.php" hash="9ecb52ba48345cdbee9ce0fd92d2aff9"/></dir></dir></dir></dir></target></contents>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
26
  <compatible/>
27
- <dependencies><required><php><min>5.4.45</min><max>5.6.15</max></php></required></dependencies>
 
 
 
 
 
 
 
28
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>kash_gateway</name>
4
+ <version>0.2.12</version>
5
  <stability>stable</stability>
6
  <license>MITL</license>
7
  <channel>community</channel>
18
  You will need a Kash account in order to use this gateway. Please contact info@withkash.com for any questions.&lt;br /&gt;&#xD;
19
  &lt;br /&gt;&#xD;
20
  Direct Debit payment works by having the customers use their bank account to pay. Your customers can have the option to pay using a credit card as well. You can choose to either charge the credit card processing fee to the customer, or pay for the fee yourself like you do currently.</description>
21
+ <notes>v0.2.6 - Support Online Refund</notes>
22
+ <authors>
23
+ <author>
24
+ <name>Kash Corp.</name>
25
+ <user>Kash Corp</user>
26
+ <email>info@withkash.com</email>
27
+ </author>
28
+ </authors>
29
+ <date>2017-03-13</date>
30
+ <time>23:00:00</time>
31
+ <contents>
32
+ <target name="mageetc">
33
+ <dir name="modules">
34
+ <file name="Kash_Gateway.xml" hash="2b23e09bdd8ecff348d3a72bebb6926e"/>
35
+ </dir>
36
+ </target>
37
+ <target name="mageskin">
38
+ <dir name="frontend">
39
+ <dir name="base">
40
+ <dir name="default">
41
+ <dir name="js">
42
+ <dir name="kash">
43
+ <file name="lightwindow.js" hash="d94daf37446ba2fd00222de24c7cf9b6"/>
44
+ </dir>
45
+ </dir>
46
+ <dir name="css">
47
+ <dir name="kash">
48
+ <file name="lightwindow.css" hash="543637b1312fd4b72696f18c14fc7a54"/>
49
+ <file name="start.css" hash="d310d178769035d366ebb2caff9bd4a3"/>
50
+ </dir>
51
+ </dir>
52
+ </dir>
53
+ </dir>
54
+ </dir>
55
+ </target>
56
+ <target name="magedesign">
57
+ <dir name="frontend">
58
+ <dir name="base">
59
+ <dir name="default">
60
+ <dir name="template">
61
+ <dir name="kash">
62
+ <file name="container.phtml" hash="718a08eb6030fa59b1221208f41ae7f4"/>
63
+ <file name="form.phtml" hash="0b4b05f427474b08d1c52cfc09fc3485"/>
64
+ <file name="js.phtml" hash="cc2180154f614c40f13e7819f8153eca"/>
65
+ <dir name="payment">
66
+ <file name="mark.phtml" hash="4499c690fe7126e4cedf83499f2eee52"/>
67
+ <file name="redirect.phtml" hash="cf9f36ef777da47f0a2912935ef06c90"/>
68
+ <file name="review.phtml" hash="ef1d435a2bc0e9daff56594a715bed1a"/>
69
+ <dir name="review">
70
+ <file name="details.phtml" hash="ff2ad65893e66920a4cc8b098dc397c1"/>
71
+ </dir>
72
+ </dir>
73
+ </dir>
74
+ </dir>
75
+ <dir name="layout">
76
+ <dir name="kash">
77
+ <file name="gateway.xml" hash="bcc9519024a9e2b2e514dd801f322e88"/>
78
+ </dir>
79
+ </dir>
80
+ </dir>
81
+ </dir>
82
+ </dir>
83
+ <dir name="adminhtml">
84
+ <dir name="default">
85
+ <dir name="default">
86
+ <dir name="template">
87
+ <dir name="kash">
88
+ <dir name="info">
89
+ <file name="default.phtml" hash="caa3f291c22f043fa8a5bf9c4c51e956"/>
90
+ </dir>
91
+ </dir>
92
+ </dir>
93
+ </dir>
94
+ </dir>
95
+ </dir>
96
+ </target>
97
+ <target name="magelocal">
98
+ <dir name="Kash">
99
+ <dir name="Gateway">
100
+ <dir name="sql">
101
+ <dir name="kash_gateway_setup">
102
+ <file name="install-0.0.1.php" hash="9ecb52ba48345cdbee9ce0fd92d2aff9"/>
103
+ </dir>
104
+ </dir>
105
+ <dir name="kashlib">
106
+ <file name="KashApi.php" hash="9a15c80500c3b61759ee1b3e8934c293"/>
107
+ </dir>
108
+ <dir name="etc">
109
+ <file name="config.xml" hash="5c626e75cbf3579b654f4f06efc6d517"/>
110
+ <file name="system.xml" hash="ca30f6ca733fd3bb8bf7acc0ebe4d705"/>
111
+ </dir>
112
+ <dir name="data">
113
+ <dir name="kash_gateway_setup">
114
+ <file name="data-install-0.0.1.php" hash="5fe91e15bc5e6269eadcc50f8991250a"/>
115
+ <file name="data-upgrade-0.2.11-0.2.12.php" hash="a85b9c990e61f8de4f2ef6e83f160f6e"/>
116
+ </dir>
117
+ </dir>
118
+ <dir name="controllers">
119
+ <file name="OffsiteController.php" hash="0144411e8d5eaea6bde1d4ef05fa5ff5"/>
120
+ </dir>
121
+ <dir name="Model">
122
+ <file name="Cart.php" hash="ced06fca31abf3fbe20e3e2eb430cfea"/>
123
+ <file name="Checkout.php" hash="f761fb032633f5f3d80947e6104efad2"/>
124
+ <file name="Config.php" hash="b6898f3133d94327d3162497c457ce3c"/>
125
+ <file name="Logger.php" hash="9092354e4fa3a1613390008fdf9fed2a"/>
126
+ <file name="Observer.php" hash="2ceac7b59bfd966b4c3dd06ecc93c493"/>
127
+ <file name="Offsite.php" hash="69daf29d2d7d3eb0e12903ee5999156c"/>
128
+ <file name="Session.php" hash="1778fbe493d2ceb81d8a20b58a21ce3c"/>
129
+ <dir name="Api">
130
+ <file name="Abstract.php" hash="dda4315e8a6b95ef3017f90cecfb250d"/>
131
+ <file name="Bb.php" hash="7a43a5d6c36d5868d23a6dbc6d2e1a18"/>
132
+ </dir>
133
+ </dir>
134
+ <dir name="Helper">
135
+ <file name="Data.php" hash="9593094f8794d90dfb2008e2f9984b1c"/>
136
+ </dir>
137
+ <dir name="Block">
138
+ <file name="Review.php" hash="a2a24914d577262188c491898c77307e"/>
139
+ <dir name="Review">
140
+ <file name="Details.php" hash="9a077c6688f913bd4f9fee74fad68b7e"/>
141
+ </dir>
142
+ <dir name="Form">
143
+ <file name="Bb.php" hash="be99610adaba2bbcb9877ba7ad56cf0f"/>
144
+ </dir>
145
+ <dir name="Adminhtml">
146
+ <file name="Info.php" hash="186ac575a69755543d649d2174f43474"/>
147
+ <dir name="Sales">
148
+ <dir name="Order">
149
+ <file name="Grid.php" hash="5f3900c603a9bb6c870c50bdadf52f73"/>
150
+ </dir>
151
+ </dir>
152
+ </dir>
153
+ </dir>
154
+ </dir>
155
+ </dir>
156
+ </target>
157
+ </contents>
158
  <compatible/>
159
+ <dependencies>
160
+ <required>
161
+ <php>
162
+ <min>5.4.45</min>
163
+ <max>5.6.99</max>
164
+ </php>
165
+ </required>
166
+ </dependencies>
167
  </package>