Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Alpha #29

Merged
merged 4 commits into from
Sep 17, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions app/Pages/Integrations.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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) {
Expand Down
2 changes: 1 addition & 1 deletion app/Pages/TransactionPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
}
Expand Down
1 change: 1 addition & 0 deletions app/PluginHero/Helpers/Debug.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
6 changes: 1 addition & 5 deletions app/PluginHero/Helpers/General.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down
4 changes: 2 additions & 2 deletions app/PluginHero/templates/plugins.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,8 +13,8 @@
<?php if (isset($plugins)) :
foreach ($plugins as $product) : ?>
<li>
<a href="<?php echo esc_url($product->permalink) ?>" target="_blank">
<img src="<?php echo $product->landingPage ? esc_url($product->landingPage) : esc_url($product->image); ?>" alt="<?php echo esc_attr($product->title) ?>">
<a href="<?php echo isset($product->landing_page) ? esc_url($product->landing_page) : esc_url($product->permalink); ?>" target="_blank">
<img src="<?php echo esc_url($product->image); ?>" alt="<?php echo esc_attr($product->title) ?>">
<span><?php echo esc_html($product->title) ?></span>
</a>
</li>
Expand Down
9 changes: 6 additions & 3 deletions app/Services/Verifier.php
Original file line number Diff line number Diff line change
Expand Up @@ -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());
Expand Down Expand Up @@ -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);
}
}
}
Expand Down
2 changes: 1 addition & 1 deletion cryptopay-wc-lite.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
7 changes: 5 additions & 2 deletions readme.txt
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down Expand Up @@ -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
Expand Down
Loading