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

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