Changeset 2915735
- Timestamp:
- 05/22/2023 10:30:12 AM (3 years ago)
- Location:
- qh-testpay
- Files:
-
- 7 edited
-
tags/1.0.1/inc/class-qhpay-admin-page.php (modified) (2 diffs)
-
tags/1.0.1/inc/functions.php (modified) (2 diffs)
-
tags/1.0.1/qh-testpay.php (modified) (4 diffs)
-
trunk/inc/banks/class-qhpay-base.php (modified) (1 diff)
-
trunk/inc/class-qhpay-admin-page.php (modified) (2 diffs)
-
trunk/inc/functions.php (modified) (3 diffs)
-
trunk/qh-testpay.php (modified) (4 diffs)
Legend:
- Unmodified
- Added
- Removed
-
qh-testpay/tags/1.0.1/inc/class-qhpay-admin-page.php
r2843203 r2915735 262 262 </td> 263 263 </tr> 264 <!-- 264 265 <tr> 265 266 <th scope="row"><?php echo __('Webhook', 'qh-testpay') ?></th> … … 267 268 <input type="text" name="settings[webhook]" id="webhook" value="<?php echo isset($settings['webhook'])? $settings['webhook']:'' ?>"/> 268 269 </td> 269 </tr> 270 </tr> --> 271 <tr> 272 <th scope="row"><?php echo __('Telegram Bot Token', 'qh-testpay') ?></th> 273 <td> 274 <input type="text" name="settings[telegram_token]" id="telegram_token" value="<?php echo isset($settings['telegram_token'])? $settings['telegram_token']:'' ?>"/> 275 </td> 276 </tr> 277 <tr> 278 <th scope="row"><?php echo __('Telegram Group ID', 'qh-testpay') ?></th> 279 <td> 280 <input type="text" name="settings[telegram_chatid]" id="telegram_chatid" value="<?php echo isset($settings['telegram_chatid'])? $settings['telegram_chatid']:'' ?>"/> 281 </td> 282 </tr> 283 270 284 <tr> 271 285 <th scope="row"><?php echo __('Auto check user paid', 'qh-testpay') ?></th> -
qh-testpay/tags/1.0.1/inc/functions.php
r2771861 r2915735 71 71 return $headers; 72 72 } 73 74 function qhp_parse_order_id($des, $prefix, $insensitive){ 73 function qhp_parse_code($des, $prefix, $insensitive){ 75 74 //TODO : Rewrite this function. 76 75 //phân biệt … … 87 86 // Print the entire match result 88 87 $orderCode = $matches[0][0]; 89 88 return $orderCode; 89 } 90 function qhp_parse_order_id($des, $prefix, $insensitive){ 91 $orderCode = qhp_parse_code($des, $prefix, $insensitive); 90 92 $prefixLength = strlen($prefix); 91 93 -
qh-testpay/tags/1.0.1/qh-testpay.php
r2843203 r2915735 18 18 define('QHTP_DIR', plugin_dir_path(__FILE__)); 19 19 define('QHTP_URL', plugins_url('/', __FILE__)); 20 define('QHTP_TEST', 0);20 define('QHTP_TEST', false); 21 21 //require(__DIR__."/lib/phpqrcode/qrlib.php"); 22 22 require(__DIR__."/inc/functions.php"); … … 536 536 } 537 537 $result = ['msg'=>[],'error'=>1,'rawInput'=> $txtBody]; 538 $bankMsg = ""; 539 $domain = parse_url(home_url(),PHP_URL_HOST); 538 540 539 541 if(!empty($jsonBody->data)) … … 551 553 } 552 554 } 555 //message for telegram 556 $bankMsg = sprintf("QHTP Thông báo giao dịch:\nTrang web: %s\nSố tiền: %s\nMã: %s\nTin nhắn: %s", 557 $domain, 558 number_format($transaction->amount), 559 qhp_parse_code($des,$this->settings['bank_transfer']['transaction_prefix'], $this->settings['bank_transfer']['case_insensitive']), 560 $transaction->description//$transaction->when 561 ); 553 562 $order_id = qhp_parse_order_id($des, $this->settings['bank_transfer']['transaction_prefix'], $this->settings['bank_transfer']['case_insensitive']); 554 563 if (is_null($order_id)) { … … 616 625 if(empty($result['error'])) break; 617 626 } 627 //telegram bot 628 if(!empty($this->settings['telegram_token']) && !empty($this->settings['telegram_chatid'])) { 629 $token = trim($this->settings['telegram_token']); 630 $chatid = trim($this->settings['telegram_chatid']); 631 $text = substr($bankMsg,0,4000);//$jsonBody->data? json_encode($jsonBody->data):'[]'; 632 if(substr( $token, 0, 3 ) != "bot") $token='bot'.$token; 633 $response = wp_remote_get( "https://api.telegram.org/{$token}/sendMessage?chat_id={$chatid}&text=".urlencode($text), array( 634 'timeout' => 120, 635 'httpversion' => '1.1', 636 'headers' => array( 637 ) 638 )); 639 #$result['msg'][] = wp_remote_retrieve_body( $response ); 640 } 618 641 //other webhook 619 642 if(!empty($this->settings['webhook']) && filter_var($this->settings['webhook'], FILTER_VALIDATE_URL)) { -
qh-testpay/trunk/inc/banks/class-qhpay-base.php
r2896947 r2915735 720 720 $pay_url = ""; 721 721 if($bank=='momo') { 722 $img_url = get_rest_url(null, " bck/v1/qrcode?app=momo&phone={$accountNo}&price={$amount}&content=".urlencode($addInfo));722 $img_url = get_rest_url(null, "qhtp/v1/qrcode?app=momo&phone={$accountNo}&price={$amount}"); 723 723 } 724 724 else if($bank=='viettelpay') { -
qh-testpay/trunk/inc/class-qhpay-admin-page.php
r2843203 r2915735 262 262 </td> 263 263 </tr> 264 <!-- 264 265 <tr> 265 266 <th scope="row"><?php echo __('Webhook', 'qh-testpay') ?></th> … … 267 268 <input type="text" name="settings[webhook]" id="webhook" value="<?php echo isset($settings['webhook'])? $settings['webhook']:'' ?>"/> 268 269 </td> 269 </tr> 270 </tr> --> 271 <tr> 272 <th scope="row"><?php echo __('Telegram Bot Token', 'qh-testpay') ?></th> 273 <td> 274 <input type="text" name="settings[telegram_token]" id="telegram_token" value="<?php echo isset($settings['telegram_token'])? $settings['telegram_token']:'' ?>"/> 275 </td> 276 </tr> 277 <tr> 278 <th scope="row"><?php echo __('Telegram Group ID', 'qh-testpay') ?></th> 279 <td> 280 <input type="text" name="settings[telegram_chatid]" id="telegram_chatid" value="<?php echo isset($settings['telegram_chatid'])? $settings['telegram_chatid']:'' ?>"/> 281 </td> 282 </tr> 283 270 284 <tr> 271 285 <th scope="row"><?php echo __('Auto check user paid', 'qh-testpay') ?></th> -
qh-testpay/trunk/inc/functions.php
r2896947 r2915735 71 71 return $headers; 72 72 } 73 74 function qhp_parse_order_id($des, $prefix, $insensitive){ 73 function qhp_parse_code($des, $prefix, $insensitive){ 75 74 //TODO : Rewrite this function. 76 75 //phân biệt … … 87 86 // Print the entire match result 88 87 $orderCode = $matches[0][0]; 89 88 return $orderCode; 89 } 90 function qhp_parse_order_id($des, $prefix, $insensitive){ 91 $orderCode = qhp_parse_code($des, $prefix, $insensitive); 90 92 $prefixLength = strlen($prefix); 91 93 … … 140 142 if($phone && $price){ 141 143 if($app=='momo') { 142 $text = sprintf("2|99|%s|||0|0|%d |%s|transfer_myqr", $phone, $price,$content);144 $text = sprintf("2|99|%s|||0|0|%d", $phone, $price); 143 145 $img = QHTP_DIR.'/assets/momo.png'; 144 146 QRcode::png($text, false, QR_ECLEVEL_Q, 10); -
qh-testpay/trunk/qh-testpay.php
r2843203 r2915735 18 18 define('QHTP_DIR', plugin_dir_path(__FILE__)); 19 19 define('QHTP_URL', plugins_url('/', __FILE__)); 20 define('QHTP_TEST', 0);20 define('QHTP_TEST', false); 21 21 //require(__DIR__."/lib/phpqrcode/qrlib.php"); 22 22 require(__DIR__."/inc/functions.php"); … … 536 536 } 537 537 $result = ['msg'=>[],'error'=>1,'rawInput'=> $txtBody]; 538 $bankMsg = ""; 539 $domain = parse_url(home_url(),PHP_URL_HOST); 538 540 539 541 if(!empty($jsonBody->data)) … … 551 553 } 552 554 } 555 //message for telegram 556 $bankMsg = sprintf("QHTP Thông báo giao dịch:\nTrang web: %s\nSố tiền: %s\nMã: %s\nTin nhắn: %s", 557 $domain, 558 number_format($transaction->amount), 559 qhp_parse_code($des,$this->settings['bank_transfer']['transaction_prefix'], $this->settings['bank_transfer']['case_insensitive']), 560 $transaction->description//$transaction->when 561 ); 553 562 $order_id = qhp_parse_order_id($des, $this->settings['bank_transfer']['transaction_prefix'], $this->settings['bank_transfer']['case_insensitive']); 554 563 if (is_null($order_id)) { … … 616 625 if(empty($result['error'])) break; 617 626 } 627 //telegram bot 628 if(!empty($this->settings['telegram_token']) && !empty($this->settings['telegram_chatid'])) { 629 $token = trim($this->settings['telegram_token']); 630 $chatid = trim($this->settings['telegram_chatid']); 631 $text = substr($bankMsg,0,4000);//$jsonBody->data? json_encode($jsonBody->data):'[]'; 632 if(substr( $token, 0, 3 ) != "bot") $token='bot'.$token; 633 $response = wp_remote_get( "https://api.telegram.org/{$token}/sendMessage?chat_id={$chatid}&text=".urlencode($text), array( 634 'timeout' => 120, 635 'httpversion' => '1.1', 636 'headers' => array( 637 ) 638 )); 639 #$result['msg'][] = wp_remote_retrieve_body( $response ); 640 } 618 641 //other webhook 619 642 if(!empty($this->settings['webhook']) && filter_var($this->settings['webhook'], FILTER_VALIDATE_URL)) {
Note: See TracChangeset
for help on using the changeset viewer.