CoinGate_For_Magento - Version 1.0.5

Version Notes

* Remove CoinGate logs
* Allow to relate CoinGate - Magento payment statuses

Download this release

Release Info

Developer CoinGate
Extension CoinGate_For_Magento
Version 1.0.5
Comparing to
See all releases


Code changes from version 1.0.4 to 1.0.5

app/code/community/Mage/Coingate/Model/CoingateFactory.php CHANGED
@@ -2,7 +2,7 @@
2
 
3
  require_once(Mage::getBaseDir() . '/app/code/community/Mage/Coingate/lib/coingate_merchant.class.php');
4
 
5
- define('COINGATE_MAGENTO_VERSION', '1.0.4');
6
 
7
  class Mage_Coingate_Model_CoingateFactory extends Mage_Payment_Model_Method_Abstract
8
  {
@@ -54,8 +54,6 @@ class Mage_Coingate_Model_CoingateFactory extends Mage_Payment_Model_Method_Abst
54
  $coingate_response = json_decode($coingate->response, TRUE);
55
 
56
  return $coingate_response['payment_url'];
57
- } else {
58
- $this->logMe('Create order', $cgConfig, $coingate);
59
  }
60
 
61
  return FALSE;
@@ -84,8 +82,6 @@ class Mage_Coingate_Model_CoingateFactory extends Mage_Payment_Model_Method_Abst
84
 
85
  if (!$coingate->success) {
86
  throw new Exception('CoinGate Order #' . $_REQUEST['id'] . ' does not exist');
87
- } else {
88
- $this->logMe('Validate order', $cgConfig, $coingate);
89
  }
90
 
91
  $coingate_response = json_decode($coingate->response, TRUE);
@@ -94,17 +90,24 @@ class Mage_Coingate_Model_CoingateFactory extends Mage_Payment_Model_Method_Abst
94
  throw new Exception('Something wrong with callback');
95
  }
96
 
97
- if ($coingate_response['status'] == 'paid') {
98
- $mage_status = Mage_Sales_Model_Order::STATE_PROCESSING;
99
- }
100
- else if ($coingate_response['status'] == 'confirming') {
101
- $mage_status = Mage_Sales_Model_Order::STATE_PENDING_PAYMENT;
102
- }
103
- else if (in_array($coingate_response['status'], array('invalid', 'expired', 'canceled'))) {
104
- $mage_status = Mage_Sales_Model_Order::STATE_CANCELED;
105
- }
106
- else {
107
- $mage_status = NULL;
 
 
 
 
 
 
 
108
  }
109
 
110
  if (!is_null($mage_status)) {
@@ -128,20 +131,4 @@ class Mage_Coingate_Model_CoingateFactory extends Mage_Payment_Model_Method_Abst
128
  )
129
  );
130
  }
131
-
132
- private function logMe($name, $cgConfig, $coingate, $customData = '')
133
- {
134
- Mage::Log($name
135
- . ' - App ID: ' . $cgConfig['app_id']
136
- . '; Mode: ' . ($cgConfig['test'] == '1' ? 'sandbox' : 'live')
137
- . '; HTTP Status: ' . $coingate->status_code
138
- . '; Response: ' . $coingate->response
139
- . '; cURL Error: ' . json_encode($coingate->curl_error)
140
- . '; PHP Version: ' . phpversion()
141
- . '; cURL Version: ' . json_encode(curl_version())
142
- . '; Magento Version: ' . Mage::getVersion()
143
- . '; Plugin Version: ' . COINGATE_MAGENTO_VERSION
144
- . $customData
145
- . "\n", null, 'coingate.log', true);
146
- }
147
  }
2
 
3
  require_once(Mage::getBaseDir() . '/app/code/community/Mage/Coingate/lib/coingate_merchant.class.php');
4
 
5
+ define('COINGATE_MAGENTO_VERSION', '1.0.5');
6
 
7
  class Mage_Coingate_Model_CoingateFactory extends Mage_Payment_Model_Method_Abstract
8
  {
54
  $coingate_response = json_decode($coingate->response, TRUE);
55
 
56
  return $coingate_response['payment_url'];
 
 
57
  }
58
 
59
  return FALSE;
82
 
83
  if (!$coingate->success) {
84
  throw new Exception('CoinGate Order #' . $_REQUEST['id'] . ' does not exist');
 
 
85
  }
86
 
87
  $coingate_response = json_decode($coingate->response, TRUE);
90
  throw new Exception('Something wrong with callback');
91
  }
92
 
93
+ switch ($coingate_response['status']) {
94
+ case 'paid':
95
+ $mage_status = $cgConfig['invoice_paid'];
96
+ break;
97
+ case 'canceled':
98
+ $mage_status = $cgConfig['invoice_canceled'];
99
+ break;
100
+ case 'expired':
101
+ $mage_status = $cgConfig['invoice_expired'];
102
+ break;
103
+ case 'invalid':
104
+ $mage_status = $cgConfig['invoice_invalid'];
105
+ break;
106
+ case 'refunded':
107
+ $mage_status = $cgConfig['invoice_refunded'];
108
+ break;
109
+ default:
110
+ $mage_status = NULL;
111
  }
112
 
113
  if (!is_null($mage_status)) {
131
  )
132
  );
133
  }
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
134
  }
app/code/community/Mage/Coingate/etc/config.xml CHANGED
@@ -2,7 +2,7 @@
2
  <config>
3
  <modules>
4
  <Mage_Coingate>
5
- <version>1.0.4</version>
6
  </Mage_Coingate>
7
  </modules>
8
 
@@ -60,6 +60,11 @@
60
  <test>0</test>
61
  <title>Bitcoin</title>
62
  <desc>Pay with Bitcoin via CoinGate</desc>
 
 
 
 
 
63
  </coingate>
64
  </payment>
65
  </default>
2
  <config>
3
  <modules>
4
  <Mage_Coingate>
5
+ <version>1.0.5</version>
6
  </Mage_Coingate>
7
  </modules>
8
 
60
  <test>0</test>
61
  <title>Bitcoin</title>
62
  <desc>Pay with Bitcoin via CoinGate</desc>
63
+ <invoice_paid>processing</invoice_paid>
64
+ <invoice_canceled>canceled</invoice_canceled>
65
+ <invoice_expired>canceled</invoice_expired>
66
+ <invoice_invalid>canceled</invoice_invalid>
67
+ <invoice_refunded>refunded</invoice_refunded>
68
  </coingate>
69
  </payment>
70
  </default>
app/code/community/Mage/Coingate/etc/system.xml CHANGED
@@ -9,7 +9,9 @@
9
  <show_in_default>1</show_in_default>
10
  <show_in_website>1</show_in_website>
11
  <show_in_store>0</show_in_store>
12
- <comment>Having trouble? We can help you! Download the log file from var/log/coingate.log and send it to support@coingate.com</comment>
 
 
13
  <fields>
14
  <active translate="label">
15
  <label>Enabled</label>
@@ -61,10 +63,10 @@
61
  <show_in_store>0</show_in_store>
62
  </api_secret>
63
  <receive_currency translate="label">
64
- <label>Currency you want to receive</label>
65
  <frontend_type>select</frontend_type>
66
  <source_model>coingate/receiveCurrencies</source_model>
67
- <tooltip>The currency in which you wish to receive your payments</tooltip>
68
  <sort_order>7</sort_order>
69
  <show_in_default>1</show_in_default>
70
  <show_in_website>1</show_in_website>
@@ -74,19 +76,73 @@
74
  <label>Test mode?</label>
75
  <frontend_type>select</frontend_type>
76
  <source_model>adminhtml/system_config_source_yesno</source_model>
 
77
  <sort_order>8</sort_order>
78
  <show_in_default>1</show_in_default>
79
  <show_in_website>1</show_in_website>
80
  <show_in_store>0</show_in_store>
81
  </test>
82
- <sort_order translate="label">
83
- <label>Sort Order</label>
84
- <frontend_type>text</frontend_type>
85
- <sort_order>9</sort_order>
86
- <show_in_default>1</show_in_default>
87
- <show_in_website>1</show_in_website>
88
- <show_in_store>0</show_in_store>
89
- </sort_order>
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
90
  </fields>
91
  </coingate>
92
  </groups>
9
  <show_in_default>1</show_in_default>
10
  <show_in_website>1</show_in_website>
11
  <show_in_store>0</show_in_store>
12
+ <comment>
13
+ Having trouble? View common issues: https://developer.coingate.com/docs/issues or contact support@coingate.com
14
+ </comment>
15
  <fields>
16
  <active translate="label">
17
  <label>Enabled</label>
63
  <show_in_store>0</show_in_store>
64
  </api_secret>
65
  <receive_currency translate="label">
66
+ <label>Receive Currency</label>
67
  <frontend_type>select</frontend_type>
68
  <source_model>coingate/receiveCurrencies</source_model>
69
+ <tooltip>Currency you want to receive when making withdrawal at CoinGate. Please take a note what if you choose EUR or USD you will be asked to verify your business before making a withdrawal at CoinGate.</tooltip>
70
  <sort_order>7</sort_order>
71
  <show_in_default>1</show_in_default>
72
  <show_in_website>1</show_in_website>
76
  <label>Test mode?</label>
77
  <frontend_type>select</frontend_type>
78
  <source_model>adminhtml/system_config_source_yesno</source_model>
79
+ <tooltip>Live (coingate.com) is for production and Sandbox (sandbox.coingate.com) is for testing purpose.</tooltip>
80
  <sort_order>8</sort_order>
81
  <show_in_default>1</show_in_default>
82
  <show_in_website>1</show_in_website>
83
  <show_in_store>0</show_in_store>
84
  </test>
85
+ <sort_order translate="label">
86
+ <label>Sort Order</label>
87
+ <frontend_type>text</frontend_type>
88
+ <sort_order>9</sort_order>
89
+ <show_in_default>1</show_in_default>
90
+ <show_in_website>1</show_in_website>
91
+ <show_in_store>0</show_in_store>
92
+ </sort_order>
93
+ <invoice>
94
+ <label>Payment Statuses</label>
95
+ <frontend_model>adminhtml/system_config_form_field_heading</frontend_model>
96
+ <sort_order>100</sort_order>
97
+ <show_in_default>1</show_in_default>
98
+ <show_in_website>1</show_in_website>
99
+ <show_in_store>1</show_in_store>
100
+ </invoice>
101
+ <invoice_paid translate="label">
102
+ <label>Paid</label>
103
+ <frontend_type>select</frontend_type>
104
+ <source_model>adminhtml/system_config_source_order_status</source_model>
105
+ <sort_order>120</sort_order>
106
+ <show_in_default>1</show_in_default>
107
+ <show_in_website>1</show_in_website>
108
+ <show_in_store>1</show_in_store>
109
+ </invoice_paid>
110
+ <invoice_canceled translate="label">
111
+ <label>Canceled</label>
112
+ <frontend_type>select</frontend_type>
113
+ <source_model>adminhtml/system_config_source_order_status</source_model>
114
+ <sort_order>130</sort_order>
115
+ <show_in_default>1</show_in_default>
116
+ <show_in_website>1</show_in_website>
117
+ <show_in_store>1</show_in_store>
118
+ </invoice_canceled>
119
+ <invoice_expired translate="label">
120
+ <label>Expired</label>
121
+ <frontend_type>select</frontend_type>
122
+ <source_model>adminhtml/system_config_source_order_status</source_model>
123
+ <sort_order>140</sort_order>
124
+ <show_in_default>1</show_in_default>
125
+ <show_in_website>1</show_in_website>
126
+ <show_in_store>1</show_in_store>
127
+ </invoice_expired>
128
+ <invoice_invalid translate="label">
129
+ <label>Invalid</label>
130
+ <frontend_type>select</frontend_type>
131
+ <source_model>adminhtml/system_config_source_order_status</source_model>
132
+ <sort_order>150</sort_order>
133
+ <show_in_default>1</show_in_default>
134
+ <show_in_website>1</show_in_website>
135
+ <show_in_store>1</show_in_store>
136
+ </invoice_invalid>
137
+ <invoice_refunded translate="label">
138
+ <label>Refunded</label>
139
+ <frontend_type>select</frontend_type>
140
+ <source_model>adminhtml/system_config_source_order_status</source_model>
141
+ <sort_order>150</sort_order>
142
+ <show_in_default>1</show_in_default>
143
+ <show_in_website>1</show_in_website>
144
+ <show_in_store>1</show_in_store>
145
+ </invoice_refunded>
146
  </fields>
147
  </coingate>
148
  </groups>
package.xml CHANGED
@@ -1,9 +1,9 @@
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CoinGate_For_Magento</name>
4
- <version>1.0.4</version>
5
  <stability>stable</stability>
6
- <license uri="https://github.com/coingate/magento-plugin/blob/master/LICENSE.md">MITL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Accept Bitcoin on your Magento website through CoinGate.com and receive payouts in euros or US dollars.</summary>
@@ -27,12 +27,12 @@ After the customer pays the invoice, the merchant receives 19.80 euro (20 euro m
27
  &#xD;
28
  To be able to use the plugin you have to create an account on &lt;a href="https://coingate.com" target="_blank"&gt;https://coingate.com&lt;/a&gt;&#xD;
29
  </description>
30
- <notes>* Remove debug code&#xD;
31
- * Added status "Mage_Sales_Model_Order::STATE_PENDING_PAYMENT" when CoinGate status is "confirming"</notes>
32
  <authors><author><name>CoinGate</name><user>coingate</user><email>info@coingate.com</email></author></authors>
33
- <date>2016-07-08</date>
34
- <time>13:59:01</time>
35
- <contents><target name="magecommunity"><dir name="Mage"><dir name="Coingate"><dir name="Block"><file name="Callback.php" hash="ad228ee9b00f327052a72246fe76b339"/><file name="Form.php" hash="ab93f50ac62fab7b986ccfe4732d63e4"/><file name="Redirect.php" hash="21b349e960636fd441b35d42facaf17d"/></dir><dir name="Model"><file name="CoingateFactory.php" hash="f202fac9b77370078db8a840a0599a1b"/><file name="ReceiveCurrencies.php" hash="94f7f39c759012b8e75ec8e6846cae5f"/></dir><dir name="controllers"><file name="PayController.php" hash="ffe09d0ff067e5247351990255d0c472"/></dir><dir name="etc"><file name="config.xml" hash="34acaad8a76441ebd86778b7413c4ca3"/><file name="system.xml" hash="7c0eeb2bbd12b9febe32187fcebafd53"/></dir><dir name="lib"><file name="coingate_merchant.class.php" hash="af5eb495a82c48d703f2acd45f07cf8a"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Coingate.xml" hash="cc8a4080d714fd0c50eadf91a77be49c"/></dir></target></contents>
36
  <compatible/>
37
  <dependencies><required><php><min>5.0.0</min><max>7.0.0</max></php></required></dependencies>
38
  </package>
1
  <?xml version="1.0"?>
2
  <package>
3
  <name>CoinGate_For_Magento</name>
4
+ <version>1.0.5</version>
5
  <stability>stable</stability>
6
+ <license uri="https://github.com/coingate/magento-plugin/blob/master/LICENSE">MITL</license>
7
  <channel>community</channel>
8
  <extends/>
9
  <summary>Accept Bitcoin on your Magento website through CoinGate.com and receive payouts in euros or US dollars.</summary>
27
  &#xD;
28
  To be able to use the plugin you have to create an account on &lt;a href="https://coingate.com" target="_blank"&gt;https://coingate.com&lt;/a&gt;&#xD;
29
  </description>
30
+ <notes>* Remove CoinGate logs&#xD;
31
+ * Allow to relate CoinGate - Magento payment statuses</notes>
32
  <authors><author><name>CoinGate</name><user>coingate</user><email>info@coingate.com</email></author></authors>
33
+ <date>2016-11-09</date>
34
+ <time>12:02:24</time>
35
+ <contents><target name="magecommunity"><dir name="Mage"><dir name="Coingate"><dir name="Block"><file name="Callback.php" hash="ad228ee9b00f327052a72246fe76b339"/><file name="Form.php" hash="ab93f50ac62fab7b986ccfe4732d63e4"/><file name="Redirect.php" hash="21b349e960636fd441b35d42facaf17d"/></dir><dir name="Model"><file name="CoingateFactory.php" hash="d48055139aa587eaf9490173e83493dd"/><file name="ReceiveCurrencies.php" hash="94f7f39c759012b8e75ec8e6846cae5f"/></dir><dir name="controllers"><file name="PayController.php" hash="ffe09d0ff067e5247351990255d0c472"/></dir><dir name="etc"><file name="config.xml" hash="fe380e522cf7a8c00124f0d282dd8a9a"/><file name="system.xml" hash="dd8cdc7665dc165d18137047670109bf"/></dir><dir name="lib"><file name="coingate_merchant.class.php" hash="af5eb495a82c48d703f2acd45f07cf8a"/></dir></dir></dir></target><target name="mageetc"><dir name="modules"><file name="Mage_Coingate.xml" hash="cc8a4080d714fd0c50eadf91a77be49c"/></dir></target></contents>
36
  <compatible/>
37
  <dependencies><required><php><min>5.0.0</min><max>7.0.0</max></php></required></dependencies>
38
  </package>