Changeset 3486371
- Timestamp:
- 03/19/2026 10:46:12 AM (2 weeks ago)
- Location:
- coinsnap-for-contact-form-7
- Files:
-
- 63 added
- 4 edited
-
tags/1.5.2 (added)
-
tags/1.5.2/assets (added)
-
tags/1.5.2/assets/css (added)
-
tags/1.5.2/assets/css/coinsnapcf7-backend-style.css (added)
-
tags/1.5.2/assets/css/index.php (added)
-
tags/1.5.2/assets/index.php (added)
-
tags/1.5.2/assets/js (added)
-
tags/1.5.2/assets/js/adminFields.js (added)
-
tags/1.5.2/assets/js/connectionCheck.js (added)
-
tags/1.5.2/assets/js/index.php (added)
-
tags/1.5.2/coinsnap-for-contact-form-7.php (added)
-
tags/1.5.2/coinsnapcf7-class.php (added)
-
tags/1.5.2/index.php (added)
-
tags/1.5.2/languages (added)
-
tags/1.5.2/languages/index.php (added)
-
tags/1.5.2/library (added)
-
tags/1.5.2/library/Client (added)
-
tags/1.5.2/library/Client/AbstractClient.php (added)
-
tags/1.5.2/library/Client/BTCPayApiAuthorization.php (added)
-
tags/1.5.2/library/Client/BTCPayApiKey.php (added)
-
tags/1.5.2/library/Client/Invoice.php (added)
-
tags/1.5.2/library/Client/InvoiceCheckoutOptions.php (added)
-
tags/1.5.2/library/Client/Server.php (added)
-
tags/1.5.2/library/Client/Store.php (added)
-
tags/1.5.2/library/Client/User.php (added)
-
tags/1.5.2/library/Client/Webhook.php (added)
-
tags/1.5.2/library/Client/index.php (added)
-
tags/1.5.2/library/Exception (added)
-
tags/1.5.2/library/Exception/BadRequestException.php (added)
-
tags/1.5.2/library/Exception/CSException.php (added)
-
tags/1.5.2/library/Exception/ConnectException.php (added)
-
tags/1.5.2/library/Exception/ForbiddenException.php (added)
-
tags/1.5.2/library/Exception/RequestException.php (added)
-
tags/1.5.2/library/Exception/index.php (added)
-
tags/1.5.2/library/Http (added)
-
tags/1.5.2/library/Http/ClientInterface.php (added)
-
tags/1.5.2/library/Http/Response.php (added)
-
tags/1.5.2/library/Http/ResponseInterface.php (added)
-
tags/1.5.2/library/Http/WPRemoteClient.php (added)
-
tags/1.5.2/library/Http/index.php (added)
-
tags/1.5.2/library/Result (added)
-
tags/1.5.2/library/Result/AbstractResult.php (added)
-
tags/1.5.2/library/Result/ApiKey.php (added)
-
tags/1.5.2/library/Result/Invoice.php (added)
-
tags/1.5.2/library/Result/InvoiceCheckoutHTML.php (added)
-
tags/1.5.2/library/Result/InvoiceList.php (added)
-
tags/1.5.2/library/Result/InvoicePayment.php (added)
-
tags/1.5.2/library/Result/InvoicePaymentMethod.php (added)
-
tags/1.5.2/library/Result/ServerInfo.php (added)
-
tags/1.5.2/library/Result/Store.php (added)
-
tags/1.5.2/library/Result/User.php (added)
-
tags/1.5.2/library/Result/Webhook.php (added)
-
tags/1.5.2/library/Result/WebhookAuthorizedEvents.php (added)
-
tags/1.5.2/library/Result/WebhookCreated.php (added)
-
tags/1.5.2/library/Result/index.php (added)
-
tags/1.5.2/library/Util (added)
-
tags/1.5.2/library/Util/Notice.php (added)
-
tags/1.5.2/library/Util/PreciseNumber.php (added)
-
tags/1.5.2/library/Util/index.php (added)
-
tags/1.5.2/library/index.php (added)
-
tags/1.5.2/library/loader.php (added)
-
tags/1.5.2/license.txt (added)
-
tags/1.5.2/readme.txt (added)
-
trunk/coinsnap-for-contact-form-7.php (modified) (2 diffs)
-
trunk/coinsnapcf7-class.php (modified) (5 diffs)
-
trunk/library/Client/Invoice.php (modified) (2 diffs)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
coinsnap-for-contact-form-7/trunk/coinsnap-for-contact-form-7.php
r3485383 r3486371 4 4 * Plugin URI: https://coinsnap.io/wp-add-ons/contact-form-7/ 5 5 * Description: With this Bitcoin payment plugin for Contact Form 7 you can now offer products, downloads, bookings or get donations in Bitcoin right in your forms! 6 * Version: 1.5. 16 * Version: 1.5.2 7 7 * Author: Coinsnap 8 8 * Author URI: https://coinsnap.io/ … … 23 23 24 24 if(!defined('COINSNAPCF7_REFERRAL_CODE' )){define( 'COINSNAPCF7_REFERRAL_CODE', 'D19827' );} 25 if(!defined('COINSNAPCF7_VERSION' )){define( 'COINSNAPCF7_VERSION', '1.5. 1' );}25 if(!defined('COINSNAPCF7_VERSION' )){define( 'COINSNAPCF7_VERSION', '1.5.2' );} 26 26 if(!defined('COINSNAP_SERVER_URL')){define( 'COINSNAP_SERVER_URL', 'https://app.coinsnap.io' );} 27 27 if(!defined('COINSNAP_API_PATH')){define( 'COINSNAP_API_PATH', '/api/v1/');} -
coinsnap-for-contact-form-7/trunk/coinsnapcf7-class.php
r3485383 r3486371 790 790 '_date' => date_i18n(get_option('date_format')), 791 791 '_time' => date_i18n(get_option('time_format')), 792 '_remote_ip' => sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'])) ??'',793 '_user_agent' => sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'])) ??'',792 '_remote_ip' => (isset($_SERVER['REMOTE_ADDR']))? sanitize_text_field(wp_unslash($_SERVER['REMOTE_ADDR'])) : '', 793 '_user_agent' => (isset($_SERVER['HTTP_USER_AGENT']))? sanitize_text_field(wp_unslash($_SERVER['HTTP_USER_AGENT'])) : '', 794 794 '_url' => wp_unslash($submission->get_meta('url')), 795 '_referer' => sanitize_text_field(wp_unslash($_SERVER['HTTP_REFERER'])) ??''795 '_referer' => (isset($_SERVER['HTTP_REFERER']))? sanitize_text_field(wp_unslash($_SERVER['HTTP_REFERER'])) : '' 796 796 ]; 797 797 … … 947 947 if ( filter_input(INPUT_GET,'cf7-listener',FILTER_SANITIZE_FULL_SPECIAL_CHARS) === null || filter_input(INPUT_GET,'cf7-listener',FILTER_SANITIZE_FULL_SPECIAL_CHARS) !== 'coinsnap' ) { return; } 948 948 949 950 951 949 // form_id get parameter check 952 950 $form_id = filter_input(INPUT_GET,'form_id',FILTER_VALIDATE_INT); … … 1001 999 1002 1000 $invoice_id = $postData->invoiceId; 1001 $payload_type = $postData->type; 1003 1002 1004 1003 $client = new \Coinsnap\Client\Invoice( $this->getApiUrl(), $this->getApiKey() ); … … 1021 1020 $paymentFirst = get_post_meta( $form_id, "_cf7_coinsnap_paymentfirst", true ); 1022 1021 1023 if($paymentFirst > 0 && $status === 'Settled'){1022 if($paymentFirst > 0 && ($payload_type === 'Settled' || $payload_type === 'InvoiceSettled')){ 1024 1023 1025 1024 $order_data = $wpdb->get_row( $wpdb->prepare( "SELECT * FROM %i WHERE id=%d", $table_name, $order_id ), ARRAY_A ); 1026 1025 1027 $mail_send_result = $this->cf7_mail_send($form_id,$order_data); 1026 $mail_send_result = $this->cf7_mail_send($form_id,$order_data);//cf7_mail_send 1028 1027 $update_array = [ 1029 1028 'message' => $mail_send_result['message'], … … 1046 1045 } 1047 1046 } 1047 /* 1048 public function cf7_emulate_send($form_id,$order_data){ 1049 1050 $contact_form = WPCF7_ContactForm::get_instance($form_id); 1051 1052 // Sent values 1053 $body = json_decode($order_data['field_values'],true); 1054 1055 $_POST = $body; 1056 $_POST['_wpcf7'] = $form_id; 1057 $_POST['_wpcf7_unit_tag'] = 'wpcf7-f'.$form_id.'-p0-o1'; 1058 $_POST['_wpcf7_container_post'] = 0; 1059 1060 $files_array = json_decode($order_data['files'],true); 1061 1062 // attachments 1063 add_filter('wpcf7_mail_components', function($components) use ($files_array){ 1064 1065 $valid = []; 1066 // Sent files 1067 1068 foreach ($files_array as $file) { 1069 if (file_exists($file)) { 1070 $valid[] = $file; 1071 } 1072 } 1073 1074 $components['attachments'] = implode("\n", $valid); 1075 1076 return $components; 1077 }); 1078 1079 // отключаем spam 1080 add_filter('wpcf7_spam', '__return_false'); 1081 1082 // Submission message 1083 $message = 'Submission after payment '. gmdate('Y-m-d H:i:s',time()). 1084 ' --------------------------------------- '. wp_json_encode($contact_form,true). 1085 ' --------------------------------------- '. wp_json_encode($_POST,true); 1086 1087 1088 // отправка как CF7 1089 $result = $contact_form->submit(true); 1090 1091 remove_all_filters('wpcf7_mail_components'); 1092 remove_all_filters('wpcf7_spam'); 1093 1094 $result_array = array('result' => $result,'message' => $message); 1095 1096 return $result_array; 1097 }*/ 1048 1098 1049 1099 public function cf7_mail_send($form_id,$order_data){ -
coinsnap-for-contact-form-7/trunk/library/Client/Invoice.php
r3378565 r3486371 30 30 public function loadExchangeRates(): array { 31 31 $url = 'https://api.coingecko.com/api/v3/exchange_rates'; 32 $headers = []; 32 $headers = [ 33 'Host' => 'api.coingecko.com', 34 'User-Agent' => 'Mozilla/5.0 (Windows NT 10.0; Win64; x64; rv:148.0) Gecko/20100101 Firefox/148.0', 35 'Accept:' => 'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8', 36 'Accept-Language' => 'en-US,en;q=0.9', 37 'Accept-Encoding' => 'gzip, deflate, br, zstd', 38 'Connection' => 'keep-alive', 39 'Priority' => 'u=0, i', 40 ]; 33 41 $method = 'GET'; 34 $response = $this->getHttpClient()->request($method, $url, $headers); 35 36 if ($response->getStatus() === 200) { 37 $body = json_decode($response->getBody(), true, 512, JSON_THROW_ON_ERROR); 38 } 42 $code = 1000; 43 44 while($code > 399){ 45 if($code !== 1000){ sleep(2); } 46 $response = $this->getHttpClient()->request($method, $url, $headers); 47 $code = (int)$response->getStatus(); 48 } 49 50 $body = json_decode($response->getBody(), true, 512, JSON_THROW_ON_ERROR); 51 /* 52 if ((int)$response->getStatus() < 400) {} 39 53 else { 40 return array('result' => false, 'error' => 'ratesLoadingError ');41 } 54 return array('result' => false, 'error' => 'ratesLoadingError ('.(int)$response->getStatus().')'); 55 }*/ 42 56 43 57 if (count($body)<1 || !isset($body['rates'])){ … … 50 64 public function checkPaymentData($amount,$currency,$provider = 'coinsnap',$mode = 'invoice'): array { 51 65 52 $btcPayCurrencies = $this->loadExchangeRates(); 66 if(defined('COINSNAP_CURRENCY_RATES')){ 67 $btcPayCurrencies = COINSNAP_CURRENCY_RATES; 68 } 69 else { 70 $btcPayCurrencies = $this->loadExchangeRates(); 71 define('COINSNAP_CURRENCY_RATES',$btcPayCurrencies); 72 } 53 73 54 74 if(!$btcPayCurrencies['result']){ -
coinsnap-for-contact-form-7/trunk/readme.txt
r3485383 r3486371 3 3 Tags: Coinsnap, Contact Form 7, Bitcoin, Lightning 4 4 Tested up to: 6.9 5 Stable tag: 1.5. 15 Stable tag: 1.5.2 6 6 License: GPLv2 7 7 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 235 235 * Update: added form submission after payment status in payments table 236 236 237 237 = 1.5.2 :: 2026-03-19 = 238 * Updated webhook payload handler. 239 * Updated currency rates handler functionality.
Note: See TracChangeset
for help on using the changeset viewer.