From cce47f21118bedcdac43f519e0e4fcee56d10935 Mon Sep 17 00:00:00 2001 From: Lei OT Date: Mon, 20 Oct 2025 15:25:41 +0800 Subject: [PATCH] =?UTF-8?q?PayPal=20webhook=20=20=E6=97=B6=E9=97=B4;=20sty?= =?UTF-8?q?le:=20payment=5Flist?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../pay/models/Online_payment_note_model.php | 9 ++++- webht/third_party/pay/views/payment_list.php | 40 +++++++++++++------ .../third_party/paypal/controllers/index.php | 4 ++ .../models/Online_payment_note_model.php | 3 +- 4 files changed, 40 insertions(+), 16 deletions(-) diff --git a/webht/third_party/pay/models/Online_payment_note_model.php b/webht/third_party/pay/models/Online_payment_note_model.php index 4bcd3a17..613d921f 100644 --- a/webht/third_party/pay/models/Online_payment_note_model.php +++ b/webht/third_party/pay/models/Online_payment_note_model.php @@ -230,7 +230,9 @@ class Online_payment_note_model extends CI_Model { $search_sql.=" AND ( OPN_transactionId = '$keyword' OR OPN_relatedId like '%$keyword%' OR OPN_orderId like '%$keyword%' - OR OPN_rawOrderId like '%$keyword%' )"; + OR OPN_rawOrderId like '%$keyword%' + OR OPN_payerEmail like '%$keyword%' + )"; } $this->search = $search_sql; return $this->query_note(); @@ -240,7 +242,10 @@ class Online_payment_note_model extends CI_Model { { $this->init_query(); $this->search = $method===null ? "" : " AND OPN_accountMethod IN ($method) "; - $this->search .= " AND OPN_noticeTime BETWEEN '$date 00:00:00' AND '$date 23:59:59' "; + $this->search .= " AND (OPN_noticeTime BETWEEN '$date 00:00:00' AND '$date 23:59:59' + OR OPN_noticeSendTime BETWEEN '$date 00:00:00' AND '$date 23:59:59' + ) + "; $this->send = " AND isnull(OPN_noticeSendStatus,'') NOT IN ('', 'sendfail', 'unsend', 'closed' )"; return $this->query_note(); } diff --git a/webht/third_party/pay/views/payment_list.php b/webht/third_party/pay/views/payment_list.php index 90d7ac8e..ce35b7ff 100644 --- a/webht/third_party/pay/views/payment_list.php +++ b/webht/third_party/pay/views/payment_list.php @@ -41,6 +41,8 @@ .highlights-color {background-color: #eb5e26;} .trippest-color {background-color: #E83201;} + .opacity-4 {opacity: 0.4;} + .app-color {background-color: #EC3A4F;} .hly-color {background-color: #009fe9;} .unknown-color{ background-color: #999999;} @@ -49,12 +51,12 @@ .table td { word-break: break-word; } /* .text-completed {color: #00CC00;} */ /* .text-pending {color: #ff9900;} */ - .text-pending {color: #00A2E8;} - .text-declined {color: #a94442;} - .text-under_review {color: #ff9900;} - .text-resolved {color: #ff9900;} - .text-customer_dispute_updated {color: #ff9900;} - .text-approved {color: #777;} + .text-pending, .text-pending a:not(.btn) {color: #00A2E8;} + .text-declined, .text-declined a:not(.btn) {color: #c0192a;} + .text-under_review, .text-under_review a:not(.btn) {color: #ff9900;} + .text-resolved, .text-resolved a:not(.btn) {color: #ff9900;} + .text-customer_dispute_updated, .text-customer_dispute_updated a:not(.btn) {color: #ff9900;} + .text-approved, .text-approved a:not(.btn) {color: #777;} .flex {display: flex;} .items-center {align-items: center;} @@ -278,8 +280,12 @@ ?> OPN_transactionResult}" : ''; ?> text-OPN_resultMsg)) ?>"> - brand_name))."-color"; ?>">brand_name; ?> - OPN_fundSource)))."-color"; ?>">OPN_fundSource); ?>
+ + brand_name))."-color"; ?>">brand_name; ?> + OPN_paymentSource != '' && stripos($item->OPN_paymentSource, $item->brand_name) === false) { ?> + brand_name))."-color"; ?>">OPN_paymentSource; ?> + + OPN_fundSource)))."-color"; ?>">OPN_fundSource); ?>
$item->OPN_payerEmail,'method' => '','date'=>'')); ?>">OPN_payerEmail; ?> + app_name) { ?> app_name))."-color"; ?>">app_name; ?> @@ -307,10 +315,10 @@ OPN_remark ? "
{$item->OPN_remark}
" : ''; ?> OPN_transactionId; ?> - OPN_transactionId; ?> + OPN_transactionId; ?>
OPN_relatedId) { ?> - ┖ OPN_relatedId; ?> + ┖ OPN_relatedId; ?>
@@ -340,15 +348,21 @@ if ($item->OPN_transactionResult !== 'completed') { $cls = "text-{$item->OPN_transactionResult}"; $text = strtoupper($item->OPN_transactionResult); + $send_text = $item->OPN_noticeType !== 'pay' ? strtoupper($item->OPN_noticeType) : $item->OPN_resultCode; echo "{$text}
"; } elseif ($item->OPN_noticeType !== 'pay') { + $send_text = $item->OPN_noticeType == 'refund' ? strtoupper($item->OPN_transactionResult) : $item->OPN_resultCode; echo '' . strtoupper($item->OPN_noticeType) . '
'; } else { + $send_text = ($item->OPN_noticeSendStatus ? $item->OPN_noticeSendStatus : '⏳'); echo '' . strtoupper($item->OPN_transactionResult) . '
'; } ?>
+ - OPN_noticeSendStatus ? $item->OPN_noticeSendStatus : '⏳' ; ?> +
@@ -471,7 +485,7 @@ jQuery.browser = {}; $('#modal_set_gai').modal('show'); }, error: function(msg) { - alert('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYoyo...'); + alert('\u53d1\u751f\u9519\u8bef\uff0c\u8bf7\u8054\u7cfbYoyo....'); } }); } diff --git a/webht/third_party/paypal/controllers/index.php b/webht/third_party/paypal/controllers/index.php index 1992c950..13447140 100644 --- a/webht/third_party/paypal/controllers/index.php +++ b/webht/third_party/paypal/controllers/index.php @@ -741,6 +741,7 @@ class Index extends CI_Controller { case 'PAYMENT.CAPTURE.COMPLETED': case 'PAYMENT.CAPTURE.DECLINED': // todo: CHECKOUT.PAYMENT-APPROVAL.REVERSED case 'PAYMENT.CAPTURE.PENDING': + $save_to_pn = $post_data->event_type !== 'PAYMENT.CAPTURE.PENDING'; // false; $fund_type = 'pay'; $pn_invoice = $post_data->resource->invoice_id; $pn_custom = isset($post_data->resource->custom_id) ? $post_data->resource->custom_id : ''; @@ -863,6 +864,7 @@ class Index extends CI_Controller { // $pn_mc_gross = '-' . $post_data->resource->amount->total; // $post_data->parent_txn_id = $post_data->resource->sale_id; // } + $create_time = isset($post_data->resource->create_time) ? $post_data->resource->create_time : $post_data->resource->update_time; $pn_payment_date = isset($post_data->resource->update_time) ? $post_data->resource->update_time : $post_data->resource->create_time; // $pn_payer = $post_data->resource->amount->currency; // $pn_payer_email = $post_data->resource->amount->currency; @@ -870,6 +872,7 @@ class Index extends CI_Controller { $pn_memo = json_encode($post_data); // $raw_post; if (!empty($pn_txn_id)) { //把PDT时间转成GMT时间 + $create_time = gmdate('Y-m-d H:i:s', strtotime($create_time)); $pn_payment_date = gmdate('Y-m-d H:i:s', strtotime($pn_payment_date)); if ($save_to_pn) { $this->Note_model->save_paypal_note( @@ -902,6 +905,7 @@ class Index extends CI_Controller { 'net_amount' => $net_amount, 'pay_fee' => isset($post_data->mc_fee) ? $post_data->mc_fee : 0, 'transaction_status' => $transaction_status, // $pn_payment_status, OPN_transactionResult + 'payment_create' => $create_time, 'payment_date' => $pn_payment_date, 'fund_source' => $pn_receiver_account_name, 'fund_type' => $fund_type, diff --git a/webht/third_party/paypal/models/Online_payment_note_model.php b/webht/third_party/paypal/models/Online_payment_note_model.php index 61ae8b03..6abb8772 100644 --- a/webht/third_party/paypal/models/Online_payment_note_model.php +++ b/webht/third_party/paypal/models/Online_payment_note_model.php @@ -573,6 +573,7 @@ class Online_payment_note_model extends CI_Model { $this->load->model('paypal_model', 'account_model'); $ssje = $this->account_model->get_ssje_exclude_fee($result_data['net_amount'],'', str_replace("CNY", "RMB", strtoupper($result_data['pay_currency']))); + $localSqlDateTime0 = date('Y-m-d H:i:s', strtotime($result_data['payment_create']) + 3600 * 8); $localSqlDateTime = date('Y-m-d H:i:s', strtotime($result_data['payment_date']) + 3600 * 8); $save_column = array(); @@ -586,7 +587,7 @@ class Online_payment_note_model extends CI_Model { $save_column['OPN_entryAmountCNY'] = floatval($ssje); $save_column['OPN_noticeType'] = $result_data['fund_type']; $save_column['OPN_relatedId'] = $result_data['referer_id']; - $save_column['OPN_acquiringTime'] = $localSqlDateTime; + $save_column['OPN_acquiringTime'] = $localSqlDateTime0; $save_column['OPN_completeTime'] = $localSqlDateTime; $save_column['OPN_accountMethod'] = 15002; // $this->config->item('method_code', 'paypal');