From c3dd61d383677d33fba577873fbfb213f265c2d8 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Mon, 16 Sep 2024 12:20:11 +0800 Subject: [PATCH 1/4] added failed reason for verifier --- app/Pages/TransactionPage.php | 2 +- app/Services/Verifier.php | 9 ++++++--- 2 files changed, 7 insertions(+), 4 deletions(-) diff --git a/app/Pages/TransactionPage.php b/app/Pages/TransactionPage.php index 0f721c2..2274904 100644 --- a/app/Pages/TransactionPage.php +++ b/app/Pages/TransactionPage.php @@ -191,7 +191,7 @@ public function page(): void $result .= $tx->params->sanction->source . ' with ' . $tx->params->sanction->api . ' API'; } - if (isset($tx->params->failedReason)) { + if (isset($tx->params->failedReason) && $tx->status == Status::FAILED->getValue()) { $result .= CPL_BR2 . esc_html__('Failed reason: ', 'cryptopay'); $result .= $tx->params->failedReason; } diff --git a/app/Services/Verifier.php b/app/Services/Verifier.php index 0b645a6..8aa1b83 100644 --- a/app/Services/Verifier.php +++ b/app/Services/Verifier.php @@ -144,12 +144,13 @@ public static function verifyPendingTransactions( /** @var TransactionType $transaction */ foreach ($transactions as $transaction) { + $paymentData = new PaymentDataType($model->getAddon()); + try { if ((strtotime(current_time('mysql')) - $transaction->getCreatedAt()->getTimestamp()) < 30) { continue; } - $paymentData = new PaymentDataType($model->getAddon()); $paymentData->setHash($transaction->getHash()); $paymentData->setOrder($transaction->getOrder()); $paymentData->setParams($transaction->getParams()); @@ -180,8 +181,10 @@ public static function verifyPendingTransactions( Hook::callAction('payment_finished', $paymentData); Hook::callAction('payment_finished_' . $model->getAddon(), $paymentData); } catch (\Exception $e) { - Helpers::debug($e->getMessage(), 'ERROR', $e); - $model->updateStatusToFailedByHash($transaction->getHash()); + $paymentData->setStatus(false); + Helpers::debug('Verifier payment finished error', 'ERROR', $e); + $paymentData->getParams()->set('failedReason', $e->getMessage()); + $paymentData->getModel()->updateWithPaymentData($paymentData, $transaction); } } } From b7f0f4332e367d286f41428f920adb35358f8837 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Mon, 16 Sep 2024 13:08:47 +0800 Subject: [PATCH 2/4] fix --- app/PluginHero/Helpers/Debug.php | 1 + 1 file changed, 1 insertion(+) diff --git a/app/PluginHero/Helpers/Debug.php b/app/PluginHero/Helpers/Debug.php index 7fe6a32..30cde1b 100644 --- a/app/PluginHero/Helpers/Debug.php +++ b/app/PluginHero/Helpers/Debug.php @@ -53,6 +53,7 @@ public static function debug(string $message, string $level = 'INFO', array|\Thr $file = self::getProp('pluginDir') . 'debug.log'; if ($wp_filesystem->exists($file)) { + $content = $wp_filesystem->get_contents($file) . $content; $wp_filesystem->put_contents($file, $content, FS_CHMOD_FILE); } else { $wp_filesystem->put_contents($file, $content, FS_CHMOD_FILE); From 6119c6a20727dc752f8d9866ee8f2e78e3743d55 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Mon, 16 Sep 2024 14:36:22 +0800 Subject: [PATCH 3/4] updated --- app/PluginHero/templates/plugins.php | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/app/PluginHero/templates/plugins.php b/app/PluginHero/templates/plugins.php index 05bcc45..3529ab9 100644 --- a/app/PluginHero/templates/plugins.php +++ b/app/PluginHero/templates/plugins.php @@ -13,8 +13,8 @@
  • - - <?php echo esc_attr($product->title) ?> + + <?php echo esc_attr($product->title) ?> title) ?>
  • From e1e147a3195f5cf69756eaa6f880b9064594e0b3 Mon Sep 17 00:00:00 2001 From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com> Date: Tue, 17 Sep 2024 15:17:45 +0800 Subject: [PATCH 4/4] updated api endpoints --- app/Pages/Integrations.php | 4 ++-- app/PluginHero/Helpers/General.php | 6 +----- cryptopay-wc-lite.php | 2 +- readme.txt | 7 +++++-- 4 files changed, 9 insertions(+), 10 deletions(-) diff --git a/app/Pages/Integrations.php b/app/Pages/Integrations.php index efe8c30..f3c0dad 100644 --- a/app/Pages/Integrations.php +++ b/app/Pages/Integrations.php @@ -26,7 +26,7 @@ class Integrations extends Page /** * @var string */ - private string $categories = '?categories=88,167,306,87'; + private string $categories = '?categories=88,167,87'; /** * @var string @@ -103,7 +103,7 @@ public function page(): void update_option('cryptopay_lite_new_product_notification_new_count', 0); $oldProducts = json_decode(get_option('cryptopay_lite_products_json', '{}')); if ($this->count || empty((array) $oldProducts)) { - $res = $this->client->get('get-plugins-by-category' . $this->categories); + $res = $this->client->get('get-cryptopay-plugins'); $pluginsPure = isset($res->success) && $res->success ? $res->data->plugins : []; foreach ($pluginsPure as $key => $pluginPure) { diff --git a/app/PluginHero/Helpers/General.php b/app/PluginHero/Helpers/General.php index ab8269d..4611255 100644 --- a/app/PluginHero/Helpers/General.php +++ b/app/PluginHero/Helpers/General.php @@ -130,11 +130,7 @@ public static function cache(callable $function, string $file, int $time = 600): $content = $function(); - if ($wp_filesystem->exists($file)) { - $wp_filesystem->put_contents($file, $content, FS_CHMOD_FILE); - } else { - $wp_filesystem->put_contents($file, $content, FS_CHMOD_FILE); - } + $wp_filesystem->put_contents($file, $content, FS_CHMOD_FILE); } return (object) compact('file', 'content'); diff --git a/cryptopay-wc-lite.php b/cryptopay-wc-lite.php index 3309b4d..8767608 100644 --- a/cryptopay-wc-lite.php +++ b/cryptopay-wc-lite.php @@ -11,7 +11,7 @@ /** * Plugin Name: CryptoPay Lite - * Version: 2.3.4 + * Version: 2.3.5 * Plugin URI: https://beycanpress.com/cryptopay/ * Description: All In One Cryptocurrency Payments for WordPress * Author: BeycanPress LLC diff --git a/readme.txt b/readme.txt index 0a31b9c..142e6d5 100644 --- a/readme.txt +++ b/readme.txt @@ -4,8 +4,8 @@ Tags: WooCommerce, Cryptocurrency, Payment, Gateway, Bitcoin Requires at least: 5.0 Tested up to: 6.6.2 Requires PHP: 8.1 -Stable Tag: 2.3.4 -Version: 2.3.4 +Stable Tag: 2.3.5 +Version: 2.3.5 License: GPLv3 License URI: https://www.gnu.org/licenses/gpl-3.0.html @@ -137,6 +137,9 @@ Yes, our plugin comes with WooCommerce crypto payment gateway support by default == Changelog == += 2.3.5 = +* Updated: API Endpoints + = 2.3.4 = * Added: Failed reason message for transactions if is failed * Fixed: Not showing "open in explorer" button for mobile devices