Changeset 2963669
- Timestamp:
- 09/06/2023 01:49:53 PM (3 years ago)
- Location:
- btcpay-greenfield-for-woocommerce
- Files:
-
- 2 added
- 16 edited
- 1 copied
-
tags/2.3.0 (copied) (copied from btcpay-greenfield-for-woocommerce/trunk)
-
tags/2.3.0/btcpay-greenfield-for-woocommerce.php (modified) (3 diffs)
-
tags/2.3.0/changelog.txt (added)
-
tags/2.3.0/readme.txt (modified) (3 diffs)
-
tags/2.3.0/src/Admin/GlobalSettings.php (modified) (2 diffs)
-
tags/2.3.0/src/Gateway/AbstractGateway.php (modified) (4 diffs)
-
tags/2.3.0/src/Helper/GreenfieldApiHelper.php (modified) (1 diff)
-
tags/2.3.0/vendor/autoload.php (modified) (1 diff)
-
tags/2.3.0/vendor/composer/autoload_real.php (modified) (2 diffs)
-
tags/2.3.0/vendor/composer/autoload_static.php (modified) (2 diffs)
-
trunk/btcpay-greenfield-for-woocommerce.php (modified) (3 diffs)
-
trunk/changelog.txt (added)
-
trunk/readme.txt (modified) (3 diffs)
-
trunk/src/Admin/GlobalSettings.php (modified) (2 diffs)
-
trunk/src/Gateway/AbstractGateway.php (modified) (4 diffs)
-
trunk/src/Helper/GreenfieldApiHelper.php (modified) (1 diff)
-
trunk/vendor/autoload.php (modified) (1 diff)
-
trunk/vendor/composer/autoload_real.php (modified) (2 diffs)
-
trunk/vendor/composer/autoload_static.php (modified) (2 diffs)
Legend:
- Unmodified
- Added
- Removed
-
btcpay-greenfield-for-woocommerce/tags/2.3.0/btcpay-greenfield-for-woocommerce.php
r2956798 r2963669 8 8 * Text Domain: btcpay-greenfield-for-woocommerce 9 9 * Domain Path: /languages 10 * Version: 2. 2.310 * Version: 2.3.0 11 11 * Requires PHP: 7.4 12 12 * Tested up to: 6.3 … … 27 27 defined( 'ABSPATH' ) || exit(); 28 28 29 define( 'BTCPAYSERVER_VERSION', '2. 2.3' );29 define( 'BTCPAYSERVER_VERSION', '2.3.0' ); 30 30 define( 'BTCPAYSERVER_VERSION_KEY', 'btcpay_gf_version' ); 31 31 define( 'BTCPAYSERVER_PLUGIN_FILE_PATH', plugin_dir_path( __FILE__ ) ); … … 422 422 add_filter( 'woocommerce_payment_gateways', [ 'BTCPayServerWCPlugin', 'initPaymentGateways' ] ); 423 423 add_action( 'plugins_loaded', 'init_btcpay_greenfield', 0 ); 424 425 // Mark support for HPOS / COT. 426 add_action( 'before_woocommerce_init', function() { 427 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { 428 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); 429 } 430 } ); -
btcpay-greenfield-for-woocommerce/tags/2.3.0/readme.txt
r2956798 r2963669 6 6 Tested up to: 6.3 7 7 Requires PHP: 7.4 8 Stable tag: 2. 2.38 Stable tag: 2.3.0 9 9 License: MIT 10 10 License URI: https://github.com/btcpayserver/woocommerce-greenfield-plugin/blob/master/license.txt … … 105 105 == Changelog == 106 106 107 = 2.3.0 :: 2023-09-06 = 108 * Support for high performance order storage (HPOS) 109 110 Note: This is opt-in but brings performance improvements. Follow instructions [here](https://github.com/woocommerce/woocommerce/wiki/High-Performance-Order-Storage-Upgrade-Recipe-Book#how-to-enable-hpos) if you want to use it. 111 107 112 = 2.2.3 :: 2023-08-22 = 108 113 * Automatically create webhook after redirect. … … 128 133 If you do NOT use refunds. You do NOT need to do anything, your existing API key and setup will continue to work as before. 129 134 130 = 1.1.5 :: 2023-03-08 = 131 * Fix: fix error when plugins override delete_transient function not returning boolean value 132 133 = 1.1.4 :: 2023-01-20 = 134 (redo deployment because of broken build pipe) 135 * Fix: fixed error on thank you page for separate payment methods. 136 * Dev: updating Docker to latest WP and WC versions. 137 * Dev: switch Github action for checkout to v3. 138 139 = 1.1.3 :: 2023-01-20 = 140 * Fix: fixed error on thank you page for separate payment methods. 141 * Dev: updating Docker to latest WP and WC versions. 142 * Dev: switch Github action for checkout to v3. 143 144 = 1.1.2 :: 2022-12-09 = 145 * Fix existing invoice check, wrongly marking invoice invalid on some use cases. 146 * Add check for cURL PHP extension. 147 * Make sure generated gateways exist on filesystem. 148 149 = 1.1.1 :: 2022-09-12 = 150 * Update missing metadata 151 152 = 1.1.0 :: 2022-09-12 = 153 * Feature: Sats-Mode, currency SAT for Satoshis/Sats now available. 154 * Settings, adding more links to docs. 155 156 = 1.0.3 :: 2022-08-17 = 157 * New order state: Payment received after invoice has been expired. 158 * Order metadata restructure, also list multiple payments separated. 159 * Add plugin action links for settings, logs, docs, support. 160 * Show notice when BTCPay Server is not fully synched yet. 161 * Add BTCPay Server info to debug log. 162 * Update Readme with development instructions. 163 * Docker: Update to latest WP and WC versions. 164 * Pin BTCPay Server PHP library stable version. 165 166 = 1.0.2 :: 2022-04-08 = 167 * Fix plugin meta docblock version update, pump version once more. 168 169 = 1.0.1 :: 2022-04-08 = 170 * Fix bug if the custom uploaded payment gateway icon is deleted from filesystem. 171 * Added information about Tor proxy for Umbrel and other self-hosted nodes to BTCPay settings page. 172 173 = 1.0.0 :: 2022-03-27 = 174 * Reflect stability with release 1.0.0. 175 * Create a new invoice (and mark the old invalid) if the user uses browser back button and changes the payment method (relevant for separate payment gateway feature). 176 * Added plugin loader singleton. 177 * Added missing docs link to separate payment gateways feature. 178 * Added checkbox to enable/disable gateway from within gateway settings. 179 * Updated README.md 180 181 = 0.2.5 :: 2022-03-13 = 182 * Load media library and JS only on payment gateway settings page. 183 184 = 0.2.4 :: 2022-03-04 = 185 * Fix possible problem with CamelCased headers on PHP-FPM and/or Nginx. 186 * Do not log hitting the cache on debug log to avoid clutter. 187 188 = 0.2.3 :: 2022-02-28 = 189 * Adding irrelevant GitHub workflow files to .distignore. 190 * Updating installation instructions with new material. 191 192 = 0.2.2 :: 2022-02-28 = 193 * Fix fatal error, make sure is_plugin_active() is available. 194 195 = 0.2.1 :: 2022-02-21 = 196 * Replace SVG by PNG logo to avoid scaling it on themes without proper CSS rules for payment gateway icons. 197 198 = 0.2.0 :: 2022-02-18 = 199 * Fix Cash on delivery, Bank transfer gateways missing after plugin activation. 200 201 = 0.1.10 :: 2022-02-15 = 202 * Make sure custom endpoint works without nice url enabled. 203 * Better description for setting. 204 * Update translation strings. 205 206 = 0.1.9 :: 2022-02-08 = 207 * Make sure custom endpoint works by flushing rewrite rules on plugin activation. 208 * Replacing usage of WC_Admin_Settings::addMessage() with our own. 209 210 = 0.1.1 :: 2022-01-13 = 211 * Admin notice if legacy plugin is installed 212 * Admin notice on missing WooCommerce / PHP version lower 7.4 213 * Minor changes metadata / readme.txt 214 215 = 0.1.0 :: 2022-01-13 = 216 * First public release for testing. 135 Changelog of older releases can be found [here](https://github.com/btcpayserver/woocommerce-greenfield-plugin/blob/master/changelog.txt) -
btcpay-greenfield-for-woocommerce/tags/2.3.0/src/Admin/GlobalSettings.php
r2954869 r2963669 65 65 66 66 // Check setup status and prepare output. 67 $storedApiKey = get_option('btcpay_gf_api_key'); 68 $storedStoreId = get_option('btcpay_gf_store_id'); 69 $storedUrl = get_option('btcpay_gf_url'); 70 67 71 $setupStatus = ''; 68 if ($ this->apiHelper->configured) {72 if ($storedUrl && $storedStoreId && $storedApiKey) { 69 73 $setupStatus = '<p class="btcpay-connection-success">' . _x('BTCPay Server connected.', 'global_settings', 'btcpay-greenfield-for-woocommerce') . '</p>'; 70 74 } else { … … 80 84 } 81 85 82 if ($this->apiHelper->webhookIsSetup()) { 86 // Todo: check why $this->apiHelper->webhookIsSetup() is cached, also others above. 87 if (!empty($webhookConfig['secret'])) { 83 88 $whStatus = '<p class="btcpay-connection-success">' . _x('Webhook setup automatically.', 'global_settings', 'btcpay-greenfield-for-woocommerce') . ' ID: ' . $whId . '</p>'; 84 89 } else { -
btcpay-greenfield-for-woocommerce/tags/2.3.0/src/Gateway/AbstractGateway.php
r2892604 r2963669 112 112 // Check for existing invoice and redirect instead. 113 113 if ( $this->validInvoiceExists( $orderId ) ) { 114 $existingInvoiceId = get_post_meta( $orderId, 'BTCPay_id', true);114 $existingInvoiceId = $order->get_meta( 'BTCPay_id' ); 115 115 Logger::debug( 'Found existing BTCPay Server invoice and redirecting to it. Invoice id: ' . $existingInvoiceId ); 116 116 … … 547 547 protected function validInvoiceExists( int $orderId ): bool { 548 548 // Check order metadata for BTCPay_id. 549 if ( $invoiceId = get_post_meta( $orderId, 'BTCPay_id', true ) ) { 549 $order = wc_get_order($orderId); 550 if ( $invoiceId = $order->get_meta( 'BTCPay_id' ) ) { 550 551 // Validate the order status on BTCPay server. 551 552 $client = new Invoice( $this->apiHelper->url, $this->apiHelper->apiKey ); 552 553 try { 553 554 Logger::debug( 'Trying to fetch existing invoice from BTCPay Server.' ); 554 $invoice = $client->getInvoice( $this->apiHelper->storeId, $invoiceId );555 $invoice = $client->getInvoice( $this->apiHelper->storeId, $invoiceId ); 555 556 $invalidStates = [ 'Expired', 'Invalid' ]; 556 557 if ( in_array( $invoice->getData()['status'], $invalidStates ) ) { … … 614 615 $paymentMethodName = $payment->getPaymentMethod(); 615 616 // Update order meta data with payment methods and transactions. 616 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_total_paid", $payment->getTotalPaid() ?? '' );617 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_total_amount", $payment->getAmount() ?? '' );618 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_total_due", $payment->getDue() ?? '' );619 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_total_fee", $payment->getNetworkFee() ?? '' );620 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_rate", $payment->getRate() ?? '' );617 $order->update_meta_data( "BTCPay_{$paymentMethodName}_total_paid", $payment->getTotalPaid() ?? '' ); 618 $order->update_meta_data( "BTCPay_{$paymentMethodName}_total_amount", $payment->getAmount() ?? '' ); 619 $order->update_meta_data( "BTCPay_{$paymentMethodName}_total_due", $payment->getDue() ?? '' ); 620 $order->update_meta_data( "BTCPay_{$paymentMethodName}_total_fee", $payment->getNetworkFee() ?? '' ); 621 $order->update_meta_data( "BTCPay_{$paymentMethodName}_rate", $payment->getRate() ?? '' ); 621 622 if ((float) $payment->getRate() > 0.0) { 622 623 $formattedRate = number_format((float) $payment->getRate(), wc_get_price_decimals(), wc_get_price_decimal_separator(), wc_get_price_thousand_separator()); 623 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_rateFormatted", $formattedRate );624 $order->update_meta_data( "BTCPay_{$paymentMethodName}_rateFormatted", $formattedRate ); 624 625 } 625 626 626 627 // For each actual payment make a separate entry to make sense of it. 627 628 foreach ($payment->getPayments() as $index => $trx) { 628 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_{$index}_id", $trx->getTransactionId() ?? '' );629 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_{$index}_timestamp", $trx->getReceivedTimestamp() ?? '' );630 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_{$index}_destination", $trx->getDestination() ?? '' );631 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_{$index}_amount", $trx->getValue() ?? '' );632 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_{$index}_status", $trx->getStatus() ?? '' );633 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_{$index}_networkFee", $trx->getFee() ?? '' );629 $order->update_meta_data( "BTCPay_{$paymentMethodName}_{$index}_id", $trx->getTransactionId() ?? '' ); 630 $order->update_meta_data( "BTCPay_{$paymentMethodName}_{$index}_timestamp", $trx->getReceivedTimestamp() ?? '' ); 631 $order->update_meta_data( "BTCPay_{$paymentMethodName}_{$index}_destination", $trx->getDestination() ?? '' ); 632 $order->update_meta_data( "BTCPay_{$paymentMethodName}_{$index}_amount", $trx->getValue() ?? '' ); 633 $order->update_meta_data( "BTCPay_{$paymentMethodName}_{$index}_status", $trx->getStatus() ?? '' ); 634 $order->update_meta_data( "BTCPay_{$paymentMethodName}_{$index}_networkFee", $trx->getFee() ?? '' ); 634 635 } 636 637 // Save the order. 638 $order->save(); 635 639 } 636 640 } … … 767 771 protected function updateOrderMetadata( int $orderId, \BTCPayServer\Result\Invoice $invoice ) { 768 772 // Store relevant BTCPay invoice data. 769 update_post_meta( $orderId, 'BTCPay_redirect', $invoice->getData()['checkoutLink'] ); 770 update_post_meta( $orderId, 'BTCPay_id', $invoice->getData()['id'] ); 773 $order = wc_get_order($orderId); 774 $order->update_meta_data( 'BTCPay_redirect', $invoice->getData()['checkoutLink'] ); 775 $order->update_meta_data( 'BTCPay_id', $invoice->getData()['id'] ); 776 $order->save(); 771 777 } 772 778 -
btcpay-greenfield-for-woocommerce/tags/2.3.0/src/Helper/GreenfieldApiHelper.php
r2956798 r2963669 23 23 public $storeId; 24 24 25 // todo: perf static instance25 // todo: need to refactor as it loads cached options if form submitted by ajax 26 26 public function __construct() { 27 27 if ($config = self::getConfig()) { -
btcpay-greenfield-for-woocommerce/tags/2.3.0/vendor/autoload.php
r2956798 r2963669 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit fd933f855e2b3e9fc705a8e1da981a27::getLoader();25 return ComposerAutoloaderInitd14bfa940f72714486b6878ba7d4cb9e::getLoader(); -
btcpay-greenfield-for-woocommerce/tags/2.3.0/vendor/composer/autoload_real.php
r2956798 r2963669 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit fd933f855e2b3e9fc705a8e1da981a275 class ComposerAutoloaderInitd14bfa940f72714486b6878ba7d4cb9e 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit fd933f855e2b3e9fc705a8e1da981a27', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitd14bfa940f72714486b6878ba7d4cb9e', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit fd933f855e2b3e9fc705a8e1da981a27', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitd14bfa940f72714486b6878ba7d4cb9e', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit fd933f855e2b3e9fc705a8e1da981a27::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInitd14bfa940f72714486b6878ba7d4cb9e::getInitializer($loader)); 33 33 34 34 $loader->register(true); -
btcpay-greenfield-for-woocommerce/tags/2.3.0/vendor/composer/autoload_static.php
r2956798 r2963669 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit fd933f855e2b3e9fc705a8e1da981a277 class ComposerStaticInitd14bfa940f72714486b6878ba7d4cb9e 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 33 33 { 34 34 return \Closure::bind(function () use ($loader) { 35 $loader->prefixLengthsPsr4 = ComposerStaticInit fd933f855e2b3e9fc705a8e1da981a27::$prefixLengthsPsr4;36 $loader->prefixDirsPsr4 = ComposerStaticInit fd933f855e2b3e9fc705a8e1da981a27::$prefixDirsPsr4;37 $loader->classMap = ComposerStaticInit fd933f855e2b3e9fc705a8e1da981a27::$classMap;35 $loader->prefixLengthsPsr4 = ComposerStaticInitd14bfa940f72714486b6878ba7d4cb9e::$prefixLengthsPsr4; 36 $loader->prefixDirsPsr4 = ComposerStaticInitd14bfa940f72714486b6878ba7d4cb9e::$prefixDirsPsr4; 37 $loader->classMap = ComposerStaticInitd14bfa940f72714486b6878ba7d4cb9e::$classMap; 38 38 39 39 }, null, ClassLoader::class); -
btcpay-greenfield-for-woocommerce/trunk/btcpay-greenfield-for-woocommerce.php
r2956798 r2963669 8 8 * Text Domain: btcpay-greenfield-for-woocommerce 9 9 * Domain Path: /languages 10 * Version: 2. 2.310 * Version: 2.3.0 11 11 * Requires PHP: 7.4 12 12 * Tested up to: 6.3 … … 27 27 defined( 'ABSPATH' ) || exit(); 28 28 29 define( 'BTCPAYSERVER_VERSION', '2. 2.3' );29 define( 'BTCPAYSERVER_VERSION', '2.3.0' ); 30 30 define( 'BTCPAYSERVER_VERSION_KEY', 'btcpay_gf_version' ); 31 31 define( 'BTCPAYSERVER_PLUGIN_FILE_PATH', plugin_dir_path( __FILE__ ) ); … … 422 422 add_filter( 'woocommerce_payment_gateways', [ 'BTCPayServerWCPlugin', 'initPaymentGateways' ] ); 423 423 add_action( 'plugins_loaded', 'init_btcpay_greenfield', 0 ); 424 425 // Mark support for HPOS / COT. 426 add_action( 'before_woocommerce_init', function() { 427 if ( class_exists( \Automattic\WooCommerce\Utilities\FeaturesUtil::class ) ) { 428 \Automattic\WooCommerce\Utilities\FeaturesUtil::declare_compatibility( 'custom_order_tables', __FILE__, true ); 429 } 430 } ); -
btcpay-greenfield-for-woocommerce/trunk/readme.txt
r2956798 r2963669 6 6 Tested up to: 6.3 7 7 Requires PHP: 7.4 8 Stable tag: 2. 2.38 Stable tag: 2.3.0 9 9 License: MIT 10 10 License URI: https://github.com/btcpayserver/woocommerce-greenfield-plugin/blob/master/license.txt … … 105 105 == Changelog == 106 106 107 = 2.3.0 :: 2023-09-06 = 108 * Support for high performance order storage (HPOS) 109 110 Note: This is opt-in but brings performance improvements. Follow instructions [here](https://github.com/woocommerce/woocommerce/wiki/High-Performance-Order-Storage-Upgrade-Recipe-Book#how-to-enable-hpos) if you want to use it. 111 107 112 = 2.2.3 :: 2023-08-22 = 108 113 * Automatically create webhook after redirect. … … 128 133 If you do NOT use refunds. You do NOT need to do anything, your existing API key and setup will continue to work as before. 129 134 130 = 1.1.5 :: 2023-03-08 = 131 * Fix: fix error when plugins override delete_transient function not returning boolean value 132 133 = 1.1.4 :: 2023-01-20 = 134 (redo deployment because of broken build pipe) 135 * Fix: fixed error on thank you page for separate payment methods. 136 * Dev: updating Docker to latest WP and WC versions. 137 * Dev: switch Github action for checkout to v3. 138 139 = 1.1.3 :: 2023-01-20 = 140 * Fix: fixed error on thank you page for separate payment methods. 141 * Dev: updating Docker to latest WP and WC versions. 142 * Dev: switch Github action for checkout to v3. 143 144 = 1.1.2 :: 2022-12-09 = 145 * Fix existing invoice check, wrongly marking invoice invalid on some use cases. 146 * Add check for cURL PHP extension. 147 * Make sure generated gateways exist on filesystem. 148 149 = 1.1.1 :: 2022-09-12 = 150 * Update missing metadata 151 152 = 1.1.0 :: 2022-09-12 = 153 * Feature: Sats-Mode, currency SAT for Satoshis/Sats now available. 154 * Settings, adding more links to docs. 155 156 = 1.0.3 :: 2022-08-17 = 157 * New order state: Payment received after invoice has been expired. 158 * Order metadata restructure, also list multiple payments separated. 159 * Add plugin action links for settings, logs, docs, support. 160 * Show notice when BTCPay Server is not fully synched yet. 161 * Add BTCPay Server info to debug log. 162 * Update Readme with development instructions. 163 * Docker: Update to latest WP and WC versions. 164 * Pin BTCPay Server PHP library stable version. 165 166 = 1.0.2 :: 2022-04-08 = 167 * Fix plugin meta docblock version update, pump version once more. 168 169 = 1.0.1 :: 2022-04-08 = 170 * Fix bug if the custom uploaded payment gateway icon is deleted from filesystem. 171 * Added information about Tor proxy for Umbrel and other self-hosted nodes to BTCPay settings page. 172 173 = 1.0.0 :: 2022-03-27 = 174 * Reflect stability with release 1.0.0. 175 * Create a new invoice (and mark the old invalid) if the user uses browser back button and changes the payment method (relevant for separate payment gateway feature). 176 * Added plugin loader singleton. 177 * Added missing docs link to separate payment gateways feature. 178 * Added checkbox to enable/disable gateway from within gateway settings. 179 * Updated README.md 180 181 = 0.2.5 :: 2022-03-13 = 182 * Load media library and JS only on payment gateway settings page. 183 184 = 0.2.4 :: 2022-03-04 = 185 * Fix possible problem with CamelCased headers on PHP-FPM and/or Nginx. 186 * Do not log hitting the cache on debug log to avoid clutter. 187 188 = 0.2.3 :: 2022-02-28 = 189 * Adding irrelevant GitHub workflow files to .distignore. 190 * Updating installation instructions with new material. 191 192 = 0.2.2 :: 2022-02-28 = 193 * Fix fatal error, make sure is_plugin_active() is available. 194 195 = 0.2.1 :: 2022-02-21 = 196 * Replace SVG by PNG logo to avoid scaling it on themes without proper CSS rules for payment gateway icons. 197 198 = 0.2.0 :: 2022-02-18 = 199 * Fix Cash on delivery, Bank transfer gateways missing after plugin activation. 200 201 = 0.1.10 :: 2022-02-15 = 202 * Make sure custom endpoint works without nice url enabled. 203 * Better description for setting. 204 * Update translation strings. 205 206 = 0.1.9 :: 2022-02-08 = 207 * Make sure custom endpoint works by flushing rewrite rules on plugin activation. 208 * Replacing usage of WC_Admin_Settings::addMessage() with our own. 209 210 = 0.1.1 :: 2022-01-13 = 211 * Admin notice if legacy plugin is installed 212 * Admin notice on missing WooCommerce / PHP version lower 7.4 213 * Minor changes metadata / readme.txt 214 215 = 0.1.0 :: 2022-01-13 = 216 * First public release for testing. 135 Changelog of older releases can be found [here](https://github.com/btcpayserver/woocommerce-greenfield-plugin/blob/master/changelog.txt) -
btcpay-greenfield-for-woocommerce/trunk/src/Admin/GlobalSettings.php
r2954869 r2963669 65 65 66 66 // Check setup status and prepare output. 67 $storedApiKey = get_option('btcpay_gf_api_key'); 68 $storedStoreId = get_option('btcpay_gf_store_id'); 69 $storedUrl = get_option('btcpay_gf_url'); 70 67 71 $setupStatus = ''; 68 if ($ this->apiHelper->configured) {72 if ($storedUrl && $storedStoreId && $storedApiKey) { 69 73 $setupStatus = '<p class="btcpay-connection-success">' . _x('BTCPay Server connected.', 'global_settings', 'btcpay-greenfield-for-woocommerce') . '</p>'; 70 74 } else { … … 80 84 } 81 85 82 if ($this->apiHelper->webhookIsSetup()) { 86 // Todo: check why $this->apiHelper->webhookIsSetup() is cached, also others above. 87 if (!empty($webhookConfig['secret'])) { 83 88 $whStatus = '<p class="btcpay-connection-success">' . _x('Webhook setup automatically.', 'global_settings', 'btcpay-greenfield-for-woocommerce') . ' ID: ' . $whId . '</p>'; 84 89 } else { -
btcpay-greenfield-for-woocommerce/trunk/src/Gateway/AbstractGateway.php
r2892604 r2963669 112 112 // Check for existing invoice and redirect instead. 113 113 if ( $this->validInvoiceExists( $orderId ) ) { 114 $existingInvoiceId = get_post_meta( $orderId, 'BTCPay_id', true);114 $existingInvoiceId = $order->get_meta( 'BTCPay_id' ); 115 115 Logger::debug( 'Found existing BTCPay Server invoice and redirecting to it. Invoice id: ' . $existingInvoiceId ); 116 116 … … 547 547 protected function validInvoiceExists( int $orderId ): bool { 548 548 // Check order metadata for BTCPay_id. 549 if ( $invoiceId = get_post_meta( $orderId, 'BTCPay_id', true ) ) { 549 $order = wc_get_order($orderId); 550 if ( $invoiceId = $order->get_meta( 'BTCPay_id' ) ) { 550 551 // Validate the order status on BTCPay server. 551 552 $client = new Invoice( $this->apiHelper->url, $this->apiHelper->apiKey ); 552 553 try { 553 554 Logger::debug( 'Trying to fetch existing invoice from BTCPay Server.' ); 554 $invoice = $client->getInvoice( $this->apiHelper->storeId, $invoiceId );555 $invoice = $client->getInvoice( $this->apiHelper->storeId, $invoiceId ); 555 556 $invalidStates = [ 'Expired', 'Invalid' ]; 556 557 if ( in_array( $invoice->getData()['status'], $invalidStates ) ) { … … 614 615 $paymentMethodName = $payment->getPaymentMethod(); 615 616 // Update order meta data with payment methods and transactions. 616 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_total_paid", $payment->getTotalPaid() ?? '' );617 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_total_amount", $payment->getAmount() ?? '' );618 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_total_due", $payment->getDue() ?? '' );619 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_total_fee", $payment->getNetworkFee() ?? '' );620 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_rate", $payment->getRate() ?? '' );617 $order->update_meta_data( "BTCPay_{$paymentMethodName}_total_paid", $payment->getTotalPaid() ?? '' ); 618 $order->update_meta_data( "BTCPay_{$paymentMethodName}_total_amount", $payment->getAmount() ?? '' ); 619 $order->update_meta_data( "BTCPay_{$paymentMethodName}_total_due", $payment->getDue() ?? '' ); 620 $order->update_meta_data( "BTCPay_{$paymentMethodName}_total_fee", $payment->getNetworkFee() ?? '' ); 621 $order->update_meta_data( "BTCPay_{$paymentMethodName}_rate", $payment->getRate() ?? '' ); 621 622 if ((float) $payment->getRate() > 0.0) { 622 623 $formattedRate = number_format((float) $payment->getRate(), wc_get_price_decimals(), wc_get_price_decimal_separator(), wc_get_price_thousand_separator()); 623 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_rateFormatted", $formattedRate );624 $order->update_meta_data( "BTCPay_{$paymentMethodName}_rateFormatted", $formattedRate ); 624 625 } 625 626 626 627 // For each actual payment make a separate entry to make sense of it. 627 628 foreach ($payment->getPayments() as $index => $trx) { 628 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_{$index}_id", $trx->getTransactionId() ?? '' );629 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_{$index}_timestamp", $trx->getReceivedTimestamp() ?? '' );630 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_{$index}_destination", $trx->getDestination() ?? '' );631 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_{$index}_amount", $trx->getValue() ?? '' );632 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_{$index}_status", $trx->getStatus() ?? '' );633 update_post_meta( $order->get_id(),"BTCPay_{$paymentMethodName}_{$index}_networkFee", $trx->getFee() ?? '' );629 $order->update_meta_data( "BTCPay_{$paymentMethodName}_{$index}_id", $trx->getTransactionId() ?? '' ); 630 $order->update_meta_data( "BTCPay_{$paymentMethodName}_{$index}_timestamp", $trx->getReceivedTimestamp() ?? '' ); 631 $order->update_meta_data( "BTCPay_{$paymentMethodName}_{$index}_destination", $trx->getDestination() ?? '' ); 632 $order->update_meta_data( "BTCPay_{$paymentMethodName}_{$index}_amount", $trx->getValue() ?? '' ); 633 $order->update_meta_data( "BTCPay_{$paymentMethodName}_{$index}_status", $trx->getStatus() ?? '' ); 634 $order->update_meta_data( "BTCPay_{$paymentMethodName}_{$index}_networkFee", $trx->getFee() ?? '' ); 634 635 } 636 637 // Save the order. 638 $order->save(); 635 639 } 636 640 } … … 767 771 protected function updateOrderMetadata( int $orderId, \BTCPayServer\Result\Invoice $invoice ) { 768 772 // Store relevant BTCPay invoice data. 769 update_post_meta( $orderId, 'BTCPay_redirect', $invoice->getData()['checkoutLink'] ); 770 update_post_meta( $orderId, 'BTCPay_id', $invoice->getData()['id'] ); 773 $order = wc_get_order($orderId); 774 $order->update_meta_data( 'BTCPay_redirect', $invoice->getData()['checkoutLink'] ); 775 $order->update_meta_data( 'BTCPay_id', $invoice->getData()['id'] ); 776 $order->save(); 771 777 } 772 778 -
btcpay-greenfield-for-woocommerce/trunk/src/Helper/GreenfieldApiHelper.php
r2956798 r2963669 23 23 public $storeId; 24 24 25 // todo: perf static instance25 // todo: need to refactor as it loads cached options if form submitted by ajax 26 26 public function __construct() { 27 27 if ($config = self::getConfig()) { -
btcpay-greenfield-for-woocommerce/trunk/vendor/autoload.php
r2956798 r2963669 23 23 require_once __DIR__ . '/composer/autoload_real.php'; 24 24 25 return ComposerAutoloaderInit fd933f855e2b3e9fc705a8e1da981a27::getLoader();25 return ComposerAutoloaderInitd14bfa940f72714486b6878ba7d4cb9e::getLoader(); -
btcpay-greenfield-for-woocommerce/trunk/vendor/composer/autoload_real.php
r2956798 r2963669 3 3 // autoload_real.php @generated by Composer 4 4 5 class ComposerAutoloaderInit fd933f855e2b3e9fc705a8e1da981a275 class ComposerAutoloaderInitd14bfa940f72714486b6878ba7d4cb9e 6 6 { 7 7 private static $loader; … … 25 25 require __DIR__ . '/platform_check.php'; 26 26 27 spl_autoload_register(array('ComposerAutoloaderInit fd933f855e2b3e9fc705a8e1da981a27', 'loadClassLoader'), true, true);27 spl_autoload_register(array('ComposerAutoloaderInitd14bfa940f72714486b6878ba7d4cb9e', 'loadClassLoader'), true, true); 28 28 self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__)); 29 spl_autoload_unregister(array('ComposerAutoloaderInit fd933f855e2b3e9fc705a8e1da981a27', 'loadClassLoader'));29 spl_autoload_unregister(array('ComposerAutoloaderInitd14bfa940f72714486b6878ba7d4cb9e', 'loadClassLoader')); 30 30 31 31 require __DIR__ . '/autoload_static.php'; 32 call_user_func(\Composer\Autoload\ComposerStaticInit fd933f855e2b3e9fc705a8e1da981a27::getInitializer($loader));32 call_user_func(\Composer\Autoload\ComposerStaticInitd14bfa940f72714486b6878ba7d4cb9e::getInitializer($loader)); 33 33 34 34 $loader->register(true); -
btcpay-greenfield-for-woocommerce/trunk/vendor/composer/autoload_static.php
r2956798 r2963669 5 5 namespace Composer\Autoload; 6 6 7 class ComposerStaticInit fd933f855e2b3e9fc705a8e1da981a277 class ComposerStaticInitd14bfa940f72714486b6878ba7d4cb9e 8 8 { 9 9 public static $prefixLengthsPsr4 = array ( … … 33 33 { 34 34 return \Closure::bind(function () use ($loader) { 35 $loader->prefixLengthsPsr4 = ComposerStaticInit fd933f855e2b3e9fc705a8e1da981a27::$prefixLengthsPsr4;36 $loader->prefixDirsPsr4 = ComposerStaticInit fd933f855e2b3e9fc705a8e1da981a27::$prefixDirsPsr4;37 $loader->classMap = ComposerStaticInit fd933f855e2b3e9fc705a8e1da981a27::$classMap;35 $loader->prefixLengthsPsr4 = ComposerStaticInitd14bfa940f72714486b6878ba7d4cb9e::$prefixLengthsPsr4; 36 $loader->prefixDirsPsr4 = ComposerStaticInitd14bfa940f72714486b6878ba7d4cb9e::$prefixDirsPsr4; 37 $loader->classMap = ComposerStaticInitd14bfa940f72714486b6878ba7d4cb9e::$classMap; 38 38 39 39 }, null, ClassLoader::class);
Note: See TracChangeset
for help on using the changeset viewer.