Skip to content

Commit

Permalink
update search
Browse files Browse the repository at this point in the history
اضافه شدن جستجوی تراکنش و افزایش تعداد مغایرت گیری
  • Loading branch information
mahdisarani committed Aug 15, 2021
1 parent 8e2e091 commit 8b590f3
Show file tree
Hide file tree
Showing 4 changed files with 75 additions and 18 deletions.
6 changes: 3 additions & 3 deletions admin/deposit/deposit-order.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
<thead>
<tr>
<th style="text-align:center;" >تاریخ </th>
<th style="text-align:center;" >کد پرداخت</th>
<th style="text-align:center;" >شماره پرداخت</th>
<th style="text-align:center;" >شناسه فاکتور</th>
<th style="text-align:center;" >مبلغ</th>
<th style="text-align:center;">وضعیت</th>
Expand All @@ -44,7 +44,7 @@
<?php
$wc_orders = wc_get_orders( array(
'limit' => -1,
'meta_key' => '_payping_payCode',
'meta_key' => 'woo_payping_refid',
'payment_method' => array('WC_payping', 'WC_payping_Ghesta'),
'status' => array( 'pending', 'on-hold', 'cancelled', 'failed' ),
) );
Expand Down Expand Up @@ -84,7 +84,7 @@
<tfoot>
<tr>
<th style="text-align:center;" >تاریخ </th>
<th style="text-align:center;" >کد پرداخت</th>
<th style="text-align:center;" >شماره پرداخت</th>
<th style="text-align:center;" >شناسه فاکتور</th>
<th style="text-align:center;" >مبلغ</th>
<th style="text-align:center;">وضعیت</th>
Expand Down
71 changes: 57 additions & 14 deletions admin/transactions/reports.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,32 +3,74 @@
require_once( PPD_GPPDIR . 'admin/transactions/settle.html.php');
return;
}
$limit = 10;
$limit = 15;
if( !isset( $_GET['p'] ) || $_GET['p'] <= 1){
$offset = 0;
}else{
$offset = ( $_GET['p'] - 1 )*$limit;
}
$Filter = array();
$transactionType = 0;
$FromDate = null;
$ToDate = null;
$Filter = array();
$transactionType = 0;
$FromDate = null;
$ToDate = null;
$cardNumber = null;
$payerName = null;
$code = null;
$payerPhoneNumber = null;
$amount = 0;

if( isset( $_POST['searchtrsnatn'] ) ){
if( isset( $_POST['amount'] ) && ! empty( $_POST['amount'] ) ){
$amount = $_POST['amount'];
}

if( isset( $_POST['code'] ) && ! empty( $_POST['code'] ) ){
$code = $_POST['code'];
}

if( isset( $_POST['payerName'] ) && ! empty( $_POST['payerName'] ) ){
$payerName = $_POST['payerName'];
}

if( isset( $_POST['payerPhoneNumber'] ) && ! empty( $_POST['payerPhoneNumber'] ) ){
$payerPhoneNumber = $_POST['payerPhoneNumber'];
}

if( isset( $_POST['cardNumber'] ) && ! empty( $_POST['cardNumber'] ) ){
$cardNumber = $_POST['cardNumber'];
}
}

$params = array(
'offset' => $offset,
'limit' => $limit,
'Filter' => $Filter,
'transactionType' => $transactionType,
'FromDate' => $FromDate,
'ToDate' => $ToDate
"amount" => $amount,
"code" => $code,
"fromDate" => $FromDate,
"toDate" => $ToDate,
"limit" => $limit,
"offset" => $offset,
"payerName" => $payerName,
"cardNumber" => $cardNumber,
"paymentStatus" => $transactionType,
"payerPhoneNumber" => $payerPhoneNumber
);
$parent = new PayPingAPIS();
$response = $parent->TransactionReport( $params );

$parent = new PayPingAPIS();
$response = $parent->AdvancedTransactionReport( $params );
$code = wp_remote_retrieve_response_code( $response );
if( $code === 200 ){
$Transactions = json_decode( wp_remote_retrieve_body( $response ), true );
?>
<h3>جستجوی تراکنش</h3>
<form method="post">
<p>
<input type="text" name="amount" placeholder="مبلغ به تومان" dir="ltr">
<input type="text" name="code" placeholder="کد پرداخت" dir="ltr">
<input type="text" name="payerName" placeholder="نام پرداخت کننده">
<input type="text" name="payerPhoneNumber" placeholder="شماره تلفن پرداخت کننده" dir="ltr">
<input type="text" name="cardNumber" placeholder="شماره کارت پرداخت کننده" dir="ltr">
<input type="submit" value="جستجو" class="button" name="searchtrsnatn">
</p>
</form>
<table class="form-table" style="border: 1px solid #fff; margin-bottom: 25px;">
<thead>
<tr style="text-align: center; background-color:#fff;">
Expand Down Expand Up @@ -107,8 +149,9 @@
</tfooter>
</table>
<?php
$response = $parent->TransactionReportCount( $params );
$response = $parent->AdvancedTransactionReportCount( $params );
$Total = json_decode( wp_remote_retrieve_body( $response ) );

class pp_pagination {
private $total = 0;
private $per_page = 50;
Expand Down
14 changes: 14 additions & 0 deletions includes/PayPing.php
Original file line number Diff line number Diff line change
Expand Up @@ -209,6 +209,20 @@ public function TransactionReport( $params ){
return $Response;
}
/* End TransactionReport */

/* Start AdvancedTransactionReport */
public function AdvancedTransactionReportCount( $params ){
$Response = self::PayPingRequest( '/v2/report/AdvancedTransactionReportCount', 'post', $params, 'TransactionsListCount' );
return $Response;
}
/* End AdvancedTransactionReport */

/* Start AdvancedTransactionReport */
public function AdvancedTransactionReport( $params ){
$Response = self::PayPingRequest( '/v2/report/AdvancedTransactionReport', 'post', $params, 'TransactionsList' );
return $Response;
}
/* End AdvancedTransactionReport */

/* Start TransActionDetails */
public function TransActionDetails( $PaymentCode ){
Expand Down
2 changes: 1 addition & 1 deletion index.php
Original file line number Diff line number Diff line change
Expand Up @@ -51,7 +51,7 @@ function custom_time_event_func(){

function pp_aouto_deposit(){
$wc_orders = wc_get_orders( array(
'limit' => 50,
'limit' => 100,
'meta_key' => '_payping_payCode',
'payment_method' => array('WC_payping', 'WC_payping_Ghesta'),
'status' => array( 'pending', 'on-hold', 'cancelled', 'failed' ),
Expand Down

0 comments on commit 8b590f3

Please sign in to comment.