Changeset 3431602
- Timestamp:
- 01/03/2026 12:07:06 PM (3 months ago)
- Location:
- depay-payments-for-woocommerce
- Files:
-
- 12 edited
- 1 copied
-
tags/3.0.6 (copied) (copied from depay-payments-for-woocommerce/trunk)
-
tags/3.0.6/changelog.txt (modified) (1 diff)
-
tags/3.0.6/depay-woocommerce-payments.php (modified) (2 diffs)
-
tags/3.0.6/includes/class-depay-wc-payments-gateway.php (modified) (4 diffs)
-
tags/3.0.6/languages/depay-woocommerce-payments.pot (modified) (1 diff)
-
tags/3.0.6/package.json (modified) (1 diff)
-
tags/3.0.6/readme.txt (modified) (2 diffs)
-
trunk/changelog.txt (modified) (1 diff)
-
trunk/depay-woocommerce-payments.php (modified) (2 diffs)
-
trunk/includes/class-depay-wc-payments-gateway.php (modified) (4 diffs)
-
trunk/languages/depay-woocommerce-payments.pot (modified) (1 diff)
-
trunk/package.json (modified) (1 diff)
-
trunk/readme.txt (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
depay-payments-for-woocommerce/tags/3.0.6/changelog.txt
r3389400 r3431602 1 1 *** DePay Web3 Payments for WooCommerce Changelog *** 2 3 2026-1-3 - version 3.0.6 4 * fixes token denomination issue (where no price is available) 2 5 3 6 2025-11-4 - version 3.0.5 -
depay-payments-for-woocommerce/tags/3.0.6/depay-woocommerce-payments.php
r3389400 r3431602 12 12 * Requires at least: 5.8 13 13 * Requires PHP: 7.0 14 * Version: 3.0. 514 * Version: 3.0.6 15 15 * 16 16 * @package DePay\Payments … … 22 22 define( 'DEPAY_WC_ABSPATH', __DIR__ . '/' ); 23 23 define( 'DEPAY_MIN_WC_ADMIN_VERSION', '0.23.2' ); 24 define( 'DEPAY_CURRENT_VERSION', '3.0. 5' );24 define( 'DEPAY_CURRENT_VERSION', '3.0.6' ); 25 25 26 26 require_once DEPAY_WC_ABSPATH . '/vendor/autoload.php'; -
depay-payments-for-woocommerce/tags/3.0.6/includes/class-depay-wc-payments-gateway.php
r3217507 r3431602 136 136 $token_denominated = false; 137 137 $token = null; 138 $total_in_usd = null; 138 139 $api_key = get_option( 'depay_wc_api_key' ); 139 140 if ( empty( $api_key ) ) { … … 176 177 } else if ( is_wp_error($usd_amount) || wp_remote_retrieve_response_code( $usd_amount ) != 200 ) { 177 178 DePay_WC_Payments::log( 'Price request failed!' ); 178 throw new Exception( 'Price request failed!' ); 179 } 180 $total_in_usd = bcmul( $usd_amount['body'], 1, 3 ); 179 // throw new Exception( 'Price request failed!' ); 180 } else { 181 $total_in_usd = bcmul( $usd_amount['body'], 1, 3 ); 182 } 181 183 } else if ( 'USD' == $currency ) { 182 184 $total_in_usd = $total; … … 205 207 } 206 208 207 if ( empty($total_in_usd) ) {209 if ( empty($total_in_usd) && !$token_denominated ) { 208 210 DePay_WC_Payments::log( 'total_in_usd empty!' ); 209 211 throw new Exception( 'total_in_usd empty!' ); … … 218 220 } 219 221 220 foreach ( $accepted_payments as $accepted_payment ) {221 if ( $api_key ) {222 $requests[] = array(223 'url' => sprintf( 'https://api.depay.com/v2/conversions/%s/%s/USD?amount=' . $price_format_specifier, $accepted_payment->blockchain, $accepted_payment->token, $total_in_usd ),224 'type' => 'GET',225 'timeout' => 10,226 'headers' => array(227 'x-api-key' => $api_key228 )229 );230 $requests[] = array(231 'url' => sprintf( 'https://api.depay.com/v2/tokens/decimals/%s/%s', $accepted_payment->blockchain, $accepted_payment->token ),232 'type' => 'GET',233 'headers' => array(234 'x-api-key' => $api_key235 )236 );237 } else {238 $requests[] = array(239 'url' => sprintf( 'https://public.depay.com/conversions/%s/%s/USD?amount=' . $price_format_specifier, $accepted_payment->blockchain, $accepted_payment->token, $total_in_usd ),240 'type' => 'GET',241 'timeout' => 10242 );243 $requests[] = array(244 'url' => sprintf( 'https://public.depay.com/tokens/decimals/%s/%s', $accepted_payment->blockchain, $accepted_payment->token ),245 'type' => 'GET'246 );247 }248 }249 250 $responses = Requests::request_multiple( $requests );251 252 222 $accept = []; 253 254 for ($i = 0; $i < count($responses); $i++) { 255 if ( 0 === $i % 2 ) { // even 0, 2, 4 ... 256 if ( 429 === $responses[$i]->status_code ) { 257 DePay_WC_Payments::log( 'To many requests! Please upgrade to DePay PRO.' ); 258 throw new Exception( 'To many requests! Please upgrade to DePay PRO.' ); 259 } else if ( $responses[$i]->success && $responses[$i+1]->success && !empty( $responses[$i]->body ) && !empty( $responses[$i+1]->body ) ) { 260 $accepted_payment = $accepted_payments[ $i / 2 ]; 261 if ( $token_denominated && $token && $token->blockchain === $accepted_payment->blockchain && $token->address === $accepted_payment->token ) { 262 $amount = $total; 223 $requests = []; 224 225 if ( empty($total_in_usd) && $token_denominated ) { 226 227 $match = null; 228 229 foreach ( $accepted_payments as $accepted_payment ) { 230 if ( 231 $accepted_payment->blockchain === $token->blockchain && 232 $accepted_payment->token === $token->address 233 ) { 234 $match = $accepted_payment; 235 break; 236 } 237 } 238 239 if ( null !== $match ) { 240 array_push($accept, [ 241 'blockchain' => $match->blockchain, 242 'token' => $match->token, 243 'amount' => $total, 244 'receiver' => $match->receiver 245 ]); 246 } 247 248 } else { 249 250 foreach ( $accepted_payments as $accepted_payment ) { 251 if ( $api_key ) { 252 $requests[] = array( 253 'url' => sprintf( 'https://api.depay.com/v2/conversions/%s/%s/USD?amount=' . $price_format_specifier, $accepted_payment->blockchain, $accepted_payment->token, $total_in_usd ), 254 'type' => 'GET', 255 'timeout' => 10, 256 'headers' => array( 257 'x-api-key' => $api_key 258 ) 259 ); 260 $requests[] = array( 261 'url' => sprintf( 'https://api.depay.com/v2/tokens/decimals/%s/%s', $accepted_payment->blockchain, $accepted_payment->token ), 262 'type' => 'GET', 263 'headers' => array( 264 'x-api-key' => $api_key 265 ) 266 ); 267 } else { 268 $requests[] = array( 269 'url' => sprintf( 'https://public.depay.com/conversions/%s/%s/USD?amount=' . $price_format_specifier, $accepted_payment->blockchain, $accepted_payment->token, $total_in_usd ), 270 'type' => 'GET', 271 'timeout' => 10 272 ); 273 $requests[] = array( 274 'url' => sprintf( 'https://public.depay.com/tokens/decimals/%s/%s', $accepted_payment->blockchain, $accepted_payment->token ), 275 'type' => 'GET' 276 ); 277 } 278 } 279 280 $responses = Requests::request_multiple( $requests ); 281 282 for ($i = 0; $i < count($responses); $i++) { 283 if ( 0 === $i % 2 ) { // even 0, 2, 4 ... 284 if ( 429 === $responses[$i]->status_code ) { 285 DePay_WC_Payments::log( 'To many requests! Please upgrade to DePay PRO.' ); 286 throw new Exception( 'To many requests! Please upgrade to DePay PRO.' ); 287 } else if ( $responses[$i]->success && $responses[$i+1]->success && !empty( $responses[$i]->body ) && !empty( $responses[$i+1]->body ) ) { 288 $accepted_payment = $accepted_payments[ $i / 2 ]; 289 if ( $token_denominated && $token && $token->blockchain === $accepted_payment->blockchain && $token->address === $accepted_payment->token ) { 290 $amount = $total; 291 } else { 292 $amount = $this->round_token_amount( $responses[$i]->body ); 293 } 294 if ( !empty( $amount ) && strval( $amount ) !== '0.00' ) { 295 array_push($accept, [ 296 'blockchain' => $accepted_payment->blockchain, 297 'token' => $accepted_payment->token, 298 'amount' => $amount, 299 'receiver' => $accepted_payment->receiver 300 ]); 301 } else { 302 DePay_WC_Payments::log( 'Amount is empty: ' . $requests[$i]['url'] ); 303 } 263 304 } else { 264 $amount = $this->round_token_amount( $responses[$i]->body);305 DePay_WC_Payments::log( 'Accept request failed: ' . $responses[$i]->status_code . ' ' . $requests[$i]['url'] ); 265 306 } 266 if ( !empty( $amount ) && strval( $amount ) !== '0.00' ) {267 array_push($accept, [268 'blockchain' => $accepted_payment->blockchain,269 'token' => $accepted_payment->token,270 'amount' => $amount,271 'receiver' => $accepted_payment->receiver272 ]);273 } else {274 DePay_WC_Payments::log( 'Amount is empty: ' . $requests[$i]['url'] );275 }276 } else {277 DePay_WC_Payments::log( 'Accept request failed: ' . $responses[$i]->status_code . ' ' . $requests[$i]['url'] );278 307 } 279 308 } 280 309 } 281 310 282 311 if ( empty( $accept ) ) { 283 312 DePay_WC_Payments::log( 'No valid payment route found!' ); -
depay-payments-for-woocommerce/tags/3.0.6/languages/depay-woocommerce-payments.pot
r3389400 r3431602 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: DePay WooCommerce Payments 3.0. 5\n"5 "Project-Id-Version: DePay WooCommerce Payments 3.0.6\n" 6 6 "Report-Msgid-Bugs-To: " 7 7 "support@depay.com\n" -
depay-payments-for-woocommerce/tags/3.0.6/package.json
r3389400 r3431602 2 2 "name": "@depay/web3-woocommerce-depay-payments", 3 3 "moduleName": "WooCommerceDePayPayments", 4 "version": "3.0. 5",4 "version": "3.0.6", 5 5 "description": "Accept Web3 Crypto Payments. Supports various tokens, blockchains and wallets. MetaMask, Phantom, USDC, USDT, ETH, SOL, BSC, POL, xDAI…", 6 6 "main": "./dist/umd/index.js", -
depay-payments-for-woocommerce/tags/3.0.6/readme.txt
r3389400 r3431602 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.2 7 Stable tag: 3.0. 57 Stable tag: 3.0.6 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 82 82 == Changelog == 83 83 84 = 2026-1-3 - v3.0.6 = 85 * fixes token denomination issue (where no price is available) 86 84 87 = 2025-11-4 - v3.0.5 = 85 88 * fixes Solana issues -
depay-payments-for-woocommerce/trunk/changelog.txt
r3389400 r3431602 1 1 *** DePay Web3 Payments for WooCommerce Changelog *** 2 3 2026-1-3 - version 3.0.6 4 * fixes token denomination issue (where no price is available) 2 5 3 6 2025-11-4 - version 3.0.5 -
depay-payments-for-woocommerce/trunk/depay-woocommerce-payments.php
r3389400 r3431602 12 12 * Requires at least: 5.8 13 13 * Requires PHP: 7.0 14 * Version: 3.0. 514 * Version: 3.0.6 15 15 * 16 16 * @package DePay\Payments … … 22 22 define( 'DEPAY_WC_ABSPATH', __DIR__ . '/' ); 23 23 define( 'DEPAY_MIN_WC_ADMIN_VERSION', '0.23.2' ); 24 define( 'DEPAY_CURRENT_VERSION', '3.0. 5' );24 define( 'DEPAY_CURRENT_VERSION', '3.0.6' ); 25 25 26 26 require_once DEPAY_WC_ABSPATH . '/vendor/autoload.php'; -
depay-payments-for-woocommerce/trunk/includes/class-depay-wc-payments-gateway.php
r3217507 r3431602 136 136 $token_denominated = false; 137 137 $token = null; 138 $total_in_usd = null; 138 139 $api_key = get_option( 'depay_wc_api_key' ); 139 140 if ( empty( $api_key ) ) { … … 176 177 } else if ( is_wp_error($usd_amount) || wp_remote_retrieve_response_code( $usd_amount ) != 200 ) { 177 178 DePay_WC_Payments::log( 'Price request failed!' ); 178 throw new Exception( 'Price request failed!' ); 179 } 180 $total_in_usd = bcmul( $usd_amount['body'], 1, 3 ); 179 // throw new Exception( 'Price request failed!' ); 180 } else { 181 $total_in_usd = bcmul( $usd_amount['body'], 1, 3 ); 182 } 181 183 } else if ( 'USD' == $currency ) { 182 184 $total_in_usd = $total; … … 205 207 } 206 208 207 if ( empty($total_in_usd) ) {209 if ( empty($total_in_usd) && !$token_denominated ) { 208 210 DePay_WC_Payments::log( 'total_in_usd empty!' ); 209 211 throw new Exception( 'total_in_usd empty!' ); … … 218 220 } 219 221 220 foreach ( $accepted_payments as $accepted_payment ) {221 if ( $api_key ) {222 $requests[] = array(223 'url' => sprintf( 'https://api.depay.com/v2/conversions/%s/%s/USD?amount=' . $price_format_specifier, $accepted_payment->blockchain, $accepted_payment->token, $total_in_usd ),224 'type' => 'GET',225 'timeout' => 10,226 'headers' => array(227 'x-api-key' => $api_key228 )229 );230 $requests[] = array(231 'url' => sprintf( 'https://api.depay.com/v2/tokens/decimals/%s/%s', $accepted_payment->blockchain, $accepted_payment->token ),232 'type' => 'GET',233 'headers' => array(234 'x-api-key' => $api_key235 )236 );237 } else {238 $requests[] = array(239 'url' => sprintf( 'https://public.depay.com/conversions/%s/%s/USD?amount=' . $price_format_specifier, $accepted_payment->blockchain, $accepted_payment->token, $total_in_usd ),240 'type' => 'GET',241 'timeout' => 10242 );243 $requests[] = array(244 'url' => sprintf( 'https://public.depay.com/tokens/decimals/%s/%s', $accepted_payment->blockchain, $accepted_payment->token ),245 'type' => 'GET'246 );247 }248 }249 250 $responses = Requests::request_multiple( $requests );251 252 222 $accept = []; 253 254 for ($i = 0; $i < count($responses); $i++) { 255 if ( 0 === $i % 2 ) { // even 0, 2, 4 ... 256 if ( 429 === $responses[$i]->status_code ) { 257 DePay_WC_Payments::log( 'To many requests! Please upgrade to DePay PRO.' ); 258 throw new Exception( 'To many requests! Please upgrade to DePay PRO.' ); 259 } else if ( $responses[$i]->success && $responses[$i+1]->success && !empty( $responses[$i]->body ) && !empty( $responses[$i+1]->body ) ) { 260 $accepted_payment = $accepted_payments[ $i / 2 ]; 261 if ( $token_denominated && $token && $token->blockchain === $accepted_payment->blockchain && $token->address === $accepted_payment->token ) { 262 $amount = $total; 223 $requests = []; 224 225 if ( empty($total_in_usd) && $token_denominated ) { 226 227 $match = null; 228 229 foreach ( $accepted_payments as $accepted_payment ) { 230 if ( 231 $accepted_payment->blockchain === $token->blockchain && 232 $accepted_payment->token === $token->address 233 ) { 234 $match = $accepted_payment; 235 break; 236 } 237 } 238 239 if ( null !== $match ) { 240 array_push($accept, [ 241 'blockchain' => $match->blockchain, 242 'token' => $match->token, 243 'amount' => $total, 244 'receiver' => $match->receiver 245 ]); 246 } 247 248 } else { 249 250 foreach ( $accepted_payments as $accepted_payment ) { 251 if ( $api_key ) { 252 $requests[] = array( 253 'url' => sprintf( 'https://api.depay.com/v2/conversions/%s/%s/USD?amount=' . $price_format_specifier, $accepted_payment->blockchain, $accepted_payment->token, $total_in_usd ), 254 'type' => 'GET', 255 'timeout' => 10, 256 'headers' => array( 257 'x-api-key' => $api_key 258 ) 259 ); 260 $requests[] = array( 261 'url' => sprintf( 'https://api.depay.com/v2/tokens/decimals/%s/%s', $accepted_payment->blockchain, $accepted_payment->token ), 262 'type' => 'GET', 263 'headers' => array( 264 'x-api-key' => $api_key 265 ) 266 ); 267 } else { 268 $requests[] = array( 269 'url' => sprintf( 'https://public.depay.com/conversions/%s/%s/USD?amount=' . $price_format_specifier, $accepted_payment->blockchain, $accepted_payment->token, $total_in_usd ), 270 'type' => 'GET', 271 'timeout' => 10 272 ); 273 $requests[] = array( 274 'url' => sprintf( 'https://public.depay.com/tokens/decimals/%s/%s', $accepted_payment->blockchain, $accepted_payment->token ), 275 'type' => 'GET' 276 ); 277 } 278 } 279 280 $responses = Requests::request_multiple( $requests ); 281 282 for ($i = 0; $i < count($responses); $i++) { 283 if ( 0 === $i % 2 ) { // even 0, 2, 4 ... 284 if ( 429 === $responses[$i]->status_code ) { 285 DePay_WC_Payments::log( 'To many requests! Please upgrade to DePay PRO.' ); 286 throw new Exception( 'To many requests! Please upgrade to DePay PRO.' ); 287 } else if ( $responses[$i]->success && $responses[$i+1]->success && !empty( $responses[$i]->body ) && !empty( $responses[$i+1]->body ) ) { 288 $accepted_payment = $accepted_payments[ $i / 2 ]; 289 if ( $token_denominated && $token && $token->blockchain === $accepted_payment->blockchain && $token->address === $accepted_payment->token ) { 290 $amount = $total; 291 } else { 292 $amount = $this->round_token_amount( $responses[$i]->body ); 293 } 294 if ( !empty( $amount ) && strval( $amount ) !== '0.00' ) { 295 array_push($accept, [ 296 'blockchain' => $accepted_payment->blockchain, 297 'token' => $accepted_payment->token, 298 'amount' => $amount, 299 'receiver' => $accepted_payment->receiver 300 ]); 301 } else { 302 DePay_WC_Payments::log( 'Amount is empty: ' . $requests[$i]['url'] ); 303 } 263 304 } else { 264 $amount = $this->round_token_amount( $responses[$i]->body);305 DePay_WC_Payments::log( 'Accept request failed: ' . $responses[$i]->status_code . ' ' . $requests[$i]['url'] ); 265 306 } 266 if ( !empty( $amount ) && strval( $amount ) !== '0.00' ) {267 array_push($accept, [268 'blockchain' => $accepted_payment->blockchain,269 'token' => $accepted_payment->token,270 'amount' => $amount,271 'receiver' => $accepted_payment->receiver272 ]);273 } else {274 DePay_WC_Payments::log( 'Amount is empty: ' . $requests[$i]['url'] );275 }276 } else {277 DePay_WC_Payments::log( 'Accept request failed: ' . $responses[$i]->status_code . ' ' . $requests[$i]['url'] );278 307 } 279 308 } 280 309 } 281 310 282 311 if ( empty( $accept ) ) { 283 312 DePay_WC_Payments::log( 'No valid payment route found!' ); -
depay-payments-for-woocommerce/trunk/languages/depay-woocommerce-payments.pot
r3389400 r3431602 3 3 msgid "" 4 4 msgstr "" 5 "Project-Id-Version: DePay WooCommerce Payments 3.0. 5\n"5 "Project-Id-Version: DePay WooCommerce Payments 3.0.6\n" 6 6 "Report-Msgid-Bugs-To: " 7 7 "support@depay.com\n" -
depay-payments-for-woocommerce/trunk/package.json
r3389400 r3431602 2 2 "name": "@depay/web3-woocommerce-depay-payments", 3 3 "moduleName": "WooCommerceDePayPayments", 4 "version": "3.0. 5",4 "version": "3.0.6", 5 5 "description": "Accept Web3 Crypto Payments. Supports various tokens, blockchains and wallets. MetaMask, Phantom, USDC, USDT, ETH, SOL, BSC, POL, xDAI…", 6 6 "main": "./dist/umd/index.js", -
depay-payments-for-woocommerce/trunk/readme.txt
r3389400 r3431602 5 5 Tested up to: 6.8 6 6 Requires PHP: 7.2 7 Stable tag: 3.0. 57 Stable tag: 3.0.6 8 8 License: GPLv2 or later 9 9 License URI: http://www.gnu.org/licenses/gpl-2.0.html … … 82 82 == Changelog == 83 83 84 = 2026-1-3 - v3.0.6 = 85 * fixes token denomination issue (where no price is available) 86 84 87 = 2025-11-4 - v3.0.5 = 85 88 * fixes Solana issues
Note: See TracChangeset
for help on using the changeset viewer.