From 873f23cc6e2efb851a7feb24da8f415ba65d3488 Mon Sep 17 00:00:00 2001
From: Halil Beycan <50718965+BeycanDeveloper@users.noreply.github.com>
Date: Fri, 22 Mar 2024 20:26:40 +0800
Subject: [PATCH] updated integrator
---
app/Gateways/AbstractGateway.php | 6 ++--
composer.json | 2 +-
composer.lock | 14 ++++----
gravity-forms-cryptopay-gateway.php | 18 ++--------
.../cryptopay-integrator/composer.json | 2 +-
.../cryptopay-integrator/phpcs.xml | 4 +++
.../cryptopay-integrator/src/Helpers.php | 35 +++++++++++++++++++
.../cryptopay-integrator/src/Session.php | 4 ++-
.../cryptopay-integrator/views/message-1.php | 19 ++++++++++
.../cryptopay-integrator/views/message-2.php | 16 +++++++++
.../cryptopay-integrator/views/pay.php | 23 ++++++++++++
vendor/composer/installed.json | 14 ++++----
vendor/composer/installed.php | 10 +++---
13 files changed, 126 insertions(+), 41 deletions(-)
create mode 100644 vendor/beycanpress/cryptopay-integrator/views/message-1.php
create mode 100644 vendor/beycanpress/cryptopay-integrator/views/message-2.php
diff --git a/app/Gateways/AbstractGateway.php b/app/Gateways/AbstractGateway.php
index 86165e3..03d1157 100644
--- a/app/Gateways/AbstractGateway.php
+++ b/app/Gateways/AbstractGateway.php
@@ -176,7 +176,7 @@ public function editor_script(): void
}
if (form.fields.some(field => field.type === 'total')) {
$('#field_' + currentFieldId + ' .ginput_container')?.html(
- 'get_field_works_or_expect_msg(); ?>'
+ 'get_field_works_or_expect_msg()); ?>'
);
}
});
@@ -186,7 +186,7 @@ public function editor_script(): void
}
if (!form.fields.some(field => field.type === 'total')) {
$('#field_' + currentFieldId + ' .ginput_container')?.html(
- 'get_field_works_or_expect_msg(false); ?>'
+ 'get_field_works_or_expect_msg(false)); ?>'
);
}
if (!form.fields.some(field => field.type === 'type); ?>')) {
@@ -225,7 +225,7 @@ public function get_field_input($form, $value = '', $entry = null): string
ob_start();
?>
- get_field_works_or_expect_msg($this->form_hash_total_field($form)); ?>
+ get_field_works_or_expect_msg($this->form_hash_total_field($form))); ?>
-
-
' . esc_html__('clicking here', 'gf-cryptopay') . ''); ?>
-
-
-
-
' . esc_html__('clicking here', 'gf-cryptopay') . ''); ?>
-
-
+
+
+ 0
+
diff --git a/vendor/beycanpress/cryptopay-integrator/src/Helpers.php b/vendor/beycanpress/cryptopay-integrator/src/Helpers.php
index cc937c3..3d6c7e3 100644
--- a/vendor/beycanpress/cryptopay-integrator/src/Helpers.php
+++ b/vendor/beycanpress/cryptopay-integrator/src/Helpers.php
@@ -143,6 +143,30 @@ public static function response(string $method, ...$args): mixed
}
}
+ /**
+ * @param string $currentPlugin
+ * @param string $pluginLink
+ * @param bool $download
+ * @return void
+ */
+ public static function requirePluginMessage(string $currentPlugin, string $pluginLink, bool $download = true): void
+ {
+ add_action('admin_notices', function () use ($currentPlugin, $pluginLink, $download): void {
+ require dirname(__DIR__) . '/views/message-1.php';
+ });
+ }
+
+ /**
+ * @param string $currentPlugin
+ * @return void
+ */
+ public static function requireCryptoPayMessage(string $currentPlugin): void
+ {
+ add_action('admin_notices', function () use ($currentPlugin): void {
+ require dirname(__DIR__) . '/views/message-2.php';
+ });
+ }
+
/**
* @param array $data
* @return string
@@ -181,6 +205,17 @@ public static function createSPP(array $data): string
return home_url("/?cp_spp={$token}");
}
+ /**
+ * @param string $url
+ * @return string|null
+ */
+ public static function getSPPToken(string $url): ?string
+ {
+ /** @var array $matches */
+ preg_match('/[?&]cp_spp=([^&]+)/', $url, $matches);
+ return isset($matches[1]) ? $matches[1] : null;
+ }
+
/**
* @return void
*/
diff --git a/vendor/beycanpress/cryptopay-integrator/src/Session.php b/vendor/beycanpress/cryptopay-integrator/src/Session.php
index b2f3db3..78e7802 100644
--- a/vendor/beycanpress/cryptopay-integrator/src/Session.php
+++ b/vendor/beycanpress/cryptopay-integrator/src/Session.php
@@ -59,7 +59,9 @@ public static function has(string $key): bool
public static function remove(string $key): void
{
self::start();
- unset($_SESSION['cp_integrator'][$key]);
+ if (self::has($key)) {
+ unset($_SESSION['cp_integrator'][$key]);
+ }
}
/**
diff --git a/vendor/beycanpress/cryptopay-integrator/views/message-1.php b/vendor/beycanpress/cryptopay-integrator/views/message-1.php
new file mode 100644
index 0000000..9600d46
--- /dev/null
+++ b/vendor/beycanpress/cryptopay-integrator/views/message-1.php
@@ -0,0 +1,19 @@
+
+
+ ' . esc_html__('clicking here', 'cryptopay') . '',
+ $pluginLink
+ )
+ )
+ ),
+ ['a' => ['href' => [], 'target' => []]]
+ ); ?>
+
+
\ No newline at end of file
diff --git a/vendor/beycanpress/cryptopay-integrator/views/message-2.php b/vendor/beycanpress/cryptopay-integrator/views/message-2.php
new file mode 100644
index 0000000..7f86956
--- /dev/null
+++ b/vendor/beycanpress/cryptopay-integrator/views/message-2.php
@@ -0,0 +1,16 @@
+
+
+
+ ' . esc_html__('clicking here', 'cryptopay') . '',
+ esc_html($currentPlugin)
+ )
+ ),
+ ['a' => ['href' => [], 'target' => []]]
+ ); ?>
+
+
\ No newline at end of file
diff --git a/vendor/beycanpress/cryptopay-integrator/views/pay.php b/vendor/beycanpress/cryptopay-integrator/views/pay.php
index c29c948..ed6d5e8 100644
--- a/vendor/beycanpress/cryptopay-integrator/views/pay.php
+++ b/vendor/beycanpress/cryptopay-integrator/views/pay.php
@@ -49,7 +49,26 @@
border-radius: 5px;
}
+ .go-to-back {
+ text-align: center;
+ margin: 20px 0;
+ }
+
+ .go-to-back a {
+ display: inline-block;
+ padding: 10px 20px;
+ background-color: #007bff;
+ color: #fff;
+ text-decoration: none;
+ border-radius: 5px;
+ }
+
@media screen and (max-width: 768px) {
+ body {
+ padding: 0 20px;
+ text-align: center;
+ }
+
.container {
flex-direction: column;
}
@@ -59,6 +78,7 @@
margin-right: 0;
margin-bottom: 20px;
max-width: 100%;
+ width: 100%;
}
}
@@ -84,6 +104,9 @@
+