PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 2.4.0
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v2.4.0
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 2.4.0, at includes/Admin/Elementor/Better_Payment_Widget.php

3,896 lines 173.6 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\DB;
6 use Better_Payment\Lite\Classes\Handler;
7 use Better_Payment\Lite\Classes\Helper as ClassesHelper;
8 use Better_Payment\Lite\Classes\ProCompatibility;
9 use Better_Payment\Lite\Classes\ProPaymentFormControls;
10 use Better_Payment\Lite\Classes\ProPaymentFormLayouts;
11 use Better_Payment\Lite\Traits\Helper as TraitsHelper;
12 use \Elementor\Controls_Manager as Controls_Manager;
13 use Elementor\Core\Kits\Documents\Tabs\Global_Typography;
14 use Elementor\Group_Control_Background;
15 use Elementor\Group_Control_Border;
16 use Elementor\Group_Control_Box_Shadow;
17 use Elementor\Group_Control_Typography;
18 use Elementor\Plugin;
19 use \Elementor\Repeater;
20 use Elementor\Utils;
21 use \Elementor\Widget_Base as Widget_Base;
22
23 /**
24 * Exit if accessed directly
25 */
26 if (!defined('ABSPATH')) {
27 exit;
28 }
29
30 /**
31 * The elementor widget class
32 *
33 * @since 0.0.1
34 */
35 class Better_Payment_Widget extends Widget_Base {
36
37 use TraitsHelper;
38
39 private $better_payment_global_settings = [];
40
41 /**
42 * @var mixed|void
43 */
44 protected $pro_enabled;
45
46 /**
47 * Login_Register constructor.
48 * Initializing the Login_Register widget class.
49 * @inheritDoc
50 */
51 public function __construct( $data = [], $args = null ) {
52 parent::__construct( $data, $args );
53 $this->pro_enabled = apply_filters( 'better_payment/pro_enabled', false );
54
55 }
56
57 public function get_name() {
58 return 'better-payment';
59 }
60
61 public function get_title() {
62 return esc_html__( 'Payment Form', 'better-payment' );
63 }
64
65 public function get_icon() {
66 return 'bp-icon bp-payment-form';
67 }
68
69 public function get_categories() {
70 return ['better-payment'];
71 }
72
73 public function get_keywords() {
74 return [
75 'payment', 'better-payment', 'paypal', 'stripe', 'sell', 'donate', 'transaction', 'online-transaction', 'paystack', 'better payment'
76 ];
77 }
78
79 public function get_custom_help_url()
80 {
81 return 'https://betterpayment.co/docs/';
82 }
83
84 public function get_style_depends() {
85 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' ] );
86 }
87
88 public function get_script_depends() {
89 return apply_filters( 'better_payment/elementor/editor/get_script_depends', [ 'better-payment-common-script', 'better-payment' ] );
90 }
91
92 protected function register_controls() {
93 $this->better_payment_global_settings = DB::get_settings();
94
95 $is_edit_mode = Plugin::instance()->editor->is_edit_mode();
96
97 if ( $is_edit_mode && ( ! current_user_can('manage_options') ) ) {
98 $this->better_payment_global_settings = [];
99 }
100
101 $this->start_controls_section(
102 'better_payment_form_setting',
103 [
104 'label' => esc_html__( 'Payment Settings', 'better-payment' ),
105 ]
106 );
107
108 do_action('better_payment/elementor/editor/layouts_payment_settings_section', $this);
109
110 $this->add_control(
111 'better_payment_form_layout',
112 [
113 'label' => esc_html__( 'Form Layout', 'better-payment' ),
114 'type' => Controls_Manager::SELECT,
115 'default' => 'layout-1',
116 'options' => $this->better_payment_free_layouts(),
117 ]
118 );
119
120 if ( $this->lite_registers_pro_layout_controls() ) {
121 ProPaymentFormControls::payment_controls( $this );
122 }
123 do_action( 'better_payment/elementor/editor/pro_layout_payment_controls', $this );
124
125 $this->add_control(
126 'better_payment_form_payment_source',
127 [
128 'label' => esc_html__( 'Payment Source', 'better-payment' ),
129 'type' => Controls_Manager::SELECT,
130 'default' => 'manual',
131 'options' => [
132 'manual' => 'Manual',
133 'woocommerce' => 'WooCommerce',
134 'fluentcart' => 'FluentCart',
135 'stripe' => 'Stripe Product',
136 ],
137 'condition' => [
138 'better_payment_form_layout!' => ['layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
139 ],
140 ]
141 );
142
143 $this->add_control( 'better_payment_form_payment_source_stripe_price_id', [
144 'label' => __( 'Default Price ID', 'better-payment' ),
145 'description' => sprintf(
146 __( '<p>Create a product from Stripe dashboard and <a href="%1$s" target="_blank">get the (default) price id.</a></p> <p>For coupons, create a <a href="%2$s" target="_blank">promotion code</a> and share its code, or tag a coupon with the metadata <code>better_payment_public</code> = <code>yes</code> to accept its ID. Make sure they are global or product independent.</p>', 'better-payment' ),
147 esc_url('//betterpayment.co/docs/retrieve-price-id-for-recurring-payments/'),
148 esc_url('//docs.stripe.com/payments/checkout/discounts')
149 ),
150 'type' => Controls_Manager::TEXT,
151 'placeholder' => 'price_G0FvDp6vZvdwRZ',
152 'label_block' => true,
153 'ai' => [
154 'active' => false,
155 ],
156 'condition' => [
157 'better_payment_form_payment_source' => 'stripe',
158 'better_payment_form_layout!' => ['layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
159 ],
160 ] );
161
162 $this->add_control( 'better_payment_form_payment_source_notice', [
163 'type' => Controls_Manager::RAW_HTML,
164 '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') ),
165 'content_classes' => 'better-payment-warning',
166 // Layout 6 (Pro) has its own notice, registered with its product controls.
167 'conditions' => [
168 'relation' => 'and',
169 'terms' => [
170 [
171 'name' => 'better_payment_form_layout',
172 'operator' => '!=',
173 'value' => 'layout-4-pro',
174 ],
175 [
176 'name' => 'better_payment_form_layout',
177 'operator' => '!=',
178 'value' => 'layout-5-pro',
179 ],
180 [
181 'name' => 'better_payment_form_layout',
182 'operator' => '!=',
183 'value' => 'layout-6-pro',
184 ],
185 [
186 'name' => 'better_payment_form_payment_source',
187 'value' => 'woocommerce' . ( ! class_exists('woocommerce') ? '' : 'exist' ),
188 ],
189 ],
190 ],
191 ] );
192
193 $this->add_control(
194 'better_payment_form_woocommerce_product_section',
195 [
196 'label' => __( 'Product', 'better-payment' ),
197 'type' => Controls_Manager::HIDDEN,
198 'condition' => [
199 'better_payment_form_payment_source' => 'woocommerce',
200 ],
201 ]
202 );
203
204 $this->add_control( "better_payment_form_woocommerce_product_id", [
205 'label' => __( 'Choose a Product', 'better-payment' ),
206 'description' => __( 'Enter Product IDs separated by a comma', 'better-payment' ),
207 'type' => 'better-payment-select2',
208 'label_block' => true,
209 'multiple' => false,
210 'source_name' => 'post_type',
211 'source_type' => 'product',
212 'placeholder' => __( 'Search By', 'better-payment' ),
213 'conditions' => $this->payment_source_woo_conditions(),
214 'separator' => 'after',
215 'dynamic' => [
216 'active' => false,
217 ],
218 'condition' => [
219 'better_payment_form_layout' => ['layout-1', 'layout-2', 'layout-3'],
220 ],
221 ] );
222
223 if ( $this->lite_registers_pro_layout_controls() ) {
224 ProPaymentFormControls::product_controls( $this );
225 }
226 do_action( 'better_payment/elementor/editor/pro_layout_product_controls', $this );
227
228 $this->add_control( 'better_payment_form_payment_source_fluentcart_notice', [
229 'type' => Controls_Manager::RAW_HTML,
230 'raw' => sprintf( __( '<a href="%1$s" target="_blank"><strong>FluentCart</strong></a> is not installed/activated on your site. Please install and activate <a href="%1$s" target="_blank"><strong>FluentCart</strong></a> first.', 'better-payment' ), esc_url('plugin-install.php?s=fluentcart&tab=search&type=term') ),
231 'content_classes' => 'better-payment-warning',
232 // Layout 6 (Pro) has its own notice, registered with its product controls.
233 'conditions' => [
234 'relation' => 'and',
235 'terms' => [
236 [
237 'name' => 'better_payment_form_layout',
238 'operator' => '!=',
239 'value' => 'layout-4-pro',
240 ],
241 [
242 'name' => 'better_payment_form_layout',
243 'operator' => '!=',
244 'value' => 'layout-5-pro',
245 ],
246 [
247 'name' => 'better_payment_form_layout',
248 'operator' => '!=',
249 'value' => 'layout-6-pro',
250 ],
251 [
252 'name' => 'better_payment_form_payment_source',
253 'value' => 'fluentcart' . ( ! function_exists('fluentCart') ? '' : 'exist' ),
254 ],
255 ],
256 ],
257 ] );
258
259 $this->add_control( "better_payment_form_fluentcart_product_id", [
260 'label' => __( 'Choose a FluentCart Product', 'better-payment' ),
261 'type' => 'better-payment-select2',
262 'label_block' => true,
263 'multiple' => false,
264 'source_name' => 'post_type',
265 'source_type' => 'fluent-products',
266 'conditions' => $this->payment_source_fluentcart_conditions(),
267 'separator' => 'after',
268 'dynamic' => [
269 'active' => false,
270 ],
271 'condition' => [
272 'better_payment_form_layout' => ['layout-1', 'layout-2', 'layout-3'],
273 ],
274 ] );
275
276 $this->add_control(
277 'better_payment_form_paypal_enable',
278 [
279 'label' => __( 'Enable PayPal', 'better-payment' ),
280 'type' => Controls_Manager::SWITCHER,
281 'label_on' => __( 'Yes', 'better-payment' ),
282 'label_off' => __( 'No', 'better-payment' ),
283 'return_value' => 'yes',
284 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_paypal']), //yes or no
285 'separator' => 'before',
286 'condition' => $this->pro_layout_control_condition( 'better_payment_form_paypal_enable' ),
287 ]
288 );
289
290 $this->add_control( 'better_payment_form_paypal_enable_notice', [
291 'type' => Controls_Manager::RAW_HTML,
292 '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' ) ),
293 'content_classes' => 'better-payment-warning',
294 'condition' => [
295 'better_payment_form_paypal_enable' => 'yes',
296 'better_payment_paypal_business_email' => '',
297 ],
298 ] );
299
300 $this->add_control(
301 'better_payment_form_stripe_enable',
302 [
303 'label' => __( 'Enable Stripe', 'better-payment' ),
304 'type' => Controls_Manager::SWITCHER,
305 'label_on' => __( 'Yes', 'better-payment' ),
306 'label_off' => __( 'No', 'better-payment' ),
307 'return_value' => 'yes',
308 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_stripe']), //yes or no
309 ]
310 );
311
312 $this->add_control( 'better_payment_form_stripe_enable_notice', [
313 'type' => Controls_Manager::RAW_HTML,
314 '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' ) ),
315 'content_classes' => 'better-payment-warning',
316 'conditions' => [
317 'relation' => 'and',
318 'terms' => [
319 [
320 'name' => 'better_payment_form_stripe_enable',
321 'value' => 'yes',
322 ],
323 [
324 'name' => 'better_payment_stripe_live_mode',
325 'operator' => '!==',
326 'value' => 'yes',
327 ],
328 [
329 'relation' => 'or',
330 'terms' => [
331 [
332 'name' => 'better_payment_stripe_public_key',
333 'value' => '',
334 ],
335 [
336 'name' => 'better_payment_stripe_secret_key',
337 'value' => '',
338 ],
339 ],
340 ],
341 ],
342 ],
343 ] );
344
345 $this->add_control( 'better_payment_form_stripe_enable_notice_live', [
346 'type' => Controls_Manager::RAW_HTML,
347 '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' ) ),
348 'content_classes' => 'better-payment-warning',
349 'conditions' => [
350 'relation' => 'and',
351 'terms' => [
352 [
353 'name' => 'better_payment_form_stripe_enable',
354 'value' => 'yes',
355 ],
356 [
357 'name' => 'better_payment_stripe_live_mode',
358 'value' => 'yes',
359 ],
360 [
361 'relation' => 'or',
362 'terms' => [
363 [
364 'name' => 'better_payment_stripe_public_key_live',
365 'value' => '',
366 ],
367 [
368 'name' => 'better_payment_stripe_secret_key_live',
369 'value' => '',
370 ],
371 ],
372 ],
373 ],
374 ],
375 ] );
376
377 $this->add_control(
378 'better_payment_form_paystack_enable',
379 [
380 'label' => __( 'Enable Paystack', 'better-payment' ),
381 'type' => Controls_Manager::SWITCHER,
382 'label_on' => __( 'Yes', 'better-payment' ),
383 'label_off' => __( 'No', 'better-payment' ),
384 'return_value' => 'yes',
385 '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
386 'condition' => $this->pro_layout_control_condition( 'better_payment_form_paystack_enable' ),
387 ]
388 );
389
390 $this->add_control( 'better_payment_form_paystack_enable_notice', [
391 'type' => Controls_Manager::RAW_HTML,
392 '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' ) ),
393 'content_classes' => 'better-payment-warning',
394 'conditions' => [
395 'relation' => 'and',
396 'terms' => [
397 [
398 'name' => 'better_payment_form_paystack_enable',
399 'value' => 'yes',
400 ],
401 [
402 'relation' => 'or',
403 'terms' => [
404 [
405 'name' => 'better_payment_paystack_public_key',
406 'value' => '',
407 ],
408 [
409 'name' => 'better_payment_paystack_secret_key',
410 'value' => '',
411 ],
412 ],
413 ],
414 ],
415 ],
416 ] );
417
418 $this->add_control(
419 'better_payment_form_email_enable',
420 [
421 'label' => __( 'Enable Email Notification', 'better-payment' ),
422 'type' => Controls_Manager::SWITCHER,
423 'label_on' => __( 'Yes', 'better-payment' ),
424 'label_off' => __( 'No', 'better-payment' ),
425 'return_value' => 'yes',
426 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_email']), //yes or no
427 ]
428 );
429
430 $this->add_control(
431 'better_payment_form_sidebar_show',
432 [
433 'label' => __( 'Show Sidebar', 'better-payment' ),
434 'type' => Controls_Manager::SWITCHER,
435 'label_on' => __( 'Yes', 'better-payment' ),
436 'label_off' => __( 'No', 'better-payment' ),
437 'return_value' => 'yes',
438 'default' => 'yes',
439 ]
440 );
441
442 $better_payment_helper = new ClassesHelper();
443 $better_payment_general_currency = $this->better_payment_global_settings['better_payment_settings_general_general_currency'];
444
445 $better_payment_general_currency_woocommerce = $better_payment_general_currency;
446 if( class_exists('woocommerce') ) {
447 $better_payment_general_currency_woocommerce = get_woocommerce_currency() ? get_woocommerce_currency() : $better_payment_general_currency_woocommerce;
448 }
449
450 $this->add_control(
451 'better_payment_form_currency_use_woocommerce',
452 [
453 'label' => esc_html__( 'Use WooCommerce Currency?', 'better-payment' ),
454 'type' => Controls_Manager::SWITCHER,
455 'label_on' => __( 'Yes', 'better-payment' ),
456 'label_off' => __( 'No', 'better-payment' ),
457 'return_value' => 'yes',
458 'default' => '',
459 'conditions' => $this->payment_source_woo_conditions(),
460 ]
461 );
462
463 $this->add_control(
464 'better_payment_form_currency',
465 [
466 'label' => esc_html__( 'Currency', 'better-payment' ),
467 'type' => Controls_Manager::SELECT,
468 'default' => esc_html($better_payment_general_currency), //USD
469 'options' => $better_payment_helper->get_currency_list(),
470 'conditions' => [
471 'relation' => 'or',
472 'terms' => [
473 [
474 'relation' => 'and',
475 'terms' => [
476 [
477 'name' => 'better_payment_form_paypal_enable',
478 'value' => 'yes',
479 ],
480 [
481 'name' => 'better_payment_form_payment_source',
482 'value' => 'manual',
483 ],
484 ],
485 ],
486
487 [
488 'relation' => 'and',
489 'terms' => [
490 [
491 'name' => 'better_payment_form_stripe_enable',
492 'value' => 'yes',
493 ],
494 [
495 'name' => 'better_payment_form_payment_source',
496 'value' => 'manual',
497 ],
498 ],
499 ],
500
501 [
502 'relation' => 'and',
503 'terms' => [
504 [
505 'name' => 'better_payment_form_paystack_enable',
506 'value' => 'yes',
507 ],
508 [
509 'name' => 'better_payment_form_payment_source',
510 'value' => 'manual',
511 ],
512 ],
513 ],
514
515 [
516 'relation' => 'and',
517 'terms' => [
518 [
519 'name' => 'better_payment_form_paypal_enable',
520 'value' => 'yes',
521 ],
522 [
523 'name' => 'better_payment_form_currency_use_woocommerce',
524 'value' => '',
525 ],
526 ],
527 ],
528
529 [
530 'relation' => 'and',
531 'terms' => [
532 [
533 'name' => 'better_payment_form_stripe_enable',
534 'value' => 'yes',
535 ],
536 [
537 'name' => 'better_payment_form_currency_use_woocommerce',
538 'value' => '',
539 ],
540 ],
541 ],
542
543 [
544 'relation' => 'and',
545 'terms' => [
546 [
547 'name' => 'better_payment_form_paystack_enable',
548 'value' => 'yes',
549 ],
550 [
551 'name' => 'better_payment_form_currency_use_woocommerce',
552 'value' => '',
553 ],
554 ],
555 ],
556
557 ],
558 ],
559 ]
560 );
561
562 $this->add_control(
563 'better_payment_form_currency_woocommerce',
564 [
565 'label' => esc_html__( 'WooCommerce Currency', 'better-payment' ),
566 'type' => Controls_Manager::SELECT,
567 'default' => $better_payment_general_currency_woocommerce,
568 'options' => [
569 $better_payment_general_currency_woocommerce => $better_payment_general_currency_woocommerce,
570 ],
571 'condition' => [
572 'better_payment_form_payment_source' => 'woocommerce',
573 'better_payment_form_currency_use_woocommerce' => 'yes',
574
575 ]
576 ]
577 );
578
579 $this->add_control(
580 'better_payment_form_currency_notice',
581 [
582 'type' => Controls_Manager::RAW_HTML,
583 'raw' => sprintf( __( 'Supported by %1$sStripe%2$s (and/or %1$sPaystack%2$s) only', 'better-payment' ), '<strong>', '</strong>' ),
584 'content_classes' => 'better-payment-warning',
585 'conditions' => [
586 'relation' => 'and',
587 'terms' => [
588 [
589 'name' => 'better_payment_form_paypal_enable',
590 'value' => 'yes',
591 ],
592 [
593 'relation' => 'or',
594 'terms' => $this->get_paypal_unsupported_currencies_conditions(),
595 ]
596 ],
597 ]
598 ]
599 );
600
601 $this->add_control(
602 'better_payment_form_currency_alignment',
603 [
604 'label' => esc_html__( 'Currency Alignment', 'better-payment' ),
605 'type' => Controls_Manager::CHOOSE,
606 'options' => [
607 'left' => [
608 'title' => esc_html__( 'Left', 'better-payment' ),
609 'icon' => 'eicon-text-align-left',
610 ],
611 'right' => [
612 'title' => esc_html__( 'Right', 'better-payment' ),
613 'icon' => 'eicon-text-align-right',
614 ],
615 ],
616 ]
617 );
618
619 $this->end_controls_section();
620
621 $this->form_element_settings();
622 $this->paypal_form_setting();
623 $this->stripe_form_setting();
624 $this->paystack_form_setting();
625 $this->email_element_settings();
626
627 $this->success_message_setting();
628 $this->error_message_setting();
629
630 $this->form_style();
631 }
632
633 public function payment_source_woo_conditions(){
634 $conditions = [
635 'relation' => 'and',
636 'terms' => [
637 [
638 'name' => 'better_payment_form_payment_source',
639 'value' => 'woocommerce',
640 ],
641 [
642 'name' => 'better_payment_form_layout',
643 'operator' => '!=',
644 'value' => 'layout-4-pro',
645 ],
646 [
647 'name' => 'better_payment_form_layout',
648 'operator' => '!=',
649 'value' => 'layout-5-pro',
650 ],
651 // [
652 // 'name' => 'better_payment_form_layout',
653 // 'operator' => '!=',
654 // 'value' => 'layout-6-pro',
655 // ],
656 ],
657 ];
658
659 return $conditions;
660 }
661
662 public function payment_source_fluentcart_conditions(){
663 $conditions = [
664 'relation' => 'and',
665 'terms' => [
666 [
667 'name' => 'better_payment_form_payment_source',
668 'value' => 'fluentcart',
669 ],
670 [
671 'name' => 'better_payment_form_layout',
672 'operator' => '!=',
673 'value' => 'layout-4-pro',
674 ],
675 [
676 'name' => 'better_payment_form_layout',
677 'operator' => '!=',
678 'value' => 'layout-5-pro',
679 ],
680 [
681 'name' => 'better_payment_form_layout',
682 'operator' => '!=',
683 'value' => 'layout-6-pro',
684 ],
685 ],
686 ];
687
688 return $conditions;
689 }
690
691 public function form_element_settings() {
692 $this->start_controls_section(
693 'better_payment_form_element',
694 [
695 'label' => esc_html__( 'Form Settings', 'better-payment' ),
696 'conditions' => [
697 'relation' => 'or',
698 'terms' => [
699 [
700 'name' => 'better_payment_form_paypal_enable',
701 'value' => 'yes',
702 ],
703 [
704 'name' => 'better_payment_form_stripe_enable',
705 'value' => 'yes',
706 ],
707 [
708 'name' => 'better_payment_form_paystack_enable',
709 'value' => 'yes',
710 ],
711 ]
712 ]
713 ]
714 );
715
716 $this->add_control(
717 'better_payment_form_title',
718 [
719 'label' => __( 'Form Name', 'better-payment' ),
720 'type' => Controls_Manager::TEXT,
721 'dynamic' => [
722 'active' => true,
723 ],
724 'default' => __( 'Better Payment', 'better-payment' ),
725 'ai' => [
726 'active' => false,
727 ],
728 ]
729 );
730
731 do_action('better_payment/elementor/editor/layouts_form_settings_section', $this);
732
733 $form_fields_repeater = new Repeater();
734
735 $form_fields_repeater->add_control(
736 'better_payment_field_name_heading',
737 [
738 'label' => __( 'Field Name', 'better-payment' ),
739 'type' => Controls_Manager::TEXT,
740 'default' => __( 'Field Name', 'better-payment' ),
741 'label_block' => false,
742 'ai' => [
743 'active' => false,
744 ],
745 ]
746 );
747
748 $form_fields_repeater->add_control(
749 'better_payment_field_name_placeholder',
750 [
751 'label' => __( 'Placeholder Text', 'better-payment' ),
752 'type' => Controls_Manager::TEXT,
753 'default' => __( 'Field Name', 'better-payment' ),
754 'label_block' => false,
755 'ai' => [
756 'active' => false,
757 ],
758 ]
759 );
760
761 $form_fields_repeater->add_control(
762 'better_payment_field_type',
763 [
764 'label' => __( 'Field Type', 'better-payment' ),
765 'type' => Controls_Manager::SELECT,
766 'default' => 'text',
767 'options' => [
768 'text' => __( 'Text', 'better-payment' ),
769 'email' => __( 'Email', 'better-payment' ),
770 'number' => __( 'Number', 'better-payment' ),
771 // 'password' => __( 'Password', 'better-payment' ),
772 // 'textarea' => __( 'Textarea', 'better-payment' ),
773 // 'select' => __( 'Select', 'better-payment' ),
774 // 'checkbox' => __( 'Checkbox', 'better-payment' ),
775 // 'radio' => __( 'Radio', 'better-payment' ),
776 // 'date' => __( 'Date', 'better-payment' ),
777 // 'time' => __( 'Time', 'better-payment' ),
778 // 'datetime' => __( 'Date Time', 'better-payment' ),
779 // 'file' => __( 'File', 'better-payment' ),
780 // 'hidden' => __( 'Hidden', 'better-payment' ),
781 ],
782 'label_block' => false,
783 ]
784 );
785
786 $form_fields_repeater->add_control(
787 'better_payment_primary_field_type',
788 [
789 'label' => __( 'Primary Field Type', 'better-payment' ),
790 'description' => __( 'If this is a primary field (first name, last name, email etc), then please select one.', 'better-payment' ),
791 'type' => Controls_Manager::SELECT,
792 'default' => 'primary_none',
793 'options' => [
794 'primary_first_name' => __( 'First Name', 'better-payment' ),
795 'primary_last_name' => __( 'Last Name', 'better-payment' ),
796 'primary_email' => __( 'Email', 'better-payment' ),
797 'primary_payment_amount' => __( 'Payment Amount', 'better-payment' ),
798 'primary_coupon_code' => __( 'Coupon Code', 'better-payment' ),
799 'primary_reference_number' => __( 'Reference Number', 'better-payment' ),
800 'primary_none' => __( 'None', 'better-payment' ),
801 ],
802 'label_block' => false,
803 ]
804 );
805
806 $form_fields_repeater->add_control(
807 'better_payment_field_icon',
808 [
809 'label' => esc_html__( 'Icon', 'better-payment' ),
810 'description' => esc_html__( 'Select an icon for this field (not applicable for primary field - Payment Amount and layout 4, 5, 6).', 'better-payment' ),
811 'type' => Controls_Manager::ICONS,
812
813 ]
814 );
815
816 $form_fields_repeater->add_control(
817 'better_payment_field_name_show',
818 [
819 'label' => __( 'Show', 'better-payment' ),
820 'type' => Controls_Manager::SWITCHER,
821 'label_on' => __( 'Yes', 'better-payment' ),
822 'label_off' => __( 'No', 'better-payment' ),
823 'return_value' => 'yes',
824 'default' => 'yes',
825
826 ]
827 );
828
829 $form_fields_repeater->add_control(
830 'better_payment_field_name_show_notice',
831 [
832 'type' => Controls_Manager::RAW_HTML,
833 'raw' => sprintf(
834 esc_html__( 'Field is hidden if payment source is WooCommerce or payment type is recurring/split payment or field dynamic value is enabled.', 'better-payment' ),
835 ),
836 'content_classes' => 'elementor-descriptor',
837 'condition' => [
838 'better_payment_primary_field_type' => 'primary_payment_amount'
839 ],
840 ]
841 );
842
843 $form_fields_repeater->add_control(
844 'better_payment_field_name_required',
845 [
846 'label' => __( 'Required', 'better-payment' ),
847 'type' => Controls_Manager::SWITCHER,
848 'label_on' => __( 'Yes', 'better-payment' ),
849 'label_off' => __( 'No', 'better-payment' ),
850 'return_value' => 'yes',
851 'default' => 'no',
852 'condition' => [
853 'better_payment_field_name_show' => 'yes'
854 ],
855 ]
856 );
857
858 $form_fields_repeater->add_control(
859 'better_payment_field_name_min',
860 [
861 'label' => __( 'Min. Value', 'better-payment' ),
862 'type' => Controls_Manager::NUMBER,
863 'condition' => [
864 'better_payment_primary_field_type' => 'primary_payment_amount'
865 ],
866 ]
867 );
868
869 $form_fields_repeater->add_control(
870 'better_payment_field_name_max',
871 [
872 'label' => __( 'Max. Value', 'better-payment' ),
873 'type' => Controls_Manager::NUMBER,
874 'condition' => [
875 'better_payment_primary_field_type' => 'primary_payment_amount'
876 ],
877 ]
878 );
879
880 $form_fields_repeater->add_control(
881 'better_payment_field_name_default',
882 [
883 'label' => __( 'Default Value', 'better-payment' ),
884 'type' => Controls_Manager::NUMBER,
885 'condition' => [
886 'better_payment_primary_field_type' => 'primary_payment_amount'
887 ],
888 ]
889 );
890
891 $form_fields_repeater->add_control(
892 'better_payment_field_name_default_dynamic_enable',
893 [
894 'label' => __( 'Dynamic Value', 'better-payment' ),
895 'type' => Controls_Manager::SWITCHER,
896 'description' => __( 'It will override default value!', 'better-payment' ),
897 'label_on' => __( 'Yes', 'better-payment' ),
898 'label_off' => __( 'No', 'better-payment' ),
899 'return_value' => 'yes',
900 'condition' => [
901 'better_payment_primary_field_type' => 'primary_payment_amount'
902 ],
903 ]
904 );
905
906 $form_fields_repeater->add_control(
907 'better_payment_field_name_default_dynamic',
908 [
909 'type' => Controls_Manager::RAW_HTML,
910 'raw' => sprintf(
911 __( '<p class="better-payment-dynamic-value-info" style="word-break: break-word;"><a href="%1$s" target="_blank">Sample url »</a><br>%1$s</p>', 'better-payment' ),
912 esc_url_raw( get_permalink( get_the_ID() ) . '?payment_amount=100' )
913 ),
914 'content_classes' => 'elementor-control-alert elementor-panel-alert elementor-panel-alert-info',
915 'ai' => [
916 'active' => false,
917 ],
918 'condition' => [
919 'better_payment_primary_field_type' => 'primary_payment_amount',
920 'better_payment_field_name_default_dynamic_enable' => 'yes'
921 ],
922 ]
923 );
924
925 $form_fields_repeater->add_control(
926 'better_payment_field_name_default_fixed',
927 [
928 'label' => __( 'Readonly', 'better-payment' ),
929 'type' => Controls_Manager::SWITCHER,
930 'label_on' => __( 'Yes', 'better-payment' ),
931 'label_off' => __( 'No', 'better-payment' ),
932 'return_value' => 'yes',
933 'condition' => [
934 'better_payment_primary_field_type' => 'primary_payment_amount'
935 ],
936 ]
937 );
938
939 $form_fields_repeater->add_control(
940 'better_payment_field_name_display_inline',
941 [
942 'label' => __( 'Display Inline?', 'better-payment' ),
943 'type' => Controls_Manager::SWITCHER,
944 'label_on' => __( 'Yes', 'better-payment' ),
945 'label_off' => __( 'No', 'better-payment' ),
946 'return_value' => 'inline-block',
947 'default' => 'block',
948 'condition' => [
949 'better_payment_field_name_show' => 'yes'
950 ],
951 'selectors' => [
952 '{{WRAPPER}} .better-payment-form-layout form {{CURRENT_ITEM}}.bp-form__group' => 'display: {{VALUE}};',
953 '{{WRAPPER}} .better-payment-form {{CURRENT_ITEM}}.better-payment-field-advanced-layout' => 'display: {{VALUE}};',
954
955 ]
956 ]
957 );
958
959 $form_fields_repeater->add_control(
960 'better_payment_field_name_display_inline_width',
961 [
962 'label' => __( 'Column Width', 'better-payment' ),
963 'type' => Controls_Manager::SLIDER,
964 'size_units' => [ '%', 'px', 'em' ],
965 'range' => [
966 '%' => [
967 'min' => 1,
968 'max' => 100,
969 ],
970 'px' => [
971 'min' => 10,
972 'max' => 1500,
973 ],
974 'em' => [
975 'min' => 1,
976 'max' => 80,
977 ],
978 ],
979 'condition' => [
980 'better_payment_field_name_show' => 'yes',
981 'better_payment_field_name_display_inline' => 'inline-block'
982 ],
983 'selectors' => [
984 '{{WRAPPER}} .better-payment-form-layout form {{CURRENT_ITEM}}.bp-form__group' => 'width: {{SIZE}}{{UNIT}};',
985 '{{WRAPPER}} .better-payment-form {{CURRENT_ITEM}}.better-payment-field-advanced-layout' => 'width: {{SIZE}}{{UNIT}};',
986 ],
987 'description' => __( 'Set the width of the column. Use less than 50% to make fields inline', 'better-payment' ),
988 ]
989 );
990
991 $form_fields_first_name = [
992 'better_payment_field_name_heading' => esc_html__( 'First Name', 'better-payment' ),
993 'better_payment_field_name_placeholder' => esc_html__( 'First Name', 'better-payment' ),
994 'better_payment_field_type' => 'text',
995 'better_payment_primary_field_type' => 'primary_first_name',
996 'better_payment_field_name_show' => 'yes',
997 'better_payment_field_name_required' => 'no',
998 ];
999
1000 $form_fields_last_name = [
1001 'better_payment_field_name_heading' => esc_html__( 'Last Name', 'better-payment' ),
1002 'better_payment_field_name_placeholder' => esc_html__( 'Last Name', 'better-payment' ),
1003 'better_payment_field_type' => 'text',
1004 'better_payment_primary_field_type' => 'primary_last_name',
1005 'better_payment_field_name_show' => 'yes',
1006 'better_payment_field_name_required' => 'no',
1007 ];
1008
1009 $form_field_email = [
1010 'better_payment_field_name_heading' => esc_html__( 'Email Address', 'better-payment' ),
1011 'better_payment_field_name_placeholder' => esc_html__( 'Email Address', 'better-payment' ),
1012 'better_payment_field_type' => 'email',
1013 'better_payment_primary_field_type' => 'primary_email',
1014 'better_payment_field_name_show' => 'yes',
1015 'better_payment_field_name_required' => 'yes',
1016 ];
1017
1018 $form_field_payment_amount = [
1019 'better_payment_field_name_heading' => esc_html__( 'Payment Amount', 'better-payment' ),
1020 'better_payment_field_name_placeholder' => esc_html__( 'Payment Amount', 'better-payment' ),
1021 'better_payment_field_type' => 'number',
1022 'better_payment_primary_field_type' => 'primary_payment_amount',
1023 'better_payment_field_name_show' => 'yes',
1024 'better_payment_field_name_required' => 'yes',
1025 ];
1026
1027 $form_fields_defaults = [
1028 $form_fields_first_name,
1029 $form_fields_last_name,
1030 $form_field_email,
1031 $form_field_payment_amount,
1032 ];
1033
1034 $this->add_control(
1035 'better_payment_form_fields',
1036 [
1037 'label' => esc_html__( 'Form Fields', 'better-payment' ),
1038 'type' => \Elementor\Controls_Manager::REPEATER,
1039 'fields' => $form_fields_repeater->get_controls(),
1040 'default' => $form_fields_defaults,
1041 'title_field' => '{{{ better_payment_field_name_heading }}}',
1042 'condition' => [
1043 'better_payment_form_layout!' => ['layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
1044 ],
1045 ]
1046 );
1047
1048 if ( $this->lite_registers_pro_layout_controls() ) {
1049 ProPaymentFormControls::form_fields_controls( $this, $form_fields_repeater );
1050 }
1051 do_action( 'better_payment/elementor/editor/pro_layout_form_fields_controls', $this, $form_fields_repeater );
1052
1053 $repeater = new Repeater();
1054
1055
1056 $repeater->add_control(
1057 'better_payment_amount_val',
1058 [
1059 'label' => esc_html__( 'Payment Amount', 'better-payment' ),
1060 'type' => Controls_Manager::NUMBER,
1061 'min' => 1,
1062 ]
1063 );
1064
1065 $this->add_control(
1066 'better_payment_show_amount_list',
1067 [
1068 'label' => __( 'Show Amount List', 'better-payment' ),
1069 'type' => Controls_Manager::SWITCHER,
1070 'label_on' => __( 'Yes', 'better-payment' ),
1071 'label_off' => __( 'No', 'better-payment' ),
1072 'return_value' => 'yes',
1073 'default' => 'no',
1074 'condition' => [
1075 'better_payment_form_payment_source!' => ['woocommerce', 'fluentcart'],
1076 'better_payment_form_layout!' => ['layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
1077 ],
1078 ]
1079 );
1080
1081 if ( $this->lite_registers_pro_layout_controls() ) {
1082 ProPaymentFormControls::amount_list_toggle_control( $this );
1083 }
1084 do_action( 'better_payment/elementor/editor/pro_layout_amount_list_toggle_control', $this );
1085
1086 $this->add_control(
1087 'better_payment_amount',
1088 [
1089 'label' => esc_html__( 'Amount List', 'better-payment' ),
1090 'type' => Controls_Manager::REPEATER,
1091 'default' => [
1092 [
1093 'better_payment_amount_val' => 5
1094 ],
1095 [
1096 'better_payment_amount_val' => 10
1097 ],
1098 [
1099 'better_payment_amount_val' => 15
1100 ],
1101 [
1102 'better_payment_amount_val' => 20
1103 ],
1104 ],
1105 'fields' => $repeater->get_controls(),
1106 'title_field' => '<i class="{{ better_payment_amount_val }}" aria-hidden="true"></i> {{{ better_payment_amount_val }}}',
1107 'condition' => $this->pro_layout_control_condition( 'better_payment_amount', [
1108 'better_payment_show_amount_list' => 'yes',
1109 'better_payment_form_payment_source!' => ['woocommerce', 'fluentcart'],
1110 'better_payment_form_layout!' => ['layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
1111 ] ),
1112 ]
1113 );
1114
1115 if ( $this->lite_registers_pro_layout_controls() ) {
1116 ProPaymentFormControls::amount_list_control( $this, $repeater );
1117 }
1118 do_action( 'better_payment/elementor/editor/pro_layout_amount_list_control', $this, $repeater );
1119
1120 do_action('better_payment/elementor/editor/layouts_form_settings_amount_list_section', $this);
1121
1122 $this->add_control(
1123 'better_payment_form_transaction_details_section',
1124 [
1125 'label' => esc_html__( 'Transaction Details', 'better-payment' ),
1126 'type' => Controls_Manager::HEADING,
1127 'separator' => 'before',
1128 ]
1129 );
1130
1131 $this->add_control(
1132 'better_payment_form_transaction_details_heading',
1133 [
1134 'label' => esc_html__( 'Heading Text', 'better-payment' ),
1135 'type' => Controls_Manager::TEXT,
1136 'default' => __( 'Transaction Details', 'better-payment' ),
1137 'label_block' => true,
1138 'ai' => [
1139 'active' => false,
1140 ],
1141 ]
1142 );
1143
1144 $this->add_control(
1145 'better_payment_form_transaction_details_sub_heading',
1146 [
1147 'label' => esc_html__( 'Sub Heading Text', 'better-payment' ),
1148 'type' => Controls_Manager::TEXT,
1149 'default' => __( 'Total payment of your product in the following:', 'better-payment' ),
1150 'label_block' => true,
1151 'ai' => [
1152 'active' => false,
1153 ],
1154 ]
1155 );
1156
1157 $this->add_control(
1158 'better_payment_form_transaction_details_product_title',
1159 [
1160 'label' => esc_html__( 'Product Title Text', 'better-payment' ),
1161 'type' => Controls_Manager::TEXT,
1162 'default' => __( 'Title:', 'better-payment' ),
1163 'condition' => [
1164 'better_payment_form_payment_source' => 'woocommerce',
1165 ],
1166 'label_block' => true,
1167 'ai' => [
1168 'active' => false,
1169 ],
1170 ]
1171 );
1172
1173 $this->add_control(
1174 'better_payment_form_transaction_details_amount_text',
1175 [
1176 'label' => esc_html__( 'Amount Text', 'better-payment' ),
1177 'type' => Controls_Manager::TEXT,
1178 'default' => __( 'Amount:', 'better-payment' ),
1179 'label_block' => true,
1180 'ai' => [
1181 'active' => false,
1182 ],
1183 'condition' => [
1184 'better_payment_form_layout!' => ['layout-4-pro', 'layout-6-pro'],
1185 ],
1186 ]
1187 );
1188
1189 do_action('better_payment/elementor/editor/layouts_form_settings_transaction_details_section', $this);
1190
1191 $this->add_control(
1192 'better_payment_form_form_buttons_section',
1193 [
1194 'label' => esc_html__( 'Form Custom Text', 'better-payment' ),
1195 'type' => Controls_Manager::HEADING,
1196 'separator' => 'before',
1197 ]
1198 );
1199
1200 if ( $this->lite_registers_pro_layout_controls() ) {
1201 ProPaymentFormControls::form_title_controls( $this );
1202 }
1203 do_action( 'better_payment/elementor/editor/pro_layout_form_title_controls', $this );
1204
1205 $this->add_control(
1206 'better_payment_form_form_buttons_paypal_button_text',
1207 [
1208 'label' => esc_html__( 'PayPal Button Text', 'better-payment' ),
1209 'type' => Controls_Manager::TEXT,
1210 'label_block' => true,
1211 'ai' => [
1212 'active' => false,
1213 ],
1214 ]
1215 );
1216
1217 $this->add_control(
1218 'better_payment_form_form_buttons_stripe_button_text',
1219 [
1220 'label' => esc_html__( 'Stripe Button Text', 'better-payment' ),
1221 'type' => Controls_Manager::TEXT,
1222 'label_block' => true,
1223 'ai' => [
1224 'active' => false,
1225 ],
1226 ]
1227 );
1228
1229 $this->add_control(
1230 'better_payment_form_form_buttons_paystack_button_text',
1231 [
1232 'label' => esc_html__( 'Paystack Button Text', 'better-payment' ),
1233 'type' => Controls_Manager::TEXT,
1234 'label_block' => true,
1235 'ai' => [
1236 'active' => false,
1237 ],
1238 ]
1239 );
1240
1241 $this->end_controls_section();
1242 }
1243
1244 public function paypal_form_setting() {
1245 $this->start_controls_section(
1246 'better_payment_form_paypal_settings',
1247 [
1248 'label' => esc_html__( 'PayPal Settings', 'better-payment' ),
1249 'condition' => [
1250 'better_payment_form_paypal_enable' => 'yes'
1251 ]
1252 ]
1253 );
1254
1255
1256 $this->add_control(
1257 'better_payment_paypal_business_email',
1258 [
1259 'label' => __( 'Business Email', 'better-payment' ),
1260 'type' => Controls_Manager::TEXT,
1261 'dynamic' => [
1262 'active' => true,
1263 ],
1264 'label_block' => true,
1265 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_payment_paypal_email']),
1266 'ai' => [
1267 'active' => false,
1268 ],
1269 ]
1270 );
1271
1272 $this->add_control(
1273 'better_payment_paypal_button_type',
1274 [
1275 'label' => esc_html__( 'Button Type', 'better-payment' ),
1276 'type' => Controls_Manager::HIDDEN,
1277 'default' => '_xclick',
1278 'options' => [
1279 '_xclick' => 'XCLICK',
1280 '_cart' => 'CART',
1281 '_donations' => 'DONATIONS'
1282 ]
1283 ]
1284 );
1285
1286 $this->add_control(
1287 'better_payment_paypal_live_mode',
1288 [
1289 'label' => __( 'Live Mode', 'better-payment' ),
1290 'type' => Controls_Manager::SWITCHER,
1291 'label_on' => __( 'Yes', 'better-payment' ),
1292 'label_off' => __( 'No', 'better-payment' ),
1293 'return_value' => 'yes',
1294 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_payment_paypal_live_mode']), //yes or no
1295 ]
1296 );
1297
1298 $this->end_controls_section();
1299 }
1300
1301 public function stripe_form_setting() {
1302 $this->start_controls_section(
1303 'better_payment_form_stripe_settings',
1304 [
1305 'label' => esc_html__( 'Stripe Settings', 'better-payment' ),
1306 'condition' => [
1307 'better_payment_form_stripe_enable' => 'yes'
1308 ]
1309 ]
1310 );
1311
1312 $this->add_control(
1313 'better_payment_stripe_public_key',
1314 [
1315 'label' => __( 'Test Public Key', 'better-payment' ),
1316 'type' => Controls_Manager::TEXT,
1317 'dynamic' => [
1318 'active' => true,
1319 ],
1320 'label_block' => true,
1321 'default' => esc_html( $this->better_payment_global_settings['better_payment_settings_payment_stripe_test_public'] ),
1322 'ai' => [
1323 'active' => false,
1324 ],
1325 'condition' => [
1326 'better_payment_stripe_live_mode!' => 'yes',
1327 ],
1328 ]
1329 );
1330
1331 $this->add_control(
1332 'better_payment_stripe_secret_key',
1333 [
1334 'label' => __( 'Test Secret Key', 'better-payment' ),
1335 'type' => Controls_Manager::TEXT,
1336 'input_type' => 'password',
1337 'dynamic' => [
1338 'active' => true,
1339 ],
1340 'label_block' => true,
1341 'default' => esc_html( $this->better_payment_global_settings['better_payment_settings_payment_stripe_test_secret'] ),
1342 'ai' => [
1343 'active' => false,
1344 ],
1345 'condition' => [
1346 'better_payment_stripe_live_mode!' => 'yes',
1347 ],
1348 ]
1349 );
1350
1351 $this->add_control(
1352 'better_payment_stripe_public_key_live',
1353 [
1354 'label' => __( 'Live Public Key', 'better-payment' ),
1355 'type' => Controls_Manager::TEXT,
1356 'dynamic' => [
1357 'active' => true,
1358 ],
1359 'label_block' => true,
1360 'default' => esc_html( $this->better_payment_global_settings['better_payment_settings_payment_stripe_live_public'] ),
1361 'ai' => [
1362 'active' => false,
1363 ],
1364 'condition' => [
1365 'better_payment_stripe_live_mode' => 'yes',
1366 ],
1367 ]
1368 );
1369
1370 $this->add_control(
1371 'better_payment_stripe_secret_key_live',
1372 [
1373 'label' => __( 'Live Secret Key', 'better-payment' ),
1374 'type' => Controls_Manager::TEXT,
1375 'input_type' => 'password',
1376 'dynamic' => [
1377 'active' => true,
1378 ],
1379 'label_block' => true,
1380 'default' => esc_html( $this->better_payment_global_settings['better_payment_settings_payment_stripe_live_secret'] ),
1381 'ai' => [
1382 'active' => false,
1383 ],
1384 'condition' => [
1385 'better_payment_stripe_live_mode' => 'yes',
1386 ],
1387 ]
1388 );
1389
1390 $this->add_control(
1391 'better_payment_stripe_live_mode',
1392 [
1393 'label' => __( 'Live Mode', 'better-payment' ),
1394 'type' => Controls_Manager::SWITCHER,
1395 'label_on' => __( 'Yes', 'better-payment' ),
1396 'label_off' => __( 'No', 'better-payment' ),
1397 'return_value' => 'yes',
1398 'default' => esc_html( $this->better_payment_global_settings['better_payment_settings_payment_stripe_live_mode'] ), //yes or no
1399 ]
1400 );
1401
1402 $this->end_controls_section();
1403 }
1404
1405 public function paystack_form_setting() {
1406 $this->start_controls_section(
1407 'better_payment_form_paystack_settings',
1408 [
1409 'label' => esc_html__( 'Paystack Settings', 'better-payment' ),
1410 'condition' => [
1411 'better_payment_form_paystack_enable' => 'yes'
1412 ]
1413 ]
1414 );
1415
1416 $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;
1417 $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'] : '';
1418 $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'] : '';
1419
1420 $this->add_control(
1421 'better_payment_paystack_public_key',
1422 [
1423 'label' => __( 'Public Key', 'better-payment' ),
1424 'type' => Controls_Manager::TEXT,
1425 'dynamic' => [
1426 'active' => true,
1427 ],
1428 'label_block' => true,
1429 'default' => $better_payment_is_paystack_live ? esc_html( $bp_settings_paystack_live_public ) : esc_html( $bp_settings_paystack_test_public ),
1430 'ai' => [
1431 'active' => false,
1432 ],
1433 ]
1434 );
1435
1436 $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'] : '';
1437 $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'] : '';
1438
1439 $this->add_control(
1440 'better_payment_paystack_secret_key',
1441 [
1442 'label' => __( 'Secret Key', 'better-payment' ),
1443 'type' => Controls_Manager::TEXT,
1444 'input_type' => 'password',
1445 'dynamic' => [
1446 'active' => true,
1447 ],
1448 'label_block' => true,
1449 'default' => $better_payment_is_paystack_live ? esc_html( $bp_settings_paystack_live_secret ) : esc_html( $bp_settings_paystack_test_secret ),
1450 'ai' => [
1451 'active' => false,
1452 ],
1453 ]
1454 );
1455
1456 $this->add_control(
1457 'better_payment_paystack_live_mode',
1458 [
1459 'label' => __( 'Live Mode', 'better-payment' ),
1460 'type' => Controls_Manager::SWITCHER,
1461 'label_on' => __( 'Yes', 'better-payment' ),
1462 'label_off' => __( 'No', 'better-payment' ),
1463 'return_value' => 'yes',
1464 '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
1465 ]
1466 );
1467
1468 $this->end_controls_section();
1469 }
1470
1471 public function email_element_settings() {
1472 $this->start_controls_section(
1473 'better_payment_email_element',
1474 [
1475 'label' => esc_html__( 'Email Settings', 'better-payment' ),
1476 'condition' => [
1477 'better_payment_form_email_enable' => 'yes'
1478 ]
1479 ]
1480 );
1481
1482 $this->add_control(
1483 'better_payment_form_email_logo',
1484 [
1485 'label' => __('Choose Logo', 'better-payment'),
1486 'type' => Controls_Manager::MEDIA,
1487 'label_block' => true,
1488 'ai' => [
1489 'active' => false,
1490 ],
1491 ]
1492 );
1493
1494 $this->start_controls_tabs( 'better_payment_email_tabs' );
1495
1496 //Admin Email Notification
1497 $this->start_controls_tab( 'better_payment_email_admin_tab', [
1498 'label' => __( 'Admin', 'better-payment' ),
1499 ] );
1500
1501 $this->add_control('better_payment_email_to', [
1502 'label' => __('To', 'better-payment'),
1503 'type' => Controls_Manager::TEXT,
1504 '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')),
1505 'placeholder' => get_option('admin_email'),
1506 'label_block' => true,
1507 'title' => __('Email address to notify site admin after each successful transaction', 'better-payment'),
1508 'render_type' => 'none',
1509 'ai' => [
1510 'active' => false,
1511 ],
1512 ]);
1513
1514 $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')));
1515
1516 $this->add_control('better_payment_email_subject', [
1517 'label' => __('Subject', 'better-payment'),
1518 'type' => Controls_Manager::TEXT,
1519 'default' => esc_html($default_subject),
1520 'placeholder' => esc_html($default_subject),
1521 'label_block' => true,
1522 'render_type' => 'none',
1523 'ai' => [
1524 'active' => false,
1525 ],
1526 ]);
1527
1528 $this->add_control('better_payment_email_content', [
1529 'label' => __('Message', 'better-payment'),
1530 'type' => Controls_Manager::TEXTAREA,
1531 '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']) : '',
1532 'placeholder' => '',
1533 'render_type' => 'none',
1534 ]);
1535
1536 $this->add_control(
1537 'better_payment_email_content_greeting',
1538 [
1539 'label' => __( 'Show Greeting Text', 'better-payment' ),
1540 'type' => Controls_Manager::HIDDEN,
1541 'label_on' => __( 'Yes', 'better-payment' ),
1542 'label_off' => __( 'No', 'better-payment' ),
1543 'return_value' => 'yes',
1544 'default' => 'yes',
1545 ]
1546 );
1547
1548 $this->add_control(
1549 'better_payment_email_content_heading',
1550 [
1551 'label' => __( 'Show Header Text', 'better-payment' ),
1552 'type' => Controls_Manager::SWITCHER,
1553 'label_on' => __( 'Yes', 'better-payment' ),
1554 'label_off' => __( 'No', 'better-payment' ),
1555 'return_value' => 'yes',
1556 'default' => 'yes',
1557 ]
1558 );
1559
1560 $this->add_control(
1561 'better_payment_email_content_from_section',
1562 [
1563 'label' => __( 'Show From Section', 'better-payment' ),
1564 'type' => Controls_Manager::SWITCHER,
1565 'label_on' => __( 'Yes', 'better-payment' ),
1566 'label_off' => __( 'No', 'better-payment' ),
1567 'return_value' => 'yes',
1568 'default' => 'yes',
1569 ]
1570 );
1571
1572 $this->add_control(
1573 'better_payment_email_content_to_section',
1574 [
1575 'label' => __( 'Show To Section', 'better-payment' ),
1576 'type' => Controls_Manager::SWITCHER,
1577 'label_on' => __( 'Yes', 'better-payment' ),
1578 'label_off' => __( 'No', 'better-payment' ),
1579 'return_value' => 'yes',
1580 'default' => 'yes',
1581 ]
1582 );
1583
1584 $this->add_control(
1585 'better_payment_email_content_transaction_summary',
1586 [
1587 'label' => __( 'Show Transaction Summary', 'better-payment' ),
1588 'type' => Controls_Manager::SWITCHER,
1589 'label_on' => __( 'Yes', 'better-payment' ),
1590 'label_off' => __( 'No', 'better-payment' ),
1591 'return_value' => 'yes',
1592 'default' => 'yes',
1593 ]
1594 );
1595
1596 $this->add_control(
1597 'better_payment_email_content_footer_text',
1598 [
1599 'label' => __( 'Show Footer Text', 'better-payment' ),
1600 'type' => Controls_Manager::SWITCHER,
1601 'label_on' => __( 'Yes', 'better-payment' ),
1602 'label_off' => __( 'No', 'better-payment' ),
1603 'return_value' => 'yes',
1604 'default' => 'yes',
1605 ]
1606 );
1607
1608 $site_url_parsed = wp_parse_url(get_site_url());
1609 $better_domain = $site_url_parsed['host'] ? esc_html($site_url_parsed['host']) : 'example.com';
1610
1611 $this->add_control('better_payment_email_from', [
1612 'label' => __('From email', 'better-payment'),
1613 'type' => Controls_Manager::TEXT,
1614 '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",
1615 'render_type' => 'none',
1616 'separator' => 'before',
1617 'ai' => [
1618 'active' => false,
1619 ],
1620 ]);
1621
1622 $this->add_control('better_payment_email_from_name', [
1623 'label' => __('From name', 'better-payment'),
1624 'type' => Controls_Manager::TEXT,
1625 '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')),
1626 'render_type' => 'none',
1627 'ai' => [
1628 'active' => false,
1629 ],
1630 ]);
1631
1632 $this->add_control('better_payment_email_reply_to', [
1633 'label' => __('Reply-To', 'better-payment'),
1634 'type' => Controls_Manager::TEXT,
1635 '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",
1636 'placeholder' => "wordpress@$better_domain",
1637 'render_type' => 'none',
1638 'ai' => [
1639 'active' => false,
1640 ],
1641 ]);
1642
1643 $this->add_control('better_payment_email_cc', [
1644 'label' => __('Cc', 'better-payment'),
1645 'type' => Controls_Manager::TEXT,
1646 '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']) : '',
1647 'render_type' => 'none',
1648 'ai' => [
1649 'active' => false,
1650 ],
1651 ]);
1652
1653 $this->add_control('better_payment_email_bcc', [
1654 'label' => __('Bcc', 'better-payment'),
1655 'type' => Controls_Manager::TEXT,
1656 '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']) : '',
1657 'render_type' => 'none',
1658 'ai' => [
1659 'active' => false,
1660 ],
1661 ]);
1662
1663 $this->add_control('better_payment_email_content_type', [
1664 'label' => __('Send as', 'better-payment'),
1665 'type' => Controls_Manager::SELECT,
1666 '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
1667 'render_type' => 'none',
1668 'options' => [
1669 'html' => __('HTML', 'better-payment'),
1670 'plain' => __('Plain', 'better-payment')
1671 ]
1672 ]);
1673
1674 $this->end_controls_tab();
1675
1676 //Customer Email Notification
1677 $this->start_controls_tab( 'better_payment_email_customer_tab', [
1678 'label' => __( 'Customer', 'better-payment' ),
1679 ] );
1680
1681 $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')));
1682
1683 $this->add_control('better_payment_email_subject_customer', [
1684 'label' => __('Subject', 'better-payment'),
1685 'type' => Controls_Manager::TEXT,
1686 'default' => esc_html($default_subject),
1687 'placeholder' => esc_html($default_subject),
1688 'label_block' => true,
1689 'render_type' => 'none',
1690 'ai' => [
1691 'active' => false,
1692 ],
1693 ]);
1694
1695 $this->add_control('better_payment_email_content_customer', [
1696 'label' => __('Message', 'better-payment'),
1697 'type' => Controls_Manager::TEXTAREA,
1698 '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']) : '',
1699 'placeholder' => '',
1700 'render_type' => 'none'
1701 ]);
1702
1703 $this->add_control(
1704 'better_payment_form_email_attachment_pdf_show',
1705 [
1706 'label' => __('PDF Attachment?', 'better-payment'),
1707 'type' => Controls_Manager::SWITCHER,
1708 'default' => '',
1709 'label_on' => __('Yes', 'better-payment'),
1710 'label_off' => __('No', 'better-payment'),
1711 'return_value' => 'yes',
1712 ]
1713 );
1714
1715 $this->add_control(
1716 'better_payment_form_email_attachment',
1717 [
1718 'label' => __('Attachment', 'better-payment'),
1719 'description' => __('Allowed file types: jpg, jpeg, png', 'better-payment'),
1720 'type' => Controls_Manager::MEDIA,
1721 'label_block' => true,
1722 'ai' => [
1723 'active' => false,
1724 ],
1725 'condition' => [
1726 'better_payment_form_email_attachment_pdf_show!' => 'yes',
1727 ],
1728 ]
1729 );
1730
1731 $this->add_control(
1732 'better_payment_form_email_attachment_pdf',
1733 [
1734 'label' => __('PDF', 'better-payment'),
1735 'description' => __('Allowed file types: pdf', 'better-payment'),
1736 'type' => Controls_Manager::MEDIA,
1737 'media_types' => [
1738 'application/pdf'
1739 ],
1740 'label_block' => true,
1741 'ai' => [
1742 'active' => false,
1743 ],
1744 'condition' => [
1745 'better_payment_form_email_attachment_pdf_show' => 'yes',
1746 ],
1747 ]
1748 );
1749
1750 $site_url_parsed = wp_parse_url(get_site_url());
1751 $better_domain = $site_url_parsed['host'] ? esc_html($site_url_parsed['host']) : 'example.com';
1752
1753 $this->add_control('better_payment_email_from_customer', [
1754 'label' => __('From email', 'better-payment'),
1755 'type' => Controls_Manager::TEXT,
1756 '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",
1757 'render_type' => 'none',
1758 'separator' => 'before',
1759 'ai' => [
1760 'active' => false,
1761 ],
1762 ]);
1763
1764 $this->add_control('better_payment_email_from_name_customer', [
1765 'label' => __('From name', 'better-payment'),
1766 'type' => Controls_Manager::TEXT,
1767 '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'),
1768 'render_type' => 'none',
1769 'ai' => [
1770 'active' => false,
1771 ],
1772 ]);
1773
1774 $this->add_control('better_payment_email_reply_to_customer', [
1775 'label' => __('Reply-To', 'better-payment'),
1776 'type' => Controls_Manager::TEXT,
1777 '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",
1778 'placeholder' => "wordpress@$better_domain",
1779 'render_type' => 'none',
1780 'ai' => [
1781 'active' => false,
1782 ],
1783 ]);
1784
1785 $this->add_control('better_payment_email_cc_customer', [
1786 'label' => __('Cc', 'better-payment'),
1787 'type' => Controls_Manager::TEXT,
1788 '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']) : '',
1789 'render_type' => 'none',
1790 'ai' => [
1791 'active' => false,
1792 ],
1793 ]);
1794
1795 $this->add_control('better_payment_email_bcc_customer', [
1796 'label' => __('Bcc', 'better-payment'),
1797 'type' => Controls_Manager::TEXT,
1798 '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']) : '',
1799 'render_type' => 'none',
1800 'ai' => [
1801 'active' => false,
1802 ],
1803 ]);
1804
1805 $this->add_control('better_payment_email_content_type_customer', [
1806 'label' => __('Send as', 'better-payment'),
1807 'type' => Controls_Manager::SELECT,
1808 '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
1809 'render_type' => 'none',
1810 'options' => [
1811 'html' => __('HTML', 'better-payment'),
1812 'plain' => __('Plain', 'better-payment')
1813 ]
1814 ]);
1815
1816 $this->end_controls_tab();
1817
1818 $this->end_controls_tabs();
1819
1820 $this->end_controls_section();
1821 }
1822
1823 public function success_message_setting() {
1824 $this->start_controls_section(
1825 'better_payment_form_success_message_settings',
1826 [
1827 'label' => esc_html__( 'Success Message', 'better-payment' ),
1828 'conditions' => [
1829 'relation' => 'or',
1830 'terms' => [
1831 [
1832 'name' => 'better_payment_form_stripe_enable',
1833 'value' => 'yes',
1834 ],
1835 [
1836 'name' => 'better_payment_form_paypal_enable',
1837 'value' => 'yes',
1838 ],
1839 [
1840 'name' => 'better_payment_form_paystack_enable',
1841 'value' => 'yes',
1842 ],
1843 ],
1844 ]
1845 ]
1846 );
1847
1848 $this->add_control(
1849 'better_payment_form_success_message_icon',
1850 [
1851 'label' => esc_html__( 'Icon', 'better-payment' ),
1852 'type' => Controls_Manager::ICONS,
1853
1854 ]
1855 );
1856
1857 $this->add_control(
1858 'better_payment_form_success_message_content',
1859 [
1860 'label' => esc_html__( 'Content', 'better-payment' ),
1861 'type' => Controls_Manager::HEADING,
1862 'separator' => 'before',
1863 ]
1864 );
1865
1866 $this->add_control('better_payment_form_success_message_heading', [
1867 'label' => __('Heading', 'better-payment'),
1868 'type' => Controls_Manager::TEXTAREA,
1869 'default' => __('You paid', 'better-payment') . ' [currency_symbol][amount] ' . __('to', 'better-payment') . ' [store_name]',
1870 'placeholder' => __('You paid', 'better-payment') . ' [currency_symbol][amount] ' . __('to', 'better-payment') . ' [store_name]',
1871 'description' => __('Use shortcode like', 'better-payment') . ' [currency_symbol], [amount], [store_name] ' . __('to customize your message.', 'better-payment') . ' ' . __('eg:', 'better-payment') . ' ' . __('You paid', 'better-payment') . ' [currency_symbol][amount] ' . __('to', 'better-payment') . ' [store_name] ' . __('for your order.', 'better-payment'),
1872 'render_type' => 'none',
1873 ]);
1874
1875 $this->add_control('better_payment_form_success_message_sub_heading', [
1876 'label' => __('Sub Heading', 'better-payment'),
1877 'type' => Controls_Manager::TEXTAREA,
1878 'default' => __('Payment confirmation email will be sent to', 'better-payment') . ' [customer_email]',
1879 'placeholder' => __('Payment confirmation email will be sent to', 'better-payment') . ' [customer_email]',
1880 'description' => __('Payment confirmation email will be sent to', 'better-payment') . ' [customer_email]',
1881 'render_type' => 'none',
1882 ]);
1883
1884 $this->add_control(
1885 'better_payment_form_success_message_transaction',
1886 [
1887 'label' => __( 'Transaction', 'better-payment' ),
1888 'type' => Controls_Manager::TEXT,
1889 'default' => __( 'Transaction ID', 'better-payment' ),
1890 'placeholder' => __( 'Transaction ID', 'better-payment' ),
1891 'dynamic' => [
1892 'active' => true,
1893 ],
1894 'label_block' => true,
1895 'ai' => [
1896 'active' => false,
1897 ],
1898 ]
1899 );
1900
1901 $this->add_control(
1902 'better_payment_form_success_message_thanks',
1903 [
1904 'label' => __( 'Thank You', 'better-payment' ),
1905 'type' => Controls_Manager::TEXT,
1906 'default' => __( 'Thank you for your payment', 'better-payment' ),
1907 'placeholder' => __( 'Thank you for your payment', 'better-payment' ),
1908 'dynamic' => [
1909 'active' => true,
1910 ],
1911 'label_block' => true,
1912 'ai' => [
1913 'active' => false,
1914 ],
1915 ]
1916 );
1917
1918 $this->add_control(
1919 'better_payment_form_success_message_amount_text',
1920 [
1921 'label' => __( 'Amount', 'better-payment' ),
1922 'type' => Controls_Manager::TEXT,
1923 'default' => __( 'Amount', 'better-payment' ),
1924 'placeholder' => __( 'Amount', 'better-payment' ),
1925 'dynamic' => [
1926 'active' => true,
1927 ],
1928 'label_block' => true,
1929 'ai' => [
1930 'active' => false,
1931 ],
1932 ]
1933 );
1934
1935 $this->add_control(
1936 'better_payment_form_success_message_currency_text',
1937 [
1938 'label' => __( 'Currency', 'better-payment' ),
1939 'type' => Controls_Manager::TEXT,
1940 'default' => __( 'Currency', 'better-payment' ),
1941 'placeholder' => __( 'Currency', 'better-payment' ),
1942 'dynamic' => [
1943 'active' => true,
1944 ],
1945 'label_block' => true,
1946 'ai' => [
1947 'active' => false,
1948 ],
1949 ]
1950 );
1951
1952 $this->add_control(
1953 'better_payment_form_success_message_pay_method_text',
1954 [
1955 'label' => __( 'Payment Method', 'better-payment' ),
1956 'type' => Controls_Manager::TEXT,
1957 'default' => __( 'Payment Method', 'better-payment' ),
1958 'placeholder' => __( 'Payment Method', 'better-payment' ),
1959 'dynamic' => [
1960 'active' => true,
1961 ],
1962 'label_block' => true,
1963 'ai' => [
1964 'active' => false,
1965 ],
1966 ]
1967 );
1968
1969 $this->add_control(
1970 'better_payment_form_success_message_pay_type_text',
1971 [
1972 'label' => __( 'Payment Type', 'better-payment' ),
1973 'type' => Controls_Manager::TEXT,
1974 'default' => __( 'Payment Type', 'better-payment' ),
1975 'placeholder' => __( 'Payment Type', 'better-payment' ),
1976 'dynamic' => [
1977 'active' => true,
1978 ],
1979 'label_block' => true,
1980 'ai' => [
1981 'active' => false,
1982 ],
1983 ]
1984 );
1985
1986 $this->add_control(
1987 'better_payment_form_success_message_merchant_details_text',
1988 [
1989 'label' => __( 'Merchant Details', 'better-payment' ),
1990 'type' => Controls_Manager::TEXT,
1991 'default' => __( 'Merchant Details', 'better-payment' ),
1992 'placeholder' => __( 'Merchant Details', 'better-payment' ),
1993 'dynamic' => [
1994 'active' => true,
1995 ],
1996 'label_block' => true,
1997 'ai' => [
1998 'active' => false,
1999 ],
2000 ]
2001 );
2002
2003 $this->add_control(
2004 'better_payment_form_success_message_paid_amount_text',
2005 [
2006 'label' => __( 'Paid Amount', 'better-payment' ),
2007 'type' => Controls_Manager::TEXT,
2008 'default' => __( 'Paid Amount', 'better-payment' ),
2009 'placeholder' => __( 'Paid Amount', 'better-payment' ),
2010 'dynamic' => [
2011 'active' => true,
2012 ],
2013 'label_block' => true,
2014 'ai' => [
2015 'active' => false,
2016 ],
2017 ]
2018 );
2019
2020 $this->add_control(
2021 'better_payment_form_success_message_purchase_details_text',
2022 [
2023 'label' => __( 'Purchase Details', 'better-payment' ),
2024 'type' => Controls_Manager::TEXT,
2025 'default' => __( 'Purchase Details', 'better-payment' ),
2026 'placeholder' => __( 'Purchase Details', 'better-payment' ),
2027 'dynamic' => [
2028 'active' => true,
2029 ],
2030 'label_block' => true,
2031 'ai' => [
2032 'active' => false,
2033 ],
2034 ]
2035 );
2036
2037 $this->add_control(
2038 'better_payment_form_success_message_print_btn_text',
2039 [
2040 'label' => __( 'Print', 'better-payment' ),
2041 'type' => Controls_Manager::TEXT,
2042 'default' => __( 'Print', 'better-payment' ),
2043 'placeholder' => __( 'Print', 'better-payment' ),
2044 'dynamic' => [
2045 'active' => true,
2046 ],
2047 'label_block' => true,
2048 'ai' => [
2049 'active' => false,
2050 ],
2051 ]
2052 );
2053
2054 $this->add_control(
2055 'better_payment_form_success_message_view_details_btn_text',
2056 [
2057 'label' => __( 'View Details', 'better-payment' ),
2058 'type' => Controls_Manager::TEXT,
2059 'default' => __( 'View Details', 'better-payment' ),
2060 'placeholder' => __( 'View Details', 'better-payment' ),
2061 'dynamic' => [
2062 'active' => true,
2063 ],
2064 'label_block' => true,
2065 'ai' => [
2066 'active' => false,
2067 ],
2068 ]
2069 );
2070
2071 $this->add_control( 'better_payment_form_success_page_view_details_url', [
2072 'type' => Controls_Manager::URL,
2073 'label' => __( 'User Dashboard URL', 'better-payment' ),
2074 'show_external' => false,
2075 'placeholder' => __( 'eg. https://example.com/custom-page/', 'better-payment' ),
2076 'description' => __( 'Please enter the page url where <strong>User Dashboard</strong> widget is used.', 'better-payment' ),
2077 ] );
2078
2079 $this->add_control( 'better_payment_form_success_page_url', [
2080 'type' => Controls_Manager::URL,
2081 'label' => __( 'Custom Redirect URL', 'better-payment' ),
2082 'show_external' => false,
2083 'placeholder' => __( 'eg. https://example.com/custom-page/', 'better-payment' ),
2084 'description' => __( 'Please note that only your current domain is allowed here to keep your site secure.', 'better-payment' ),
2085 ] );
2086
2087 $this->end_controls_section();
2088 }
2089
2090 public function error_message_setting() {
2091 $this->start_controls_section(
2092 'better_payment_form_error_message_settings',
2093 [
2094 'label' => esc_html__( 'Error Message', 'better-payment' ),
2095 'conditions' => [
2096 'relation' => 'or',
2097 'terms' => [
2098 [
2099 'name' => 'better_payment_form_stripe_enable',
2100 'value' => 'yes',
2101 ],
2102 [
2103 'name' => 'better_payment_form_paypal_enable',
2104 'value' => 'yes',
2105 ],
2106 [
2107 'name' => 'better_payment_form_paystack_enable',
2108 'value' => 'yes',
2109 ],
2110 ],
2111 ]
2112 ]
2113 );
2114
2115 $this->add_control(
2116 'better_payment_form_error_message_icon',
2117 [
2118 'label' => esc_html__( 'Icon', 'better-payment' ),
2119 'type' => Controls_Manager::ICONS,
2120
2121 ]
2122 );
2123
2124 $this->add_control(
2125 'better_payment_form_error_message_heading',
2126 [
2127 'label' => __( 'Heading Message Text', 'better-payment' ),
2128 'type' => Controls_Manager::TEXT,
2129 'default' => __( 'Payment Failed!', 'better-payment' ),
2130 'dynamic' => [
2131 'active' => true,
2132 ],
2133 'label_block' => true,
2134 'ai' => [
2135 'active' => false,
2136 ],
2137 ]
2138 );
2139
2140 $this->add_control(
2141 'better_payment_form_error_message_sub_heading',
2142 [
2143 'label' => __( 'Sub Heading Message Text', 'better-payment' ),
2144 'type' => Controls_Manager::TEXTAREA,
2145 'default' => __( 'Your payment has failed. Please check your payment details', 'better-payment' ),
2146 'dynamic' => [
2147 'active' => true,
2148 ],
2149 'label_block' => true,
2150 'ai' => [
2151 'active' => false,
2152 ],
2153 ]
2154 );
2155
2156 $this->add_control(
2157 'better_payment_form_error_message_transaction_id_text',
2158 [
2159 'label' => __( 'Transaction ID Text', 'better-payment' ),
2160 'type' => Controls_Manager::TEXT,
2161 'default' => __( 'Transaction ID', 'better-payment' ),
2162 'dynamic' => [
2163 'active' => true,
2164 ],
2165 'label_block' => true,
2166 'ai' => [
2167 'active' => false,
2168 ],
2169 ]
2170 );
2171
2172 $this->add_control(
2173 'better_payment_form_error_details_button_switch',
2174 [
2175 'label' => __( 'Show Details Button', 'better-payment' ),
2176 'type' => Controls_Manager::SWITCHER,
2177 'label_on' => __( 'Show', 'better-payment' ),
2178 'label_off' => __( 'Hide', 'better-payment' ),
2179 'return_value' => 'yes',
2180 'default' => 'no',
2181 'separator' => 'before',
2182 ]
2183 );
2184
2185 $this->add_control(
2186 'better_payment_form_error_details_button_text',
2187 [
2188 'label' => __( 'View Details', 'better-payment' ),
2189 'type' => Controls_Manager::TEXT,
2190 'default' => __( 'View Details', 'better-payment' ),
2191 'dynamic' => [
2192 'active' => true,
2193 ],
2194 'label_block' => true,
2195 'ai' => [
2196 'active' => false,
2197 ],
2198 'condition' => [
2199 'better_payment_form_error_details_button_switch' => 'yes',
2200 ],
2201 ]
2202 );
2203
2204 $this->add_control( 'better_payment_form_error_details_page_url', [
2205 'type' => Controls_Manager::URL,
2206 'label' => __( 'User Dashboard URL', 'better-payment' ),
2207 'show_external' => false,
2208 'placeholder' => __( 'eg. https://example.com/custom-page/', 'better-payment' ),
2209 'condition' => [
2210 'better_payment_form_error_details_button_switch' => 'yes',
2211 ],
2212 'description' => __( 'Please enter the page url where <strong>User Dashboard</strong> widget is used.', 'better-payment' ),
2213 ] );
2214
2215 $this->add_control( 'better_payment_form_error_page_url', [
2216 'type' => Controls_Manager::URL,
2217 'label' => __( 'Custom Redirect URL', 'better-payment' ),
2218 'show_external' => false,
2219 'placeholder' => __( 'eg. https://example.com/custom-page/', 'better-payment' ),
2220 'description' => __( 'Please note that only your current domain is allowed here to keep your site secure.', 'better-payment' ),
2221 ] );
2222
2223 $this->end_controls_section();
2224 }
2225
2226 public function form_style() {
2227 $this->form_sidebar_style();
2228 $this->form_sidebar_text_style();
2229 $this->form_container_style();
2230 $this->form_fields_style();
2231 $this->form_fields_amount_style();
2232 $this->form_button_style();
2233
2234 }
2235
2236 public function form_sidebar_style() {
2237 $this->start_controls_section(
2238 'better_payment_form_sidebar_style',
2239 [
2240 'label' => esc_html__( 'Form Sidebar Style', 'better-payment' ),
2241 'tab' => Controls_Manager::TAB_STYLE,
2242 ]
2243 );
2244
2245 $this->add_group_control(
2246 Group_Control_Background::get_type(),
2247 [
2248 'name' => 'better_payment_form_sidebar_background',
2249 'types' => [ 'classic', 'gradient' ],
2250 'selector' => '{{WRAPPER}} .better-payment .dynamic-amount-section, {{WRAPPER}} .better-payment .transaction-details-wrap, {{WRAPPER}} .better-payment .donation-image-wrap, {{WRAPPER}} .better-payment .order-details-wrap',
2251 'fields_options' => [
2252 'color' => [
2253 'selectors' => [
2254 '{{SELECTOR}}' => 'background-color: {{VALUE}}; background-image: none;',
2255 ],
2256 ],
2257 ],
2258 ]
2259 );
2260
2261 $this->add_responsive_control(
2262 'better_payment_form_sidebar_margin',
2263 [
2264 'label' => esc_html__( 'Margin', 'better-payment' ),
2265 'type' => Controls_Manager::DIMENSIONS,
2266 'size_units' => [ 'px', 'em', '%' ],
2267 'selectors' => [
2268 '{{WRAPPER}} .better-payment .dynamic-amount-section' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2269 '{{WRAPPER}} .better-payment .transaction-details-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2270 '{{WRAPPER}} .better-payment .donation-image-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2271 '{{WRAPPER}} .better-payment .order-details-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2272 ],
2273 'separator' => 'before',
2274 ]
2275 );
2276
2277 $this->add_responsive_control(
2278 'better_payment_form_sidebar_padding',
2279 [
2280 'label' => esc_html__( 'Padding', 'better-payment' ),
2281 'type' => Controls_Manager::DIMENSIONS,
2282 'size_units' => [ 'px', 'em', '%' ],
2283 'selectors' => [
2284 '{{WRAPPER}} .better-payment .dynamic-amount-section-inner.p-6' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2285 '{{WRAPPER}} .better-payment .transaction-details-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2286 '{{WRAPPER}} .better-payment .donation-image-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2287 '{{WRAPPER}} .better-payment .order-details-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2288 ],
2289 ]
2290 );
2291
2292 $this->add_responsive_control(
2293 'better_payment_form_sidebar_border_radius',
2294 [
2295 'label' => esc_html__( 'Border Radius', 'better-payment' ),
2296 'type' => Controls_Manager::DIMENSIONS,
2297 'separator' => 'before',
2298 'size_units' => [ 'px' ],
2299 'selectors' => [
2300 '{{WRAPPER}} .better-payment .dynamic-amount-section' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2301 '{{WRAPPER}} .better-payment .transaction-details-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2302 '{{WRAPPER}} .better-payment .donation-image-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2303 '{{WRAPPER}} .better-payment .order-details-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2304 ],
2305 ]
2306 );
2307
2308 $this->add_group_control(
2309 Group_Control_Border::get_type(),
2310 [
2311 'name' => 'better_payment_form_sidebar_border',
2312 'selector' => '{{WRAPPER}} .better-payment .dynamic-amount-section, {{WRAPPER}} .better-payment .transaction-details-wrap, {{WRAPPER}} .better-payment .donation-image-wrap, {{WRAPPER}} .better-payment .order-details-wrap',
2313 ]
2314 );
2315
2316 $this->add_group_control(
2317 Group_Control_Box_Shadow::get_type(),
2318 [
2319 'name' => 'better_payment_form_sidebar_box_shadow',
2320 'selector' => '{{WRAPPER}} .better-payment .dynamic-amount-section, {{WRAPPER}} .better-payment .transaction-details-wrap, {{WRAPPER}} .better-payment .donation-image-wrap, {{WRAPPER}} .better-payment .order-details-wrap',
2321 ]
2322 );
2323
2324 $this->end_controls_section();
2325 }
2326
2327 public function form_sidebar_text_style() {
2328 $this->start_controls_section(
2329 'better_payment_form_sidebar_text_style',
2330 [
2331 'label' => esc_html__( 'Sidebar Text Style', 'better-payment' ),
2332 'tab' => Controls_Manager::TAB_STYLE,
2333 'condition' => [
2334 'better_payment_form_layout!' => ['layout-5-pro'],
2335 ],
2336 ]
2337 );
2338
2339 $this->add_control(
2340 'better_payment_form_sidebar_text_title_style',
2341 [
2342 'label' => __( 'Title Text', 'better-payment' ),
2343 'type' => Controls_Manager::HEADING,
2344 'condition' => [
2345 'better_payment_form_layout!' => ['layout-5-pro'],
2346 ],
2347 ]
2348 );
2349
2350 $this->add_control(
2351 'better_payment_form_sidebar_text_title_color',
2352 [
2353 'label' => __( 'Color', 'better-payment' ),
2354 'type' => Controls_Manager::COLOR,
2355 'default' => '',
2356 'selectors' => [
2357 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-title' => 'color: {{VALUE}}',
2358 '{{WRAPPER}} .transaction-details-wrap .transaction-details-header-title' => 'color: {{VALUE}}',
2359 '{{WRAPPER}} .order-details-wrap .title' => 'color: {{VALUE}}',
2360 ],
2361 'condition' => [
2362 'better_payment_form_layout!' => ['layout-5-pro'],
2363 ],
2364 ]
2365 );
2366
2367 $this->add_group_control(
2368 Group_Control_Typography::get_type(),
2369 [
2370 'name' => 'better_payment_form_sidebar_text_title_typography',
2371 'label' => __( 'Typography', 'better-payment' ),
2372 'selector' => '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-title, {{WRAPPER}} .transaction-details-wrap .transaction-details-header-title, {{WRAPPER}} .order-details-wrap .title',
2373 'separator' => 'after',
2374 'condition' => [
2375 'better_payment_form_layout!' => ['layout-5-pro'],
2376 ],
2377 ]
2378 );
2379
2380 $this->add_responsive_control(
2381 'better_payment_form_sidebar_text_title_margin',
2382 [
2383 'label' => esc_html__( 'Margin', 'better-payment' ),
2384 'type' => Controls_Manager::DIMENSIONS,
2385 'size_units' => [ 'px', 'em', '%' ],
2386 'selectors' => [
2387 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2388 '{{WRAPPER}} .transaction-details-wrap .transaction-details-header-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2389 '{{WRAPPER}} .order-details-wrap .title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2390 ],
2391 'condition' => [
2392 'better_payment_form_layout!' => ['layout-5-pro'],
2393 ],
2394 ]
2395 );
2396
2397 $this->add_responsive_control(
2398 'better_payment_form_sidebar_text_title_padding',
2399 [
2400 'label' => esc_html__( 'Padding', 'better-payment' ),
2401 'type' => Controls_Manager::DIMENSIONS,
2402 'size_units' => [ 'px', 'em', '%' ],
2403 'selectors' => [
2404 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2405 '{{WRAPPER}} .transaction-details-wrap .transaction-details-header-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2406 '{{WRAPPER}} .order-details-wrap .title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2407 ],
2408 'condition' => [
2409 'better_payment_form_layout!' => ['layout-5-pro'],
2410 ],
2411 ]
2412 );
2413
2414 $this->add_control(
2415 'better_payment_form_sidebar_text_sub_title_style',
2416 [
2417 'label' => __( 'Sub-Title Text', 'better-payment' ),
2418 'type' => Controls_Manager::HEADING,
2419 'separator' => 'before',
2420 'condition' => [
2421 'better_payment_form_layout!' => ['layout-5-pro', 'layout-6-pro'],
2422 ],
2423 ],
2424 );
2425
2426 $this->add_control(
2427 'better_payment_form_sidebar_text_sub_title_color',
2428 [
2429 'label' => __( 'Color', 'better-payment' ),
2430 'type' => Controls_Manager::COLOR,
2431 'default' => '',
2432 'selectors' => [
2433 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-sub-title' => 'color: {{VALUE}}',
2434 '{{WRAPPER}} .transaction-details-wrap .transaction-details-header-paragraph' => 'color: {{VALUE}}',
2435 ],
2436 'condition' => [
2437 'better_payment_form_layout!' => ['layout-5-pro', 'layout-6-pro'],
2438 ],
2439 ]
2440 );
2441
2442 $this->add_group_control(
2443 Group_Control_Typography::get_type(),
2444 [
2445 'name' => 'better_payment_form_sidebar_text_sub_title_typography',
2446 'label' => __( 'Typography', 'better-payment' ),
2447 'selector' => '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-sub-title, {{WRAPPER}} .transaction-details-wrap .transaction-details-header-paragraph',
2448 'condition' => [
2449 'better_payment_form_layout!' => ['layout-5-pro', 'layout-6-pro'],
2450 ],
2451 ]
2452 );
2453
2454 $this->add_responsive_control(
2455 'better_payment_form_sidebar_text_sub_title_margin',
2456 [
2457 'label' => esc_html__( 'Margin', 'better-payment' ),
2458 'type' => Controls_Manager::DIMENSIONS,
2459 'size_units' => [ 'px', 'em', '%' ],
2460 'selectors' => [
2461 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-sub-title' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2462 '{{WRAPPER}} .transaction-details-wrap .transaction-details-header-paragraph' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2463 ],
2464 'condition' => [
2465 'better_payment_form_layout!' => ['layout-5-pro', 'layout-6-pro'],
2466 ],
2467 ]
2468 );
2469
2470 $this->add_responsive_control(
2471 'better_payment_form_sidebar_text_sub_title_padding',
2472 [
2473 'label' => esc_html__( 'Padding', 'better-payment' ),
2474 'type' => Controls_Manager::DIMENSIONS,
2475 'size_units' => [ 'px', 'em', '%' ],
2476 'selectors' => [
2477 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-sub-title' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2478 '{{WRAPPER}} .transaction-details-wrap .transaction-details-header-paragraph' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2479 ],
2480 'condition' => [
2481 'better_payment_form_layout!' => ['layout-5-pro', 'layout-6-pro'],
2482 ],
2483 ]
2484 );
2485
2486 $this->add_control(
2487 'better_payment_form_sidebar_text_amount_style',
2488 [
2489 'label' => __( 'Amount Text', 'better-payment' ),
2490 'type' => Controls_Manager::HEADING,
2491 'separator' => 'before',
2492 'condition' => [
2493 'better_payment_form_layout!' => ['layout-5-pro'],
2494 ],
2495 ],
2496 );
2497
2498 $this->add_control(
2499 'better_payment_form_sidebar_text_amount_title_color',
2500 [
2501 'label' => __( 'Color', 'better-payment' ),
2502 'type' => Controls_Manager::COLOR,
2503 'default' => '',
2504 'selectors' => [
2505 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount' => 'color: {{VALUE}}',
2506 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount a' => 'color: {{VALUE}}',
2507 '{{WRAPPER}} .transaction-details-wrap .total-amount-text' => 'color: {{VALUE}}',
2508 '{{WRAPPER}} .order-details-wrap .total-amount-text' => 'color: {{VALUE}}',
2509 ],
2510 'condition' => [
2511 'better_payment_form_layout!' => ['layout-5-pro'],
2512 ],
2513 ]
2514 );
2515
2516 $this->add_group_control(
2517 Group_Control_Typography::get_type(),
2518 [
2519 'name' => 'better_payment_form_sidebar_text_amount_typography',
2520 'label' => __( 'Typography', 'better-payment' ),
2521 'selector' => '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount, {{WRAPPER}} .transaction-details-wrap .total-amount-text, {{WRAPPER}} .order-details-wrap .total-amount-text',
2522 'condition' => [
2523 'better_payment_form_layout!' => ['layout-5-pro'],
2524 ],
2525 ]
2526 );
2527
2528 $this->add_responsive_control(
2529 'better_payment_form_sidebar_text_amount_margin',
2530 [
2531 'label' => esc_html__( 'Margin', 'better-payment' ),
2532 'type' => Controls_Manager::DIMENSIONS,
2533 'size_units' => [ 'px', 'em', '%' ],
2534 'selectors' => [
2535 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2536 '{{WRAPPER}} .transaction-details-wrap .total-amount-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2537 '{{WRAPPER}} .order-details-wrap .total-amount-text' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2538 ],
2539 'condition' => [
2540 'better_payment_form_layout!' => ['layout-5-pro'],
2541 ],
2542 ]
2543 );
2544
2545 $this->add_responsive_control(
2546 'better_payment_form_sidebar_text_amount_padding',
2547 [
2548 'label' => esc_html__( 'Padding', 'better-payment' ),
2549 'type' => Controls_Manager::DIMENSIONS,
2550 'size_units' => [ 'px', 'em', '%' ],
2551 'selectors' => [
2552 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2553 '{{WRAPPER}} .transaction-details-wrap .total-amount-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2554 '{{WRAPPER}} .order-details-wrap .total-amount-text' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2555 ],
2556 'condition' => [
2557 'better_payment_form_layout!' => ['layout-5-pro'],
2558 ],
2559 ]
2560 );
2561
2562 $this->add_control(
2563 'better_payment_form_sidebar_text_amount_summary_style',
2564 [
2565 'label' => __( 'Amount Summary', 'better-payment' ),
2566 'type' => Controls_Manager::HEADING,
2567 'separator' => 'before',
2568 'condition' => [
2569 'better_payment_form_layout!' => ['layout-5-pro'],
2570 ],
2571 ],
2572 );
2573
2574 $this->add_control(
2575 'better_payment_form_sidebar_text_amount_summary_color',
2576 [
2577 'label' => __( 'Color', 'better-payment' ),
2578 'type' => Controls_Manager::COLOR,
2579 'default' => '',
2580 'selectors' => [
2581 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount-summary' => 'color: {{VALUE}}',
2582 '{{WRAPPER}} .transaction-details-wrap .total-amount-number' => 'color: {{VALUE}}',
2583 '{{WRAPPER}} .transaction-details-wrap .total-amount-number span' => 'color: {{VALUE}}',
2584 '{{WRAPPER}} .order-details-wrap .total-amount-number' => 'color: {{VALUE}}',
2585 ],
2586 'condition' => [
2587 'better_payment_form_layout!' => ['layout-5-pro'],
2588 ],
2589 ]
2590 );
2591
2592 $this->add_group_control(
2593 Group_Control_Typography::get_type(),
2594 [
2595 'name' => 'better_payment_form_sidebar_text_amount_summary_typography',
2596 'label' => __( 'Typography', 'better-payment' ),
2597 'selector' => '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount-summary, {{WRAPPER}} .transaction-details-wrap .total-amount-number, {{WRAPPER}} .transaction-details-wrap .total-amount-number span, {{WRAPPER}} .order-details-wrap .total-amount-number',
2598 'condition' => [
2599 'better_payment_form_layout!' => ['layout-5-pro'],
2600 ],
2601 ]
2602 );
2603
2604 $this->add_responsive_control(
2605 'better_payment_form_sidebar_text_amount_summary_margin',
2606 [
2607 'label' => esc_html__( 'Margin', 'better-payment' ),
2608 'type' => Controls_Manager::DIMENSIONS,
2609 'size_units' => [ 'px', 'em', '%' ],
2610 'selectors' => [
2611 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount-summary' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2612 '{{WRAPPER}} .transaction-details-wrap .total-amount-number' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2613 '{{WRAPPER}} .order-details-wrap .total-amount-number' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2614 ],
2615 'condition' => [
2616 'better_payment_form_layout!' => ['layout-5-pro'],
2617 ],
2618 ]
2619 );
2620
2621 $this->add_responsive_control(
2622 'better_payment_form_sidebar_text_amount_summary_padding',
2623 [
2624 'label' => esc_html__( 'Padding', 'better-payment' ),
2625 'type' => Controls_Manager::DIMENSIONS,
2626 'size_units' => [ 'px', 'em', '%' ],
2627 'selectors' => [
2628 '{{WRAPPER}} .dynamic-amount-section-inner .bp-dynamic-amount-section-amount-summary' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2629 '{{WRAPPER}} .transaction-details-wrap .total-amount-number' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2630 '{{WRAPPER}} .order-details-wrap .total-amount-number' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2631 ],
2632 'condition' => [
2633 'better_payment_form_layout!' => ['layout-5-pro'],
2634 ],
2635 ]
2636 );
2637
2638 $this->add_control(
2639 'better_payment_form_sidebar_text_icon_style',
2640 [
2641 'label' => __( 'Icon', 'better-payment' ),
2642 'type' => Controls_Manager::HEADING,
2643 'separator' => 'before',
2644 'condition' => [
2645 'better_payment_form_layout!' => ['layout-1', 'layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
2646 ],
2647 ],
2648 );
2649
2650 $this->add_control(
2651 'better_payment_form_sidebar_text_icon_color',
2652 [
2653 'label' => __( 'Color', 'better-payment' ),
2654 'type' => Controls_Manager::COLOR,
2655 'default' => '',
2656 'selectors' => [
2657 '{{WRAPPER}} .bp-dynamic-amount-section-icon:before' => 'color: {{VALUE}}',
2658 ],
2659 'condition' => [
2660 'better_payment_form_layout!' => ['layout-1', 'layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
2661 ],
2662 ]
2663 );
2664
2665 $this->add_responsive_control(
2666 'better_payment_form_sidebar_text_icon_font_size',
2667 [
2668 'label' => esc_html__( 'Font Size', 'better-payment' ),
2669 'type' => Controls_Manager::SLIDER,
2670 'size_units' => [ 'px', 'em', '%' ],
2671 'range' => [
2672 'px' => [
2673 'min' => 10,
2674 'max' => 100,
2675 ],
2676 'em' => [
2677 'min' => 1,
2678 'max' => 50,
2679 ],
2680 ],
2681 'selectors' => [
2682 '{{WRAPPER}} .bp-dynamic-amount-section-icon:before' => 'font-size: {{SIZE}}{{UNIT}};',
2683 ],
2684 'condition' => [
2685 'better_payment_form_layout!' => ['layout-1', 'layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
2686 ],
2687 ]
2688 );
2689
2690 $this->add_responsive_control(
2691 'better_payment_form_sidebar_text_icon_margin',
2692 [
2693 'label' => esc_html__( 'Margin', 'better-payment' ),
2694 'type' => Controls_Manager::DIMENSIONS,
2695 'size_units' => [ 'px', 'em', '%' ],
2696 'selectors' => [
2697 '{{WRAPPER}} .bp-dynamic-amount-section-icon-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2698 ],
2699 'condition' => [
2700 'better_payment_form_layout!' => ['layout-1', 'layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
2701 ],
2702 ]
2703 );
2704
2705 $this->add_responsive_control(
2706 'better_payment_form_sidebar_text_icon_padding',
2707 [
2708 'label' => esc_html__( 'Padding', 'better-payment' ),
2709 'type' => Controls_Manager::DIMENSIONS,
2710 'size_units' => [ 'px', 'em', '%' ],
2711 'selectors' => [
2712 '{{WRAPPER}} .bp-dynamic-amount-section-icon-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2713 ],
2714 'condition' => [
2715 'better_payment_form_layout!' => ['layout-1', 'layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
2716 ],
2717 ]
2718 );
2719
2720 $this->end_controls_section();
2721 }
2722
2723 public function form_container_style() {
2724 $this->start_controls_section(
2725 'better_payment_form_container_style',
2726 [
2727 'label' => esc_html__( 'Form Container Style', 'better-payment' ),
2728 'tab' => Controls_Manager::TAB_STYLE,
2729 ]
2730 );
2731
2732 $this->add_group_control(
2733 Group_Control_Background::get_type(),
2734 [
2735 'name' => 'better_payment_form_container_background',
2736 'types' => [ 'classic', 'gradient' ],
2737 'selector' => '{{WRAPPER}} .better-payment .form-content-section, {{WRAPPER}} .better-payment .general-form-wrap, {{WRAPPER}} .better-payment .donation-form-wrap, {{WRAPPER}} .better-payment .woo-form-wrap',
2738 ]
2739 );
2740
2741 $this->add_responsive_control(
2742 'better_payment_form_container_margin',
2743 [
2744 'label' => esc_html__( 'Margin', 'better-payment' ),
2745 'type' => Controls_Manager::DIMENSIONS,
2746 'size_units' => [ 'px', 'em', '%' ],
2747 'selectors' => [
2748 '{{WRAPPER}} .better-payment .form-content-section' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2749 '{{WRAPPER}} .better-payment .general-form-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2750 '{{WRAPPER}} .better-payment .donation-form-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2751 '{{WRAPPER}} .better-payment .woo-form-wrap' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2752 ],
2753 ]
2754 );
2755
2756 $this->add_responsive_control(
2757 'better_payment_form_container_padding',
2758 [
2759 'label' => esc_html__( 'Padding', 'better-payment' ),
2760 'type' => Controls_Manager::DIMENSIONS,
2761 'size_units' => [ 'px', 'em', '%' ],
2762 'selectors' => [
2763 '{{WRAPPER}} .better-payment .form-content-section-inner.p-6' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2764 '{{WRAPPER}} .better-payment .general-form-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2765 '{{WRAPPER}} .better-payment .donation-form-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2766 '{{WRAPPER}} .better-payment .woo-form-wrap' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}} !important;',
2767 ],
2768 ]
2769 );
2770
2771 $this->add_control(
2772 'better_payment_form_container_border_radius',
2773 [
2774 'label' => esc_html__( 'Border Radius', 'better-payment' ),
2775 'type' => Controls_Manager::DIMENSIONS,
2776 'separator' => 'before',
2777 'size_units' => [ 'px' ],
2778 'selectors' => [
2779 '{{WRAPPER}} .better-payment .form-content-section' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2780 '{{WRAPPER}} .better-payment .general-form-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2781 '{{WRAPPER}} .better-payment .donation-form-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2782 '{{WRAPPER}} .better-payment .woo-form-wrap' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2783 ],
2784 ]
2785 );
2786
2787 $this->add_group_control(
2788 Group_Control_Border::get_type(),
2789 [
2790 'name' => 'better_payment_form_container_border',
2791 'selector' => '{{WRAPPER}} .better-payment .form-content-section, {{WRAPPER}} .better-payment .general-form-wrap, {{WRAPPER}} .better-payment .donation-form-wrap, {{WRAPPER}} .better-payment .woo-form-wrap',
2792 ]
2793 );
2794
2795 $this->add_group_control(
2796 Group_Control_Box_Shadow::get_type(),
2797 [
2798 'name' => 'better_payment_form_container_box_shadow',
2799 'selector' => '{{WRAPPER}} .better-payment .form-content-section, {{WRAPPER}} .better-payment .general-form-wrap, {{WRAPPER}} .better-payment .donation-form-wrap, {{WRAPPER}} .better-payment .woo-form-wrap',
2800 ]
2801 );
2802
2803 $this->end_controls_section();
2804 }
2805
2806 public function form_fields_style() {
2807 $this->start_controls_section(
2808 'better_payment_form_fields_style',
2809 [
2810 'label' => esc_html__( 'Form Fields Style', 'better-payment' ),
2811 'tab' => Controls_Manager::TAB_STYLE,
2812 ]
2813 );
2814
2815 $this->add_control(
2816 'better_payment_form_fields_input_bg',
2817 [
2818 'label' => __( 'Background Color', 'better-payment' ),
2819 'type' => Controls_Manager::COLOR,
2820 'default' => '',
2821 'selectors' => [
2822 '{{WRAPPER}} .better-payment .form-content-section input' => 'background-color: {{VALUE}}',
2823 '{{WRAPPER}} .better-payment .general-form-wrap input' => 'background-color: {{VALUE}}',
2824 '{{WRAPPER}} .better-payment .donation-form-wrap input' => 'background-color: {{VALUE}}',
2825 '{{WRAPPER}} .better-payment .woo-form-wrap input' => 'background-color: {{VALUE}}',
2826 ],
2827 ]
2828 );
2829
2830 $this->add_control(
2831 'better_payment_form_fields_input_text_color',
2832 [
2833 'label' => __( 'Text Color', 'better-payment' ),
2834 'type' => Controls_Manager::COLOR,
2835 'default' => '',
2836 'selectors' => [
2837 '{{WRAPPER}} .better-payment .form-content-section input' => 'color: {{VALUE}}',
2838 '{{WRAPPER}} .better-payment .form-content-section .payment-method-checkbox' => 'color: {{VALUE}}',
2839 '{{WRAPPER}} .better-payment .general-form-wrap input' => 'color: {{VALUE}}',
2840 '{{WRAPPER}} .better-payment .donation-form-wrap input' => 'color: {{VALUE}}',
2841 '{{WRAPPER}} .better-payment .woo-form-wrap input' => 'color: {{VALUE}}',
2842 ],
2843 ]
2844 );
2845
2846 $this->add_control(
2847 'better_payment_form_fields_input_placeholder_color',
2848 [
2849 'label' => __( 'Placeholder Color', 'better-payment' ),
2850 'type' => Controls_Manager::COLOR,
2851 'default' => '',
2852 'selectors' => [
2853 '{{WRAPPER}} .better-payment .form-content-section input::placeholder' => 'color: {{VALUE}}',
2854 '{{WRAPPER}} .better-payment .general-form-wrap input::placeholder' => 'color: {{VALUE}}',
2855 '{{WRAPPER}} .better-payment .donation-form-wrap input::placeholder' => 'color: {{VALUE}}',
2856 '{{WRAPPER}} .better-payment .woo-form-wrap input::placeholder' => 'color: {{VALUE}}',
2857 ],
2858 ]
2859 );
2860
2861 $this->add_responsive_control(
2862 'better_payment_form_fields_input_spacing',
2863 [
2864 'label' => __( 'Spacing', 'better-payment' ),
2865 'type' => Controls_Manager::SLIDER,
2866 'default' => [
2867 'size' => '0',
2868 'unit' => 'px',
2869 ],
2870 'range' => [
2871 'px' => [
2872 'min' => 0,
2873 'max' => 100,
2874 'step' => 1,
2875 ],
2876 ],
2877 'size_units' => [ 'px', 'em', '%' ],
2878 'selectors' => [
2879 '{{WRAPPER}} .better-payment .form-content-section input' => 'margin-bottom: {{SIZE}}{{UNIT}}',
2880 '{{WRAPPER}} .better-payment .general-form-wrap input' => 'margin-bottom: {{SIZE}}{{UNIT}}',
2881 '{{WRAPPER}} .better-payment .donation-form-wrap input' => 'margin-bottom: {{SIZE}}{{UNIT}}',
2882 '{{WRAPPER}} .better-payment .woo-form-wrap input' => 'margin-bottom: {{SIZE}}{{UNIT}}',
2883 ],
2884 ]
2885 );
2886
2887 $this->add_responsive_control(
2888 'better_payment_form_fields_input_padding',
2889 [
2890 'label' => __( 'Padding', 'better-payment' ),
2891 'type' => Controls_Manager::DIMENSIONS,
2892 'size_units' => [ 'px', 'em', '%' ],
2893 'selectors' => [
2894 '{{WRAPPER}} .better-payment .form-content-section input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2895 '{{WRAPPER}} .better-payment .general-form-wrap input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2896 '{{WRAPPER}} .better-payment .donation-form-wrap input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2897 '{{WRAPPER}} .better-payment .woo-form-wrap input' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2898 ],
2899 ]
2900 );
2901
2902 $this->add_responsive_control(
2903 'better_payment_form_fields_input_text_indent',
2904 [
2905 'label' => __( 'Text Indent', 'better-payment' ),
2906 'type' => Controls_Manager::SLIDER,
2907 'range' => [
2908 'px' => [
2909 'min' => 0,
2910 'max' => 60,
2911 'step' => 1,
2912 ],
2913 '%' => [
2914 'min' => 0,
2915 'max' => 30,
2916 'step' => 1,
2917 ],
2918 ],
2919 'size_units' => [ 'px', 'em', '%' ],
2920 'selectors' => [
2921 '{{WRAPPER}} .form-content-section input' => 'text-indent: {{SIZE}}{{UNIT}}',
2922 '{{WRAPPER}} .general-form-wrap input' => 'text-indent: {{SIZE}}{{UNIT}}',
2923 '{{WRAPPER}} .better-payment .donation-form-wrap input' => 'text-indent: {{SIZE}}{{UNIT}}',
2924 '{{WRAPPER}} .better-payment .woo-form-wrap input' => 'text-indent: {{SIZE}}{{UNIT}}',
2925 ],
2926 ]
2927 );
2928
2929 $this->add_responsive_control(
2930 'better_payment_form_fields_input_width',
2931 [
2932 'label' => __( 'Input Width', 'better-payment' ),
2933 'type' => Controls_Manager::SLIDER,
2934 'range' => [
2935 'px' => [
2936 'min' => 0,
2937 'max' => 1200,
2938 'step' => 1,
2939 ],
2940 ],
2941 'size_units' => [ 'px', 'em', '%' ],
2942 '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' ),
2943 'selectors' => [
2944 '{{WRAPPER}} .better-payment .form-content-section input[type="text"]' => 'width: {{SIZE}}{{UNIT}}',
2945 '{{WRAPPER}} .better-payment .form-content-section input[type="email"]' => 'width: {{SIZE}}{{UNIT}}',
2946 '{{WRAPPER}} .better-payment .form-content-section input[type="number"]' => 'width: {{SIZE}}{{UNIT}}',
2947 '{{WRAPPER}} .better-payment .general-form-wrap input[type="text"]' => 'width: {{SIZE}}{{UNIT}}',
2948 '{{WRAPPER}} .better-payment .general-form-wrap input[type="email"]' => 'width: {{SIZE}}{{UNIT}}',
2949 '{{WRAPPER}} .better-payment .general-form-wrap input[type="number"]' => 'width: {{SIZE}}{{UNIT}}',
2950 '{{WRAPPER}} .better-payment .donation-form-wrap input[type="text"]' => 'width: {{SIZE}}{{UNIT}}',
2951 '{{WRAPPER}} .better-payment .donation-form-wrap input[type="email"]' => 'width: {{SIZE}}{{UNIT}}',
2952 '{{WRAPPER}} .better-payment .donation-form-wrap input[type="number"]' => 'width: {{SIZE}}{{UNIT}}',
2953 '{{WRAPPER}} .better-payment .woo-form-wrap input[type="text"]' => 'width: {{SIZE}}{{UNIT}}',
2954 '{{WRAPPER}} .better-payment .woo-form-wrap input[type="email"]' => 'width: {{SIZE}}{{UNIT}}',
2955 '{{WRAPPER}} .better-payment .woo-form-wrap input[type="number"]' => 'width: {{SIZE}}{{UNIT}}',
2956 ],
2957 ]
2958 );
2959
2960 $this->add_responsive_control(
2961 'better_payment_form_fields_input_height',
2962 [
2963 'label' => __( 'Input Height', 'better-payment' ),
2964 'type' => Controls_Manager::SLIDER,
2965 'range' => [
2966 'px' => [
2967 'min' => 0,
2968 'max' => 1200,
2969 'step' => 1,
2970 ],
2971 ],
2972 'size_units' => [ 'px', 'em', '%' ],
2973 'selectors' => [
2974 '{{WRAPPER}} .better-payment .form-content-section input[type="text"]' => 'height: {{SIZE}}{{UNIT}}',
2975 '{{WRAPPER}} .better-payment .form-content-section input[type="email"]' => 'height: {{SIZE}}{{UNIT}}',
2976 '{{WRAPPER}} .better-payment .form-content-section input[type="number"]' => 'height: {{SIZE}}{{UNIT}}',
2977 '{{WRAPPER}} .better-payment .general-form-wrap input[type="text"]' => 'height: {{SIZE}}{{UNIT}}',
2978 '{{WRAPPER}} .better-payment .general-form-wrap input[type="email"]' => 'height: {{SIZE}}{{UNIT}}',
2979 '{{WRAPPER}} .better-payment .general-form-wrap input[type="number"]' => 'height: {{SIZE}}{{UNIT}}',
2980 '{{WRAPPER}} .better-payment .donation-form-wrap input[type="text"]' => 'height: {{SIZE}}{{UNIT}}',
2981 '{{WRAPPER}} .better-payment .donation-form-wrap input[type="email"]' => 'height: {{SIZE}}{{UNIT}}',
2982 '{{WRAPPER}} .better-payment .donation-form-wrap input[type="number"]' => 'height: {{SIZE}}{{UNIT}}',
2983 '{{WRAPPER}} .better-payment .woo-form-wrap input[type="text"]' => 'height: {{SIZE}}{{UNIT}}',
2984 '{{WRAPPER}} .better-payment .woo-form-wrap input[type="email"]' => 'height: {{SIZE}}{{UNIT}}',
2985 '{{WRAPPER}} .better-payment .woo-form-wrap input[type="number"]' => 'height: {{SIZE}}{{UNIT}}',
2986 ],
2987 ]
2988 );
2989
2990 $this->add_group_control(
2991 Group_Control_Border::get_type(),
2992 [
2993 'name' => 'better_payment_form_fields_input_border',
2994 'label' => __( 'Border', 'better-payment' ),
2995 'placeholder' => '1px',
2996 'default' => '1px',
2997 'selector' => '{{WRAPPER}} .better-payment .form-content-section input, {{WRAPPER}} .better-payment .general-form-wrap input, {{WRAPPER}} .better-payment .donation-form-wrap input, {{WRAPPER}} .better-payment .woo-form-wrap input',
2998 ]
2999 );
3000
3001 $this->add_control(
3002 'better_payment_form_fields_input_radius',
3003 [
3004 'label' => __( 'Border Radius', 'better-payment' ),
3005 'type' => Controls_Manager::DIMENSIONS,
3006 'size_units' => [ 'px', 'em', '%' ],
3007 'selectors' => [
3008 '{{WRAPPER}} .better-payment .form-content-section input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3009 '{{WRAPPER}} .better-payment .general-form-wrap input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3010 '{{WRAPPER}} .better-payment .donation-form-wrap input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3011 '{{WRAPPER}} .better-payment .woo-form-wrap input' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3012 ],
3013 'separator' => 'after',
3014 ]
3015 );
3016
3017 $this->add_group_control(
3018 Group_Control_Typography::get_type(),
3019 [
3020 'name' => 'better_payment_form_fields_input_typography',
3021 'label' => __( 'Typography', 'better-payment' ),
3022 'selector' => '{{WRAPPER}} .better-payment .form-content-section input, {{WRAPPER}} .better-payment .general-form-wrap input, {{WRAPPER}} .better-payment .donation-form-wrap input, {{WRAPPER}} .better-payment .woo-form-wrap input',
3023 ]
3024 );
3025
3026 $this->add_group_control(
3027 Group_Control_Box_Shadow::get_type(),
3028 [
3029 'name' => 'better_payment_form_fields_input_box_shadow',
3030 'selector' => '{{WRAPPER}} .better-payment .form-content-section input, {{WRAPPER}} .better-payment .general-form-wrap input, {{WRAPPER}} .better-payment .donation-form-wrap input, {{WRAPPER}} .better-payment .woo-form-wrap input',
3031 ]
3032 );
3033
3034 $this->add_control(
3035 'better_payment_form_fields_payment_method_label',
3036 [
3037 'label' => esc_html__( 'Payment Method', 'better-payment' ),
3038 'type' => Controls_Manager::HEADING,
3039 'separator' => 'before',
3040 'condition' => [
3041 'better_payment_form_layout!' => ['layout-5-pro'],
3042 ],
3043 ]
3044 );
3045
3046 $this->start_controls_tabs( 'better_payment_form_fields_payment_amount_border_tabs' );
3047
3048 $this->start_controls_tab(
3049 'better_payment_form_fields_payment_method_border_tab_active',
3050 [
3051 'label' => __( 'Active', 'better-payment' ),
3052 'condition' => [
3053 'better_payment_form_layout!' => ['layout-5-pro'],
3054 ],
3055 ]
3056 );
3057
3058 $this->add_group_control(
3059 Group_Control_Border::get_type(),
3060 [
3061 'name' => 'better_payment_form_fields_payment_method_border_active',
3062 'label' => __( 'Border', 'better-payment' ),
3063 'selector' => '{{WRAPPER}} .better-payment .payment-form-layout-3 .payment-method-checkbox.active, {{WRAPPER}} .better-payment .payment-form-layout-1 .payment-method-checkbox.single-item.active, {{WRAPPER}} .better-payment .payment-form-layout-2 .payment-method-checkbox.single-item.active, {{WRAPPER}} .better-payment .general-form-wrap .payment-method-items input:checked + .payment-method-image-wrap, {{WRAPPER}} .better-payment .woo-form-wrap .payment-method-items input:checked + .payment-option',
3064 'condition' => [
3065 'better_payment_form_layout!' => ['layout-5-pro'],
3066 ],
3067 ]
3068 );
3069
3070 $this->end_controls_tab();
3071
3072 $this->start_controls_tab(
3073 'better_payment_form_fields_payment_method_border_tab_inactive',
3074 [
3075 'label' => __( 'Inactive', 'better-payment' ),
3076 'condition' => [
3077 'better_payment_form_layout!' => ['layout-5-pro'],
3078 ],
3079 ]
3080 );
3081
3082 $this->add_group_control(
3083 Group_Control_Border::get_type(),
3084 [
3085 'name' => 'better_payment_form_fields_payment_method_border_inactive',
3086 'label' => __( 'Border', 'better-payment' ),
3087 'selector' => '{{WRAPPER}} .better-payment .payment-form-layout-3 .payment-method-checkbox, {{WRAPPER}} .better-payment .general-form-wrap .payment-method-items .payment-method-image-wrap, {{WRAPPER}} .better-payment .woo-form-wrap .payment-method-items .payment-option',
3088 'condition' => [
3089 'better_payment_form_layout!' => ['layout-5-pro'],
3090 ],
3091 ]
3092 );
3093
3094 $this->end_controls_tab();
3095
3096 $this->end_controls_tabs();
3097
3098 $this->add_control(
3099 'better_payment_form_fields_input_icon_label',
3100 [
3101 'label' => esc_html__( 'Input Icon', 'better-payment' ),
3102 'type' => Controls_Manager::HEADING,
3103 'separator' => 'before',
3104 'condition' => [
3105 'better_payment_form_layout!' => ['layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
3106 ],
3107 ]
3108 );
3109
3110 $this->add_control(
3111 'better_payment_form_fields_input_icon_color',
3112 [
3113 'label' => __( 'Color', 'better-payment' ),
3114 'type' => Controls_Manager::COLOR,
3115 'default' => '',
3116 'selectors' => [
3117 '{{WRAPPER}} .better-payment .form-content-section .control.has-icons-left .icon' => 'color: {{VALUE}}',
3118 '{{WRAPPER}} .better-payment .form-content-section .control.has-icons-right .icon' => 'color: {{VALUE}}',
3119 '{{WRAPPER}} .better-payment .form-content-section .control.has-icons-left .icon i::before' => 'color: {{VALUE}}',
3120 '{{WRAPPER}} .better-payment .form-content-section .control.has-icons-right .icon i::before' => 'color: {{VALUE}}',
3121 '{{WRAPPER}} .better-payment .form-content-section .control .bp-currency-symbol' => 'color: {{VALUE}}',
3122 ],
3123 'condition' => [
3124 'better_payment_form_layout!' => ['layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
3125 ],
3126 ]
3127 );
3128
3129 $this->add_responsive_control(
3130 'better_payment_form_fields_input_icon_size',
3131 [
3132 'label' => __( 'Size', 'better-payment' ),
3133 'type' => Controls_Manager::SLIDER,
3134 'range' => [
3135 'px' => [
3136 'min' => 0,
3137 'max' => 300,
3138 'step' => 1,
3139 ],
3140 ],
3141 'size_units' => [ 'px', 'em', '%' ],
3142 'selectors' => [
3143 '{{WRAPPER}} .better-payment .form-content-section .control.has-icons-left .icon' => 'font-size: {{SIZE}}{{UNIT}}',
3144 '{{WRAPPER}} .better-payment .form-content-section .control.has-icons-right .icon' => 'font-size: {{SIZE}}{{UNIT}}',
3145 '{{WRAPPER}} .better-payment .form-content-section .control .bp-currency-symbol' => 'font-size: {{SIZE}}{{UNIT}}',
3146 ],
3147 'condition' => [
3148 'better_payment_form_layout!' => ['layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
3149 ],
3150 ]
3151 );
3152
3153 $this->add_responsive_control(
3154 'better_payment_form_fields_input_icon_width',
3155 [
3156 'label' => __( 'Width', 'better-payment' ),
3157 'type' => Controls_Manager::SLIDER,
3158 'range' => [
3159 'px' => [
3160 'min' => 0,
3161 'max' => 300,
3162 'step' => 1,
3163 ],
3164 ],
3165 'size_units' => [ 'px', 'em', '%' ],
3166 'selectors' => [
3167 '{{WRAPPER}} .better-payment .form-content-section .control.has-icons-left .icon' => 'width: {{SIZE}}{{UNIT}}',
3168 '{{WRAPPER}} .better-payment .form-content-section .control.has-icons-right .icon' => 'width: {{SIZE}}{{UNIT}}',
3169 ],
3170 'condition' => [
3171 'better_payment_form_layout!' => ['layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
3172 ],
3173 ]
3174 );
3175
3176 $this->add_responsive_control(
3177 'better_payment_form_fields_input_icon_height',
3178 [
3179 'label' => __( 'Height', 'better-payment' ),
3180 'type' => Controls_Manager::SLIDER,
3181 'range' => [
3182 'px' => [
3183 'min' => 0,
3184 'max' => 300,
3185 'step' => 1,
3186 ],
3187 ],
3188 'size_units' => [ 'px', 'em', '%' ],
3189 'selectors' => [
3190 '{{WRAPPER}} .better-payment .form-content-section .control.has-icons-left .icon' => 'height: {{SIZE}}{{UNIT}}',
3191 '{{WRAPPER}} .better-payment .form-content-section .control.has-icons-right .icon' => 'height: {{SIZE}}{{UNIT}}',
3192 ],
3193 'condition' => [
3194 'better_payment_form_layout!' => ['layout-4-pro', 'layout-5-pro', 'layout-6-pro'],
3195 ],
3196 ]
3197 );
3198
3199 $this->end_controls_section();
3200 }
3201
3202 public function form_fields_amount_style() {
3203
3204 $this->start_controls_section(
3205 'better_payment_form_fields_amount_style',
3206 [
3207 'label' => __( 'Amount Fields Style', 'better-payment' ),
3208 'tab' => Controls_Manager::TAB_STYLE,
3209 ]
3210 );
3211
3212 $this->add_responsive_control(
3213 'better_payment_form_fields_amount_width',
3214 [
3215 'label' => __( 'Input Width', 'better-payment' ),
3216 'type' => Controls_Manager::SLIDER,
3217 'range' => [
3218 'px' => [
3219 'min' => 0,
3220 'max' => 1200,
3221 'step' => 1,
3222 ],
3223 ],
3224 'size_units' => [ 'px', 'em', '%' ],
3225 'selectors' => [
3226 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'width: {{SIZE}}{{UNIT}}',
3227 '{{WRAPPER}} .better-payment .general-form-wrap .payment-amount .text' => 'width: {{SIZE}}{{UNIT}}',
3228 '{{WRAPPER}} .better-payment .donation-form-wrap .payment-amount .text' => 'width: {{SIZE}}{{UNIT}}',
3229 '{{WRAPPER}} .better-payment .woo-form-wrap .payment-amount .text' => 'width: {{SIZE}}{{UNIT}}',
3230 ],
3231 ]
3232 );
3233
3234 $this->add_responsive_control(
3235 'better_payment_form_fields_amount_height',
3236 [
3237 'label' => __( 'Input Height', 'better-payment' ),
3238 'type' => Controls_Manager::SLIDER,
3239 'range' => [
3240 'px' => [
3241 'min' => 0,
3242 'max' => 1200,
3243 'step' => 1,
3244 ],
3245 ],
3246 'size_units' => [ 'px', 'em', '%' ],
3247 'selectors' => [
3248 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'height: {{SIZE}}{{UNIT}}',
3249 '{{WRAPPER}} .better-payment .general-form-wrap .payment-amount .text' => 'height: {{SIZE}}{{UNIT}}',
3250 '{{WRAPPER}} .better-payment .donation-form-wrap .payment-amount .text' => 'height: {{SIZE}}{{UNIT}}',
3251 '{{WRAPPER}} .better-payment .woo-form-wrap .payment-amount .text' => 'height: {{SIZE}}{{UNIT}}',
3252 ],
3253 ]
3254 );
3255
3256 $this->add_responsive_control(
3257 'better_payment_form_fields_amount_spacing',
3258 [
3259 'label' => __( 'Spacing', 'better-payment' ),
3260 'type' => Controls_Manager::SLIDER,
3261 'default' => [
3262 'size' => '0',
3263 'unit' => 'px',
3264 ],
3265 'range' => [
3266 'px' => [
3267 'min' => 0,
3268 'max' => 100,
3269 'step' => 1,
3270 ],
3271 ],
3272 'size_units' => [ 'px', 'em', '%' ],
3273 'selectors' => [
3274 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'margin-bottom: {{SIZE}}{{UNIT}}',
3275 '{{WRAPPER}} .better-payment .general-form-wrap .payment-amount .text' => 'margin-bottom: {{SIZE}}{{UNIT}}',
3276 '{{WRAPPER}} .better-payment .donation-form-wrap .payment-amount .text' => 'margin-bottom: {{SIZE}}{{UNIT}}',
3277 '{{WRAPPER}} .better-payment .woo-form-wrap .payment-amount .text' => 'margin-bottom: {{SIZE}}{{UNIT}}',
3278 ],
3279 ]
3280 );
3281
3282 $this->start_controls_tabs( 'better_payment_form_amount_tabs_button_style' );
3283
3284 $this->start_controls_tab(
3285 'better_payment_form_fields_amount_normal',
3286 [
3287 'label' => __( 'Normal', 'better-payment' ),
3288 ]
3289 );
3290
3291 $this->add_control(
3292 'better_payment_form_fields_amount_normal_bg',
3293 [
3294 'label' => __( 'Background Color', 'better-payment' ),
3295 'type' => Controls_Manager::COLOR,
3296 'default' => '',
3297 'selectors' => [
3298 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'background-color: {{VALUE}}',
3299 '{{WRAPPER}} .better-payment .general-form-wrap .payment-amount .text' => 'background-color: {{VALUE}}',
3300 '{{WRAPPER}} .better-payment .donation-form-wrap .payment-amount .text' => 'background-color: {{VALUE}}',
3301 '{{WRAPPER}} .better-payment .woo-form-wrap .payment-amount .text' => 'background-color: {{VALUE}}',
3302 ],
3303 ]
3304 );
3305
3306 $this->add_control(
3307 'better_payment_form_fields_amount_normal_text_color',
3308 [
3309 'label' => __( 'Text Color', 'better-payment' ),
3310 'type' => Controls_Manager::COLOR,
3311 'default' => '',
3312 'selectors' => [
3313 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'color: {{VALUE}}',
3314 '{{WRAPPER}} .better-payment .general-form-wrap .payment-amount .text' => 'color: {{VALUE}}',
3315 '{{WRAPPER}} .better-payment .donation-form-wrap .payment-amount .text' => 'color: {{VALUE}}',
3316 '{{WRAPPER}} .better-payment .woo-form-wrap .payment-amount .text' => 'color: {{VALUE}}',
3317 ],
3318 ]
3319 );
3320
3321 $this->end_controls_tab();
3322
3323 $this->start_controls_tab(
3324 'better_payment_form_fields_amount_selected',
3325 [
3326 'label' => __( 'Selected', 'better-payment' ),
3327 ]
3328 );
3329
3330 $this->add_control(
3331 'better_payment_form_fields_amount_selected_bg',
3332 [
3333 'label' => __( 'Background Color', 'better-payment' ),
3334 'type' => Controls_Manager::COLOR,
3335 'default' => '',
3336 'selectors' => [
3337 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type="radio"].bp-form__control:checked ~ label' => 'background-color: {{VALUE}}',
3338 '{{WRAPPER}} .better-payment .general-form-wrap .payment-amount input:checked + .text' => 'background-color: {{VALUE}}',
3339 '{{WRAPPER}} .better-payment .donation-form-wrap .payment-amount input:checked + .text' => 'background-color: {{VALUE}}',
3340 '{{WRAPPER}} .better-payment .woo-form-wrap .payment-amount input:checked + .text' => 'background-color: {{VALUE}}',
3341 ],
3342 ]
3343 );
3344
3345 $this->add_control(
3346 'better_payment_form_fields_amount_selected_text_color',
3347 [
3348 'label' => __( 'Text Color', 'better-payment' ),
3349 'type' => Controls_Manager::COLOR,
3350 'default' => '',
3351 'selectors' => [
3352 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type="radio"].bp-form__control:checked ~ label' => 'color: {{VALUE}}',
3353 '{{WRAPPER}} .better-payment .general-form-wrap .payment-amount input:checked + .text' => 'color: {{VALUE}}',
3354 '{{WRAPPER}} .better-payment .donation-form-wrap .payment-amount input:checked + .text' => 'color: {{VALUE}}',
3355 '{{WRAPPER}} .better-payment .woo-form-wrap .payment-amount input:checked + .text' => 'color: {{VALUE}}',
3356 ]
3357 ]
3358 );
3359
3360 $this->end_controls_tab();
3361
3362 $this->end_controls_tabs();
3363
3364 $this->add_group_control(
3365 Group_Control_Border::get_type(),
3366 [
3367 'name' => 'better_payment_form_fields_amount_border',
3368 'label' => __( 'Border', 'better-payment' ),
3369 'placeholder' => '1px',
3370 'default' => '1px',
3371 'selector' => '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label, {{WRAPPER}} .better-payment .general-form-wrap .payment-amount input:checked + .text, {{WRAPPER}} .better-payment .donation-form-wrap .payment-amount input:checked + .text, {{WRAPPER}} .better-payment .woo-form-wrap .payment-amount input:checked + .text',
3372 'separator' => 'before',
3373 ]
3374 );
3375
3376 $this->add_control(
3377 'better_payment_form_fields_amount_border_radius',
3378 [
3379 'label' => __( 'Border Radius', 'better-payment' ),
3380 'type' => Controls_Manager::DIMENSIONS,
3381 'size_units' => [ 'px', 'em', '%' ],
3382 'selectors' => [
3383 '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3384 '{{WRAPPER}} .better-payment .general-form-wrap .payment-amount .text' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3385 '{{WRAPPER}} .better-payment .donation-form-wrap .payment-amount .text' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3386 '{{WRAPPER}} .better-payment .woo-form-wrap .payment-amount .text' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3387 ],
3388 ]
3389 );
3390
3391 $this->add_group_control(
3392 Group_Control_Typography::get_type(),
3393 [
3394 'name' => 'better_payment_form_fields_amount_typography',
3395 'label' => __( 'Typography', 'better-payment' ),
3396 'selector' => '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label, {{WRAPPER}} .better-payment .general-form-wrap .payment-amount .text, {{WRAPPER}} .better-payment .donation-form-wrap .payment-amount .text, {{WRAPPER}} .better-payment .woo-form-wrap .payment-amount .text',
3397 'separator' => 'before',
3398 ]
3399 );
3400
3401 $this->add_group_control(
3402 Group_Control_Box_Shadow::get_type(),
3403 [
3404 'name' => 'better_payment_form_fields_amount_box_shadow',
3405 'selector' => '{{WRAPPER}} .payment-form-layout .bp-payment-amount-wrap .bp-form__group label, {{WRAPPER}} .better-payment .general-form-wrap .payment-amount .text, {{WRAPPER}} .better-payment .donation-form-wrap .payment-amount .text, {{WRAPPER}} .better-payment .woo-form-wrap .payment-amount .text',
3406 ]
3407 );
3408
3409 $this->end_controls_section();
3410 }
3411
3412 public function form_button_style() {
3413 $this->start_controls_section(
3414 'better_payment_form_button_style',
3415 [
3416 'label' => __( 'Form Button Style', 'better-payment' ),
3417 'tab' => Controls_Manager::TAB_STYLE,
3418 ]
3419 );
3420
3421 $this->add_responsive_control(
3422 'better_payment_form_button_width',
3423 [
3424 'label' => __( 'Width', 'better-payment' ),
3425 'type' => Controls_Manager::SLIDER,
3426 'range' => [
3427 'px' => [
3428 'min' => 0,
3429 'max' => 700,
3430 'step' => 1,
3431 ],
3432 ],
3433 'size_units' => [ 'px', 'em', '%' ],
3434 'selectors' => [
3435 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'flex: none;width: {{SIZE}}{{UNIT}}',
3436 '{{WRAPPER}} .better-payment .general-form-wrap .button' => 'flex: none;width: {{SIZE}}{{UNIT}}',
3437 '{{WRAPPER}} .better-payment .donation-form-wrap .button' => 'flex: none;width: {{SIZE}}{{UNIT}}',
3438 '{{WRAPPER}} .better-payment .woo-form-wrap .button' => 'flex: none;width: {{SIZE}}{{UNIT}}',
3439 ],
3440 ]
3441 );
3442
3443 $this->start_controls_tabs( 'better_payment_form_button_tabs_style' );
3444
3445 $this->start_controls_tab(
3446 'better_payment_form_button_normal',
3447 [
3448 'label' => __( 'Normal', 'better-payment' ),
3449 ]
3450 );
3451
3452 $this->add_control(
3453 'better_payment_form_button_normal_bg',
3454 [
3455 'label' => __( 'Background Color', 'better-payment' ),
3456 'type' => Controls_Manager::COLOR,
3457 'default' => '',
3458 'selectors' => [
3459 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'background-color: {{VALUE}} !important',
3460 '{{WRAPPER}} .better-payment .general-form-wrap .button' => 'background-color: {{VALUE}} !important',
3461 '{{WRAPPER}} .better-payment .donation-form-wrap .button' => 'background-color: {{VALUE}} !important',
3462 '{{WRAPPER}} .better-payment .woo-form-wrap .button' => 'background: {{VALUE}}',
3463 ],
3464 ]
3465 );
3466
3467 $this->add_control(
3468 'better_payment_form_button_normal_text_color',
3469 [
3470 'label' => __( 'Text Color', 'better-payment' ),
3471 'type' => Controls_Manager::COLOR,
3472 'default' => '',
3473 'selectors' => [
3474 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'color: {{VALUE}} !important',
3475 '{{WRAPPER}} .better-payment .general-form-wrap .button' => 'color: {{VALUE}} !important',
3476 '{{WRAPPER}} .better-payment .donation-form-wrap .button' => 'color: {{VALUE}} !important',
3477 '{{WRAPPER}} .better-payment .woo-form-wrap .button' => 'color: {{VALUE}} !important',
3478 ],
3479 ]
3480 );
3481
3482 $this->add_group_control(
3483 Group_Control_Border::get_type(),
3484 [
3485 'name' => 'better_payment_form_button_normal_border',
3486 'label' => __( 'Border', 'better-payment' ),
3487 'default' => '1px',
3488 'selector' => '{{WRAPPER}} .better-payment .payment-form-layout .button, {{WRAPPER}} .better-payment .general-form-wrap .button, {{WRAPPER}} .better-payment .donation-form-wrap .button, {{WRAPPER}} .better-payment .woo-form-wrap .button',
3489 ]
3490 );
3491
3492 $this->add_control(
3493 'better_payment_form_button_normal_border_radius',
3494 [
3495 'label' => __( 'Border Radius', 'better-payment' ),
3496 'type' => Controls_Manager::DIMENSIONS,
3497 'size_units' => [ 'px', 'em', '%' ],
3498 'selectors' => [
3499 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3500 '{{WRAPPER}} .better-payment .general-form-wrap .button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3501 '{{WRAPPER}} .better-payment .donation-form-wrap .button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3502 '{{WRAPPER}} .better-payment .woo-form-wrap .button' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3503 ],
3504 ]
3505 );
3506
3507 $this->add_responsive_control(
3508 'better_payment_form_button_normal_padding',
3509 [
3510 'label' => __( 'Padding', 'better-payment' ),
3511 'type' => Controls_Manager::DIMENSIONS,
3512 'size_units' => [ 'px', 'em', '%' ],
3513 'selectors' => [
3514 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3515 '{{WRAPPER}} .better-payment .general-form-wrap .button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3516 '{{WRAPPER}} .better-payment .donation-form-wrap .button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3517 '{{WRAPPER}} .better-payment .woo-form-wrap .button' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
3518 ],
3519 ]
3520 );
3521
3522 $this->add_responsive_control(
3523 'better_payment_form_button_normal_margin',
3524 [
3525 'label' => __( 'Margin Top', 'better-payment' ),
3526 'type' => Controls_Manager::SLIDER,
3527 'range' => [
3528 'px' => [
3529 'min' => 0,
3530 'max' => 100,
3531 'step' => 1,
3532 ],
3533 ],
3534 'size_units' => [ 'px', 'em', '%' ],
3535 'selectors' => [
3536 '{{WRAPPER}} .better-payment .payment-form-layout .button' => 'margin-top: {{SIZE}}{{UNIT}}',
3537 '{{WRAPPER}} .better-payment .general-form-wrap .button' => 'margin-top: {{SIZE}}{{UNIT}}',
3538 '{{WRAPPER}} .better-payment .donation-form-wrap .button' => 'margin-top: {{SIZE}}{{UNIT}}',
3539 '{{WRAPPER}} .better-payment .woo-form-wrap .button' => 'margin-top: {{SIZE}}{{UNIT}}',
3540 ],
3541 ]
3542 );
3543
3544 $this->add_group_control(
3545 Group_Control_Typography::get_type(),
3546 [
3547 'name' => 'better_payment_form_button_normal_typography',
3548 'label' => __( 'Typography', 'better-payment' ),
3549 'selector' => '{{WRAPPER}} .better-payment .payment-form-layout .button, {{WRAPPER}} .better-payment .general-form-wrap .button, {{WRAPPER}} .better-payment .donation-form-wrap .button, {{WRAPPER}} .better-payment .woo-form-wrap .button',
3550 'separator' => 'before',
3551 ]
3552 );
3553
3554 $this->add_group_control(
3555 Group_Control_Box_Shadow::get_type(),
3556 [
3557 'name' => 'better_payment_form_button_normal_box_shadow',
3558 'selector' => '{{WRAPPER}} .better-payment .payment-form-layout .button, {{WRAPPER}} .better-payment .general-form-wrap .button, {{WRAPPER}} .better-payment .donation-form-wrap .button, {{WRAPPER}} .better-payment .woo-form-wrap .button',
3559 ]
3560 );
3561
3562 $this->end_controls_tab();
3563
3564 $this->start_controls_tab(
3565 'better_payment_form_button_hover',
3566 [
3567 'label' => __( 'Hover', 'better-payment' ),
3568 ]
3569 );
3570
3571 $this->add_control(
3572 'better_payment_form_button_hover_bg',
3573 [
3574 'label' => __( 'Background Color', 'better-payment' ),
3575 'type' => Controls_Manager::COLOR,
3576 'default' => '',
3577 'selectors' => [
3578 '{{WRAPPER}} .better-payment .payment-form-layout .button:hover' => 'background-color: {{VALUE}} !important',
3579 '{{WRAPPER}} .better-payment .payment-form-layout.payment-form-layout-3 .button:hover' => 'background-color: {{VALUE}} !important',
3580 '{{WRAPPER}} .better-payment .general-form-wrap .button:hover' => 'background-color: {{VALUE}} !important',
3581 '{{WRAPPER}} .better-payment .donation-form-wrap .button:hover' => 'background-color: {{VALUE}} !important',
3582 '{{WRAPPER}} .better-payment .woo-form-wrap .button:hover' => 'background-color: {{VALUE}} !important',
3583 ],
3584 ]
3585 );
3586
3587 $this->add_control(
3588 'better_payment_form_button_hover_text_color',
3589 [
3590 'label' => __( 'Text Color', 'better-payment' ),
3591 'type' => Controls_Manager::COLOR,
3592 'default' => '',
3593 'selectors' => [
3594 '{{WRAPPER}} .better-payment .payment-form-layout .button:hover' => 'color: {{VALUE}} !important',
3595 '{{WRAPPER}} .better-payment .payment-form-layout.payment-form-layout-3 .button:hover' => 'color: {{VALUE}} !important',
3596 '{{WRAPPER}} .better-payment .general-form-wrap .button:hover' => 'color: {{VALUE}} !important',
3597 '{{WRAPPER}} .better-payment .donation-form-wrap .button:hover' => 'color: {{VALUE}} !important',
3598 '{{WRAPPER}} .better-payment .woo-form-wrap .button:hover' => 'color: {{VALUE}} !important',
3599 ],
3600 ]
3601 );
3602
3603 $this->add_control(
3604 'better_payment_form_button_hover_border',
3605 [
3606 'label' => __( 'Border Color', 'better-payment' ),
3607 'type' => Controls_Manager::COLOR,
3608 'default' => '',
3609 'selectors' => [
3610 '{{WRAPPER}} .better-payment .payment-form-layout .button:hover' => 'border-color: {{VALUE}}',
3611 '{{WRAPPER}} .better-payment .general-form-wrap .button:hover' => 'border-color: {{VALUE}}',
3612 '{{WRAPPER}} .better-payment .donation-form-wrap .button:hover' => 'border-color: {{VALUE}}',
3613 '{{WRAPPER}} .better-payment .woo-form-wrap .button:hover' => 'border-color: {{VALUE}}',
3614 ],
3615 ]
3616 );
3617
3618 $this->end_controls_tab();
3619
3620 $this->end_controls_tabs();
3621
3622 $this->end_controls_section();
3623 }
3624
3625 /**
3626 * Render the widget output on the frontend.
3627 *
3628 * @since 1.0.0
3629 */
3630 protected function render() {
3631 $is_edit_mode = Plugin::instance()->editor->is_edit_mode();
3632
3633 if ( $is_edit_mode && ( ! current_user_can('manage_options') ) ) {
3634 return;
3635 }
3636
3637 $settings = $this->get_settings_for_display();
3638
3639 if ( $settings[ 'better_payment_form_paypal_enable' ] != 'yes' && $settings[ 'better_payment_form_stripe_enable' ] != 'yes' && $settings[ 'better_payment_form_paystack_enable' ] != 'yes' ) {
3640 return false;
3641 }
3642
3643 $payment_field = "number" ;
3644
3645 $response = Handler::manage_response( $settings, $this->get_id() );
3646 if ( $response ) {
3647 return false;
3648 }
3649
3650 do_action('better_payment/elementor/editor/manage_response_webhook', $this, $settings );
3651
3652 wp_enqueue_script( 'better-payment' );
3653
3654 $action = esc_url( admin_url( 'admin-post.php' ) );
3655 $setting_meta = wp_json_encode( [
3656 'page_id' => get_the_ID(),
3657 'widget_id' => esc_attr( $this->get_id() ),
3658 ] );
3659
3660 $better_payment_placeholder_class = '';
3661 if ( !empty($settings[ 'better_payment_placeholder_switch' ]) && $settings[ 'better_payment_placeholder_switch' ] != 'yes' ) {
3662 $better_payment_placeholder_class = 'better-payment-hide-placeholder';
3663 }
3664
3665 $data = array(
3666 'payment_field' => $payment_field,
3667 'action' => $action,
3668 'setting_meta' => $setting_meta,
3669 'better_payment_placeholder_class' => $better_payment_placeholder_class,
3670 );
3671
3672 $widgetObj = $this;
3673 $extraDatas = $data;
3674
3675 $better_payment_form_layout = sanitize_text_field($settings[ 'better_payment_form_layout' ]);
3676 $better_payment_form_layout = in_array($better_payment_form_layout, array_keys( $this->better_payment_free_layouts() ) ) ? $better_payment_form_layout : 'layout-1';
3677
3678 $template_file = BETTER_PAYMENT_ADMIN_VIEWS_PATH . '/elementor/layouts/' . $better_payment_form_layout . '.php';
3679
3680 if ( false !== strpos( $better_payment_form_layout, '-pro' ) ) {
3681 $template_file = $this->pro_layout_template_file( $better_payment_form_layout, $settings );
3682 }
3683
3684 $better_payment_form_content = '';
3685
3686 if ( file_exists($template_file) ) {
3687 ob_start();
3688 include $template_file;
3689 $better_payment_form_content = ob_get_contents();
3690 ob_end_clean();
3691 }
3692
3693 $better_payment_form_content = apply_filters( 'better_payment/elementor/editor/get_layout_content', $better_payment_form_content, $settings, $this, $data );
3694
3695 echo $better_payment_form_content;
3696 }
3697
3698 /**
3699 * Render amount element
3700 *
3701 * `'version' => 'v2'` is the amount list of Pro layouts 4 and 5, and only Pro's
3702 * templates ask for it. Better Payment Pro prints it itself once it declares
3703 * `elementor_pro_layout_rendering`; Lite's copy (Classes\ProPaymentFormLayouts)
3704 * serves Pro 1.4.3 and older, and nothing is printed otherwise. The method stays
3705 * public with this signature because Pro 1.4.3 calls it
3706 * (tests/Unit/ProCouplingContractTest.php).
3707 *
3708 * @since 0.0.1
3709 */
3710 public function render_amount_element( $settings, $args = [] ) {
3711 if ( ! empty( $args['version'] ) ) {
3712 if ( ProPaymentFormLayouts::lite_copy_applies() ) {
3713 ProPaymentFormLayouts::render_amount_element( $this, $settings );
3714 }
3715
3716 return;
3717 }
3718
3719 $layout_form_currency_symbol = $this->get_currency_symbol( esc_html($settings[ 'better_payment_form_currency' ]) );
3720 $currency_alignment = ! empty ( $settings['better_payment_form_currency_alignment'] ) ? $settings['better_payment_form_currency_alignment'] : 'left';
3721 $layout_form_currency_left = 'left' === $currency_alignment ? $layout_form_currency_symbol : '';
3722 $layout_form_currency_right = 'right' === $currency_alignment ? $layout_form_currency_symbol : '' ;
3723 ?>
3724 <!-- <div class="pt-5"> -->
3725 <?php
3726 foreach ( $settings['better_payment_amount'] as $item ) {
3727 $uid = uniqid();
3728 ?>
3729 <div class="bp-form__group pt-5">
3730 <input type="radio" value="<?php echo floatval( $item[ 'better_payment_amount_val' ] ); ?>"
3731 id="bp_payment_amount-<?php echo esc_attr($uid); ?>" class="bp-form__control bp-form_pay-radio "
3732 name="primary_payment_amount_radio">
3733 <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>
3734 </div>
3735
3736 <?php
3737 }
3738 ?>
3739 <!-- </div> -->
3740 <?php
3741 }
3742
3743 public function render_attribute_default_text( $settings ) {
3744 $render_attribute_default_text = '';
3745
3746 $items = [];
3747 $layout = ! empty( $settings["better_payment_form_layout"] ) ? $settings["better_payment_form_layout"] : '';
3748
3749 switch( $layout ) {
3750 case 'layout-1':
3751 case 'layout-2':
3752 case 'layout-3':
3753 $items = ! empty( $settings['better_payment_form_fields'] ) ? $settings['better_payment_form_fields'] : [];
3754 break;
3755
3756 default:
3757 // Pro layouts 4, 5 and 6. Better Payment Pro reads its own repeater once it
3758 // declares `elementor_pro_layout_rendering`; Lite's copy serves older Pro.
3759 if ( ProPaymentFormLayouts::lite_copy_applies() ) {
3760 $items = ProPaymentFormLayouts::default_text_items( $settings );
3761 }
3762 break;
3763 }
3764
3765 if (!empty($items)) :
3766 foreach ($items as $item) :
3767 $item_primary_field_type = !empty($item["better_payment_primary_field_type"]) ? $item["better_payment_primary_field_type"] : "";
3768 $is_payment_amount_field = 'primary_payment_amount' === $item_primary_field_type ? 1 : 0;
3769
3770 if ( $is_payment_amount_field ) {
3771 $render_attribute_default_dynamic = ! empty( $item["better_payment_field_name_default_dynamic_enable"] ) && 'yes' === $item["better_payment_field_name_default_dynamic_enable"] ? 1 : 0;
3772 $is_campaign_widget = ! empty( $_GET['campaign_id'] ) ? 1 : 0;
3773 $render_attribute_default_text = ( $render_attribute_default_dynamic || $is_campaign_widget ) && ! empty( $_GET['payment_amount'] ) ? floatval( sanitize_text_field( $_GET['payment_amount'] ) ) : '';
3774 }
3775 endforeach;
3776 endif;
3777
3778 return $render_attribute_default_text;
3779 }
3780
3781 /**
3782 * Render campaign_id hidden field
3783 *
3784 * @since 1.0.0
3785 */
3786 public function render_campaign_id_hidden_field( $settings ) {
3787 $campaign_id_value = ! empty( $_GET['campaign_id'] ) ? sanitize_text_field( $_GET['campaign_id'] ) : '';
3788 $campaign_currency_value = ! empty( $_GET['campaign_currency'] ) ? sanitize_text_field( $_GET['campaign_currency'] ) : '';
3789
3790 return '
3791 <input type="hidden" name="campaign_id" value="' . esc_attr( $campaign_id_value ) . '">
3792 <input type="hidden" name="campaign_currency" value="' . esc_attr( $campaign_currency_value ) . '">
3793 ';
3794 }
3795
3796 public function better_payment_free_layouts(){
3797 $layouts = apply_filters('better_payment/elementor/widget/layouts', [
3798 'layout-1' => 'Layout 1',
3799 'layout-2' => 'Layout 2',
3800 'layout-3' => 'Layout 3'
3801 ]);
3802
3803 if ( ! $this->pro_enabled ) {
3804 $pro_banners = [
3805 'layout-4-pro' => 'Layout 4 (Pro)',
3806 'layout-5-pro' => 'Layout 5 (Pro)',
3807 'layout-6-pro' => 'Layout 6 (Pro)',
3808 ];
3809
3810 $layouts = array_merge( $layouts, $pro_banners );
3811 }
3812
3813 return $layouts;
3814 }
3815
3816 public function get_paypal_unsupported_currencies_conditions() {
3817 $paypal_unsupported_currencies = $this->bp_unsupported_currencies('paypal');
3818 $conditions = [];
3819 foreach ($paypal_unsupported_currencies as $currency) {
3820 $conditions[] = [
3821 'name' => 'better_payment_form_currency',
3822 'value' => $currency,
3823 ];
3824 }
3825 return $conditions;
3826 }
3827
3828 /**
3829 * Whether Lite registers its copy of the controls only Pro layouts (4, 5, 6) use.
3830 *
3831 * Only for an active Pro that does not declare `elementor_payment_form_pro_controls`
3832 * (1.4.3 and older); the copy is Classes\ProPaymentFormControls. A current Pro
3833 * registers its own copy of each group on the `better_payment/elementor/editor/pro_layout_*`
3834 * action fired right after each call, so the panel position is unchanged. A free
3835 * install registers none of them: a Pro layout shows only its upgrade banner there,
3836 * and Elementor keeps the saved value of a control that is not registered, so a site
3837 * that loses Pro keeps its configuration. Control ids must never change: saved
3838 * Elementor data, PaymentRequestGuard and the payment handlers read them.
3839 *
3840 * @return bool
3841 */
3842 protected function lite_registers_pro_layout_controls() {
3843 return ProCompatibility::lite_copy_applies( ProPaymentFormControls::FEATURE );
3844 }
3845
3846 /**
3847 * A free control's condition, plus what Pro's payment types add to it.
3848 *
3849 * PayPal, Paystack and the amount list hide for a recurring or split payment. That
3850 * condition names `better_payment_form_payment_type`, a Pro-layout control, and
3851 * Elementor hides — and nulls when rendering — a control whose condition names a
3852 * control that is not registered. So a free install gets the bare condition, Better
3853 * Payment Pro adds the payment type on
3854 * `better_payment/elementor/editor/pro_layout_control_condition`, and Lite adds it
3855 * itself only while it registers the Pro-layout controls for an older Pro.
3856 *
3857 * @param string $control_id The control id.
3858 * @param array $condition The control's own condition.
3859 * @return array
3860 */
3861 protected function pro_layout_control_condition( $control_id, array $condition = [] ) {
3862 if ( $this->lite_registers_pro_layout_controls() ) {
3863 $condition = ProPaymentFormControls::control_condition( $condition, $control_id );
3864 }
3865
3866 $filtered = apply_filters( 'better_payment/elementor/editor/pro_layout_control_condition', $condition, $control_id, $this );
3867
3868 return is_array( $filtered ) ? $filtered : $condition;
3869 }
3870
3871 /**
3872 * The template that renders a Pro layout (`layout-4-pro`, `layout-5-pro`, `layout-6-pro`).
3873 *
3874 * Without Pro it is the upgrade banner. With Pro it is whatever
3875 * `better_payment/elementor/widget/layout_template` returns: Better Payment Pro
3876 * supplies its template there once it declares `elementor_pro_layout_rendering`, and
3877 * for an older Pro the filter starts at Pro's own template
3878 * (Classes\ProPaymentFormLayouts). An active Pro never gets the banner; with no
3879 * template nothing renders.
3880 *
3881 * @param string $layout Whitelisted `-pro` layout key.
3882 * @param array $settings Widget settings.
3883 * @return string Template path, or '' for none.
3884 */
3885 protected function pro_layout_template_file( $layout, $settings ) {
3886 if ( ! $this->pro_enabled ) {
3887 return BETTER_PAYMENT_ADMIN_VIEWS_PATH . '/partials/layout-pro-banners.php';
3888 }
3889
3890 $template = ProPaymentFormLayouts::lite_copy_applies() ? ProPaymentFormLayouts::template_file( $layout ) : '';
3891 $template = apply_filters( 'better_payment/elementor/widget/layout_template', $template, $layout, $settings, $this );
3892
3893 return is_string( $template ) ? $template : '';
3894 }
3895 }
3896