Version Notes
* Update CoinGate PHP Merchant Class
* Added debug logs
Download this release
Release Info
Developer | CoinGate |
Extension | CoinGate_For_Magento |
Version | 1.0.2 |
Comparing to | |
See all releases |
Code changes from version 1.0.1 to 1.0.2
- app/code/community/Mage/Coingate/.DS_Store +0 -0
- app/code/community/Mage/Coingate/Model/CoingateFactory.php +28 -5
- app/code/community/Mage/Coingate/etc/config.xml +1 -1
- app/code/community/Mage/Coingate/etc/system.xml +2 -0
- app/code/community/Mage/Coingate/lib/coingate_merchant.class.php +14 -6
- package.xml +6 -6
app/code/community/Mage/Coingate/.DS_Store
DELETED
Binary file
|
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.
|
6 |
|
7 |
class Mage_Coingate_Model_CoingateFactory extends Mage_Payment_Model_Method_Abstract
|
8 |
{
|
@@ -54,6 +54,8 @@ 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 |
}
|
58 |
|
59 |
return FALSE;
|
@@ -70,8 +72,9 @@ class Mage_Coingate_Model_CoingateFactory extends Mage_Payment_Model_Method_Abst
|
|
70 |
$payment = $order->getPayment();
|
71 |
$token = $payment->getAdditionalInformation('coingate_order_token');
|
72 |
|
73 |
-
if ($token == '' || $_GET['token'] != $token)
|
74 |
throw new Exception('Token: 1:' . $_GET['token'] . ' : 2:' . $token . ' do not match');
|
|
|
75 |
|
76 |
$cgConfig = Mage::getStoreConfig('payment/coingate');
|
77 |
|
@@ -79,13 +82,17 @@ class Mage_Coingate_Model_CoingateFactory extends Mage_Payment_Model_Method_Abst
|
|
79 |
|
80 |
$coingate->get_order($_REQUEST['id']);
|
81 |
|
82 |
-
if (!$coingate->success)
|
83 |
-
throw new Exception('CoinGate Order #' . $
|
|
|
|
|
|
|
84 |
|
85 |
$coingate_response = json_decode($coingate->response, TRUE);
|
86 |
|
87 |
-
if (!is_array($coingate_response))
|
88 |
throw new Exception('Something wrong with callback');
|
|
|
89 |
|
90 |
if ($coingate_response['status'] == 'paid') {
|
91 |
$order->sendNewOrderEmail()
|
@@ -112,4 +119,20 @@ class Mage_Coingate_Model_CoingateFactory extends Mage_Payment_Model_Method_Abst
|
|
112 |
)
|
113 |
);
|
114 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
115 |
}
|
2 |
|
3 |
require_once(Mage::getBaseDir() . '/app/code/community/Mage/Coingate/lib/coingate_merchant.class.php');
|
4 |
|
5 |
+
define('COINGATE_MAGENTO_VERSION', '1.0.2');
|
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 |
+
} else {
|
58 |
+
$this->logMe('Create order', $cgConfig, $coingate);
|
59 |
}
|
60 |
|
61 |
return FALSE;
|
72 |
$payment = $order->getPayment();
|
73 |
$token = $payment->getAdditionalInformation('coingate_order_token');
|
74 |
|
75 |
+
if ($token == '' || $_GET['token'] != $token) {
|
76 |
throw new Exception('Token: 1:' . $_GET['token'] . ' : 2:' . $token . ' do not match');
|
77 |
+
}
|
78 |
|
79 |
$cgConfig = Mage::getStoreConfig('payment/coingate');
|
80 |
|
82 |
|
83 |
$coingate->get_order($_REQUEST['id']);
|
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);
|
92 |
|
93 |
+
if (!is_array($coingate_response)) {
|
94 |
throw new Exception('Something wrong with callback');
|
95 |
+
}
|
96 |
|
97 |
if ($coingate_response['status'] == 'paid') {
|
98 |
$order->sendNewOrderEmail()
|
119 |
)
|
120 |
);
|
121 |
}
|
122 |
+
|
123 |
+
private function logMe($name, $cgConfig, $coingate, $customData = '')
|
124 |
+
{
|
125 |
+
Mage::Log($name
|
126 |
+
. ' - App ID: ' . $cgConfig['app_id']
|
127 |
+
. '; Mode: ' . ($cgConfig['test'] == '1' ? 'sandbox' : 'live')
|
128 |
+
. '; HTTP Status: ' . $coingate->status_code
|
129 |
+
. '; Response: ' . $coingate->response
|
130 |
+
. '; cURL Error: ' . json_encode($coingate->curl_error)
|
131 |
+
. '; PHP Version: ' . phpversion()
|
132 |
+
. '; cURL Version: ' . json_encode(curl_version())
|
133 |
+
. '; Magento Version: ' . Mage::getVersion()
|
134 |
+
. '; Plugin Version: ' . COINGATE_MAGENTO_VERSION
|
135 |
+
. $customData
|
136 |
+
. "\n", null, 'coingate.log', true);
|
137 |
+
}
|
138 |
}
|
app/code/community/Mage/Coingate/etc/config.xml
CHANGED
@@ -2,7 +2,7 @@
|
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Mage_Coingate>
|
5 |
-
<version>1.0.
|
6 |
</Mage_Coingate>
|
7 |
</modules>
|
8 |
|
2 |
<config>
|
3 |
<modules>
|
4 |
<Mage_Coingate>
|
5 |
+
<version>1.0.2</version>
|
6 |
</Mage_Coingate>
|
7 |
</modules>
|
8 |
|
app/code/community/Mage/Coingate/etc/system.xml
CHANGED
@@ -9,6 +9,7 @@
|
|
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 |
<fields>
|
13 |
<active translate="label">
|
14 |
<label>Enabled</label>
|
@@ -63,6 +64,7 @@
|
|
63 |
<label>Currency you want to receive</label>
|
64 |
<frontend_type>select</frontend_type>
|
65 |
<source_model>coingate/receiveCurrencies</source_model>
|
|
|
66 |
<sort_order>7</sort_order>
|
67 |
<show_in_default>1</show_in_default>
|
68 |
<show_in_website>1</show_in_website>
|
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>
|
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>
|
app/code/community/Mage/Coingate/lib/coingate_merchant.class.php
CHANGED
@@ -4,12 +4,12 @@
|
|
4 |
* PHP CoinGate Merchant Class
|
5 |
*
|
6 |
* @author CoinGate <info@coingate.com>
|
7 |
-
* @version 1.0.
|
8 |
-
* @link http://developer.coingate.com
|
9 |
* @license MIT
|
10 |
*/
|
11 |
|
12 |
-
define('CLASS_VERSION', '1.0.
|
13 |
|
14 |
class CoingateMerchant {
|
15 |
private $app_id = '';
|
@@ -48,6 +48,12 @@ class CoingateMerchant {
|
|
48 |
$this->request('/orders/' . $order_id);
|
49 |
}
|
50 |
|
|
|
|
|
|
|
|
|
|
|
|
|
51 |
public function request($url, $method = 'GET', $params = array())
|
52 |
{
|
53 |
$url = $this->api_url . $url;
|
@@ -61,7 +67,7 @@ class CoingateMerchant {
|
|
61 |
$headers[] = 'Access-Signature: ' . $signature;
|
62 |
|
63 |
$curl = curl_init();
|
64 |
-
|
65 |
$curl_options = array(
|
66 |
CURLOPT_RETURNTRANSFER => 1,
|
67 |
CURLOPT_URL => $url
|
@@ -78,10 +84,14 @@ class CoingateMerchant {
|
|
78 |
curl_setopt_array($curl, $curl_options);
|
79 |
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
80 |
curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
|
|
|
81 |
|
82 |
$response = curl_exec($curl);
|
83 |
$http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
84 |
|
|
|
|
|
|
|
85 |
curl_close($curl);
|
86 |
|
87 |
$this->success = $http_status == 200;
|
@@ -100,5 +110,3 @@ class CoingateMerchant {
|
|
100 |
$this->api_url .= $this->version;
|
101 |
}
|
102 |
}
|
103 |
-
|
104 |
-
?>
|
4 |
* PHP CoinGate Merchant Class
|
5 |
*
|
6 |
* @author CoinGate <info@coingate.com>
|
7 |
+
* @version 1.0.3
|
8 |
+
* @link http://developer.coingate.com
|
9 |
* @license MIT
|
10 |
*/
|
11 |
|
12 |
+
define('CLASS_VERSION', '1.0.3');
|
13 |
|
14 |
class CoingateMerchant {
|
15 |
private $app_id = '';
|
48 |
$this->request('/orders/' . $order_id);
|
49 |
}
|
50 |
|
51 |
+
public function test_connection() {
|
52 |
+
$this->request('/auth/test');
|
53 |
+
|
54 |
+
return $this->success && $this->response == 'OK';
|
55 |
+
}
|
56 |
+
|
57 |
public function request($url, $method = 'GET', $params = array())
|
58 |
{
|
59 |
$url = $this->api_url . $url;
|
67 |
$headers[] = 'Access-Signature: ' . $signature;
|
68 |
|
69 |
$curl = curl_init();
|
70 |
+
|
71 |
$curl_options = array(
|
72 |
CURLOPT_RETURNTRANSFER => 1,
|
73 |
CURLOPT_URL => $url
|
84 |
curl_setopt_array($curl, $curl_options);
|
85 |
curl_setopt($curl, CURLOPT_HTTPHEADER, $headers);
|
86 |
curl_setopt($curl, CURLOPT_USERAGENT, $this->user_agent);
|
87 |
+
curl_setopt($curl, CURLOPT_SSL_VERIFYPEER, FALSE);
|
88 |
|
89 |
$response = curl_exec($curl);
|
90 |
$http_status = curl_getinfo($curl, CURLINFO_HTTP_CODE);
|
91 |
|
92 |
+
$this->curl_error['message'] = curl_error($curl);
|
93 |
+
$this->curl_error['number'] = curl_errno($curl);
|
94 |
+
|
95 |
curl_close($curl);
|
96 |
|
97 |
$this->success = $http_status == 200;
|
110 |
$this->api_url .= $this->version;
|
111 |
}
|
112 |
}
|
|
|
|
package.xml
CHANGED
@@ -1,7 +1,7 @@
|
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>CoinGate_For_Magento</name>
|
4 |
-
<version>1.0.
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://github.com/coingate/magento-plugin/blob/master/LICENSE.md">MIT</license>
|
7 |
<channel>community</channel>
|
@@ -10,12 +10,12 @@
|
|
10 |
<description>Bitcoin is an innovative payment network and a new kind of money. It uses peer-to-peer technology to operate with no central authority or banks. Bitcoin is open-source; its design is public, nobody owns or controls Bitcoin and everyone can take part.
|
11 |

|
12 |
CoinGate is a bitcoin payment processor, which allows businesses to receive payments in euros and US dollars through the Bitcoin payment network, seamlessly connecting innovations of Bitcoin with comfort of familiar currencies and user-friendly interface.</description>
|
13 |
-
<notes>* Update CoinGate PHP Merchant Class
|
14 |
-
*
|
15 |
<authors><author><name>CoinGate Team</name><user>CoinGate</user><email>info@coingate.com</email></author></authors>
|
16 |
-
<date>2015-
|
17 |
-
<time>13:
|
18 |
-
<contents><target name="magecommunity"><dir name="Mage"><dir name="Coingate"><dir name="Block"><file name="Callback.php" hash="0845222d4c5ce4457aab3eb14282ff8d"/><file name="Form.php" hash="ab93f50ac62fab7b986ccfe4732d63e4"/><file name="Redirect.php" hash="21b349e960636fd441b35d42facaf17d"/></dir><dir name="Model"><file name="CoingateFactory.php" hash="
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php><package><name>curl</name><channel>connect.magentocommerce.com/core</channel><min>7.37.1</min><max></max></package></required></dependencies>
|
21 |
</package>
|
1 |
<?xml version="1.0"?>
|
2 |
<package>
|
3 |
<name>CoinGate_For_Magento</name>
|
4 |
+
<version>1.0.2</version>
|
5 |
<stability>stable</stability>
|
6 |
<license uri="https://github.com/coingate/magento-plugin/blob/master/LICENSE.md">MIT</license>
|
7 |
<channel>community</channel>
|
10 |
<description>Bitcoin is an innovative payment network and a new kind of money. It uses peer-to-peer technology to operate with no central authority or banks. Bitcoin is open-source; its design is public, nobody owns or controls Bitcoin and everyone can take part.
|
11 |

|
12 |
CoinGate is a bitcoin payment processor, which allows businesses to receive payments in euros and US dollars through the Bitcoin payment network, seamlessly connecting innovations of Bitcoin with comfort of familiar currencies and user-friendly interface.</description>
|
13 |
+
<notes>* Update CoinGate PHP Merchant Class
|
14 |
+
* Added debug logs</notes>
|
15 |
<authors><author><name>CoinGate Team</name><user>CoinGate</user><email>info@coingate.com</email></author></authors>
|
16 |
+
<date>2015-09-08</date>
|
17 |
+
<time>13:12:50</time>
|
18 |
+
<contents><target name="magecommunity"><dir name="Mage"><dir name="Coingate"><dir name="Block"><file name="Callback.php" hash="0845222d4c5ce4457aab3eb14282ff8d"/><file name="Form.php" hash="ab93f50ac62fab7b986ccfe4732d63e4"/><file name="Redirect.php" hash="21b349e960636fd441b35d42facaf17d"/></dir><dir name="Model"><file name="CoingateFactory.php" hash="e2fba3f2979ef294fed63fe07bb1a977"/><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="ad9821f6f4cb68e6e1dc21bb8371088d"/><file name="system.xml" hash="ecf436c082353a952c7906b90726b428"/></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>
|
19 |
<compatible/>
|
20 |
<dependencies><required><php><min>5.0.0</min><max>6.0.0</max></php><package><name>curl</name><channel>connect.magentocommerce.com/core</channel><min>7.37.1</min><max></max></package></required></dependencies>
|
21 |
</package>
|