adding new transaction class to manual payout through website
This commit is contained in:
parent
91144afa4e
commit
fbfc8d60da
@ -13,29 +13,31 @@ if ( ! $user->checkPin($_SESSION['USERDATA']['id'], $_POST['authPin']) && $_POST
|
|||||||
} else {
|
} else {
|
||||||
switch ($_POST['do']) {
|
switch ($_POST['do']) {
|
||||||
case 'cashOut':
|
case 'cashOut':
|
||||||
$dUserBalance = $user->getBalance($_SESSION['USERDATA']['id']);
|
$continue = true;
|
||||||
$sUserSendAddress = $user->getLtcAddress($_SESSION['USERDATA']['id']);
|
$dBalance = $transaction->getBalance($_SESSION['USERDATA']['id']);
|
||||||
$dUserPaid = $user->getPaid($_SESSION['USERDATA']['id']);
|
$sCoinAddress = $user->getCoinAddress($_SESSION['USERDATA']['id']);
|
||||||
if ($dUserBalance > 0.1) {
|
if ($dBalance > 0.1) {
|
||||||
if ($bitcoin->can_connect() === true) {
|
if ($bitcoin->can_connect() === true) {
|
||||||
try {
|
try {
|
||||||
$bitcoin->validateaddress($sUserSendAddress);
|
$bitcoin->validateaddress($sCoinAddress);
|
||||||
} catch (BitcoinClientException $e) {
|
} catch (BitcoinClientException $e) {
|
||||||
|
var_dump($e);
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Invalid payment address: ' . $sUserSendAddress, 'TYPE' => 'errormsg');
|
$_SESSION['POPUP'][] = array('CONTENT' => 'Invalid payment address: ' . $sUserSendAddress, 'TYPE' => 'errormsg');
|
||||||
|
$continue = false;
|
||||||
}
|
}
|
||||||
// Remove the transfer fee
|
if ($continue == true) {
|
||||||
$dUserBalance = $dUserBalance - 0.1;
|
// Remove the transfer fee and send to address
|
||||||
try {
|
try {
|
||||||
$bitcoin->sendtoaddress($sUserSendAddress, $dUserBalance);
|
$bitcoin->sendtoaddress($sCoinAddress, $dBalance - 0.1);
|
||||||
} catch (BitcoinClientException $e) {
|
} catch (BitcoinClientException $e) {
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Failed to send LTC, please contact site support immidiately', 'TYPE' => 'errormsg');
|
$_SESSION['POPUP'][] = array('CONTENT' => 'Failed to send LTC, please contact site support immidiately', 'TYPE' => 'errormsg');
|
||||||
|
var_dump($e);
|
||||||
|
$continue = false;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// Set balance to 0, add to paid out, insert to ledger
|
// Set balance to 0, add to paid out, insert to ledger
|
||||||
if ( $user->setBalance($_SESSION['USERDATA']['id'], 0) &&
|
if ($continue == true && $transaction->addTransaction($_SESSION['USERDATA']['id'], $dBalance, 'Debit_MP', NULL, $sCoinAddress))
|
||||||
$user->setPaid($_SESSION['USERDATA']['id'], $dUserPaid + $dUserBalance) &&
|
|
||||||
$user->addLedger($_SESSION['USERDATA']['id'], $dUserBalance, $sUserSendAddress) ) {
|
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Transaction completed', 'TYPE' => 'success');
|
$_SESSION['POPUP'][] = array('CONTENT' => 'Transaction completed', 'TYPE' => 'success');
|
||||||
}
|
|
||||||
} else {
|
} else {
|
||||||
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to pushpool service', 'TYPE' => 'errormsg');
|
$_SESSION['POPUP'][] = array('CONTENT' => 'Unable to connect to pushpool service', 'TYPE' => 'errormsg');
|
||||||
}
|
}
|
||||||
|
|||||||
@ -19,7 +19,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody style="font-size:12px;">
|
<tbody style="font-size:12px;">
|
||||||
{section transaction $TRANSACTIONS}
|
{section transaction $TRANSACTIONS}
|
||||||
{if (($TRANSACTIONS[transaction].type == 'Credit' and $TRANSACTIONS[transaction].confirmations >= 120) or $TRANSACTIONS[transaction].type != 'Credit')}
|
{if (($TRANSACTIONS[transaction].type == 'Credit' and $TRANSACTIONS[transaction].confirmations >= $GLOBAL.confirmations) or $TRANSACTIONS[transaction].type != 'Credit')}
|
||||||
<tr class="{cycle values="odd,even"}">
|
<tr class="{cycle values="odd,even"}">
|
||||||
<td>{$TRANSACTIONS[transaction].id}</td>
|
<td>{$TRANSACTIONS[transaction].id}</td>
|
||||||
<td>{$TRANSACTIONS[transaction].timestamp}</td>
|
<td>{$TRANSACTIONS[transaction].timestamp}</td>
|
||||||
@ -50,7 +50,7 @@
|
|||||||
</thead>
|
</thead>
|
||||||
<tbody style="font-size:12px;">
|
<tbody style="font-size:12px;">
|
||||||
{section transaction $TRANSACTIONS}
|
{section transaction $TRANSACTIONS}
|
||||||
{if $TRANSACTIONS[transaction].type == 'Credit' && $TRANSACTIONS[transaction].confirmations < 120}
|
{if $TRANSACTIONS[transaction].type == 'Credit' && $TRANSACTIONS[transaction].confirmations < $GLOBAL.confirmations}
|
||||||
<tr class="{cycle values="odd,even"}">
|
<tr class="{cycle values="odd,even"}">
|
||||||
<td>{$TRANSACTIONS[transaction].id}</td>
|
<td>{$TRANSACTIONS[transaction].id}</td>
|
||||||
<td>{$TRANSACTIONS[transaction].timestamp}</td>
|
<td>{$TRANSACTIONS[transaction].timestamp}</td>
|
||||||
|
|||||||
Loading…
Reference in New Issue
Block a user