Version 0.9 - ready for testing

This commit is contained in:
Rene V. Vergara A. 2022-12-30 18:22:20 -05:00
parent 89d4f1bdca
commit e721f97c83
3 changed files with 345 additions and 293 deletions

View File

@ -20,17 +20,16 @@ class Submenu_Page {
public $_nrows;
public $_path;
function __construct( ) {
public function __construct( $path ) {
global $wpdb;
$this->_path = $path;
$this->console_log('$_path -> '. $this->_path);
$this->_nrows = $this->getPmtsCount();
//
// Create zgo_pmtlst if does not exist
//
$sql = 'create table if not exists zgo_pmtlst (' .
$this->_nrows = $this->getPmtsCount();
//
// Create zgo_pmtlst if does not exist
//
$sql = 'create table if not exists zgo_pmtlst (' .
'pg_ix integer ,' .
'pg_page integer not null default 0,' .
'pg_npages integer not null default 0,' .
@ -38,9 +37,9 @@ class Submenu_Page {
'pg_limit integer not null default 0,' .
'pg_dt datetime default current_timestamp, '.
'unique lstix (pg_ix) );';
$wpdb->query($sql);
$wpdb->query($sql);
if ( ! $this->pmtLstRdy() ) {
if ( ! $this->pmtLstRdy() ) {
//
// Calculate first time pagination paramters
//
@ -58,7 +57,7 @@ class Submenu_Page {
$this->_offset . ',' .
$this->_limit .')';
$wpdb->query($sql);
} else {
} else {
// Load last state
$params = $this->pmtLstParams();
$this->_page = $params->pg_page;
@ -109,15 +108,14 @@ class Submenu_Page {
public function console_log($data) {
$file = $this->_path . 'zgopmtgwy/assets/console.log';
$file = $this->_path . 'assets/log/console.log';
file_put_contents($file, 'LST::' . $data . chr(0x0D) . chr(0x0A), FILE_TEXT | FILE_APPEND | LOCK_EX );
}
public function render() {
global $wpdb;
$currentDate = date('Y-m-d H:i:s');
$currentDate = date('Y-m-d H:i:s');
if ($_SERVER['REQUEST_METHOD'] === 'POST') {
//
@ -189,42 +187,42 @@ class Submenu_Page {
<!-- now output table header -->
<div width="100%"
style="padding-right: 20px;">
<table width="100%">
<tr style="font-family: Noto Sans;
font-weight: 600;
font-size: 15px;
vertical-align: center;
height: 20px;
color: navy;">
<td width="50%" style="padding-left: 5px;">
<?php
echo 'Page ' . $this->_page . '/' . $this->_npages;
?>
</td>
<td width="50%" style="text-align: right;">
<?php echo $currentDate; ?>
</td>
</tr>
</table>
<table>
<tr style="font-family: Noto Sans;
font-weight: 600;
font-size: 15px;
text-align: center;
vertical-align: center;
height: 20px;
background-color: #ff5722;
color: white;">
<td width="10%">ZGo Order Id</td>
<td width="10%">Shop Order Id</td>
<td width="15%">Customer</td>
<td width="10%">Accepted</td>
<td width="10%">Confirmed</td>
<td width="8%">Order Total</td>
<td width="8%">Rate</td>
<td width="8%">Total ZEC</td>
<td width="5%">Paid?</td>
</tr>
<table width="100%">
<tr style="font-family: Noto Sans;
font-weight: 600;
font-size: 15px;
vertical-align: center;
height: 20px;
color: navy;">
<td width="50%" style="padding-left: 5px;">
<?php
echo 'Page ' . $this->_page . '/' . $this->_npages;
?>
</td>
<td width="50%" style="text-align: right;">
<?php echo $currentDate; ?>
</td>
</tr>
</table>
<table>
<tr style="font-family: Noto Sans;
font-weight: 600;
font-size: 15px;
text-align: center;
vertical-align: center;
height: 20px;
background-color: #ff5722;
color: white;">
<td width="10%">ZGo Order Id</td>
<td width="10%">Shop Order Id</td>
<td width="15%">Customer</td>
<td width="10%">Accepted</td>
<td width="10%">Confirmed</td>
<td width="8%">Order Total</td>
<td width="8%">Rate</td>
<td width="8%">Total ZEC</td>
<td width="5%">Paid?</td>
</tr>
<?php
@ -254,65 +252,65 @@ class Submenu_Page {
print '<td style="text-align:center;">'.$row->pmt_wc_paid ."</td></tr>";
}
?>
</table>
</div>
<br>
<form class="" action="" method="POST">
<table width="100%">
<tr>
<td width="10%"></td>
<td width="20%" align="center">
<button type="submit" name="First"
style="border: 2px solid #ff2b00;
border-radius: 8px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
font-weight: 700;
background-color: #ff5722;
color: #ffffff;">First Page</button>
</td>
<td width="20%" align="center">
<button type="submit" name="Previous"
style="border: 2px solid #ff2b00;
border-radius: 8px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
font-weight: 700;
background-color: #ff5722;
color: #ffffff;">Prev Page</button>
</td>
<td width="20%" align="center">
<button type="submit" name="Next"
style="border: 2px solid #ff2b00;
border-radius: 8px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
font-weight: 700;
background-color: #ff5722;
color: #ffffff;">Next Page</button>
</td>
<td width="20%" align="center">
<button type="submit" name="Last"
style="border: 2px solid #ff2b00;
border-radius: 8px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
font-weight: 700;
background-color: #ff5722;
color: #ffffff;">Last Page</button>
</td>
<td width="10%"></td>
</tr>
</table>
</form>
</table>
</div>
<br>
<form class="" action="" method="POST">
<table width="100%">
<tr>
<td width="10%"></td>
<td width="20%" align="center">
<button type="submit" name="First"
style="border: 2px solid #ff2b00;
border-radius: 8px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
font-weight: 700;
background-color: #ff5722;
color: #ffffff;">First Page</button>
</td>
<td width="20%" align="center">
<button type="submit" name="Previous"
style="border: 2px solid #ff2b00;
border-radius: 8px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
font-weight: 700;
background-color: #ff5722;
color: #ffffff;">Prev Page</button>
</td>
<td width="20%" align="center">
<button type="submit" name="Next"
style="border: 2px solid #ff2b00;
border-radius: 8px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
font-weight: 700;
background-color: #ff5722;
color: #ffffff;">Next Page</button>
</td>
<td width="20%" align="center">
<button type="submit" name="Last"
style="border: 2px solid #ff2b00;
border-radius: 8px;
padding-left: 10px;
padding-right: 10px;
padding-top: 5px;
padding-bottom: 5px;
font-weight: 700;
background-color: #ff5722;
color: #ffffff;">Last Page</button>
</td>
<td width="10%"></td>
</tr>
</table>
</form>
<?php
$this->render_stats();
@ -338,11 +336,11 @@ class Submenu_Page {
ZGo Confirmed Payments Statistics
</div>
<!-- now output table header -->
<table width="100%"
<table width="100%"
style="padding-right: 20px;">
<tr>
<td width="10%"></td>
<td width="80%">
<tr>
<td width="10%"></td>
<td width="80%">
<table width="100%" >
<tr style="font-family: Noto Sans;
font-weight: 600;
@ -359,175 +357,227 @@ class Submenu_Page {
</tr>
</table>
</td>
<td width="10%"></td>
</tr>
<td width="10%"></td>
<td width="80%" >
<table width="100%">
<tr style="font-family: Noto Sans;
font-weight: 700;
background-color: white;">
<td width="35%" style="padding-left: 10px;
border-top: 1px solid navy;
border-bottom: 1px solid navy;">Received Today</td>
<td width="35%">
<table width="100%"
style="border-top: 1px solid navy;
border-bottom: 1px solid navy;
border-collapse: collapse;">
<tr>
<td style="padding-left: 10px;">Total Amount</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Average Rate</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Total Zec</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Number of payments</td>
</tr>
</table>
</td>
<td width="30%">
<table width="100%"
style="border-top: 1px solid navy;
border-bottom: 1px solid navy;
border-collapse: collapse;">
<tr>
<td style="padding-left: 10px;"> <?php echo number_format($result->dTotalAmount,2);?></td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;"> <?php if ($result->dTotalZec > 0.0) {
echo number_format($result->dTotalZec/$result->dTotalAmount,2);
} else { echo '0.00'; } ?></td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;"><?php echo number_format($result->dTotalZec,8);?></td>
</tr>
<tr >
<td style="border-top: 1px solid navy;
padding-left: 10px;"><?php echo $result->dTotalPmts;?></td>
</tr>
</table>
</td>
</tr>
<tr style="font-family: Noto Sans;
font-weight: 600;">
<td width="35%" style="padding-left: 10px;
border-top: 1px solid navy;
border-bottom: 1px solid navy;">Last 7 days</td>
<td width="35%">
<table width="100%"
style="border-top: 1px solid navy;
border-bottom: 1px solid navy;
border-collapse: collapse;">
<tr>
<td style="padding-left: 10px;">Total Amount</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Average Rate</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Total Zec</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Number of payments</td>
</tr>
</table>
</td>
<td width="30%">
<table width="100%"
style="border-top: 1px solid navy;
border-bottom: 1px solid navy;
border-collapse: collapse;">
<tr>
<td style="padding-left: 10px;"> <?php echo number_format($result->wTotalAmount,2);?></td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;"> <?php if ($result->wTotalZec > 0.0) {
echo number_format($result->wTotalAmount/$result->wTotalZec,2);
} else { echo '0.00'; } ?></td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;"><?php echo number_format($result->wTotalZec,8);?></td>
</tr>
<tr >
<td style="border-top: 1px solid navy;
padding-left: 10px;"><?php echo $result->wTotalPmts;?></td>
</tr>
</table>
</td>
</tr>
<tr style="font-family: Noto Sans;
font-weight: 600;
background-color: white;">
<td width="35%" style="padding-left: 10px;
border-top: 1px solid navy;
border-bottom: 1px solid navy;">Last 30 days</td>
<td width="35%">
<table width="100%"
style="border-top: 1px solid navy;
border-bottom: 1px solid navy;
border-collapse: collapse;">
<tr>
<td style="padding-left: 10px;">Total Amount</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Average Rate</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Total Zec</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Number of payments</td>
</tr>
</table>
</td>
<td width="30%">
<table width="100%"
style="border-top: 1px solid navy;
border-bottom: 1px solid navy;
border-collapse: collapse;">
<tr>
<td style="padding-left: 10px;"> <?php echo number_format($result->mTotalAmount,2);?></td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;"> <?php if ($result->mTotalZec> 0.0) {
echo number_format($result->mTotalAmount/$result->mTotalZec,2);
} else { echo '0.00'; } ?></td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;"><?php echo number_format($result->mTotalZec,8);?></td>
</tr>
<tr >
<td style="border-top: 1px solid navy;
padding-left: 10px;"><?php echo $result->mTotalPmts;?></td>
</tr>
</table>
</td>
</tr>
</table>
<td width="10%"></td>
</tr>
<tr>
<td width="10%"></td>
<td width="80%" >
<table width="100%">
<tr style="font-family: Noto Sans;
font-weight: 700;
background-color: white;">
<td width="35%"
style="padding-left: 10px;
border-top: 1px solid navy;
border-bottom: 1px solid navy;">Received Today</td>
<td width="35%">
<table width="100%"
style="border-top: 1px solid navy;
border-bottom: 1px solid navy;
border-collapse: collapse;">
<tr>
<td style="padding-left: 10px;">Total Amount</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Average Rate</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Total Zec</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Number of payments</td>
</tr>
</table>
</td>
<td width="30%">
<table width="100%"
style="border-top: 1px solid navy;
border-bottom: 1px solid navy;
border-collapse: collapse;">
<tr>
<td style="padding-left: 10px;"> <?php echo number_format($result->dTotalAmount,2);?></td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">
<?php
if ($result->dTotalZec > 0.0) {
echo number_format($result->dTotalZec/$result->dTotalAmount,2);
} else {
echo '0.00';
}
?>
</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">
<?php
echo number_format($result->dTotalZec,8);
?>
</td>
</tr>
<tr >
<td style="border-top: 1px solid navy;
padding-left: 10px;">
<?php
echo $result->dTotalPmts;
?>
</td>
</tr>
</table>
</td>
</tr>
<tr style="font-family: Noto Sans;
font-weight: 600;">
<td width="35%"
style="padding-left: 10px;
border-top: 1px solid navy;
border-bottom: 1px solid navy;">Last 7 days</td>
<td width="35%">
<table width="100%"
style="border-top: 1px solid navy;
border-bottom: 1px solid navy;
border-collapse: collapse;">
<tr>
<td style="padding-left: 10px;">Total Amount</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Average Rate</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Total Zec</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Number of payments</td>
</tr>
</table>
</td>
<td width="30%">
<table width="100%"
style="border-top: 1px solid navy;
border-bottom: 1px solid navy;
border-collapse: collapse;">
<tr>
<td style="padding-left: 10px;">
<?php
echo number_format($result->wTotalAmount,2);
?>
</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">
<?php
if ($result->wTotalZec > 0.0) {
echo number_format($result->wTotalAmount/$result->wTotalZec,2);
} else {
echo '0.00';
}
?>
</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">
<?php
echo number_format($result->wTotalZec,8);
?>
</td>
</tr>
<tr >
<td style="border-top: 1px solid navy;
padding-left: 10px;">
<?php
echo $result->wTotalPmts;
?>
</td>
</tr>
</table>
</td>
</tr>
<tr style="font-family: Noto Sans;
font-weight: 600;
background-color: white;">
<td width="35%" style="padding-left: 10px;
border-top: 1px solid navy;
border-bottom: 1px solid navy;">Last 30 days
</td>
<td width="35%">
<table width="100%"
style="border-top: 1px solid navy;
border-bottom: 1px solid navy;
border-collapse: collapse;">
<tr>
<td style="padding-left: 10px;">Total Amount</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Average Rate</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Total Zec</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">Number of payments</td>
</tr>
</table>
</td>
<td width="30%">
<table width="100%"
style="border-top: 1px solid navy;
border-bottom: 1px solid navy;
border-collapse: collapse;">
<tr>
<td style="padding-left: 10px;">
<?php
echo number_format($result->mTotalAmount,2);
?>
</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">
<?php
if ($result->mTotalZec> 0.0) {
echo number_format($result->mTotalAmount/$result->mTotalZec,2);
} else {
echo '0.00';
}
?>
</td>
</tr>
<tr>
<td style="border-top: 1px solid navy;
padding-left: 10px;">
<?php
echo number_format($result->mTotalZec,8);
?>
</td>
</tr>
<tr >
<td style="border-top: 1px solid navy;
padding-left: 10px;">
<?php
echo $result->mTotalPmts;
?>
</td>
</tr>
</table>
</td>
</tr>
</table>
</td>
<td width="10%"></td>
<tr>
</tr>
<td width="10%"></td>
</tr>
</table>
<?php
}
@ -559,14 +609,14 @@ class Submenu_Page {
<td width="80%">
<table width="100%" >
<tr style="font-family: Noto Sans;
font-weight: 600;
font-size: 15px;
margin: auto;
text-align: center;
vertical-align: center;
height: 20px;
background-color: #ff5722;
color: white;">
font-weight: 600;
font-size: 15px;
margin: auto;
text-align: center;
vertical-align: center;
height: 20px;
background-color: #ff5722;
git color: white;">
<td width="12%">Payments:</td>
<td width="23%"><?php echo $result->gTotalPmts ?></td>
<td width="12%">Total Amount:</td>
@ -581,6 +631,5 @@ class Submenu_Page {
<?php
}
}
}
}

View File

@ -1,6 +1,9 @@
*** Changelog ***
# ZGo Payment Plugin for WooCommerce
## Version 0.9 - 2022-12-30
Integrate ZGo Payments Monitor
## Version 0.8 - 2022-12-26
ZGo's WooCommerce backend API in test mode
Set licence to GPL v2 or later

View File

@ -3,7 +3,7 @@
* Plugin Name: ZGo Payment Gateway
* Plugin URI: https://vergara.tech'
* Description: ZGo latest payment processing solution for Woocommerce. Accept payments using Zcash.
* Version: 0.8a
* Version: 0.9
* Requires at least: 5.2
* Requires PHP: 7.2
* Author: Vergara Tech LLC
@ -420,8 +420,8 @@ foreach ( glob( plugin_dir_path( __FILE__ ) . 'assets/php/*.php' ) as $file ) {
add_action( 'plugins_loaded', 'zgopmtlist_plugin' );
function zgopmtlist_plugin() {
$plugin = new Submenu( new Submenu_Page() );
$path = plugin_dir_path( __FILE__ );
$plugin = new Submenu( new Submenu_Page($path) );
$plugin->init();
}