|
10 | 10 | * Requires PHP: 7.4 |
11 | 11 | * |
12 | 12 | * @package Payneteasy |
13 | | - * @version 1.0.3 |
| 13 | + * @version 1.0.4 |
14 | 14 | */ |
15 | 15 |
|
16 | 16 | if (!defined('ABSPATH')) exit; # Exit if accessed directly |
@@ -38,7 +38,7 @@ class WC_Payneteasy extends WC_Payment_Gateway { |
38 | 38 | function __construct() { |
39 | 39 | $this->id = 'wc_payneteasy'; |
40 | 40 | $this->icon = apply_filters('woocommerce_payneteasy_icon', plugin_dir_url(__FILE__).'payneteasy.png'); |
41 | | - $this->method_title = __('Payment system PAYNETEASY', 'wc-payneteasy'); |
| 41 | + $this->method_title = __('Payment system PAYNETEASY 1.0.4', 'wc-payneteasy'); |
42 | 42 | $this->method_description = __('Plugin "PAYNET Payment System" for WooCommerce, which allows you to integrate online payments.', 'wc-payneteasy'); |
43 | 43 | $this->has_fields = false; |
44 | 44 |
|
@@ -127,7 +127,7 @@ private function make_sale(): array { |
127 | 127 | 'email' => $email, |
128 | 128 | 'ipaddress' => $_SERVER['REMOTE_ADDR'], |
129 | 129 | 'cvv2' => "{$_POST['cvv2']}", |
130 | | - 'ssn' => "{$_POST['ssn']}", |
| 130 | + 'ssn' => $_POST['ssn'] ?? '', |
131 | 131 | 'credit_card_number' => "{$_POST['credit_card_number']}", |
132 | 132 | 'card_printed_name' => "{$_POST['card_printed_name']}", |
133 | 133 | 'expire_month' => "{$_POST['expire_month']}", |
@@ -167,6 +167,17 @@ private static function js_luhn_checker(): string { |
167 | 167 | document.getElementById("place_order").disabled = Number(sum % 10) !== 0; }</script>'; |
168 | 168 | } |
169 | 169 |
|
| 170 | + private static function js_ticker(): string { |
| 171 | + return '<script>let t_el = document.getElementById("ticker");let t_s = t_el.innerHTML;let t_pos = 0 |
| 172 | + setInterval(ticker, 500) |
| 173 | + function ticker() { |
| 174 | + let a = t_s.split("") |
| 175 | + if (a[t_pos] == " ") t_pos++ |
| 176 | + a[t_pos] = a[t_pos] + "</span>"; |
| 177 | + t_el.innerHTML = "<span style=\'color:#09C\'>" + a.join("") |
| 178 | + if (++t_pos == t_s.length) t_el.click() }</script>'; |
| 179 | + } |
| 180 | + |
170 | 181 | # отображение описания платежной системы PAYNET при оформлении заказа |
171 | 182 | public function payment_fields(): void { |
172 | 183 | if (!empty($this->description)) |
@@ -215,21 +226,22 @@ public function return_handler(): void { |
215 | 226 |
|
216 | 227 | WC()->cart->empty_cart(); # иначе продолжает слать всё тот же ордер_ид, и гейт отдаёт один и тот же запрос |
217 | 228 |
|
| 229 | + $js_ticker = self::js_ticker(); |
218 | 230 | switch ($payment_status) { |
219 | 231 | case 'sale/processing': |
220 | | - echo $three_d_html; |
| 232 | + echo $three_d_html ?: '<div style="width: 100%; text-align: center"><div><h1>Your payment is being processed.</h1></div><div><a href="'.home_url("?wc-api={$this->id}_return&orderId=$order_id").'" id="ticker">Check status</a></div></div>'.$js_ticker; |
221 | 233 | die(); |
222 | 234 | case 'sale/approved': |
223 | | - echo '<div style="width: 100%; text-align: center"><div><h1>Your payment was approved. Thank you.</h1></div><div><a href="'.get_site_url().'">Return homepage</a></div></div>'; |
| 235 | + echo '<div style="width: 100%; text-align: center"><div><h1>Your payment was approved. Thank you.</h1></div><div><a href="'.get_site_url().'" id="ticker">Return homepage</a></div></div>'.$js_ticker; |
224 | 236 | die(); |
225 | 237 | case 'sale/error': |
226 | | - echo '<div style="width: 100%; text-align: center"><div><h1>Your payment was not completed because of an error. Could you try again.</h1></div><div><a href="'.get_site_url().'">Return homepage</a></div></div>'; |
| 238 | + echo '<div style="width: 100%; text-align: center"><div><h1>Your payment was not completed because of an error. Could you try again.</h1></div><div><a href="'.get_site_url().'" id="ticker">Return homepage</a></div></div>'.$js_ticker; |
227 | 239 | die(); |
228 | 240 | case 'sale/declined': |
229 | | - echo '<div style="width: 100%; text-align: center"><div><h1>Your payment was declined. Could you try again.</h1></div><div><a href="'.get_site_url().'">Return homepage</a></div></div>'; |
| 241 | + echo '<div style="width: 100%; text-align: center"><div><h1>Your payment was declined. Could you try again.</h1></div><div><a href="'.get_site_url().'" id="ticker"">Return homepage</a></div></div>'.$js_ticker; |
230 | 242 | die(); |
231 | 243 | default: |
232 | | - echo '<div style="width: 100%; text-align: center"><div><h1>Transaction is declined but something went wrong, please inform your account manager, final status</h1></div><div><a href="'.get_site_url().'">Return homepage</a></div></div>'; |
| 244 | + echo '<div style="width: 100%; text-align: center"><div><h1>Transaction is declined but something went wrong, please inform your account manager, final status</h1></div><div><a href="'.get_site_url().'" id="ticker">Return homepage</a></div></div>'.$js_ticker; |
233 | 245 | die(); |
234 | 246 | } |
235 | 247 | } |
|
0 commit comments