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

View file

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

View file

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