Skip to content

Commit 895ca8a

Browse files
committed
Version 2.2.1
Support GoUrl IPN test data
1 parent 58693db commit 895ca8a

9 files changed

Lines changed: 776 additions & 706 deletions

File tree

history.txt

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,12 @@
1+
===============================================================================
2+
== Version 2.2.1 (June 2020)
3+
===============================================================================
4+
5+
- Support GoUrl IPN test data
6+
7+
8+
9+
110
===============================================================================
211
== Version 2.2.0 (May 2020)
312
===============================================================================

js/_source/ajax.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @category Javascript
55
* @website https://gourl.io
66
* @api https://gourl.io/api.html
7-
* @version 2.2.0
7+
* @version 2.2.1
88
*/
99

1010
/**

js/_source/cryptobox.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @category Javascript
55
* @website https://gourl.io
66
* @api https://gourl.io/api.html
7-
* @version 2.2.0
7+
* @version 2.2.1
88
*/
99

1010
/**

js/_source/support.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
* @category Javascript
55
* @website https://gourl.io
66
* @api https://gourl.io/api.html
7-
* @version 2.2.0
7+
* @version 2.2.1
88
*/
99

1010
/**

lib/cryptobox.callback.php

Lines changed: 38 additions & 38 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
<?php
1+
<?php
22
/**
3-
* ##########################################
3+
* ##########################################
44
* ### PLEASE DO NOT MODIFY THIS FILE ! ###
55
* ##########################################
66
*
@@ -11,21 +11,21 @@
1111
* @copyright 2014-2020 Delta Consultants
1212
* @category Libraries
1313
* @website https://gourl.io
14-
* @version 2.2.0
15-
*
16-
*
17-
* This file processes call-backs from Cryptocoin Payment Box server when new payment
18-
* from your users comes in. Please link this file in your cryptobox configuration on
14+
* @version 2.2.1
15+
*
16+
*
17+
* This file processes call-backs from Cryptocoin Payment Box server when new payment
18+
* from your users comes in. Please link this file in your cryptobox configuration on
1919
* gourl.io - Callback url: http://yoursite.com/cryptobox.callback.php
20-
*
21-
* Usually user will see on bottom of payment box button 'Click Here if you have already sent coins'
20+
*
21+
* Usually user will see on bottom of payment box button 'Click Here if you have already sent coins'
2222
* and when he will click on that button, script will connect to our remote cryptocoin payment box server
23-
* and check user payment.
24-
*
23+
* and check user payment.
24+
*
2525
* As backup, our server will also inform your server automatically every time when payment is
26-
* received through this callback file. I.e. if the user does not click on button, your website anyway
27-
* will receive notification about a given user and save it in your database. And when your user next time
28-
* comes on your website/reload page he will automatically will see message that his payment has been
26+
* received through this callback file. I.e. if the user does not click on button, your website anyway
27+
* will receive notification about a given user and save it in your database. And when your user next time
28+
* comes on your website/reload page he will automatically will see message that his payment has been
2929
* received successfully.
3030
*
3131
*
@@ -34,7 +34,7 @@
3434

3535
if(!defined("CRYPTOBOX_WORDPRESS")) define("CRYPTOBOX_WORDPRESS", false);
3636

37-
if (!CRYPTOBOX_WORDPRESS) require_once( "cryptobox.class.php" );
37+
if (!CRYPTOBOX_WORDPRESS) require_once( "cryptobox.class.php" );
3838
elseif (!defined('ABSPATH')) exit; // Exit if accessed directly in wordpress
3939

4040

@@ -55,23 +55,23 @@
5555
$data_hash = $boxID = "";
5656
if (isset($_POST["data_hash"]) && strlen($_POST["data_hash"]) == 128 && preg_replace('/[^A-Za-z0-9]/', '', $_POST["data_hash"]) == $_POST["data_hash"]) { $data_hash = strtolower($_POST["data_hash"]); unset($_POST["data_hash"]); }
5757
if (isset($_POST["box"]) && is_numeric($_POST["box"]) && $_POST["box"] > 0) $boxID = intval($_POST["box"]);
58-
58+
5959
if ($data_hash && $boxID)
6060
{
6161
$private_key = "";
6262
$arr = explode("^", CRYPTOBOX_PRIVATE_KEYS);
6363
foreach ($arr as $v) if (strpos($v, $boxID."AA") === 0) $private_key = $v;
64-
64+
6565
if ($private_key)
6666
{
6767
$data_hash2 = strtolower(hash("sha512", $private_key.json_encode($_POST).$private_key));
6868
if ($data_hash == $data_hash2) $valid_key = true;
6969
}
7070
unset($private_key);
7171
}
72-
73-
if (!$valid_key) die("Error! Invalid Json Data sha512 Hash!");
74-
72+
73+
if (!$valid_key) die("Error! Invalid Json Data sha512 Hash!");
74+
7575
}
7676

7777

@@ -84,58 +84,58 @@
8484
if (isset($_POST["plugin_ver"]) && !isset($_POST["status"]) && $valid_key)
8585
{
8686
echo "cryptoboxver_" . (CRYPTOBOX_WORDPRESS ? "wordpress_" . GOURL_VERSION : "php_" . CRYPTOBOX_VERSION);
87-
die;
87+
die;
8888
}
8989

9090

9191
// e.
9292
if (isset($_POST["status"]) && in_array($_POST["status"], array("payment_received", "payment_received_unrecognised")) &&
9393
$_POST["box"] && is_numeric($_POST["box"]) && $_POST["box"] > 0 && $_POST["amount"] && is_numeric($_POST["amount"]) && $_POST["amount"] > 0 && $valid_key)
9494
{
95-
95+
9696
foreach ($_POST as $k => $v)
9797
{
9898
if ($k == "datetime") $mask = '/[^0-9\ \-\:]/';
9999
elseif (in_array($k, array("err", "date", "period"))) $mask = '/[^A-Za-z0-9\.\_\-\@\ ]/';
100100
else $mask = '/[^A-Za-z0-9\.\_\-\@]/';
101101
if ($v && preg_replace($mask, '', $v) != $v) $_POST[$k] = "";
102102
}
103-
103+
104104
if (!$_POST["amountusd"] || !is_numeric($_POST["amountusd"])) $_POST["amountusd"] = 0;
105105
if (!$_POST["confirmed"] || !is_numeric($_POST["confirmed"])) $_POST["confirmed"] = 0;
106-
107-
106+
107+
108108
$dt = gmdate('Y-m-d H:i:s');
109109
$obj = run_sql("select paymentID, txConfirmed from crypto_payments where boxID = ".intval($_POST["box"])." && orderID = '".addslashes($_POST["order"])."' && userID = '".addslashes($_POST["user"])."' && txID = '".addslashes($_POST["tx"])."' && amount = ".floatval($_POST["amount"])." && addr = '".addslashes($_POST["addr"])."' limit 1");
110-
111-
110+
111+
112112
$paymentID = ($obj) ? $obj->paymentID : 0;
113-
$txConfirmed = ($obj) ? $obj->txConfirmed : 0;
114-
113+
$txConfirmed = ($obj) ? $obj->txConfirmed : 0;
114+
115115
// Save new payment details in local database
116116
if (!$paymentID)
117117
{
118118
$sql = "INSERT INTO crypto_payments (boxID, boxType, orderID, userID, countryID, coinLabel, amount, amountUSD, unrecognised, addr, txID, txDate, txConfirmed, txCheckDate, recordCreated)
119119
VALUES (".intval($_POST["box"]).", '".addslashes($_POST["boxtype"])."', '".addslashes($_POST["order"])."', '".addslashes($_POST["user"])."', '".addslashes($_POST["usercountry"])."', '".addslashes($_POST["coinlabel"])."', ".floatval($_POST["amount"]).", ".floatval($_POST["amountusd"]).", ".($_POST["status"]=="payment_received_unrecognised"?1:0).", '".addslashes($_POST["addr"])."', '".addslashes($_POST["tx"])."', '".addslashes($_POST["datetime"])."', ".intval($_POST["confirmed"]).", '$dt', '$dt')";
120120

121121
$paymentID = run_sql($sql);
122-
122+
123123
$box_status = "cryptobox_newrecord";
124124
}
125125
// Update transaction status to confirmed
126126
elseif ($_POST["confirmed"] && !$txConfirmed)
127127
{
128128
$sql = "UPDATE crypto_payments SET txConfirmed = 1, txCheckDate = '$dt' WHERE paymentID = ".intval($paymentID)." LIMIT 1";
129129
run_sql($sql);
130-
130+
131131
$box_status = "cryptobox_updated";
132132
}
133-
else
133+
else
134134
{
135135
$box_status = "cryptobox_nochanges";
136136
}
137-
138-
137+
138+
139139
/**
140140
* User-defined function for new payment - cryptobox_new_payment(...)
141141
* For example, send confirmation email, update database, update user membership, etc.
@@ -144,12 +144,12 @@
144144
*/
145145

146146
if (in_array($box_status, array("cryptobox_newrecord", "cryptobox_updated")) && function_exists('cryptobox_new_payment')) cryptobox_new_payment($paymentID, $_POST, $box_status);
147-
}
147+
}
148148

149149
else
150150
$box_status = "Only POST Data Allowed";
151151

152152

153-
echo $box_status; // don't delete it
154-
155-
?>
153+
echo $box_status; // don't delete it
154+
155+
?>

0 commit comments

Comments
 (0)