PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 1.0.2
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v1.0.2
2.4.1 2.4.0 2.3.4 2.3.3 2.3.2 2.3.1 2.3.0 2.2.2 2.2.1 2.2.0 2.1.2 2.1.1 trunk 0.0.1 0.0.2 0.0.3 0.0.4 0.0.5 0.0.6 0.0.7 1.0.0 1.0.1 1.0.2 1.0.3 1.0.4 All 68 releases
better-payment / includes / Admin / Elementor / Better_Payment_Widget.php

Better_Payment_Widget.php in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More 1.0.2, at includes/Admin/Elementor/Better_Payment_Widget.php

2,648 lines 104.1 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2
3 namespace Better_Payment\Lite\Admin\Elementor;
4
5 use Better_Payment\Lite\Admin\Better_Payment_DB;
6 use Better_Payment\Lite\Classes\Better_Payment_Handler;
7 use Better_Payment\Lite\Traits\Helper;
8 use \Elementor\Controls_Manager as Controls_Manager;
9 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
10 use Elementor\Group_Control_Background;
11 use Elementor\Group_Control_Border;
12 use Elementor\Group_Control_Box_Shadow;
13 use Elementor\Group_Control_Typography;
14 use \Elementor\Repeater;
15 use Elementor\Utils;
16 use \Elementor\Widget_Base as Widget_Base;
17
18 /**
19 * Exit if accessed directly
20 */
21 if (!defined('ABSPATH')) {
22 exit;
23 }
24
25 /**
26 * The elementor widget class
27 *
28 * @since 0.0.1
29 */
30 class Better_Payment_Widget extends Widget_Base {
31
32 use Helper;
33
34 private $better_payment_global_settings = [];
35
36 public function get_name() {
37 return 'better-payment';
38 }
39
40 public function get_title() {
41 return esc_html__( 'Better Payment', 'better-payment' );
42 }
43
44 public function get_icon() {
45 return 'bp-icon bp-logo';
46 }
47
48 public function get_keywords() {
49 return [
50 'payment', 'better-payment' ,'paypal', 'stripe', 'sell', 'donate', 'transaction', 'online-transaction', 'paystack'
51 ];
52 }
53
54 public function get_custom_help_url()
55 {
56 return 'https://wpdeveloper.com/docs-category/better-payment/';
57 }
58
59 public function get_style_depends() {
60 return apply_filters( 'better_payment/elementor/editor/get_style_depends', [ 'better-payment-el', 'bp-icon-front', 'better-payment-style', 'better-payment-common-style', 'better-payment-admin-style' ] );
61 }
62
63 public function get_script_depends() {
64 return apply_filters( 'better_payment/elementor/editor/get_script_depends', [ 'better-payment-common-script', 'better-payment' ] );
65 }
66
67 protected function register_controls() {
68 $this->better_payment_global_settings = Better_Payment_DB::get_settings();
69
70 $this->start_controls_section(
71 'better_payment_form_setting',
72 [
73 'label' => esc_html__( 'Payment Settings', 'better-payment' ),
74 ]
75 );
76
77 do_action('better_payment/elementor/editor/layouts_payment_settings_section', $this);
78
79 $this->add_control(
80 'better_payment_form_layout',
81 [
82 'label' => esc_html__( 'Form Layout', 'better-payment' ),
83 'type' => Controls_Manager::SELECT,
84 'default' => 'layout-1',
85 'options' => [
86 'layout-1' => 'Layout 1',
87 'layout-2' => 'Layout 2',
88 'layout-3' => 'Layout 3',
89 ],
90 ]
91 );
92
93 $this->add_control(
94 'better_payment_form_payment_source',
95 [
96 'label' => esc_html__( 'Payment Source', 'better-payment' ),
97 'type' => Controls_Manager::SELECT,
98 'default' => 'manual',
99 'options' => [
100 'manual' => 'Manual',
101 'woocommerce' => 'WooCommerce',
102 ],
103 ]
104 );
105
106 $this->add_control( 'better_payment_form_payment_source_notice', [
107 'type' => Controls_Manager::RAW_HTML,
108 'raw' => sprintf( __( '<a href="%1$s" target="_blank"><strong>WooCommerce</strong></a> is not installed/activated on your site. Please install and activate <a href="%1$s" target="_blank"><strong>WooCommerce</strong></a> first.', 'better-payment' ), esc_url('plugin-install.php?s=woocommerce&tab=search&type=term') ),
109 'content_classes' => 'eael-warning',
110 'condition' => [
111 'better_payment_form_payment_source' => 'woocommerce' . ( ! class_exists('woocommerce') ? '' : 'exist' ),
112 ],
113 ] );
114
115 $this->add_control(
116 'better_payment_form_woocommerce_product_section',
117 [
118 'label' => __( 'Product', 'better-payment' ),
119 'type' => Controls_Manager::HIDDEN,
120 'condition' => [
121 'better_payment_form_payment_source' => 'woocommerce',
122 ],
123 ]
124 );
125
126 $this->add_control( "better_payment_form_woocommerce_product_id", [
127 'label' => __( 'Choose a Product', 'better-payment' ),
128 'description' => __( 'Enter Product IDs separated by a comma', 'better-payment' ),
129 'type' => 'better-payment-select2',
130 'label_block' => true,
131 'multiple' => false,
132 'source_type' => 'product',
133 'source_name' => 'post_type',
134 'placeholder' => __( 'Search By', 'better-payment' ),
135 'condition' => [
136 'better_payment_form_payment_source' => 'woocommerce',
137 ],
138 'separator' => 'after',
139 'default' => __( '1', 'better-payment' ),
140 'dynamic' => [
141 'active' => false,
142 ],
143 ] );
144
145 $this->add_control(
146 'better_payment_form_paypal_enable',
147 [
148 'label' => __( 'Enable PayPal', 'better-payment' ),
149 'type' => Controls_Manager::SWITCHER,
150 'label_on' => __( 'Yes', 'better-payment' ),
151 'label_off' => __( 'No', 'better-payment' ),
152 'return_value' => 'yes',
153 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_paypal']), //yes or no
154 'separator' => 'before',
155 ]
156 );
157
158 $this->add_control( 'better_payment_form_paypal_enable_notice', [
159 'type' => Controls_Manager::RAW_HTML,
160 'raw' => sprintf( __( 'Whoops! It seems like you haven\'t configured <b>PayPal (Business Email) Settings</b>. Make sure to configure these settings before you publish the form.', 'better-payment' ) ),
161 'content_classes' => 'eael-warning',
162 'condition' => [
163 'better_payment_form_paypal_enable' => 'yes',
164 'better_payment_paypal_business_email' => '',
165 ],
166 ] );
167
168 $this->add_control(
169 'better_payment_form_stripe_enable',
170 [
171 'label' => __( 'Enable Stripe', 'better-payment' ),
172 'type' => Controls_Manager::SWITCHER,
173 'label_on' => __( 'Yes', 'better-payment' ),
174 'label_off' => __( 'No', 'better-payment' ),
175 'return_value' => 'yes',
176 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_stripe']), //yes or no
177 ]
178 );
179
180 $this->add_control( 'better_payment_form_stripe_enable_notice', [
181 'type' => Controls_Manager::RAW_HTML,
182 'raw' => sprintf( __( 'Whoops! It seems like you haven\'t configured <b>Stripe (Public and Secret Key) Settings</b>. Make sure to configure these settings before you publish the form.', 'better-payment' ) ),
183 'content_classes' => 'eael-warning',
184 'conditions' => [
185 'relation' => 'and',
186 'terms' => [
187 [
188 'name' => 'better_payment_form_stripe_enable',
189 'value' => 'yes',
190 ],
191 [
192 'relation' => 'or',
193 'terms' => [
194 [
195 'name' => 'better_payment_stripe_public_key',
196 'value' => '',
197 ],
198 [
199 'name' => 'better_payment_stripe_secret_key',
200 'value' => '',
201 ],
202 ],
203 ],
204 ],
205 ],
206 ] );
207
208 $this->add_control(
209 'better_payment_form_paystack_enable',
210 [
211 'label' => __( 'Enable Paystack', 'better-payment' ),
212 'type' => Controls_Manager::SWITCHER,
213 'label_on' => __( 'Yes', 'better-payment' ),
214 'label_off' => __( 'No', 'better-payment' ),
215 'return_value' => 'yes',
216 'default' => ! empty( $this->better_payment_global_settings['better_payment_settings_general_general_paystack'] ) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_general_paystack']) : 'no', //yes or no
217 ]
218 );
219
220 $this->add_control( 'better_payment_form_paystack_enable_notice', [
221 'type' => Controls_Manager::RAW_HTML,
222 'raw' => sprintf( __( 'Whoops! It seems like you haven\'t configured <b>Paystack (Public and Secret Key) Settings</b>. Make sure to configure these settings before you publish the form.', 'better-payment' ) ),
223 'content_classes' => 'eael-warning',
224 'conditions' => [
225 'relation' => 'and',
226 'terms' => [
227 [
228 'name' => 'better_payment_form_paystack_enable',
229 'value' => 'yes',
230 ],
231 [
232 'relation' => 'or',
233 'terms' => [
234 [
235 'name' => 'better_payment_paystack_public_key',
236 'value' => '',
237 ],
238 [
239 'name' => 'better_payment_paystack_secret_key',
240 'value' => '',
241 ],
242 ],
243 ],
244 ],
245 ],
246 ] );
247
248 $this->add_control(
249 'better_payment_form_email_enable',
250 [
251 'label' => __( 'Enable Email Notification', 'better-payment' ),
252 'type' => Controls_Manager::SWITCHER,
253 'label_on' => __( 'Yes', 'better-payment' ),
254 'label_off' => __( 'No', 'better-payment' ),
255 'return_value' => 'yes',
256 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_email']), //yes or no
257 ]
258 );
259
260 $better_payment_helper = new \Better_Payment\Lite\Classes\Better_Payment_Helper();
261 $better_payment_general_currency = $this->better_payment_global_settings['better_payment_settings_general_general_currency'];
262
263 $better_payment_general_currency_woocommerce = $better_payment_general_currency;
264 if( class_exists('woocommerce') ) {
265 $better_payment_general_currency_woocommerce = get_woocommerce_currency() ? get_woocommerce_currency() : $better_payment_general_currency_woocommerce;
266 }
267
268 $this->add_control(
269 'better_payment_form_currency_use_woocommerce',
270 [
271 'label' => esc_html__( 'Use WooCommerce Currency?', 'better-payment' ),
272 'type' => Controls_Manager::SWITCHER,
273 'label_on' => __( 'Yes', 'better-payment' ),
274 'label_off' => __( 'No', 'better-payment' ),
275 'return_value' => 'yes',
276 'default' => '',
277 'condition' => [
278 'better_payment_form_payment_source' => 'woocommerce',
279 ],
280 ]
281 );
282
283 $this->add_control(
284 'better_payment_form_currency',
285 [
286 'label' => esc_html__( 'Currency', 'better-payment' ),
287 'type' => Controls_Manager::SELECT,
288 'default' => esc_html($better_payment_general_currency), //USD
289 'options' => $better_payment_helper->get_currency_list(),
290 'conditions' => [
291 'relation' => 'or',
292 'terms' => [
293 [
294 'relation' => 'and',
295 'terms' => [
296 [
297 'name' => 'better_payment_form_paypal_enable',
298 'value' => 'yes',
299 ],
300 [
301 'name' => 'better_payment_form_payment_source',
302 'value' => 'manual',
303 ],
304 ],
305 ],
306
307 [
308 'relation' => 'and',
309 'terms' => [
310 [
311 'name' => 'better_payment_form_stripe_enable',
312 'value' => 'yes',
313 ],
314 [
315 'name' => 'better_payment_form_payment_source',
316 'value' => 'manual',
317 ],
318 ],
319 ],
320
321 [
322 'relation' => 'and',
323 'terms' => [
324 [
325 'name' => 'better_payment_form_paystack_enable',
326 'value' => 'yes',
327 ],
328 [
329 'name' => 'better_payment_form_payment_source',
330 'value' => 'manual',
331 ],
332 ],
333 ],
334
335 [
336 'relation' => 'and',
337 'terms' => [
338 [
339 'name' => 'better_payment_form_paypal_enable',
340 'value' => 'yes',
341 ],
342 [
343 'name' => 'better_payment_form_currency_use_woocommerce',
344 'value' => '',
345 ],
346 ],
347 ],
348
349 [
350 'relation' => 'and',
351 'terms' => [
352 [
353 'name' => 'better_payment_form_stripe_enable',
354 'value' => 'yes',
355 ],
356 [
357 'name' => 'better_payment_form_currency_use_woocommerce',
358 'value' => '',
359 ],
360 ],
361 ],
362
363 [
364 'relation' => 'and',
365 'terms' => [
366 [
367 'name' => 'better_payment_form_paystack_enable',
368 'value' => 'yes',
369 ],
370 [
371 'name' => 'better_payment_form_currency_use_woocommerce',
372 'value' => '',
373 ],
374 ],
375 ],
376
377 ],
378 ],
379 ]
380 );
381
382 $this->add_control(
383 'better_payment_form_currency_woocommerce',
384 [
385 'label' => esc_html__( 'WooCommerce Currency', 'better-payment' ),
386 'type' => Controls_Manager::SELECT,
387 'default' => $better_payment_general_currency_woocommerce,
388 'options' => [
389 $better_payment_general_currency_woocommerce => $better_payment_general_currency_woocommerce,
390 ],
391 'condition' => [
392 'better_payment_form_payment_source' => 'woocommerce',
393 'better_payment_form_currency_use_woocommerce' => 'yes',
394
395 ]
396 ]
397 );
398
399 $this->add_control(
400 'better_payment_form_currency_notice',
401 [
402 'type' => Controls_Manager::RAW_HTML,
403 'raw' => sprintf( __( 'Supported by %sStripe%s only', 'better-payment' ), '<strong>', '</strong>' ),
404 'content_classes' => 'eael-warning',
405 'conditions' => [
406 'relation' => 'and',
407 'terms' => [
408 [
409 'name' => 'better_payment_form_paypal_enable',
410 'value' => 'yes',
411 ],
412 [
413 'relation' => 'or',
414 'terms' => [
415 [
416 'name' => 'better_payment_form_currency',
417 'value' => 'AED',
418 ],
419 [
420 'name' => 'better_payment_form_currency',
421 'value' => 'ZAR',
422 ],
423 ],
424 ]
425 ],
426 ]
427 ]
428 );
429
430 $this->add_control(
431 'better_payment_form_currency_alignment',
432 [
433 'label' => esc_html__( 'Currency Alignment', 'better-payment' ),
434 'type' => Controls_Manager::CHOOSE,
435 'options' => [
436 'left' => [
437 'title' => esc_html__( 'Left', 'better-payment' ),
438 'icon' => 'eicon-text-align-left',
439 ],
440 'right' => [
441 'title' => esc_html__( 'Right', 'better-payment' ),
442 'icon' => 'eicon-text-align-right',
443 ],
444 ],
445 ]
446 );
447
448 $this->end_controls_section();
449
450 $this->form_element_settings();
451 $this->paypal_form_setting();
452 $this->stripe_form_setting();
453 $this->paystack_form_setting();
454 $this->email_element_settings();
455
456 $this->success_message_setting();
457 $this->error_message_setting();
458
459 $this->form_style();
460 }
461
462 public function form_element_settings() {
463 $this->start_controls_section(
464 'better_payment_form_element',
465 [
466 'label' => esc_html__( 'Form Settings', 'better-payment' ),
467 'conditions' => [
468 'relation' => 'or',
469 'terms' => [
470 [
471 'name' => 'better_payment_form_paypal_enable',
472 'value' => 'yes',
473 ],
474 [
475 'name' => 'better_payment_form_stripe_enable',
476 'value' => 'yes',
477 ],
478 ]
479 ]
480 ]
481 );
482
483 $this->add_control(
484 'better_payment_form_title',
485 [
486 'label' => __( 'Form Name', 'better-payment' ),
487 'type' => Controls_Manager::TEXT,
488 'dynamic' => [
489 'active' => true,
490 ],
491 'default' => __( 'Better Payment', 'better-payment' ),
492 'ai' => [
493 'active' => false,
494 ],
495 ]
496 );
497
498 do_action('better_payment/elementor/editor/layouts_form_settings_section', $this);
499
500 $form_fields_repeater = new Repeater();
501
502 $form_fields_repeater->add_control(
503 'better_payment_field_name_heading',
504 [
505 'label' => __( 'Field Name', 'better-payment' ),
506 'type' => Controls_Manager::TEXT,
507 'default' => __( 'Field Name', 'better-payment' ),
508 'label_block' => false,
509 'ai' => [
510 'active' => false,
511 ],
512 ]
513 );
514
515 $form_fields_repeater->add_control(
516 'better_payment_field_name_placeholder',
517 [
518 'label' => __( 'Placeholder Text', 'better-payment' ),
519 'type' => Controls_Manager::TEXT,
520 'default' => __( 'Field Name', 'better-payment' ),
521 'label_block' => false,
522 'ai' => [
523 'active' => false,
524 ],
525 ]
526 );
527
528 $form_fields_repeater->add_control(
529 'better_payment_field_type',
530 [
531 'label' => __( 'Field Type', 'better-payment' ),
532 'type' => Controls_Manager::SELECT,
533 'default' => 'text',
534 'options' => [
535 'text' => __( 'Text', 'better-payment' ),
536 'email' => __( 'Email', 'better-payment' ),
537 'number' => __( 'Number', 'better-payment' ),
538 // 'password' => __( 'Password', 'better-payment' ),
539 // 'textarea' => __( 'Textarea', 'better-payment' ),
540 // 'select' => __( 'Select', 'better-payment' ),
541 // 'checkbox' => __( 'Checkbox', 'better-payment' ),
542 // 'radio' => __( 'Radio', 'better-payment' ),
543 // 'date' => __( 'Date', 'better-payment' ),
544 // 'time' => __( 'Time', 'better-payment' ),
545 // 'datetime' => __( 'Date Time', 'better-payment' ),
546 // 'file' => __( 'File', 'better-payment' ),
547 // 'hidden' => __( 'Hidden', 'better-payment' ),
548 ],
549 'label_block' => false,
550 ]
551 );
552
553 $form_fields_repeater->add_control(
554 'better_payment_primary_field_type',
555 [
556 'label' => __( 'Primary Field Type', 'better-payment' ),
557 'description' => __( 'If this is a primary field (first name, last name, email etc), then please select one.', 'better-payment' ),
558 'type' => Controls_Manager::SELECT,
559 'default' => 'primary_none',
560 'options' => [
561 'primary_first_name' => __( 'First Name', 'better-payment' ),
562 'primary_last_name' => __( 'Last Name', 'better-payment' ),
563 'primary_email' => __( 'Email', 'better-payment' ),
564 'primary_payment_amount' => __( 'Payment Amount', 'better-payment' ),
565 'primary_none' => __( 'None', 'better-payment' ),
566 ],
567 'label_block' => false,
568 ]
569 );
570
571 $form_fields_repeater->add_control(
572 'better_payment_field_icon',
573 [
574 'label' => esc_html__( 'Icon', 'better-payment' ),
575 'description' => esc_html__( 'Select an icon for this field (not applicable for primary field - Payment Amount).', 'better-payment' ),
576 'type' => Controls_Manager::ICONS,
577
578 ]
579 );
580
581 $form_fields_repeater->add_control(
582 'better_payment_field_name_show',
583 [
584 'label' => __( 'Show', 'better-payment' ),
585 'type' => Controls_Manager::SWITCHER,
586 'label_on' => __( 'Yes', 'better-payment' ),
587 'label_off' => __( 'No', 'better-payment' ),
588 'return_value' => 'yes',
589 'default' => 'yes',
590
591 ]
592 );
593
594 $form_fields_repeater->add_control(
595 'better_payment_field_name_show_notice',
596 [
597 'type' => Controls_Manager::RAW_HTML,
598 'raw' => sprintf(
599 esc_html__( 'Field is hidden if payment source is WooCommerce.', 'better-payment' ),
600 ),
601 'content_classes' => 'elementor-descriptor',
602 'condition' => [
603 'better_payment_primary_field_type' => 'primary_payment_amount'
604 ],
605 ]
606 );
607
608 $form_fields_repeater->add_control(
609 'better_payment_field_name_required',
610 [
611 'label' => __( 'Required', 'better-payment' ),
612 'type' => Controls_Manager::SWITCHER,
613 'label_on' => __( 'Yes', 'better-payment' ),
614 'label_off' => __( 'No', 'better-payment' ),
615 'return_value' => 'yes',
616 'default' => 'no',
617 'condition' => [
618 'better_payment_field_name_show' => 'yes'
619 ],
620 ]
621 );
622
623 $form_fields_repeater->add_control(
624 'better_payment_field_name_min',
625 [
626 'label' => __( 'Min. Value', 'better-payment' ),
627 'type' => Controls_Manager::NUMBER,
628 'condition' => [
629 'better_payment_primary_field_type' => 'primary_payment_amount'
630 ],
631 ]
632 );
633
634 $form_fields_repeater->add_control(
635 'better_payment_field_name_max',
636 [
637 'label' => __( 'Max. Value', 'better-payment' ),
638 'type' => Controls_Manager::NUMBER,
639 'condition' => [
640 'better_payment_primary_field_type' => 'primary_payment_amount'
641 ],
642 ]
643 );
644
645 $form_fields_repeater->add_control(
646 'better_payment_field_name_default',
647 [
648 'label' => __( 'Default Value', 'better-payment' ),
649 'type' => Controls_Manager::NUMBER,
650 'condition' => [
651 'better_payment_primary_field_type' => 'primary_payment_amount'
652 ],
653 ]
654 );
655
656 $form_fields_repeater->add_control(
657 'better_payment_field_name_default_fixed',
658 [
659 'label' => __( 'Readonly', 'better-payment' ),
660 'type' => Controls_Manager::SWITCHER,
661 'label_on' => __( 'Yes', 'better-payment' ),
662 'label_off' => __( 'No', 'better-payment' ),
663 'return_value' => 'yes',
664 'condition' => [
665 'better_payment_primary_field_type' => 'primary_payment_amount'
666 ],
667 ]
668 );
669
670 $form_fields_repeater->add_control(
671 'better_payment_field_name_display_inline',
672 [
673 'label' => __( 'Display Inline?', 'better-payment' ),
674 'type' => Controls_Manager::SWITCHER,
675 'label_on' => __( 'Yes', 'better-payment' ),
676 'label_off' => __( 'No', 'better-payment' ),
677 'return_value' => 'inline-block',
678 'default' => 'block',
679 'condition' => [
680 'better_payment_field_name_show' => 'yes'
681 ],
682 'selectors' => [
683 '{{WRAPPER}} .better-payment-form-layout form {{CURRENT_ITEM}}.bp-form__group' => 'display: {{VALUE}};',
684 '{{WRAPPER}} .better-payment-form {{CURRENT_ITEM}}.better-payment-field-advanced-layout' => 'display: {{VALUE}};',
685
686 ]
687 ]
688 );
689
690 $form_fields_repeater->add_control(
691 'better_payment_field_name_display_inline_width',
692 [
693 'label' => __( 'Column Width', 'better-payment' ),
694 'type' => Controls_Manager::SLIDER,
695 'size_units' => [ '%', 'px', 'em' ],
696 'range' => [
697 '%' => [
698 'min' => 1,
699 'max' => 100,
700 ],
701 'px' => [
702 'min' => 10,
703 'max' => 1500,
704 ],
705 'em' => [
706 'min' => 1,
707 'max' => 80,
708 ],
709 ],
710 'condition' => [
711 'better_payment_field_name_show' => 'yes',
712 'better_payment_field_name_display_inline' => 'inline-block'
713 ],
714 'selectors' => [
715 '{{WRAPPER}} .better-payment-form-layout form {{CURRENT_ITEM}}.bp-form__group' => 'width: {{SIZE}}{{UNIT}};',
716 '{{WRAPPER}} .better-payment-form {{CURRENT_ITEM}}.better-payment-field-advanced-layout' => 'width: {{SIZE}}{{UNIT}};',
717 ],
718 'description' => __( 'Set the width of the column. Use less than 50% to make fields inline', 'better-payment' ),
719 ]
720 );
721
722 $this->add_control(
723 'better_payment_form_fields',
724 [
725 'label' => esc_html__( 'Form Fields', 'better-payment' ),
726 'type' => \Elementor\Controls_Manager::REPEATER,
727 'fields' => $form_fields_repeater->get_controls(),
728 'default' => [
729 [
730 'better_payment_field_name_heading' => esc_html__( 'First Name', 'better-payment' ),
731 'better_payment_field_name_placeholder' => esc_html__( 'First Name', 'better-payment' ),
732 'better_payment_field_type' => 'text',
733 'better_payment_primary_field_type' => 'primary_first_name',
734 'better_payment_field_name_show' => 'yes',
735 'better_payment_field_name_required' => 'no',
736 ],
737 [
738 'better_payment_field_name_heading' => esc_html__( 'Last Name', 'better-payment' ),
739 'better_payment_field_name_placeholder' => esc_html__( 'Last Name', 'better-payment' ),
740 'better_payment_field_type' => 'text',
741 'better_payment_primary_field_type' => 'primary_last_name',
742 'better_payment_field_name_show' => 'yes',
743 'better_payment_field_name_required' => 'no',
744 ],
745 [
746 'better_payment_field_name_heading' => esc_html__( 'Email Address', 'better-payment' ),
747 'better_payment_field_name_placeholder' => esc_html__( 'Email Address', 'better-payment' ),
748 'better_payment_field_type' => 'email',
749 'better_payment_primary_field_type' => 'primary_email',
750 'better_payment_field_name_show' => 'yes',
751 'better_payment_field_name_required' => 'yes',
752 ],
753 [
754 'better_payment_field_name_heading' => esc_html__( 'Payment Amount', 'better-payment' ),
755 'better_payment_field_name_placeholder' => esc_html__( 'Payment Amount', 'better-payment' ),
756 'better_payment_field_type' => 'number',
757 'better_payment_primary_field_type' => 'primary_payment_amount',
758 'better_payment_field_name_show' => 'yes',
759 'better_payment_field_name_required' => 'yes',
760 ],
761 ],
762 'title_field' => '{{{ better_payment_field_name_heading }}}',
763 ]
764 );
765
766 $repeater = new Repeater();
767
768
769 $repeater->add_control(
770 'better_payment_amount_val',
771 [
772 'label' => esc_html__( 'Payment Amount', 'better-payment' ),
773 'type' => Controls_Manager::NUMBER,
774 'min' => 1,
775 ]
776 );
777
778 $this->add_control(
779 'better_payment_show_amount_list',
780 [
781 'label' => __( 'Show Amount List', 'better-payment' ),
782 'type' => Controls_Manager::SWITCHER,
783 'label_on' => __( 'Yes', 'better-payment' ),
784 'label_off' => __( 'No', 'better-payment' ),
785 'return_value' => 'yes',
786 'default' => 'no',
787 'condition' => [
788 'better_payment_form_payment_source!' => 'woocommerce',
789 ],
790 ]
791 );
792
793 $this->add_control(
794 'better_payment_amount',
795 [
796 'label' => esc_html__( 'Amount List', 'better-payment' ),
797 'type' => Controls_Manager::REPEATER,
798 'default' => [
799 [
800 'better_payment_amount_val' => 5
801 ],
802 [
803 'better_payment_amount_val' => 10
804 ],
805 [
806 'better_payment_amount_val' => 15
807 ],
808 [
809 'better_payment_amount_val' => 20
810 ],
811 ],
812 'fields' => $repeater->get_controls(),
813 'title_field' => '<i class="{{ better_payment_amount_val }}" aria-hidden="true"></i> {{{ better_payment_amount_val }}}',
814 'condition' => [
815 'better_payment_show_amount_list' => 'yes',
816 'better_payment_form_payment_source!' => 'woocommerce',
817 ],
818 ]
819 );
820
821 $this->add_control(
822 'better_payment_form_transaction_details_section',
823 [
824 'label' => esc_html__( 'Transaction Details', 'better-payment' ),
825 'type' => Controls_Manager::HEADING,
826 'separator' => 'before',
827 ]
828 );
829
830 $this->add_control(
831 'better_payment_form_transaction_details_heading',
832 [
833 'label' => esc_html__( 'Heading Text', 'better-payment' ),
834 'type' => Controls_Manager::TEXT,
835 'default' => __( 'Transaction Details', 'better-payment' ),
836 'label_block' => true,
837 'ai' => [
838 'active' => false,
839 ],
840 ]
841 );
842
843 $this->add_control(
844 'better_payment_form_transaction_details_sub_heading',
845 [
846 'label' => esc_html__( 'Sub Heading Text', 'better-payment' ),
847 'type' => Controls_Manager::TEXT,
848 'default' => __( 'Total payment of your product in the following:', 'better-payment' ),
849 'label_block' => true,
850 'ai' => [
851 'active' => false,
852 ],
853 ]
854 );
855
856 $this->add_control(
857 'better_payment_form_transaction_details_product_title',
858 [
859 'label' => esc_html__( 'Product Title Text', 'better-payment' ),
860 'type' => Controls_Manager::TEXT,
861 'default' => __( 'Title:', 'better-payment' ),
862 'condition' => [
863 'better_payment_form_payment_source' => 'woocommerce',
864 ],
865 'label_block' => true,
866 'ai' => [
867 'active' => false,
868 ],
869 ]
870 );
871
872 $this->add_control(
873 'better_payment_form_transaction_details_amount_text',
874 [
875 'label' => esc_html__( 'Amount Text', 'better-payment' ),
876 'type' => Controls_Manager::TEXT,
877 'default' => __( 'Amount:', 'better-payment' ),
878 'label_block' => true,
879 'ai' => [
880 'active' => false,
881 ],
882 ]
883 );
884
885 $this->add_control(
886 'better_payment_form_form_buttons_section',
887 [
888 'label' => esc_html__( 'Form Buttons', 'better-payment' ),
889 'type' => Controls_Manager::HEADING,
890 'separator' => 'before',
891 ]
892 );
893
894 $this->add_control(
895 'better_payment_form_form_buttons_paypal_button_text',
896 [
897 'label' => esc_html__( 'PayPal Button Text', 'better-payment' ),
898 'type' => Controls_Manager::TEXT,
899 'default' => __( 'Proceed to Payment', 'better-payment' ),
900 'label_block' => true,
901 'ai' => [
902 'active' => false,
903 ],
904 ]
905 );
906
907 $this->add_control(
908 'better_payment_form_form_buttons_stripe_button_text',
909 [
910 'label' => esc_html__( 'Stripe Button Text', 'better-payment' ),
911 'type' => Controls_Manager::TEXT,
912 'default' => __( 'Proceed to Payment', 'better-payment' ),
913 'label_block' => true,
914 'ai' => [
915 'active' => false,
916 ],
917 ]
918 );
919
920 $this->end_controls_section();
921 }
922
923 public function paypal_form_setting() {
924 $this->start_controls_section(
925 'better_payment_form_paypal_settings',
926 [
927 'label' => esc_html__( 'PayPal Settings', 'better-payment' ),
928 'condition' => [
929 'better_payment_form_paypal_enable' => 'yes'
930 ]
931 ]
932 );
933
934
935 $this->add_control(
936 'better_payment_paypal_business_email',
937 [
938 'label' => __( 'Business Email', 'better-payment' ),
939 'type' => Controls_Manager::TEXT,
940 'dynamic' => [
941 'active' => true,
942 ],
943 'label_block' => true,
944 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_payment_paypal_email']),
945 'ai' => [
946 'active' => false,
947 ],
948 ]
949 );
950
951 $this->add_control(
952 'better_payment_paypal_button_type',
953 [
954 'label' => esc_html__( 'Button Type', 'better-payment' ),
955 'type' => Controls_Manager::HIDDEN,
956 'default' => '_xclick',
957 'options' => [
958 '_xclick' => 'XCLICK',
959 '_cart' => 'CART',
960 '_donations' => 'DONATIONS'
961 ]
962 ]
963 );
964
965 $this->add_control(
966 'better_payment_paypal_live_mode',
967 [
968 'label' => __( 'Live Mode', 'better-payment' ),
969 'type' => Controls_Manager::SWITCHER,
970 'label_on' => __( 'Yes', 'better-payment' ),
971 'label_off' => __( 'No', 'better-payment' ),
972 'return_value' => 'yes',
973 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_payment_paypal_live_mode']), //yes or no
974 ]
975 );
976
977 $this->end_controls_section();
978 }
979
980 public function stripe_form_setting() {
981 $this->start_controls_section(
982 'better_payment_form_stripe_settings',
983 [
984 'label' => esc_html__( 'Stripe Settings', 'better-payment' ),
985 'condition' => [
986 'better_payment_form_stripe_enable' => 'yes'
987 ]
988 ]
989 );
990
991 $this->add_control(
992 'better_payment_stripe_public_key',
993 [
994 'label' => __( 'Test Public Key', 'better-payment' ),
995 'type' => Controls_Manager::TEXT,
996 'dynamic' => [
997 'active' => true,
998 ],
999 'label_block' => true,
1000 'default' => esc_html( $this->better_payment_global_settings['better_payment_settings_payment_stripe_test_public'] ),
1001 'ai' => [
1002 'active' => false,
1003 ],
1004 'condition' => [
1005 'better_payment_stripe_live_mode!' => 'yes',
1006 ],
1007 ]
1008 );
1009
1010 $this->add_control(
1011 'better_payment_stripe_secret_key',
1012 [
1013 'label' => __( 'Test Secret Key', 'better-payment' ),
1014 'type' => Controls_Manager::TEXT,
1015 'input_type' => 'password',
1016 'dynamic' => [
1017 'active' => true,
1018 ],
1019 'label_block' => true,
1020 'default' => esc_html( $this->better_payment_global_settings['better_payment_settings_payment_stripe_test_secret'] ),
1021 'ai' => [
1022 'active' => false,
1023 ],
1024 'condition' => [
1025 'better_payment_stripe_live_mode!' => 'yes',
1026 ],
1027 ]
1028 );
1029
1030 $this->add_control(
1031 'better_payment_stripe_public_key_live',
1032 [
1033 'label' => __( 'Live Public Key', 'better-payment' ),
1034 'type' => Controls_Manager::TEXT,
1035 'dynamic' => [
1036 'active' => true,
1037 ],
1038 'label_block' => true,
1039 'default' => esc_html( $this->better_payment_global_settings['better_payment_settings_payment_stripe_live_public'] ),
1040 'ai' => [
1041 'active' => false,
1042 ],
1043 'condition' => [
1044 'better_payment_stripe_live_mode' => 'yes',
1045 ],
1046 ]
1047 );
1048
1049 $this->add_control(
1050 'better_payment_stripe_secret_key_live',
1051 [
1052 'label' => __( 'Live Secret Key', 'better-payment' ),
1053 'type' => Controls_Manager::TEXT,
1054 'input_type' => 'password',
1055 'dynamic' => [
1056 'active' => true,
1057 ],
1058 'label_block' => true,
1059 'default' => esc_html( $this->better_payment_global_settings['better_payment_settings_payment_stripe_live_secret'] ),
1060 'ai' => [
1061 'active' => false,
1062 ],
1063 'condition' => [
1064 'better_payment_stripe_live_mode' => 'yes',
1065 ],
1066 ]
1067 );
1068
1069 $this->add_control(
1070 'better_payment_stripe_live_mode',
1071 [
1072 'label' => __( 'Live Mode', 'better-payment' ),
1073 'type' => Controls_Manager::SWITCHER,
1074 'label_on' => __( 'Yes', 'better-payment' ),
1075 'label_off' => __( 'No', 'better-payment' ),
1076 'return_value' => 'yes',
1077 'default' => esc_html( $this->better_payment_global_settings['better_payment_settings_payment_stripe_live_mode'] ), //yes or no
1078 ]
1079 );
1080
1081 $this->end_controls_section();
1082 }
1083
1084 public function paystack_form_setting() {
1085 $this->start_controls_section(
1086 'better_payment_form_paystack_settings',
1087 [
1088 'label' => esc_html__( 'Paystack Settings', 'better-payment' ),
1089 'condition' => [
1090 'better_payment_form_paystack_enable' => 'yes'
1091 ]
1092 ]
1093 );
1094
1095 $better_payment_is_paystack_live = ! empty( $this->better_payment_global_settings['better_payment_settings_payment_paystack_live_mode'] ) && $this->better_payment_global_settings['better_payment_settings_payment_paystack_live_mode'] == 'yes' ? 1 : 0;
1096 $bp_settings_paystack_live_public = ! empty( $this->better_payment_global_settings['better_payment_settings_payment_paystack_live_public'] ) ? $this->better_payment_global_settings['better_payment_settings_payment_paystack_live_public'] : '';
1097 $bp_settings_paystack_test_public = ! empty( $this->better_payment_global_settings['better_payment_settings_payment_paystack_test_public'] ) ? $this->better_payment_global_settings['better_payment_settings_payment_paystack_test_public'] : '';
1098
1099 $this->add_control(
1100 'better_payment_paystack_public_key',
1101 [
1102 'label' => __( 'Public Key', 'better-payment' ),
1103 'type' => Controls_Manager::TEXT,
1104 'dynamic' => [
1105 'active' => true,
1106 ],
1107 'label_block' => true,
1108 'default' => $better_payment_is_paystack_live ? esc_html( $bp_settings_paystack_live_public ) : esc_html( $bp_settings_paystack_test_public ),
1109 'ai' => [
1110 'active' => false,
1111 ],
1112 ]
1113 );
1114
1115 $bp_settings_paystack_live_secret = ! empty( $this->better_payment_global_settings['better_payment_settings_payment_paystack_live_secret'] ) ? $this->better_payment_global_settings['better_payment_settings_payment_paystack_live_secret'] : '';
1116 $bp_settings_paystack_test_secret = ! empty( $this->better_payment_global_settings['better_payment_settings_payment_paystack_test_secret'] ) ? $this->better_payment_global_settings['better_payment_settings_payment_paystack_test_secret'] : '';
1117
1118 $this->add_control(
1119 'better_payment_paystack_secret_key',
1120 [
1121 'label' => __( 'Secret Key', 'better-payment' ),
1122 'type' => Controls_Manager::TEXT,
1123 'input_type' => 'password',
1124 'dynamic' => [
1125 'active' => true,
1126 ],
1127 'label_block' => true,
1128 'default' => $better_payment_is_paystack_live ? esc_html( $bp_settings_paystack_live_secret ) : esc_html( $bp_settings_paystack_test_secret ),
1129 'ai' => [
1130 'active' => false,
1131 ],
1132 ]
1133 );
1134
1135 $this->add_control(
1136 'better_payment_paystack_live_mode',
1137 [
1138 'label' => __( 'Live Mode', 'better-payment' ),
1139 'type' => Controls_Manager::SWITCHER,
1140 'label_on' => __( 'Yes', 'better-payment' ),
1141 'label_off' => __( 'No', 'better-payment' ),
1142 'return_value' => 'yes',
1143 'default' => ! empty( $this->better_payment_global_settings['better_payment_settings_payment_paystack_live_mode'] ) ? esc_html($this->better_payment_global_settings['better_payment_settings_payment_paystack_live_mode']) : 'no', //yes or no
1144 ]
1145 );
1146
1147 $this->end_controls_section();
1148 }
1149
1150 public function email_element_settings() {
1151 $this->start_controls_section(
1152 'better_payment_email_element',
1153 [
1154 'label' => esc_html__( 'Email Settings', 'better-payment' ),
1155 'condition' => [
1156 'better_payment_form_email_enable' => 'yes'
1157 ]
1158 ]
1159 );
1160
1161 $this->start_controls_tabs( 'better_payment_email_tabs' );
1162
1163 //Admin Email Notification
1164 $this->start_controls_tab( 'better_payment_email_admin_tab', [
1165 'label' => __( 'Admin', 'better-payment' ),
1166 ] );
1167
1168 $this->add_control('better_payment_email_to', [
1169 'label' => __('To', 'better-payment'),
1170 'type' => Controls_Manager::TEXT,
1171 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_to']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_to']) : esc_html(get_option('admin_email')),
1172 'placeholder' => get_option('admin_email'),
1173 'label_block' => true,
1174 'title' => __('Email address to notify site admin after each successful transaction', 'better-payment'),
1175 'render_type' => 'none',
1176 'ai' => [
1177 'active' => false,
1178 ],
1179 ]);
1180
1181 $default_subject = !empty($this->better_payment_global_settings['better_payment_settings_general_email_subject']) ? esc_html__($this->better_payment_global_settings['better_payment_settings_general_email_subject'], 'better-payment') : sprintf(__('Better Payment transaction on %s', 'better-payment'), esc_html(get_option('blogname')));
1182
1183 $this->add_control('better_payment_email_subject', [
1184 'label' => __('Subject', 'better-payment'),
1185 'type' => Controls_Manager::TEXT,
1186 'default' => esc_html($default_subject),
1187 'placeholder' => esc_html($default_subject),
1188 'label_block' => true,
1189 'render_type' => 'none',
1190 'ai' => [
1191 'active' => false,
1192 ],
1193 ]);
1194
1195 $this->add_control('better_payment_email_content', [
1196 'label' => __('Message', 'better-payment'),
1197 'type' => Controls_Manager::TEXTAREA,
1198 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_message_admin']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_message_admin']) : '[bp-all-fields]',
1199 'placeholder' => '[bp-all-fields]',
1200 'render_type' => 'none',
1201 ]);
1202
1203 $site_url_parsed = wp_parse_url(get_site_url());
1204 $better_domain = $site_url_parsed['host'] ? esc_html($site_url_parsed['host']) : 'example.com';
1205
1206 $this->add_control('better_payment_email_from', [
1207 'label' => __('From email', 'better-payment'),
1208 'type' => Controls_Manager::TEXT,
1209 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_from_email']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_from_email']) : "wordpress@$better_domain",
1210 'render_type' => 'none',
1211 'separator' => 'before',
1212 'ai' => [
1213 'active' => false,
1214 ],
1215 ]);
1216
1217 $this->add_control('better_payment_email_from_name', [
1218 'label' => __('From name', 'better-payment'),
1219 'type' => Controls_Manager::TEXT,
1220 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_from_name']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_from_name']) : esc_html(get_bloginfo('name')),
1221 'render_type' => 'none',
1222 'ai' => [
1223 'active' => false,
1224 ],
1225 ]);
1226
1227 $this->add_control('better_payment_email_reply_to', [
1228 'label' => __('Reply-To', 'better-payment'),
1229 'type' => Controls_Manager::TEXT,
1230 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_reply_to']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_reply_to']) : "wordpress@$better_domain",
1231 'placeholder' => "wordpress@$better_domain",
1232 'render_type' => 'none',
1233 'ai' => [
1234 'active' => false,
1235 ],
1236 ]);
1237
1238 $this->add_control('better_payment_email_cc', [
1239 'label' => __('Cc', 'better-payment'),
1240 'type' => Controls_Manager::TEXT,
1241 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_cc']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_cc']) : '',
1242 'render_type' => 'none',
1243 'ai' => [
1244 'active' => false,
1245 ],
1246 ]);
1247
1248 $this->add_control('better_payment_email_bcc', [
1249 'label' => __('Bcc', 'better-payment'),
1250 'type' => Controls_Manager::TEXT,
1251 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_bcc']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_bcc']) : '',
1252 'render_type' => 'none',
1253 'ai' => [
1254 'active' => false,
1255 ],
1256 ]);
1257
1258 $this->add_control('better_payment_email_content_type', [
1259 'label' => __('Send as', 'better-payment'),
1260 'type' => Controls_Manager::SELECT,
1261 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_send_as']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_send_as']) : 'html', //html or plain
1262 'render_type' => 'none',
1263 'options' => [
1264 'html' => __('HTML', 'better-payment'),
1265 'plain' => __('Plain', 'better-payment')
1266 ]
1267 ]);
1268
1269 $this->end_controls_tab();
1270
1271 //Customer Email Notification
1272 $this->start_controls_tab( 'better_payment_email_customer_tab', [
1273 'label' => __( 'Customer', 'better-payment' ),
1274 ] );
1275
1276 $default_subject = !empty($this->better_payment_global_settings['better_payment_settings_general_email_subject_customer']) ? esc_html__($this->better_payment_global_settings['better_payment_settings_general_email_subject_customer'], 'better-payment') : sprintf(__('Better Payment transaction on %s', 'better-payment'), esc_html(get_option('blogname')));
1277
1278 $this->add_control('better_payment_email_subject_customer', [
1279 'label' => __('Subject', 'better-payment'),
1280 'type' => Controls_Manager::TEXT,
1281 'default' => esc_html($default_subject),
1282 'placeholder' => esc_html($default_subject),
1283 'label_block' => true,
1284 'render_type' => 'none',
1285 'ai' => [
1286 'active' => false,
1287 ],
1288 ]);
1289
1290 $this->add_control('better_payment_email_content_customer', [
1291 'label' => __('Message', 'better-payment'),
1292 'type' => Controls_Manager::TEXTAREA,
1293 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_message_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_message_customer']) : '[bp-all-fields]',
1294 'placeholder' => '[bp-all-fields]',
1295 'render_type' => 'none'
1296 ]);
1297
1298 $site_url_parsed = wp_parse_url(get_site_url());
1299 $better_domain = $site_url_parsed['host'] ? esc_html($site_url_parsed['host']) : 'example.com';
1300
1301 $this->add_control('better_payment_email_from_customer', [
1302 'label' => __('From email', 'better-payment'),
1303 'type' => Controls_Manager::TEXT,
1304 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_from_email_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_from_email_customer']) : "wordpress@$better_domain",
1305 'render_type' => 'none',
1306 'separator' => 'before',
1307 'ai' => [
1308 'active' => false,
1309 ],
1310 ]);
1311
1312 $this->add_control('better_payment_email_from_name_customer', [
1313 'label' => __('From name', 'better-payment'),
1314 'type' => Controls_Manager::TEXT,
1315 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_from_name_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_from_name_customer']) : get_bloginfo('name'),
1316 'render_type' => 'none',
1317 'ai' => [
1318 'active' => false,
1319 ],
1320 ]);
1321
1322 $this->add_control('better_payment_email_reply_to_customer', [
1323 'label' => __('Reply-To', 'better-payment'),
1324 'type' => Controls_Manager::TEXT,
1325 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_reply_to_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_reply_to_customer']) : "wordpress@$better_domain",
1326 'placeholder' => "wordpress@$better_domain",
1327 'render_type' => 'none',
1328 'ai' => [
1329 'active' => false,
1330 ],
1331 ]);
1332
1333 $this->add_control('better_payment_email_cc_customer', [
1334 'label' => __('Cc', 'better-payment'),
1335 'type' => Controls_Manager::TEXT,
1336 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_cc_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_cc_customer']) : '',
1337 'render_type' => 'none',
1338 'ai' => [
1339 'active' => false,
1340 ],
1341 ]);
1342
1343 $this->add_control('better_payment_email_bcc_customer', [
1344 'label' => __('Bcc', 'better-payment'),
1345 'type' => Controls_Manager::TEXT,
1346 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_bcc_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_bcc_customer']) : '',
1347 'render_type' => 'none',
1348 'ai' => [
1349 'active' => false,
1350 ],
1351 ]);
1352
1353 $this->add_control('better_payment_email_content_type_customer', [
1354 'label' => __('Send as', 'better-payment'),
1355 'type' => Controls_Manager::SELECT,
1356 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_send_as_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_send_as_customer']) : 'html', //html or plain
1357 'render_type' => 'none',
1358 'options' => [
1359 'html' => __('HTML', 'better-payment'),
1360 'plain' => __('Plain', 'better-payment')
1361 ]
1362 ]);
1363
1364 $this->end_controls_tab();
1365
1366 $this->end_controls_tabs();
1367
1368 $this->end_controls_section();
1369 }
1370
1371 public function success_message_setting() {
1372 $this->start_controls_section(
1373 'better_payment_form_success_message_settings',
1374 [
1375 'label' => esc_html__( 'Success Message', 'better-payment' ),
1376 'conditions' => [
1377 'relation' => 'or',
1378 'terms' => [
1379 [
1380 'name' => 'better_payment_form_stripe_enable',
1381 'value' => 'yes',
1382 ],
1383 [
1384 'name' => 'better_payment_form_paypal_enable',
1385 'value' => 'yes',
1386 ],
1387 ],
1388 ]
1389 ]
1390 );
1391
1392 $this->add_control(
1393 'better_payment_form_success_message_icon',
1394 [
1395 'label' => esc_html__( 'Icon', 'better-payment' ),
1396 'type' => Controls_Manager::ICONS,
1397
1398 ]
1399 );
1400
1401 $this->add_control(
1402 'better_payment_form_success_message_heading',
1403 [
1404 'label' => __( 'Heading Message Text', 'better-payment' ),
1405 'type' => Controls_Manager::TEXT,
1406 'default' => __( 'Payment Successful', 'better-payment' ),
1407 'dynamic' => [
1408 'active' => true,
1409 ],
1410 'label_block' => true,
1411 'ai' => [
1412 'active' => false,
1413 ],
1414 ]
1415 );
1416
1417 $this->add_control(
1418 'better_payment_form_success_message_transaction',
1419 [
1420 'label' => __( 'Transaction Text', 'better-payment' ),
1421 'type' => Controls_Manager::TEXT,
1422 'default' => __( 'Transaction Number', 'better-payment' ),
1423 'dynamic' => [
1424 'active' => true,
1425 ],
1426 'label_block' => true,
1427 'ai' => [
1428 'active' => false,
1429 ],
1430 ]
1431 );
1432
1433 $this->add_control(
1434 'better_payment_form_success_message_thanks',
1435 [
1436 'label' => __( 'Thanks Text', 'better-payment' ),
1437 'type' => Controls_Manager::TEXT,
1438 'default' => __( 'Thank you for your payment', 'better-payment' ),
1439 'dynamic' => [
1440 'active' => true,
1441 ],
1442 'label_block' => true,
1443 'ai' => [
1444 'active' => false,
1445 ],
1446 ]
1447 );
1448
1449 $this->add_control( 'better_payment_form_success_page_url', [
1450 'type' => Controls_Manager::URL,
1451 'label' => __( 'Custom Redirect URL', 'better-payment' ),
1452 'show_external' => false,
1453 'placeholder' => __( 'eg. https://your-link.com/custom-page/', 'better-payment' ),
1454 'description' => __( 'Please note that only your current domain is allowed here to keep your site secure.', 'better-payment' ),
1455 ] );
1456
1457 $this->end_controls_section();
1458 }
1459
1460 public function error_message_setting() {
1461 $this->start_controls_section(
1462 'better_payment_form_error_message_settings',
1463 [
1464 'label' => esc_html__( 'Error Message', 'better-payment' ),
1465 'conditions' => [
1466 'relation' => 'or',
1467 'terms' => [
1468 [
1469 'name' => 'better_payment_form_stripe_enable',
1470 'value' => 'yes',
1471 ],
1472 [
1473 'name' => 'better_payment_form_paypal_enable',
1474 'value' => 'yes',
1475 ],
1476 ],
1477 ]
1478 ]
1479 );
1480
1481 $this->add_control(
1482 'better_payment_form_error_message_icon',
1483 [
1484 'label' => esc_html__( 'Icon', 'better-payment' ),
1485 'type' => Controls_Manager::ICONS,
1486
1487 ]
1488 );
1489
1490 $this->add_control(
1491 'better_payment_form_error_message_heading',
1492 [
1493 'label' => __( 'Heading Message Text', 'better-payment' ),
1494 'type' => Controls_Manager::TEXT,
1495 'default' => __( 'Payment Failed', 'better-payment' ),
1496 'dynamic' => [
1497 'active' => true,
1498 ],
1499 'label_block' => true,
1500 'ai' => [
1501 'active' => false,
1502 ],
1503 ]
1504 );
1505
1506 $this->add_control( 'better_payment_form_error_page_url', [
1507 'type' => Controls_Manager::URL,
1508 'label' => __( 'Custom Redirect URL', 'better-payment' ),
1509 'show_external' => false,
1510 'placeholder' => __( 'eg. https://your-link.com/custom-page/', 'better-payment' ),
1511 'description' => __( 'Please note that only your current domain is allowed here to keep your site secure.', 'better-payment' ),
1512 ] );
1513
1514 $this->end_controls_section();
1515 }
1516
1517 public function form_style() {
1518 $this->form_sidebar_style();
1519 $this->form_sidebar_text_style();
1520 $this->form_container_style();
1521 $this->form_fields_style();
1522 $this->form_fields_amount_style();
1523 $this->form_button_style();
1524
1525 }
1526
1527 public function form_sidebar_style() {
1528 $this->start_controls_section(
1529 'better_payment_form_sidebar_style',
1530 [
1531 'label' => esc_html__( 'Form Sidebar Style', 'better-payment' ),
1532 'tab' => Controls_Manager::TAB_STYLE,
1533 ]
1534 );
1535
1536 $this->add_group_control(
1537 Group_Control_Background::get_type(),
1538 [
1539 'name' => 'better_payment_form_sidebar_background',
1540 'types' => [ 'classic', 'gradient' ],
1541 'selector' => '{{WRAPPER}} .better-payment .dynamic-amount-section',
1542 ]
1543 );
1544
1545 $this->add_responsive_control(
1546 'better_payment_form_sidebar_margin',
1547 [
1548 'label' => esc_html__( 'Margin', 'better-payment' ),
1549 'type' => Controls_Manager::DIMENSIONS,
1550 'size_units' => [ 'px', 'em', '%' ],
1551 'selectors' => [
1552 '{{WRAPPER}} .better-payment .dynamic-amount-section' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1553 ],
1554 'separator' => 'before',
1555 ]
1556 );
1557
1558 $this->add_responsive_control(
1559 'better_payment_form_sidebar_padding',
1560 [
1561 'label' => esc_html__( 'Padding', 'better-payment' ),
1562 'type' => Controls_Manager::DIMENSIONS,
1563 'size_units' => [ 'px', 'em', '%' ],
1564 'selectors' => [
1565 '{{WRAPPER}} .better-payment .dynamic-amount-section-inner.p-6' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1566 ],
1567 ]
1568 );
1569
1570 $this->add_responsive_control(
1571 'better_payment_form_sidebar_border_radius',
1572 [
1573 'label' => esc_html__( 'Border Radius', 'better-payment' ),
1574 'type' => Controls_Manager::DIMENSIONS,
1575 'separator' => 'before',
1576 'size_units' => [ 'px' ],
1577 'selectors' => [
1578 '{{WRAPPER}} .better-payment .dynamic-amount-section' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1579 ],
1580 ]
1581 );
1582
1583 $this->add_group_control(
1584 Group_Control_Border::get_type(),
1585 [
1586 'name' => 'better_payment_form_sidebar_border',
1587 'selector' => '{{WRAPPER}} .better-payment .dynamic-amount-section',
1588 ]
1589 );
1590
1591 $this->add_group_control(
1592 Group_Control_Box_Shadow::get_type(),
1593 [
1594 'name' => 'better_payment_form_sidebar_box_shadow',
1595 'selector' => '{{WRAPPER}} .better-payment .dynamic-amount-section',
1596 ]
1597 );
1598
1599 $this->end_controls_section();
1600 }
1601
1602 public function form_sidebar_text_style() {
1603 $this->start_controls_section(
1604 'better_payment_form_sidebar_text_style',
1605 [
1606 'label' => esc_html__( 'Sidebar Text Style', 'better-payment' ),
1607 'tab' => Controls_Manager::TAB_STYLE,
1608 ]
1609 );
1610
1611 $this->add_control(
1612 'better_payment_form_sidebar_text_title_style',
1613 [
1614 'label' => __( 'Title Text', 'better-payment' ),
1615 'type' => Controls_Manager::HEADING,
1616 ]
1617 );
1618
1619 $this->add_control(
1620 'better_payment_form_sidebar_text_title_color',
1621 [
1622 'label' => __( 'Color', 'better-payment' ),
1623 'type' => Controls_Manager::COLOR,
1624 'default' => '',
1625 'selectors' => [
1626 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-title' => 'color: {{VALUE}}',
1627 ],
1628 ]
1629 );
1630
1631 $this->add_group_control(
1632 Group_Control_Typography::get_type(),
1633 [
1634 'name' => 'better_payment_form_sidebar_text_title_typography',
1635 'label' => __( 'Typography', 'better-payment' ),
1636 'selector' => '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-title',
1637 'separator' => 'after',
1638 ]
1639 );
1640
1641 $this->add_responsive_control(
1642 'better_payment_form_sidebar_text_title_margin',
1643 [
1644 'label' => esc_html__( 'Margin', 'better-payment' ),
1645 'type' => Controls_Manager::DIMENSIONS,
1646 'size_units' => [ 'px', 'em', '%' ],
1647 'selectors' => [
1648 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1649 ],
1650 ]
1651 );
1652
1653 $this->add_responsive_control(
1654 'better_payment_form_sidebar_text_title_padding',
1655 [
1656 'label' => esc_html__( 'Padding', 'better-payment' ),
1657 'type' => Controls_Manager::DIMENSIONS,
1658 'size_units' => [ 'px', 'em', '%' ],
1659 'selectors' => [
1660 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1661 ],
1662 ]
1663 );
1664
1665 $this->add_control(
1666 'better_payment_form_sidebar_text_sub_title_style',
1667 [
1668 'label' => __( 'Sub-Title Text', 'better-payment' ),
1669 'type' => Controls_Manager::HEADING,
1670 'separator' => 'before',
1671 ],
1672 );
1673
1674 $this->add_control(
1675 'better_payment_form_sidebar_text_sub_title_color',
1676 [
1677 'label' => __( 'Color', 'better-payment' ),
1678 'type' => Controls_Manager::COLOR,
1679 'default' => '',
1680 'selectors' => [
1681 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-sub-title' => 'color: {{VALUE}}',
1682 ],
1683 ]
1684 );
1685
1686 $this->add_group_control(
1687 Group_Control_Typography::get_type(),
1688 [
1689 'name' => 'better_payment_form_sidebar_text_sub_title_typography',
1690 'label' => __( 'Typography', 'better-payment' ),
1691 'selector' => '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-sub-title',
1692 ]
1693 );
1694
1695 $this->add_responsive_control(
1696 'better_payment_form_sidebar_text_sub_title_margin',
1697 [
1698 'label' => esc_html__( 'Margin', 'better-payment' ),
1699 'type' => Controls_Manager::DIMENSIONS,
1700 'size_units' => [ 'px', 'em', '%' ],
1701 'selectors' => [
1702 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-sub-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1703 ],
1704 ]
1705 );
1706
1707 $this->add_responsive_control(
1708 'better_payment_form_sidebar_text_sub_title_padding',
1709 [
1710 'label' => esc_html__( 'Padding', 'better-payment' ),
1711 'type' => Controls_Manager::DIMENSIONS,
1712 'size_units' => [ 'px', 'em', '%' ],
1713 'selectors' => [
1714 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-sub-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1715 ],
1716 ]
1717 );
1718
1719 $this->add_control(
1720 'better_payment_form_sidebar_text_amount_style',
1721 [
1722 'label' => __( 'Amount Text', 'better-payment' ),
1723 'type' => Controls_Manager::HEADING,
1724 'separator' => 'before',
1725 ],
1726 );
1727
1728 $this->add_control(
1729 'better_payment_form_sidebar_text_amount_title_color',
1730 [
1731 'label' => __( 'Color', 'better-payment' ),
1732 'type' => Controls_Manager::COLOR,
1733 'default' => '',
1734 'selectors' => [
1735 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount' => 'color: {{VALUE}}',
1736 ],
1737 ]
1738 );
1739
1740 $this->add_group_control(
1741 Group_Control_Typography::get_type(),
1742 [
1743 'name' => 'better_payment_form_sidebar_text_amount_typography',
1744 'label' => __( 'Typography', 'better-payment' ),
1745 'selector' => '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount',
1746 ]
1747 );
1748
1749 $this->add_responsive_control(
1750 'better_payment_form_sidebar_text_amount_margin',
1751 [
1752 'label' => esc_html__( 'Margin', 'better-payment' ),
1753 'type' => Controls_Manager::DIMENSIONS,
1754 'size_units' => [ 'px', 'em', '%' ],
1755 'selectors' => [
1756 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1757 ],
1758 ]
1759 );
1760
1761 $this->add_responsive_control(
1762 'better_payment_form_sidebar_text_amount_padding',
1763 [
1764 'label' => esc_html__( 'Padding', 'better-payment' ),
1765 'type' => Controls_Manager::DIMENSIONS,
1766 'size_units' => [ 'px', 'em', '%' ],
1767 'selectors' => [
1768 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1769 ],
1770 ]
1771 );
1772
1773 $this->add_control(
1774 'better_payment_form_sidebar_text_amount_summary_style',
1775 [
1776 'label' => __( 'Amount Summary', 'better-payment' ),
1777 'type' => Controls_Manager::HEADING,
1778 'separator' => 'before',
1779 ],
1780 );
1781
1782 $this->add_control(
1783 'better_payment_form_sidebar_text_amount_summary_color',
1784 [
1785 'label' => __( 'Color', 'better-payment' ),
1786 'type' => Controls_Manager::COLOR,
1787 'default' => '',
1788 'selectors' => [
1789 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount-summary' => 'color: {{VALUE}}',
1790 ],
1791 ]
1792 );
1793
1794 $this->add_group_control(
1795 Group_Control_Typography::get_type(),
1796 [
1797 'name' => 'better_payment_form_sidebar_text_amount_summary_typography',
1798 'label' => __( 'Typography', 'better-payment' ),
1799 'selector' => '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount-summary',
1800 ]
1801 );
1802
1803 $this->add_responsive_control(
1804 'better_payment_form_sidebar_text_amount_summary_margin',
1805 [
1806 'label' => esc_html__( 'Margin', 'better-payment' ),
1807 'type' => Controls_Manager::DIMENSIONS,
1808 'size_units' => [ 'px', 'em', '%' ],
1809 'selectors' => [
1810 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount-summary' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1811 ],
1812 ]
1813 );
1814
1815 $this->add_responsive_control(
1816 'better_payment_form_sidebar_text_amount_summary_padding',
1817 [
1818 'label' => esc_html__( 'Padding', 'better-payment' ),
1819 'type' => Controls_Manager::DIMENSIONS,
1820 'size_units' => [ 'px', 'em', '%' ],
1821 'selectors' => [
1822 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount-summary' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1823 ],
1824 ]
1825 );
1826
1827 $this->add_control(
1828 'better_payment_form_sidebar_text_icon_style',
1829 [
1830 'label' => __( 'Icon', 'better-payment' ),
1831 'type' => Controls_Manager::HEADING,
1832 'separator' => 'before',
1833 ],
1834 );
1835
1836 $this->add_control(
1837 'better_payment_form_sidebar_text_icon_color',
1838 [
1839 'label' => __( 'Color', 'better-payment' ),
1840 'type' => Controls_Manager::COLOR,
1841 'default' => '',
1842 'selectors' => [
1843 '{{WRAPPER}} .bp-dynamic-amount-section-icon:before' => 'color: {{VALUE}}',
1844 ],
1845 'condition' => [
1846 'better_payment_form_layout!' => 'layout-1',
1847 ],
1848 ]
1849 );
1850
1851 $this->add_responsive_control(
1852 'better_payment_form_sidebar_text_icon_font_size',
1853 [
1854 'label' => esc_html__( 'Font Size', 'better-payment' ),
1855 'type' => Controls_Manager::SLIDER,
1856 'size_units' => [ 'px', 'em', '%' ],
1857 'range' => [
1858 'px' => [
1859 'min' => 10,
1860 'max' => 100,
1861 ],
1862 'em' => [
1863 'min' => 1,
1864 'max' => 50,
1865 ],
1866 ],
1867 'selectors' => [
1868 '{{WRAPPER}} .bp-dynamic-amount-section-icon:before' => 'font-size: {{SIZE}}{{UNIT}};',
1869 ],
1870 'condition' => [
1871 'better_payment_form_layout!' => 'layout-1',
1872 ],
1873 ]
1874 );
1875
1876 $this->add_responsive_control(
1877 'better_payment_form_sidebar_text_icon_margin',
1878 [
1879 'label' => esc_html__( 'Margin', 'better-payment' ),
1880 'type' => Controls_Manager::DIMENSIONS,
1881 'size_units' => [ 'px', 'em', '%' ],
1882 'selectors' => [
1883 '{{WRAPPER}} .bp-dynamic-amount-section-icon-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1884 ],
1885 'condition' => [
1886 'better_payment_form_layout!' => 'layout-1',
1887 ],
1888 ]
1889 );
1890
1891 $this->add_responsive_control(
1892 'better_payment_form_sidebar_text_icon_padding',
1893 [
1894 'label' => esc_html__( 'Padding', 'better-payment' ),
1895 'type' => Controls_Manager::DIMENSIONS,
1896 'size_units' => [ 'px', 'em', '%' ],
1897 'selectors' => [
1898 '{{WRAPPER}} .bp-dynamic-amount-section-icon-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1899 ],
1900 'condition' => [
1901 'better_payment_form_layout!' => 'layout-1',
1902 ],
1903 ]
1904 );
1905
1906 $this->end_controls_section();
1907 }
1908
1909 public function form_container_style() {
1910 $this->start_controls_section(
1911 'better_payment_form_container_style',
1912 [
1913 'label' => esc_html__( 'Form Container Style', 'better-payment' ),
1914 'tab' => Controls_Manager::TAB_STYLE,
1915 ]
1916 );
1917
1918 $this->add_group_control(
1919 Group_Control_Background::get_type(),
1920 [
1921 'name' => 'better_payment_form_container_background',
1922 'types' => [ 'classic', 'gradient' ],
1923 'selector' => '{{WRAPPER}} .better-payment .form-content-section',
1924 ]
1925 );
1926
1927 $this->add_responsive_control(
1928 'better_payment_form_container_margin',
1929 [
1930 'label' => esc_html__( 'Margin', 'better-payment' ),
1931 'type' => Controls_Manager::DIMENSIONS,
1932 'size_units' => [ 'px', 'em', '%' ],
1933 'selectors' => [
1934 '{{WRAPPER}} .better-payment .form-content-section' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1935 ],
1936 ]
1937 );
1938
1939 $this->add_responsive_control(
1940 'better_payment_form_container_padding',
1941 [
1942 'label' => esc_html__( 'Padding', 'better-payment' ),
1943 'type' => Controls_Manager::DIMENSIONS,
1944 'size_units' => [ 'px', 'em', '%' ],
1945 'selectors' => [
1946 '{{WRAPPER}} .better-payment .form-content-section-inner.p-6' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
1947 ],
1948 ]
1949 );
1950
1951 $this->add_control(
1952 'better_payment_form_container_border_radius',
1953 [
1954 'label' => esc_html__( 'Border Radius', 'better-payment' ),
1955 'type' => Controls_Manager::DIMENSIONS,
1956 'separator' => 'before',
1957 'size_units' => [ 'px' ],
1958 'selectors' => [
1959 '{{WRAPPER}} .better-payment .form-content-section' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1960 ],
1961 ]
1962 );
1963
1964 $this->add_group_control(
1965 Group_Control_Border::get_type(),
1966 [
1967 'name' => 'better_payment_form_container_border',
1968 'selector' => '{{WRAPPER}} .better-payment .form-content-section',
1969 ]
1970 );
1971
1972 $this->add_group_control(
1973 Group_Control_Box_Shadow::get_type(),
1974 [
1975 'name' => 'better_payment_form_container_box_shadow',
1976 'selector' => '{{WRAPPER}} .better-payment .form-content-section',
1977 ]
1978 );
1979
1980 $this->end_controls_section();
1981 }
1982
1983 public function form_fields_style() {
1984 $this->start_controls_section(
1985 'better_payment_form_fields_style',
1986 [
1987 'label' => esc_html__( 'Form Fields Style', 'better-payment' ),
1988 'tab' => Controls_Manager::TAB_STYLE,
1989 ]
1990 );
1991
1992 $this->add_control(
1993 'better_payment_form_fields_input_bg',
1994 [
1995 'label' => __( 'Background Color', 'better-payment' ),
1996 'type' => Controls_Manager::COLOR,
1997 'default' => '',
1998 'selectors' => [
1999 '{{WRAPPER}} .better-payment .form-content-section input' => 'background-color: {{VALUE}}',
2000 ],
2001 ]
2002 );
2003
2004 $this->add_control(
2005 'better_payment_form_fields_input_text_color',
2006 [
2007 'label' => __( 'Text Color', 'better-payment' ),
2008 'type' => Controls_Manager::COLOR,
2009 'default' => '',
2010 'selectors' => [
2011 '{{WRAPPER}} .better-payment .form-content-section input' => 'color: {{VALUE}}',
2012 '{{WRAPPER}} .better-payment .form-content-section .payment-method-checkbox' => 'color: {{VALUE}}',
2013 ],
2014 ]
2015 );
2016
2017 $this->add_control(
2018 'better_payment_form_fields_input_placeholder_color',
2019 [
2020 'label' => __( 'Placeholder Color', 'better-payment' ),
2021 'type' => Controls_Manager::COLOR,
2022 'default' => '',
2023 'selectors' => [
2024 '{{WRAPPER}} .better-payment .form-content-section input::placeholder' => 'color: {{VALUE}}',
2025 ],
2026 ]
2027 );
2028
2029 $this->add_responsive_control(
2030 'better_payment_form_fields_input_spacing',
2031 [
2032 'label' => __( 'Spacing', 'better-payment' ),
2033 'type' => Controls_Manager::SLIDER,
2034 'default' => [
2035 'size' => '0',
2036 'unit' => 'px',
2037 ],
2038 'range' => [
2039 'px' => [
2040 'min' => 0,
2041 'max' => 100,
2042 'step' => 1,
2043 ],
2044 ],
2045 'size_units' => [ 'px', 'em', '%' ],
2046 'selectors' => [
2047 '{{WRAPPER}} .better-payment .form-content-section input' => 'margin-bottom: {{SIZE}}{{UNIT}}',
2048 ],
2049 ]
2050 );
2051
2052 $this->add_responsive_control(
2053 'better_payment_form_fields_input_padding',
2054 [
2055 'label' => __( 'Padding', 'better-payment' ),
2056 'type' => Controls_Manager::DIMENSIONS,
2057 'size_units' => [ 'px', 'em', '%' ],
2058 'selectors' => [
2059 '{{WRAPPER}} .better-payment .form-content-section input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2060 ],
2061 ]
2062 );
2063
2064 $this->add_responsive_control(
2065 'better_payment_form_fields_input_text_indent',
2066 [
2067 'label' => __( 'Text Indent', 'better-payment' ),
2068 'type' => Controls_Manager::SLIDER,
2069 'range' => [
2070 'px' => [
2071 'min' => 0,
2072 'max' => 60,
2073 'step' => 1,
2074 ],
2075 '%' => [
2076 'min' => 0,
2077 'max' => 30,
2078 'step' => 1,
2079 ],
2080 ],
2081 'size_units' => [ 'px', 'em', '%' ],
2082 'selectors' => [
2083 '{{WRAPPER}} .form-content-section input' => 'text-indent: {{SIZE}}{{UNIT}}',
2084 ],
2085 ]
2086 );
2087
2088 $this->add_responsive_control(
2089 'better_payment_form_fields_input_width',
2090 [
2091 'label' => __( 'Input Width', 'better-payment' ),
2092 'type' => Controls_Manager::SLIDER,
2093 'range' => [
2094 'px' => [
2095 'min' => 0,
2096 'max' => 1200,
2097 'step' => 1,
2098 ],
2099 ],
2100 'size_units' => [ 'px', 'em', '%' ],
2101 'description' => __( 'Set width for all input fields. Not applicable if the field is set to display inline (<b>Content => Form Settings => Form Fields (Repeater) => Display Inline?</b>)', 'better-payment' ),
2102 'selectors' => [
2103 '{{WRAPPER}} .better-payment .form-content-section input[type="text"]' => 'width: {{SIZE}}{{UNIT}}',
2104 '{{WRAPPER}} .better-payment .form-content-section input[type="email"]' => 'width: {{SIZE}}{{UNIT}}',
2105 '{{WRAPPER}} .better-payment .form-content-section input[type="number"]' => 'width: {{SIZE}}{{UNIT}}',
2106 ],
2107 ]
2108 );
2109
2110 $this->add_responsive_control(
2111 'better_payment_form_fields_input_height',
2112 [
2113 'label' => __( 'Input Height', 'better-payment' ),
2114 'type' => Controls_Manager::SLIDER,
2115 'range' => [
2116 'px' => [
2117 'min' => 0,
2118 'max' => 1200,
2119 'step' => 1,
2120 ],
2121 ],
2122 'size_units' => [ 'px', 'em', '%' ],
2123 'selectors' => [
2124 '{{WRAPPER}} .better-payment .form-content-section input[type="text"]' => 'height: {{SIZE}}{{UNIT}}',
2125 '{{WRAPPER}} .better-payment .form-content-section input[type="email"]' => 'height: {{SIZE}}{{UNIT}}',
2126 '{{WRAPPER}} .better-payment .form-content-section input[type="number"]' => 'height: {{SIZE}}{{UNIT}}',
2127 ],
2128 ]
2129 );
2130
2131 $this->add_group_control(
2132 Group_Control_Border::get_type(),
2133 [
2134 'name' => 'better_payment_form_fields_input_border',
2135 'label' => __( 'Border', 'better-payment' ),
2136 'placeholder' => '1px',
2137 'default' => '1px',
2138 'selector' => '{{WRAPPER}} .better-payment .form-content-section input',
2139 ]
2140 );
2141
2142 $this->add_control(
2143 'better_payment_form_fields_input_radius',
2144 [
2145 'label' => __( 'Border Radius', 'better-payment' ),
2146 'type' => Controls_Manager::DIMENSIONS,
2147 'size_units' => [ 'px', 'em', '%' ],
2148 'selectors' => [
2149 '{{WRAPPER}} .better-payment .form-content-section input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2150 ],
2151 'separator' => 'after',
2152 ]
2153 );
2154
2155 $this->add_group_control(
2156 Group_Control_Typography::get_type(),
2157 [
2158 'name' => 'better_payment_form_fields_input_typography',
2159 'label' => __( 'Typography', 'better-payment' ),
2160 'selector' => '{{WRAPPER}} .better-payment .form-content-section input',
2161 ]
2162 );
2163
2164 $this->add_group_control(
2165 Group_Control_Box_Shadow::get_type(),
2166 [
2167 'name' => 'better_payment_form_fields_input_box_shadow',
2168 'selector' => '{{WRAPPER}} .better-payment .form-content-section input',
2169 ]
2170 );
2171
2172 $this->end_controls_section();
2173 }
2174
2175 public function form_fields_amount_style() {
2176
2177 $this->start_controls_section(
2178 'better_payment_form_fields_amount_style',
2179 [
2180 'label' => __( 'Amount Fields Style', 'better-payment' ),
2181 'tab' => Controls_Manager::TAB_STYLE,
2182 ]
2183 );
2184
2185 $this->add_responsive_control(
2186 'better_payment_form_fields_amount_width',
2187 [
2188 'label' => __( 'Input Width', 'better-payment' ),
2189 'type' => Controls_Manager::SLIDER,
2190 'range' => [
2191 'px' => [
2192 'min' => 0,
2193 'max' => 1200,
2194 'step' => 1,
2195 ],
2196 ],
2197 'size_units' => [ 'px', 'em', '%' ],
2198 'selectors' => [
2199 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'width: {{SIZE}}{{UNIT}}',
2200 ],
2201 ]
2202 );
2203
2204 $this->add_responsive_control(
2205 'better_payment_form_fields_amount_height',
2206 [
2207 'label' => __( 'Input Height', 'better-payment' ),
2208 'type' => Controls_Manager::SLIDER,
2209 'range' => [
2210 'px' => [
2211 'min' => 0,
2212 'max' => 1200,
2213 'step' => 1,
2214 ],
2215 ],
2216 'size_units' => [ 'px', 'em', '%' ],
2217 'selectors' => [
2218 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'height: {{SIZE}}{{UNIT}}',
2219 ],
2220 ]
2221 );
2222
2223 $this->add_responsive_control(
2224 'better_payment_form_fields_amount_spacing',
2225 [
2226 'label' => __( 'Spacing', 'better-payment' ),
2227 'type' => Controls_Manager::SLIDER,
2228 'default' => [
2229 'size' => '0',
2230 'unit' => 'px',
2231 ],
2232 'range' => [
2233 'px' => [
2234 'min' => 0,
2235 'max' => 100,
2236 'step' => 1,
2237 ],
2238 ],
2239 'size_units' => [ 'px', 'em', '%' ],
2240 'selectors' => [
2241 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'margin-bottom: {{SIZE}}{{UNIT}}',
2242 ],
2243 ]
2244 );
2245
2246 $this->start_controls_tabs( 'better_payment_form_amount_tabs_button_style' );
2247
2248 $this->start_controls_tab(
2249 'better_payment_form_fields_amount_normal',
2250 [
2251 'label' => __( 'Normal', 'better-payment' ),
2252 ]
2253 );
2254
2255 $this->add_control(
2256 'better_payment_form_fields_amount_normal_bg',
2257 [
2258 'label' => __( 'Background Color', 'better-payment' ),
2259 'type' => Controls_Manager::COLOR,
2260 'default' => '',
2261 'selectors' => [
2262 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'background-color: {{VALUE}}',
2263 ],
2264 ]
2265 );
2266
2267 $this->add_control(
2268 'better_payment_form_fields_amount_normal_text_color',
2269 [
2270 'label' => __( 'Text Color', 'better-payment' ),
2271 'type' => Controls_Manager::COLOR,
2272 'default' => '',
2273 'selectors' => [
2274 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'color: {{VALUE}}',
2275 ],
2276 ]
2277 );
2278
2279 $this->end_controls_tab();
2280
2281 $this->start_controls_tab(
2282 'better_payment_form_fields_amount_selected',
2283 [
2284 'label' => __( 'Selected', 'better-payment' ),
2285 ]
2286 );
2287
2288 $this->add_control(
2289 'better_payment_form_fields_amount_selected_bg',
2290 [
2291 'label' => __( 'Background Color', 'better-payment' ),
2292 'type' => Controls_Manager::COLOR,
2293 'default' => '',
2294 'selectors' => [
2295 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type="radio"].bp-form__control:checked ~ label' => 'background-color: {{VALUE}}',
2296 ],
2297 ]
2298 );
2299
2300 $this->add_control(
2301 'better_payment_form_fields_amount_selected_text_color',
2302 [
2303 'label' => __( 'Text Color', 'better-payment' ),
2304 'type' => Controls_Manager::COLOR,
2305 'default' => '',
2306 'selectors' => [
2307 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type="radio"].bp-form__control:checked ~ label' => 'color: {{VALUE}}',
2308 ]
2309 ]
2310 );
2311
2312 $this->end_controls_tab();
2313
2314 $this->end_controls_tabs();
2315
2316 $this->add_group_control(
2317 Group_Control_Border::get_type(),
2318 [
2319 'name' => 'better_payment_form_fields_amount_border',
2320 'label' => __( 'Border', 'better-payment' ),
2321 'placeholder' => '1px',
2322 'default' => '1px',
2323 'selector' => '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label',
2324 'separator' => 'before',
2325 ]
2326 );
2327
2328 $this->add_control(
2329 'better_payment_form_fields_amount_border_radius',
2330 [
2331 'label' => __( 'Border Radius', 'better-payment' ),
2332 'type' => Controls_Manager::DIMENSIONS,
2333 'size_units' => [ 'px', 'em', '%' ],
2334 'selectors' => [
2335 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2336 ],
2337 ]
2338 );
2339
2340 $this->add_group_control(
2341 Group_Control_Typography::get_type(),
2342 [
2343 'name' => 'better_payment_form_fields_amount_typography',
2344 'label' => __( 'Typography', 'better-payment' ),
2345 'selector' => '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label',
2346 'separator' => 'before',
2347 ]
2348 );
2349
2350 $this->add_group_control(
2351 Group_Control_Box_Shadow::get_type(),
2352 [
2353 'name' => 'better_payment_form_fields_amount_box_shadow',
2354 'selector' => '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label',
2355 ]
2356 );
2357
2358 $this->end_controls_section();
2359 }
2360
2361 public function form_button_style() {
2362 $this->start_controls_section(
2363 'better_payment_form_button_style',
2364 [
2365 'label' => __( 'Form Button Style', 'better-payment' ),
2366 'tab' => Controls_Manager::TAB_STYLE,
2367 ]
2368 );
2369
2370 $this->add_responsive_control(
2371 'better_payment_form_button_width',
2372 [
2373 'label' => __( 'Width', 'better-payment' ),
2374 'type' => Controls_Manager::SLIDER,
2375 'range' => [
2376 'px' => [
2377 'min' => 0,
2378 'max' => 700,
2379 'step' => 1,
2380 ],
2381 ],
2382 'size_units' => [ 'px', 'em', '%' ],
2383 'selectors' => [
2384 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'flex: none;width: {{SIZE}}{{UNIT}}',
2385 ],
2386 ]
2387 );
2388
2389 $this->start_controls_tabs( 'better_payment_form_button_tabs_style' );
2390
2391 $this->start_controls_tab(
2392 'better_payment_form_button_normal',
2393 [
2394 'label' => __( 'Normal', 'better-payment' ),
2395 ]
2396 );
2397
2398 $this->add_control(
2399 'better_payment_form_button_normal_bg',
2400 [
2401 'label' => __( 'Background Color', 'better-payment' ),
2402 'type' => Controls_Manager::COLOR,
2403 'default' => '',
2404 'selectors' => [
2405 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'background-color: {{VALUE}} !important',
2406 ],
2407 ]
2408 );
2409
2410 $this->add_control(
2411 'better_payment_form_button_normal_text_color',
2412 [
2413 'label' => __( 'Text Color', 'better-payment' ),
2414 'type' => Controls_Manager::COLOR,
2415 'default' => '',
2416 'selectors' => [
2417 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'color: {{VALUE}} !important',
2418 ],
2419 ]
2420 );
2421
2422 $this->add_group_control(
2423 Group_Control_Border::get_type(),
2424 [
2425 'name' => 'better_payment_form_button_normal_border',
2426 'label' => __( 'Border', 'better-payment' ),
2427 'default' => '1px',
2428 'selector' => '{{WRAPPER}} .better-payment .payment-form-layout .button',
2429 ]
2430 );
2431
2432 $this->add_control(
2433 'better_payment_form_button_normal_border_radius',
2434 [
2435 'label' => __( 'Border Radius', 'better-payment' ),
2436 'type' => Controls_Manager::DIMENSIONS,
2437 'size_units' => [ 'px', 'em', '%' ],
2438 'selectors' => [
2439 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2440 ],
2441 ]
2442 );
2443
2444 $this->add_responsive_control(
2445 'better_payment_form_button_normal_padding',
2446 [
2447 'label' => __( 'Padding', 'better-payment' ),
2448 'type' => Controls_Manager::DIMENSIONS,
2449 'size_units' => [ 'px', 'em', '%' ],
2450 'selectors' => [
2451 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2452 ],
2453 ]
2454 );
2455
2456 $this->add_responsive_control(
2457 'better_payment_form_button_normal_margin',
2458 [
2459 'label' => __( 'Margin Top', 'better-payment' ),
2460 'type' => Controls_Manager::SLIDER,
2461 'range' => [
2462 'px' => [
2463 'min' => 0,
2464 'max' => 100,
2465 'step' => 1,
2466 ],
2467 ],
2468 'size_units' => [ 'px', 'em', '%' ],
2469 'selectors' => [
2470 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'margin-top: {{SIZE}}{{UNIT}}',
2471 ],
2472 ]
2473 );
2474
2475 $this->add_group_control(
2476 Group_Control_Typography::get_type(),
2477 [
2478 'name' => 'better_payment_form_button_normal_typography',
2479 'label' => __( 'Typography', 'better-payment' ),
2480 'selector' => '{{WRAPPER}} .better-payment .payment-form-layout .button',
2481 'separator' => 'before',
2482 ]
2483 );
2484
2485 $this->add_group_control(
2486 Group_Control_Box_Shadow::get_type(),
2487 [
2488 'name' => 'better_payment_form_button_normal_box_shadow',
2489 'selector' => '{{WRAPPER}} .better-payment .payment-form-layout .button',
2490 ]
2491 );
2492
2493 $this->end_controls_tab();
2494
2495 $this->start_controls_tab(
2496 'better_payment_form_button_hover',
2497 [
2498 'label' => __( 'Hover', 'better-payment' ),
2499 ]
2500 );
2501
2502 $this->add_control(
2503 'better_payment_form_button_hover_bg',
2504 [
2505 'label' => __( 'Background Color', 'better-payment' ),
2506 'type' => Controls_Manager::COLOR,
2507 'default' => '',
2508 'selectors' => [
2509 '{{WRAPPER}} .better-payment .payment-form-layout .button:hover' => 'background-color: {{VALUE}} !important',
2510 '{{WRAPPER}} .better-payment .payment-form-layout.payment-form-layout-3 .button:hover' => 'background-color: {{VALUE}} !important',
2511 ],
2512 ]
2513 );
2514
2515 $this->add_control(
2516 'better_payment_form_button_hover_text_color',
2517 [
2518 'label' => __( 'Text Color', 'better-payment' ),
2519 'type' => Controls_Manager::COLOR,
2520 'default' => '',
2521 'selectors' => [
2522 '{{WRAPPER}} .better-payment .payment-form-layout .button:hover' => 'color: {{VALUE}} !important',
2523 '{{WRAPPER}} .better-payment .payment-form-layout.payment-form-layout-3 .button:hover' => 'color: {{VALUE}} !important',
2524 ],
2525 ]
2526 );
2527
2528 $this->add_control(
2529 'better_payment_form_button_hover_border',
2530 [
2531 'label' => __( 'Border Color', 'better-payment' ),
2532 'type' => Controls_Manager::COLOR,
2533 'default' => '',
2534 'selectors' => [
2535 '{{WRAPPER}} .better-payment .payment-form-layout .button:hover' => 'border-color: {{VALUE}}',
2536 ],
2537 ]
2538 );
2539
2540 $this->end_controls_tab();
2541
2542 $this->end_controls_tabs();
2543
2544 $this->end_controls_section();
2545 }
2546
2547 /**
2548 * Render the widget output on the frontend.
2549 *
2550 * @since 1.0.0
2551 */
2552 protected function render() {
2553
2554 $settings = $this->get_settings_for_display();
2555
2556 if ( $settings[ 'better_payment_form_paypal_enable' ] != 'yes' && $settings[ 'better_payment_form_stripe_enable' ] != 'yes' && $settings[ 'better_payment_form_paystack_enable' ] != 'yes' ) {
2557 return false;
2558 }
2559
2560 $payment_field = "number" ;
2561
2562 $response = Better_Payment_Handler::manage_response( $settings, $this->get_id() );
2563 if ( $response ) {
2564 return false;
2565 }
2566
2567 wp_enqueue_script( 'better-payment' );
2568
2569 $action = esc_url( admin_url( 'admin-post.php' ) );
2570 $setting_meta = wp_json_encode( [
2571 'page_id' => get_the_ID(),
2572 'widget_id' => esc_attr( $this->get_id() ),
2573 ] );
2574
2575 $better_payment_placeholder_class = '';
2576 if ( !empty($settings[ 'better_payment_placeholder_switch' ]) && $settings[ 'better_payment_placeholder_switch' ] != 'yes' ) {
2577 $better_payment_placeholder_class = 'better-payment-hide-placeholder';
2578 }
2579
2580 $data = array(
2581 'payment_field' => $payment_field,
2582 'action' => $action,
2583 'setting_meta' => $setting_meta,
2584 'better_payment_placeholder_class' => $better_payment_placeholder_class,
2585 );
2586
2587 $widgetObj = $this;
2588 $extraDatas = $data;
2589
2590 $better_payment_form_layout = sanitize_text_field($settings[ 'better_payment_form_layout' ]);
2591 $better_payment_form_layout = in_array($better_payment_form_layout, $this->better_payment_free_layouts()) ? $better_payment_form_layout : 'layout-1';
2592
2593 $template_file = BETTER_PAYMENT_ADMIN_VIEWS_PATH . '/elementor/layouts/' . $better_payment_form_layout . '.php';
2594 $better_payment_form_content = '';
2595
2596 if ( file_exists($template_file) ) {
2597 ob_start();
2598 include $template_file;
2599 $better_payment_form_content = ob_get_contents();
2600 ob_end_clean();
2601 }
2602
2603 $better_payment_form_content = apply_filters( 'better_payment/elementor/editor/get_layout_content', $better_payment_form_content, $settings, $this, $data );
2604
2605 echo $better_payment_form_content;
2606 }
2607
2608 /**
2609 * Render amount element
2610 *
2611 * @since 0.0.1
2612 */
2613 public function render_amount_element( $settings ) {
2614 $layout_form_currency_symbol = Better_Payment_Handler::get_currency_symbols( esc_html($settings[ 'better_payment_form_currency' ]) );
2615 $currency_alignment = ! empty ( $settings['better_payment_form_currency_alignment'] ) ? $settings['better_payment_form_currency_alignment'] : 'left';
2616 $layout_form_currency_left = 'left' === $currency_alignment ? $layout_form_currency_symbol : '';
2617 $layout_form_currency_right = 'right' === $currency_alignment ? $layout_form_currency_symbol : '' ;
2618
2619 $id = esc_attr( $this->get_id() );
2620 ?>
2621 <!-- <div class="pt-5"> -->
2622 <?php
2623 foreach ( $settings[ 'better_payment_amount' ] as $item ) {
2624 $uid = uniqid();
2625 ?>
2626 <div class="bp-form__group pt-5">
2627 <input type="radio" value="<?php echo floatval( $item[ 'better_payment_amount_val' ] ); ?>"
2628 id="bp_payment_amount-<?php echo esc_attr($uid); ?>" class="bp-form__control bp-form_pay-radio "
2629 name="primary_payment_amount_radio">
2630 <label for="bp_payment_amount-<?php echo esc_attr($uid); ?>"><?php printf( "%s%s%s", esc_html( $layout_form_currency_left ), floatval( $item[ 'better_payment_amount_val' ] ), esc_html( $layout_form_currency_right ) ); ?></label>
2631 </div>
2632 <?php
2633 }
2634 ?>
2635 <!-- </div> -->
2636 <?php
2637 }
2638
2639 public function better_payment_free_layouts(){
2640 return [
2641 'layout-1',
2642 'layout-2',
2643 'layout-3',
2644 ];
2645 }
2646
2647 }
2648