Cardgate_Cgp - Version 1.0.36

Version Notes

- Callback is now processed using status_id instead of status.

Download this release

Release Info

Developer Magento Core Team
Extension Cardgate_Cgp
Version 1.0.36
Comparing to
See all releases


Code changes from version 1.0.35 to 1.0.36

app/code/local/Cardgate/Cgp/Model/Base.php CHANGED
@@ -205,7 +205,7 @@ class Cardgate_Cgp_Model_Base extends Varien_Object {
205
  $amountInCents = ( int ) sprintf( '%.0f', $order->getGrandTotal() * 100 );
206
  $callbackAmount = ( int ) $this->getCallbackData( 'amount' );
207
 
208
- if ( ($amountInCents != $callbackAmount) AND (abs( $callbackAmount - $amountInCents ) > 1) ) {
209
  $this->log( 'OrderID: ' . $order->getId() . ' do not match amounts. Sent ' . $amountInCents . ', received: ' . $callbackAmount );
210
  $statusMessage = Mage::helper( "cgp" )->__( "Hacker attempt: Order total amount does not match CardGatePlus's gross total amount!" );
211
  $order->addStatusToHistory( $order->getStatus(), $statusMessage );
@@ -222,6 +222,7 @@ class Cardgate_Cgp_Model_Base extends Varien_Object {
222
  * @return void
223
  */
224
  public function processCallback() {
 
225
  $id = $this->getCallbackData( 'ref' );
226
  $order = Mage::getModel( 'sales/order' );
227
  $order->loadByIncrementId( $id );
@@ -248,8 +249,8 @@ class Cardgate_Cgp_Model_Base extends Varien_Object {
248
  $newState = null;
249
  $newStatus = true;
250
  $statusMessage = '';
251
-
252
- switch ( $this->getCallbackData( 'status' ) ) {
253
  case "0":
254
  $complete = false;
255
  $newState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
@@ -272,7 +273,7 @@ class Cardgate_Cgp_Model_Base extends Varien_Object {
272
  $canceled = true;
273
  $newState = Mage_Sales_Model_Order::STATE_CANCELED;
274
  $newStatus = $statusFailed;
275
- $statusMessage = Mage::helper( 'cgp' )->__( 'Payment failed or canceled by user.' );
276
  break;
277
  case "301":
278
  $canceled = true;
@@ -280,12 +281,24 @@ class Cardgate_Cgp_Model_Base extends Varien_Object {
280
  $newStatus = $statusFraud;
281
  $statusMessage = Mage::helper( 'cgp' )->__( 'Transaction failed, payment is fraud.' );
282
  break;
 
 
 
 
 
 
 
 
 
 
 
 
283
  case "700":
284
  // Banktransfer pending status
285
  $complete = false;
286
  $newState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
287
  $newStatus = $statusPending;
288
- $statusMessage = Mage::helper( 'cgp' )->__( 'Bank transfer: Waiting for customer action.' );
289
  $order->sendNewOrderEmail();
290
  $order->addStatusToHistory( $order->getStatus(), $statusMessage, true );
291
  $order->save();
@@ -295,7 +308,7 @@ class Cardgate_Cgp_Model_Base extends Varien_Object {
295
  $complete = false;
296
  $newState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
297
  $newStatus = $statusPending;
298
- $statusMessage = Mage::helper( 'cgp' )->__( 'Direct debit: Waiting for confirmation.' );
299
  $order->sendNewOrderEmail();
300
  $order->addStatusToHistory( $order->getStatus(), $statusMessage, true );
301
  $order->save();
@@ -303,7 +316,7 @@ class Cardgate_Cgp_Model_Base extends Varien_Object {
303
  default:
304
  $msg = 'Status not recognised: ' . $this->getCallbackData( 'status' );
305
  $this->log( $msg );
306
- die($msg);
307
  }
308
  // Update only certain states
309
  $canUpdate = false;
205
  $amountInCents = ( int ) sprintf( '%.0f', $order->getGrandTotal() * 100 );
206
  $callbackAmount = ( int ) $this->getCallbackData( 'amount' );
207
 
208
+ if ( ($amountInCents != $callbackAmount) AND ( abs( $callbackAmount - $amountInCents ) > 1) ) {
209
  $this->log( 'OrderID: ' . $order->getId() . ' do not match amounts. Sent ' . $amountInCents . ', received: ' . $callbackAmount );
210
  $statusMessage = Mage::helper( "cgp" )->__( "Hacker attempt: Order total amount does not match CardGatePlus's gross total amount!" );
211
  $order->addStatusToHistory( $order->getStatus(), $statusMessage );
222
  * @return void
223
  */
224
  public function processCallback() {
225
+ //mail('richard@cardgate.com','magento data','test'.print_r($this->getCallbackData(),true));
226
  $id = $this->getCallbackData( 'ref' );
227
  $order = Mage::getModel( 'sales/order' );
228
  $order->loadByIncrementId( $id );
249
  $newState = null;
250
  $newStatus = true;
251
  $statusMessage = '';
252
+ mail('richard@cardgate.com','callback data',print_r($this->getCallbackData(),true));
253
+ switch ( $this->getCallbackData( 'status_id' ) ) {
254
  case "0":
255
  $complete = false;
256
  $newState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
273
  $canceled = true;
274
  $newState = Mage_Sales_Model_Order::STATE_CANCELED;
275
  $newStatus = $statusFailed;
276
+ $statusMessage = Mage::helper( 'cgp' )->__( 'Payment failed.' );
277
  break;
278
  case "301":
279
  $canceled = true;
281
  $newStatus = $statusFraud;
282
  $statusMessage = Mage::helper( 'cgp' )->__( 'Transaction failed, payment is fraud.' );
283
  break;
284
+ case "308":
285
+ $canceled = true;
286
+ $newState = Mage_Sales_Model_Order::STATE_CANCELED;
287
+ $newStatus = $statusFailed;
288
+ $statusMessage = Mage::helper( 'cgp' )->__( 'Payment expired.' );
289
+ break;
290
+ case "309":
291
+ $canceled = true;
292
+ $newState = Mage_Sales_Model_Order::STATE_CANCELED;
293
+ $newStatus = $statusFailed;
294
+ $statusMessage = Mage::helper( 'cgp' )->__( 'Payment canceled by user.' );
295
+ break;
296
  case "700":
297
  // Banktransfer pending status
298
  $complete = false;
299
  $newState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
300
  $newStatus = $statusPending;
301
+ $statusMessage = Mage::helper( 'cgp' )->__( 'Transaction pending: Waiting for customer action.' );
302
  $order->sendNewOrderEmail();
303
  $order->addStatusToHistory( $order->getStatus(), $statusMessage, true );
304
  $order->save();
308
  $complete = false;
309
  $newState = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
310
  $newStatus = $statusPending;
311
+ $statusMessage = Mage::helper( 'cgp' )->__( 'Transaction pending: Waiting for confirmation.' );
312
  $order->sendNewOrderEmail();
313
  $order->addStatusToHistory( $order->getStatus(), $statusMessage, true );
314
  $order->save();
316
  default:
317
  $msg = 'Status not recognised: ' . $this->getCallbackData( 'status' );
318
  $this->log( $msg );
319
+ die( $msg );
320
  }
321
  // Update only certain states
322
  $canUpdate = false;
app/code/local/Cardgate/Cgp/controllers/StandardController.php CHANGED
@@ -29,7 +29,7 @@ class Cardgate_Cgp_StandardController extends Mage_Core_Controller_Front_Action
29
  protected function validate( $data ) {
30
  $base = Mage::getSingleton( 'cgp/base' );
31
 
32
- $hashString = ($base->isTest() ? 'TEST' : '') .
33
  $data['transaction_id'] .
34
  $data['currency'] .
35
  $data['amount'] .
29
  protected function validate( $data ) {
30
  $base = Mage::getSingleton( 'cgp/base' );
31
 
32
+ $hashString = ($data['is_test'] ? 'TEST' : '') .
33
  $data['transaction_id'] .
34
  $data['currency'] .
35
  $data['amount'] .
app/code/local/Cardgate/Cgp/etc/config.xml CHANGED
@@ -20,7 +20,7 @@
20
  <config>
21
  <modules>
22
  <Cardgate_Cgp>
23
- <version>1.0.35</version>
24
  </Cardgate_Cgp>
25
  </modules>
26
 
20
  <config>
21
  <modules>
22
  <Cardgate_Cgp>
23
+ <version>1.0.36</version>
24
  </Cardgate_Cgp>
25
  </modules>
26
 
app/code/local/Cardgate/Cgp/etc/system.xml CHANGED
@@ -20,7 +20,7 @@
20
  <config>
21
  <sections>
22
  <cgp module="cgp">
23
- <label>CardGatePlus</label>
24
  <class>cardgate-section</class>
25
  <header_css>cardgate-header</header_css>
26
  <tab>sales</tab>
20
  <config>
21
  <sections>
22
  <cgp module="cgp">
23
+ <label>CardGatePlus </label>
24
  <class>cardgate-section</class>
25
  <header_css>cardgate-header</header_css>
26
  <tab>sales</tab>
app/locale/nl_NL/Cardgate_Cgp.csv CHANGED
@@ -77,4 +77,10 @@
77
  "The tax class to use to calculate the invoice fee tax","De BTW class die gebruikt wordt voor het berekenen van de factuurkosten BTW."
78
  "Send Order Email only at payment","Verstuur bestelling Email pas bij betaling"
79
  "Send Order Email only after payment completion.","Verstuur de bestelling Email pas als de betaling afgerond is."
80
- "Instructions","Instructies"
 
 
 
 
 
 
77
  "The tax class to use to calculate the invoice fee tax","De BTW class die gebruikt wordt voor het berekenen van de factuurkosten BTW."
78
  "Send Order Email only at payment","Verstuur bestelling Email pas bij betaling"
79
  "Send Order Email only after payment completion.","Verstuur de bestelling Email pas als de betaling afgerond is."
80
+ "Instructions","Instructies"
81
+ "Payment failed.","Betaling mislukt."
82
+ "Payment expired.","Betaling verlopen."
83
+ "Payment canceled by user.","Betaling geannuleerd door gebruiker."
84
+ "Transaction pending: Waiting for customer action.", "Betaling pending: Wacht op actie van klant."
85
+ "Transaction pending: Waiting for confirmation.","Betaling pending: Wacht op bevestiging."
86
+
package.xml CHANGED
@@ -1,18 +1,18 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cardgate_Cgp</name>
4
- <version>1.0.35</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>Card Gate Plus Payment Module</summary>
10
  <description>Card Gate Plus is a Payment Service Provider from the Netherlands. We offer various payment methods against competitive rates.</description>
11
- <notes>- Fix Bank Transfer method text in frontend.</notes>
12
  <authors><author><name>Richard Schoots</name><user>auto-converted</user><email>support@cardgate.com</email></author></authors>
13
- <date>2015-06-25</date>
14
- <time>14:14:38</time>
15
- <contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="cardgate"><file name="cardgate_cgp.png" hash="b97b15baba0b27042733c8ea4b4fb6bc"/></dir></dir><file name="cardgate_cgp.css" hash="bebfc13fca1b36867c17864ae70fdabd"/></dir></dir></dir></target><target name="magelocale"><dir name="nl_NL"><file name="Cardgate_Cgp.csv" hash="2a367336716ba34a4bd9c5c59a47c09e"/></dir></target><target name="mageetc"><dir name="modules"><file name="Cardgate_Cgp.xml" hash="c7a72af045f4b737b50cc6c360d4300d"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="cardgate"><dir name="cgp"><dir name="form"><file name="banktransfer.phtml" hash="ff7a2a827a7b7a5ed9bcb5d484c30c68"/><file name="ideal.phtml" hash="42fdfee86ba3a098f5f73e9240332581"/><file name="klarna.phtml" hash="590c98ab018c474e8e4dc65e9199ba85"/><file name="klarnaaccount.phtml" hash="419f88941703c8562369844bb6a1d692"/></dir><file name="redirect.phtml" hash="ecb2b0a854cd6358adeba535f8889046"/></dir></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Cardgate"><dir name="Cgp"><dir name="Block"><dir name="Form"><file name="Banktransfer.php" hash="3fbc8e9778a79aa8802a1a2bd77681f9"/><file name="Ideal.php" hash="c0e11d3161bd93ca869a31d9b54e1b4b"/><file name="Klarna.php" hash="9bdbe1886bcdb283b86b6d208c3aa712"/><file name="Klarnaaccount.php" hash="0b4b84d9c472e815a30d5977ac53c932"/></dir><file name="Redirect.php" hash="668b52ec0c5fba7f42223d4e40a99987"/></dir><dir name="Helper"><file name="Data.php" hash="c94c725de2e14dc8019323c1ecf08962"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Languages.php" hash="4fe09e45e3d9f3866d4b7c8437832972"/><file name="Modes.php" hash="888158f9118ba5087357d5c1ad8514d4"/></dir></dir></dir></dir><dir name="Gateway"><file name="Abstract.php" hash="566134b83e6d2a01eba0c17f8a49e2dc"/><file name="Americanexpress.php" hash="e92216206b3b623aab4bd7b6e19741db"/><file name="Banktransfer.php" hash="babaf0ea30aad8aa9540c0879a9e67ca"/><file name="Default.php" hash="956d1ff0c2cfe0698efc23277e602cec"/><file name="Directdebit.php" hash="aab6b38b231d5add0e3b0fdcb3d73e3c"/><file name="Giropay.php" hash="e4c2497eaf88ddda0ba5d745945ea3bd"/><file name="Ideal.php" hash="430de461f07352905984bfa15adf9eec"/><file name="Klarna.php" hash="330efb073aba572606b1f25b597bb106"/><file name="Klarnaaccount.php" hash="2012566e77136f823e965c8811321ea3"/><file name="Maestro.php" hash="5675bd4e11b38499b209d91ca5367a07"/><file name="Mastercard.php" hash="11a3aca8cc5f3e04e08244e600c67e3d"/><file name="Mistercash.php" hash="ca9bfde52ea045fe73c6287bbb12837c"/><file name="Paypal.php" hash="cc679581956c2ae857404bc84e798fcc"/><file name="Przelewy24.php" hash="577fa43cee76b9546fc8c500a73e341a"/><file name="Sofortbanking.php" hash="7e3a03aec546156f4a3d47cb6232be2f"/><file name="Visa.php" hash="610a7893d1c03515dc1046b789005817"/><file name="Vpay.php" hash="aaf3f019a7a21c5b91a64bf95da81ed8"/><file name="Webmoney.php" hash="fb504c06b78108ac50bf3933fd44ab0e"/></dir><file name="Base.php" hash="b8a2f888d0d8e86a639b8379720c9e7a"/><file name="Observer.php" hash="81f7a3c5149f52dcb2d4c7434d250003"/></dir><dir name="controllers"><file name="StandardController.php" hash="1524983a5b9d05ef2d7e7d92c25ff409"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1caa98cae31103bb77143f821f68f451"/><file name="config.xml" hash="abacfe9e50a9e40573549ed4c401bb65"/><file name="system.xml" hash="ebb915cf7a7340b8b1a7f7c4c89e218b"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>Cardgate_Cgp</name>
4
+ <version>1.0.36</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>Card Gate Plus Payment Module</summary>
10
  <description>Card Gate Plus is a Payment Service Provider from the Netherlands. We offer various payment methods against competitive rates.</description>
11
+ <notes>- Callback is now processed using status_id instead of status.</notes>
12
  <authors><author><name>Richard Schoots</name><user>auto-converted</user><email>support@cardgate.com</email></author></authors>
13
+ <date>2015-07-22</date>
14
+ <time>11:28:33</time>
15
+ <contents><target name="mageskin"><dir name="adminhtml"><dir name="default"><dir name="default"><dir name="images"><dir name="cardgate"><file name="cardgate_cgp.png" hash="b97b15baba0b27042733c8ea4b4fb6bc"/></dir></dir><file name="cardgate_cgp.css" hash="bebfc13fca1b36867c17864ae70fdabd"/></dir></dir></dir></target><target name="magelocale"><dir name="nl_NL"><file name="Cardgate_Cgp.csv" hash="634f39395ba9302afc2eab9da25be4a2"/></dir></target><target name="mageetc"><dir name="modules"><file name="Cardgate_Cgp.xml" hash="c7a72af045f4b737b50cc6c360d4300d"/></dir></target><target name="magedesign"><dir name="frontend"><dir name="base"><dir name="default"><dir name="template"><dir name="cardgate"><dir name="cgp"><dir name="form"><file name="banktransfer.phtml" hash="ff7a2a827a7b7a5ed9bcb5d484c30c68"/><file name="ideal.phtml" hash="42fdfee86ba3a098f5f73e9240332581"/><file name="klarna.phtml" hash="590c98ab018c474e8e4dc65e9199ba85"/><file name="klarnaaccount.phtml" hash="419f88941703c8562369844bb6a1d692"/></dir><file name="redirect.phtml" hash="ecb2b0a854cd6358adeba535f8889046"/></dir></dir></dir></dir></dir></dir></target><target name="magelocal"><dir name="Cardgate"><dir name="Cgp"><dir name="Block"><dir name="Form"><file name="Banktransfer.php" hash="3fbc8e9778a79aa8802a1a2bd77681f9"/><file name="Ideal.php" hash="c0e11d3161bd93ca869a31d9b54e1b4b"/><file name="Klarna.php" hash="9bdbe1886bcdb283b86b6d208c3aa712"/><file name="Klarnaaccount.php" hash="0b4b84d9c472e815a30d5977ac53c932"/></dir><file name="Redirect.php" hash="668b52ec0c5fba7f42223d4e40a99987"/></dir><dir name="Helper"><file name="Data.php" hash="c94c725de2e14dc8019323c1ecf08962"/></dir><dir name="Model"><dir name="Adminhtml"><dir name="System"><dir name="Config"><dir name="Source"><file name="Languages.php" hash="4fe09e45e3d9f3866d4b7c8437832972"/><file name="Modes.php" hash="888158f9118ba5087357d5c1ad8514d4"/></dir></dir></dir></dir><dir name="Gateway"><file name="Abstract.php" hash="566134b83e6d2a01eba0c17f8a49e2dc"/><file name="Americanexpress.php" hash="e92216206b3b623aab4bd7b6e19741db"/><file name="Banktransfer.php" hash="babaf0ea30aad8aa9540c0879a9e67ca"/><file name="Default.php" hash="956d1ff0c2cfe0698efc23277e602cec"/><file name="Directdebit.php" hash="aab6b38b231d5add0e3b0fdcb3d73e3c"/><file name="Giropay.php" hash="e4c2497eaf88ddda0ba5d745945ea3bd"/><file name="Ideal.php" hash="430de461f07352905984bfa15adf9eec"/><file name="Klarna.php" hash="330efb073aba572606b1f25b597bb106"/><file name="Klarnaaccount.php" hash="2012566e77136f823e965c8811321ea3"/><file name="Maestro.php" hash="5675bd4e11b38499b209d91ca5367a07"/><file name="Mastercard.php" hash="11a3aca8cc5f3e04e08244e600c67e3d"/><file name="Mistercash.php" hash="ca9bfde52ea045fe73c6287bbb12837c"/><file name="Paypal.php" hash="cc679581956c2ae857404bc84e798fcc"/><file name="Przelewy24.php" hash="577fa43cee76b9546fc8c500a73e341a"/><file name="Sofortbanking.php" hash="7e3a03aec546156f4a3d47cb6232be2f"/><file name="Visa.php" hash="610a7893d1c03515dc1046b789005817"/><file name="Vpay.php" hash="aaf3f019a7a21c5b91a64bf95da81ed8"/><file name="Webmoney.php" hash="fb504c06b78108ac50bf3933fd44ab0e"/></dir><file name="Base.php" hash="f20c03f34ef2b07deb834d81976278ab"/><file name="Observer.php" hash="81f7a3c5149f52dcb2d4c7434d250003"/></dir><dir name="controllers"><file name="StandardController.php" hash="51f3acae0faeb38cb719e3f99779e6eb"/></dir><dir name="etc"><file name="adminhtml.xml" hash="1caa98cae31103bb77143f821f68f451"/><file name="config.xml" hash="48f6aae986347613abe4426e39a837d0"/><file name="system.xml" hash="63693b4f1fc7149690f7dccaa937ffc1"/></dir></dir></dir></target></contents>
16
  <compatible/>
17
  <dependencies/>
18
  </package>