diff --git a/app/Loader.php b/app/Loader.php index 05aa74c..18d3f23 100644 --- a/app/Loader.php +++ b/app/Loader.php @@ -26,6 +26,7 @@ public function __construct() ); Hook::addAction('payment_finished_ninjaforms', [$this, 'paymentFinished']); + Hook::addFilter('edit_config_data_ninjaforms', [$this, 'disableReminderEmail']); Hook::addFilter('payment_redirect_urls_ninjaforms', [$this, 'paymentRedirectUrls']); add_filter('ninja_forms_register_fields', [$this, 'registerFields']); @@ -33,6 +34,15 @@ public function __construct() //add_filter('ninja_forms_register_payment_gateways', [$this, 'registerGateways']); } + /** + * @param object $data + * @return object + */ + public function disableReminderEmail(object $data): object + { + return $data->disableReminderEmail(); + } + /** * @param object $data * @return void diff --git a/assets/js/main.js b/assets/js/main.js index 5cea844..379f1a1 100644 --- a/assets/js/main.js +++ b/assets/js/main.js @@ -7,7 +7,6 @@ } = ninja_forms_field_cryptopay; const helpers = window.cpHelpers || window.cplHelpers const app = window.CryptoPayApp || window.CryptoPayLiteApp - const modal = window.CryptoPayModal || window.CryptoPayLiteModal const order = {} const params = {} @@ -29,7 +28,7 @@ } app.events.add('confirmationCompleted', async ({transaction}) => { - modal.close(); + app.modal.close(); notPaidYet = false; helpers.closePopup(); await helpers.sleep(100); @@ -72,6 +71,7 @@ const form = getFormById(params.formId); order.amount = parseFloat(model.attributes.value); order.currency = form.get('settings').currency; + order.currency = order.currency ? order.currency : 'USD'; if (startedApp) { startedApp.reStart(order, params); @@ -81,7 +81,7 @@ }, maybeSubmit: function(event) { if (notPaidYet && this.checkError(event)) { - modal.open(); + app.modal.open(); return false; } return true; diff --git a/composer.json b/composer.json index 52daa6e..72678c3 100644 --- a/composer.json +++ b/composer.json @@ -10,6 +10,6 @@ } }, "require": { - "beycanpress/cryptopay-integrator": "^0.1.11" + "beycanpress/cryptopay-integrator": "^0.1.13" } } diff --git a/composer.lock b/composer.lock index fa80051..abf526f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,20 +4,20 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "77536fbde0f65dd1f19f2539c97b5117", + "content-hash": "45794a4a0965ae35de009e1a0f9df7ea", "packages": [ { "name": "beycanpress/cryptopay-integrator", - "version": "0.1.11", + "version": "0.1.13", "source": { "type": "git", "url": "https://github.com/BeycanPress/cryptopay-integrator.git", - "reference": "cd50c21a0daf9bbcc5b86a292d620b74b47aa73e" + "reference": "b981bcc7cf021d653acd938d817b51f1cbb27d4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/BeycanPress/cryptopay-integrator/zipball/cd50c21a0daf9bbcc5b86a292d620b74b47aa73e", - "reference": "cd50c21a0daf9bbcc5b86a292d620b74b47aa73e", + "url": "https://api.github.com/repos/BeycanPress/cryptopay-integrator/zipball/b981bcc7cf021d653acd938d817b51f1cbb27d4f", + "reference": "b981bcc7cf021d653acd938d817b51f1cbb27d4f", "shasum": "" }, "require": { @@ -37,9 +37,9 @@ "homepage": "https://github.com/BeycanPress/cryptopay-integrator", "support": { "issues": "https://github.com/BeycanPress/cryptopay-integrator/issues", - "source": "https://github.com/BeycanPress/cryptopay-integrator/tree/0.1.11" + "source": "https://github.com/BeycanPress/cryptopay-integrator/tree/0.1.13" }, - "time": "2024-04-04T08:02:22+00:00" + "time": "2024-07-20T03:27:42+00:00" } ], "packages-dev": [], diff --git a/cryptopay-gateway-for-ninjaforms.php b/cryptopay-gateway-for-ninjaforms.php index 9643f3f..b81409f 100644 --- a/cryptopay-gateway-for-ninjaforms.php +++ b/cryptopay-gateway-for-ninjaforms.php @@ -19,9 +19,9 @@ * License: GPLv3 * License URI: https://www.gnu.org/licenses/gpl-3.0.html * Text Domain: ninjaforms-cryptopay - * Tags: Cryptopay, Cryptocurrency, WooCommerce, WordPress, MetaMask, Trust, Binance, Wallet, Ethereum, Bitcoin, Binance smart chain, Payment, Plugin, Gateway, Moralis, Converter, API, coin market cap, CMC + * Tags: Bitcoin, Ethereum, Crypto, Payment, Ninja Forms * Requires at least: 5.0 - * Tested up to: 6.5.0 + * Tested up to: 6.6 * Requires PHP: 8.1 */ @@ -37,15 +37,27 @@ use BeycanPress\CryptoPay\Integrator\Helpers; -Helpers::registerModel(BeycanPress\CryptoPay\NinjaForms\Models\TransactionsPro::class); -Helpers::registerLiteModel(BeycanPress\CryptoPay\NinjaForms\Models\TransactionsLite::class); +/** + * @return void + */ +function nfCryptoPayRegisterModels(): void +{ + Helpers::registerModel(BeycanPress\CryptoPay\NinjaForms\Models\TransactionsPro::class); + Helpers::registerLiteModel(BeycanPress\CryptoPay\NinjaForms\Models\TransactionsLite::class); +} + +nfCryptoPayRegisterModels(); load_plugin_textdomain('ninjaforms-cryptopay', false, basename(__DIR__) . '/languages'); -if (!class_exists('Ninja_Forms')) { - Helpers::requirePluginMessage('Ninja Forms', 'https://wordpress.org/plugins/ninja-forms/'); -} elseif (Helpers::bothExists()) { - new BeycanPress\CryptoPay\NinjaForms\Loader(); -} else { - Helpers::requireCryptoPayMessage('Ninja Forms'); -} +add_action('plugins_loaded', function (): void { + nfCryptoPayRegisterModels(); + + if (!class_exists('Ninja_Forms')) { + Helpers::requirePluginMessage('Ninja Forms', 'https://wordpress.org/plugins/ninja-forms/'); + } elseif (Helpers::bothExists()) { + new BeycanPress\CryptoPay\NinjaForms\Loader(); + } else { + Helpers::requireCryptoPayMessage('Ninja Forms'); + } +}); diff --git a/readme.txt b/readme.txt index 7c1e272..bfb8ad4 100644 --- a/readme.txt +++ b/readme.txt @@ -2,7 +2,7 @@ Contributors: BeycanPress Tags: Bitcoin, Ethereum, Crypto, Payment, Ninja Forms Requires at least: 5.0 -Tested up to: 6.5.0 +Tested up to: 6.6 Requires PHP: 8.1 Stable Tag: 1.0.0 Version: 1.0.0 diff --git a/vendor/beycanpress/cryptopay-integrator/composer.json b/vendor/beycanpress/cryptopay-integrator/composer.json index 4ce87a9..e1b7496 100644 --- a/vendor/beycanpress/cryptopay-integrator/composer.json +++ b/vendor/beycanpress/cryptopay-integrator/composer.json @@ -1,6 +1,6 @@ { "name": "beycanpress/cryptopay-integrator", - "version": "0.1.11", + "version": "0.1.13", "description": "CryptoPay and CryptoPay Lite integration wrapper", "type": "library", "license": "MIT", diff --git a/vendor/beycanpress/cryptopay-integrator/src/Helpers.php b/vendor/beycanpress/cryptopay-integrator/src/Helpers.php index 3d6c7e3..16c2e30 100644 --- a/vendor/beycanpress/cryptopay-integrator/src/Helpers.php +++ b/vendor/beycanpress/cryptopay-integrator/src/Helpers.php @@ -37,7 +37,7 @@ public static function bothExists(): bool */ public static function liteExists(): bool { - return class_exists(LiteLoader::class); + return defined('CRYPTOPAY_LITE_LOADED'); } /** @@ -45,7 +45,7 @@ public static function liteExists(): bool */ public static function exists(): bool { - return class_exists(Loader::class); + return defined('CRYPTOPAY_LOADED'); } /** diff --git a/vendor/beycanpress/cryptopay-integrator/src/Session.php b/vendor/beycanpress/cryptopay-integrator/src/Session.php index 78e7802..417a410 100644 --- a/vendor/beycanpress/cryptopay-integrator/src/Session.php +++ b/vendor/beycanpress/cryptopay-integrator/src/Session.php @@ -11,7 +11,7 @@ class Session */ public static function start(): void { - if (PHP_SESSION_NONE === session_status()) { + if (PHP_SESSION_NONE === session_status() && !headers_sent()) { session_start(); } } diff --git a/vendor/composer/installed.json b/vendor/composer/installed.json index ad2b774..60cd66d 100644 --- a/vendor/composer/installed.json +++ b/vendor/composer/installed.json @@ -2,23 +2,23 @@ "packages": [ { "name": "beycanpress/cryptopay-integrator", - "version": "0.1.11", - "version_normalized": "0.1.11.0", + "version": "0.1.13", + "version_normalized": "0.1.13.0", "source": { "type": "git", "url": "https://github.com/BeycanPress/cryptopay-integrator.git", - "reference": "cd50c21a0daf9bbcc5b86a292d620b74b47aa73e" + "reference": "b981bcc7cf021d653acd938d817b51f1cbb27d4f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/BeycanPress/cryptopay-integrator/zipball/cd50c21a0daf9bbcc5b86a292d620b74b47aa73e", - "reference": "cd50c21a0daf9bbcc5b86a292d620b74b47aa73e", + "url": "https://api.github.com/repos/BeycanPress/cryptopay-integrator/zipball/b981bcc7cf021d653acd938d817b51f1cbb27d4f", + "reference": "b981bcc7cf021d653acd938d817b51f1cbb27d4f", "shasum": "" }, "require": { "php": ">=8.1" }, - "time": "2024-04-04T08:02:22+00:00", + "time": "2024-07-20T03:27:42+00:00", "type": "library", "installation-source": "dist", "autoload": { @@ -34,7 +34,7 @@ "homepage": "https://github.com/BeycanPress/cryptopay-integrator", "support": { "issues": "https://github.com/BeycanPress/cryptopay-integrator/issues", - "source": "https://github.com/BeycanPress/cryptopay-integrator/tree/0.1.11" + "source": "https://github.com/BeycanPress/cryptopay-integrator/tree/0.1.13" }, "install-path": "../beycanpress/cryptopay-integrator" } diff --git a/vendor/composer/installed.php b/vendor/composer/installed.php index 2375f12..3e9ccb3 100644 --- a/vendor/composer/installed.php +++ b/vendor/composer/installed.php @@ -3,7 +3,7 @@ 'name' => '__root__', 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'ee2fdbf804459b38a9a9b499fc85ce37a1b5ff83', + 'reference' => 'e830d222e6a0a895df27d78e134a2192befa8de3', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), @@ -13,16 +13,16 @@ '__root__' => array( 'pretty_version' => 'dev-master', 'version' => 'dev-master', - 'reference' => 'ee2fdbf804459b38a9a9b499fc85ce37a1b5ff83', + 'reference' => 'e830d222e6a0a895df27d78e134a2192befa8de3', 'type' => 'library', 'install_path' => __DIR__ . '/../../', 'aliases' => array(), 'dev_requirement' => false, ), 'beycanpress/cryptopay-integrator' => array( - 'pretty_version' => '0.1.11', - 'version' => '0.1.11.0', - 'reference' => 'cd50c21a0daf9bbcc5b86a292d620b74b47aa73e', + 'pretty_version' => '0.1.13', + 'version' => '0.1.13.0', + 'reference' => 'b981bcc7cf021d653acd938d817b51f1cbb27d4f', 'type' => 'library', 'install_path' => __DIR__ . '/../beycanpress/cryptopay-integrator', 'aliases' => array(),