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

better-payment-widget.php in Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More 0.0.2, at includes/elementor/better-payment-widget.php

2,491 lines 97.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 defined( 'ABSPATH' ) || exit();
3
4 use \Elementor\Controls_Manager as Controls_Manager;
5 use Elementor\Core\Schemes\Typography;
6 use Elementor\Group_Control_Background;
7 use Elementor\Group_Control_Border;
8 use Elementor\Group_Control_Box_Shadow;
9 use Elementor\Group_Control_Typography;
10 use \Elementor\Repeater;
11 use Elementor\Utils;
12 use \Elementor\Widget_Base as Widget_Base;
13
14 class Better_Payment_Widget extends Widget_Base {
15
16 private $better_payment_global_settings = [];
17
18 public function get_name() {
19 return 'better-payment';
20 }
21
22 public function get_title() {
23 return esc_html__( 'Better Payment', 'better-payment' );
24 }
25
26 public function get_icon() {
27 return 'bp-icon bp-logo';
28 }
29
30 public function get_keywords() {
31 return [
32 'payment', 'better-payment' ,'paypal', 'stripe', 'sell', 'donate', 'transaction', 'online-transaction'
33 ];
34 }
35
36 public function get_style_depends() {
37 return [ 'better-payment-el' ];
38 }
39
40 protected function _register_controls() {
41
42 $this->better_payment_global_settings = Better_Payment_DB::get_settings();
43
44 $this->start_controls_section(
45 'better_payment_form_setting',
46 [
47 'label' => esc_html__( 'Payment Settings', 'better-payment' ),
48 ]
49 );
50
51 $this->add_control(
52 'better_payment_form_title',
53 [
54 'label' => __( 'Form Title', 'better-payment' ),
55 'type' => Controls_Manager::TEXT,
56 'dynamic' => [
57 'active' => true,
58 ],
59 'label_block' => true,
60 'default' => __( 'Form Title', 'better-payment' )
61 ]
62 );
63
64 $this->add_control(
65 'better_payment_form_paypal_enable',
66 [
67 'label' => __( 'PayPal Enable', 'better-payment' ),
68 'type' => Controls_Manager::SWITCHER,
69 'label_on' => __( 'Yes', 'better-payment' ),
70 'label_off' => __( 'No', 'better-payment' ),
71 'return_value' => 'yes',
72 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_paypal']), //yes or no
73 ]
74 );
75
76 $this->add_control(
77 'better_payment_form_stripe_enable',
78 [
79 'label' => __( 'Stripe Enable', 'better-payment' ),
80 'type' => Controls_Manager::SWITCHER,
81 'label_on' => __( 'Yes', 'better-payment' ),
82 'label_off' => __( 'No', 'better-payment' ),
83 'return_value' => 'yes',
84 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_stripe']), //yes or no
85 ]
86 );
87
88 $this->add_control(
89 'better_payment_form_email_enable',
90 [
91 'label' => __( 'Email Enable', 'better-payment' ),
92 'type' => Controls_Manager::SWITCHER,
93 'label_on' => __( 'Yes', 'better-payment' ),
94 'label_off' => __( 'No', 'better-payment' ),
95 'return_value' => 'yes',
96 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_email']), //yes or no
97 ]
98 );
99
100 $this->add_control(
101 'better_payment_form_currency',
102 [
103 'label' => esc_html__( 'Currency Symbols', 'better-payment' ),
104 'type' => Controls_Manager::SELECT,
105 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_general_general_currency']), //USD
106 'options' => [
107 'AUD' => 'AUD',
108 'CAD' => 'CAD',
109 'CZK' => 'CZK',
110 'DKK' => 'DKK',
111 'EUR' => 'EUR',
112 'HKD' => 'HKD',
113 'HUF' => 'HUF',
114 'ILS' => 'ILS',
115 'JPY' => 'JPY',
116 'MXN' => 'MXN',
117 'NOK' => 'NOK',
118 'NZD' => 'NZD',
119 'PHP' => 'PHP',
120 'PLN' => 'PLN',
121 'GBP' => 'GBP',
122 'RUB' => 'RUB',
123 'SGD' => 'SGD',
124 'SEK' => 'SEK',
125 'CHF' => 'CHF',
126 'TWD' => 'TWD',
127 'THB' => 'THB',
128 'USD' => 'USD'
129 ],
130 'conditions' => [
131 'relation' => 'or',
132 'terms' => [
133 [
134 'name' => 'better_payment_form_stripe_enable',
135 'value' => 'yes',
136 ],
137 [
138 'name' => 'better_payment_form_paypal_enable',
139 'value' => 'yes',
140 ],
141 ],
142 ]
143 ]
144 );
145
146 $this->end_controls_section();
147
148 $this->form_element_settings();
149 $this->paypal_form_setting();
150 $this->stripe_form_setting();
151 $this->email_element_settings();
152
153 $this->success_message_setting();
154 $this->error_message_setting();
155
156 $this->form_style();
157 }
158
159 public function form_element_settings() {
160 $this->start_controls_section(
161 'better_payment_form_element',
162 [
163 'label' => esc_html__( 'Form Settings', 'better-payment' ),
164 'conditions' => [
165 'relation' => 'or',
166 'terms' => [
167 [
168 'name' => 'better_payment_form_stripe_enable',
169 'value' => 'yes',
170 ],
171 [
172 'name' => 'better_payment_form_paypal_enable',
173 'value' => 'yes',
174 ],
175 ]
176 ]
177 ]
178 );
179
180 $this->add_control(
181 'better_payment_first_name_heading',
182 [
183 'label' => __( 'First Name', 'better-payment' ),
184 'type' => Controls_Manager::HEADING,
185 ]
186 );
187
188 $this->add_control(
189 'better_payment_first_name_placeholder',
190 [
191 'label' => __( 'Placeholder Text', 'better-payment' ),
192 'type' => Controls_Manager::TEXT,
193 'default' => __( 'First Name', 'better-payment' ),
194 'dynamic' => [
195 'active' => true,
196 ],
197 'label_block' => true,
198 ]
199 );
200
201 $this->add_control(
202 'better_payment_first_name_show',
203 [
204 'label' => __( 'Show', 'better-payment' ),
205 'type' => Controls_Manager::SWITCHER,
206 'label_on' => __( 'Yes', 'better-payment' ),
207 'label_off' => __( 'No', 'better-payment' ),
208 'return_value' => 'yes',
209 'default' => 'yes',
210
211 ]
212 );
213
214 $this->add_control(
215 'better_payment_first_name_required',
216 [
217 'label' => __( 'Required', 'better-payment' ),
218 'type' => Controls_Manager::SWITCHER,
219 'label_on' => __( 'Yes', 'better-payment' ),
220 'label_off' => __( 'No', 'better-payment' ),
221 'return_value' => 'yes',
222 'default' => 'no',
223 'condition' => [
224 'better_payment_first_name_show' => 'yes'
225 ],
226 'separator' => 'after',
227 ]
228 );
229
230 $this->add_control(
231 'better_payment_last_heading',
232 [
233 'label' => __( 'Last Name', 'better-payment' ),
234 'type' => Controls_Manager::HEADING,
235 ]
236 );
237
238 $this->add_control(
239 'better_payment_last_name_placeholder',
240 [
241 'label' => __( 'Placeholder', 'better-payment' ),
242 'type' => Controls_Manager::TEXT,
243 'default' => __( 'Last Name', 'better-payment' ),
244 'dynamic' => [
245 'active' => true,
246 ],
247 'label_block' => true
248 ]
249 );
250
251 $this->add_control(
252 'better_payment_last_name_show',
253 [
254 'label' => __( 'Show', 'better-payment' ),
255 'type' => Controls_Manager::SWITCHER,
256 'label_on' => __( 'Yes', 'better-payment' ),
257 'label_off' => __( 'No', 'better-payment' ),
258 'return_value' => 'yes',
259 'default' => 'yes',
260 ]
261 );
262
263 $this->add_control(
264 'better_payment_last_name_required',
265 [
266 'label' => __( 'Required', 'better-payment' ),
267 'type' => Controls_Manager::SWITCHER,
268 'label_on' => __( 'Yes', 'better-payment' ),
269 'label_off' => __( 'No', 'better-payment' ),
270 'return_value' => 'yes',
271 'default' => 'no',
272 'condition' => [
273 'better_payment_last_name_show' => 'yes'
274 ],
275 'separator' => 'after',
276 ]
277 );
278
279 $this->add_control(
280 'better_payment_email_heading',
281 [
282 'label' => __( 'Email', 'better-payment' ),
283 'type' => Controls_Manager::HEADING,
284 ]
285 );
286
287 $this->add_control(
288 'better_payment_email_placeholder',
289 [
290 'label' => __( 'Placeholder', 'better-payment' ),
291 'type' => Controls_Manager::TEXT,
292 'default' => __( 'Email', 'better-payment' ),
293 'dynamic' => [
294 'active' => true,
295 ],
296 'label_block' => true
297 ]
298 );
299
300 $this->add_control(
301 'better_payment_email_show',
302 [
303 'label' => __( 'Show', 'better-payment' ),
304 'type' => Controls_Manager::SWITCHER,
305 'label_on' => __( 'Yes', 'better-payment' ),
306 'label_off' => __( 'No', 'better-payment' ),
307 'return_value' => 'yes',
308 'default' => 'yes',
309 ]
310 );
311
312 $this->add_control(
313 'better_payment_email_required',
314 [
315 'label' => __( 'Required', 'better-payment' ),
316 'type' => Controls_Manager::SWITCHER,
317 'label_on' => __( 'Yes', 'better-payment' ),
318 'label_off' => __( 'No', 'better-payment' ),
319 'return_value' => 'yes',
320 'default' => 'no',
321 'condition' => [
322 'better_payment_email_show' => 'yes'
323 ],
324 'separator' => 'after',
325 ]
326 );
327
328 $repeater = new Repeater();
329
330
331 $repeater->add_control(
332 'better_payment_amount_val',
333 [
334 'label' => esc_html__( 'Amount', 'better-payment' ),
335 'type' => Controls_Manager::NUMBER,
336 'min' => 1,
337 ]
338 );
339
340 $this->add_control(
341 'better_payment_show_amount_list',
342 [
343 'label' => __( 'Show Amount List', 'better-payment' ),
344 'type' => Controls_Manager::SWITCHER,
345 'label_on' => __( 'Yes', 'better-payment' ),
346 'label_off' => __( 'No', 'better-payment' ),
347 'return_value' => 'yes',
348 'default' => 'yes',
349 'separator' => 'before',
350 ]
351 );
352
353 $this->add_control(
354 'better_payment_amount',
355 [
356 'label' => esc_html__( 'Amount List', 'better-payment' ),
357 'type' => Controls_Manager::REPEATER,
358 'default' => [
359 [
360 'better_payment_amount_val' => 5
361 ],
362 [
363 'better_payment_amount_val' => 10
364 ],
365 [
366 'better_payment_amount_val' => 15
367 ],
368 ],
369 'fields' => $repeater->get_controls(),
370 'title_field' => '<i class="{{ better_payment_amount_val }}" aria-hidden="true"></i> {{{ better_payment_amount_val }}}',
371 'condition' => [
372 'better_payment_show_amount_list' => 'yes'
373 ],
374 ]
375 );
376
377 $this->end_controls_section();
378 }
379
380 public function paypal_form_setting() {
381 $this->start_controls_section(
382 'better_payment_form_paypal_settings',
383 [
384 'label' => esc_html__( 'PayPal Settings', 'better-payment' ),
385 'condition' => [
386 'better_payment_form_paypal_enable' => 'yes'
387 ]
388 ]
389 );
390
391
392 $this->add_control(
393 'better_payment_paypal_business_email',
394 [
395 'label' => __( 'Business Email', 'better-payment' ),
396 'type' => Controls_Manager::TEXT,
397 'dynamic' => [
398 'active' => true,
399 ],
400 'label_block' => true,
401 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_payment_paypal_email']),
402 ]
403 );
404
405 $this->add_control(
406 'better_payment_paypal_button_type',
407 [
408 'label' => esc_html__( 'Button Type', 'better-payment' ),
409 'type' => Controls_Manager::SELECT,
410 'default' => '_xclick',
411 'options' => [
412 '_xclick' => 'XCLICK',
413 '_cart' => 'CART',
414 '_donations' => 'DONATIONS'
415 ]
416 ]
417 );
418
419 $this->add_control(
420 'better_payment_paypal_live_mode',
421 [
422 'label' => __( 'Live Mode', 'better-payment' ),
423 'type' => Controls_Manager::SWITCHER,
424 'label_on' => __( 'Yes', 'better-payment' ),
425 'label_off' => __( 'No', 'better-payment' ),
426 'return_value' => 'yes',
427 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_payment_paypal_live_mode']), //yes or no
428 ]
429 );
430
431 $this->end_controls_section();
432 }
433
434 public function stripe_form_setting() {
435 $this->start_controls_section(
436 'better_payment_form_stripe_settings',
437 [
438 'label' => esc_html__( 'Stripe Settings', 'better-payment' ),
439 'condition' => [
440 'better_payment_form_stripe_enable' => 'yes'
441 ]
442 ]
443 );
444
445 $better_payment_is_stripe_live = $this->better_payment_global_settings['better_payment_settings_payment_stripe_live_mode'] == 'yes' ? 1 : 0;
446
447 $this->add_control(
448 'better_payment_stripe_public_key',
449 [
450 'label' => __( 'Public Key', 'better-payment' ),
451 'type' => Controls_Manager::TEXT,
452 'dynamic' => [
453 'active' => true,
454 ],
455 'label_block' => true,
456 'default' => $better_payment_is_stripe_live ? esc_html($this->better_payment_global_settings['better_payment_settings_payment_stripe_live_public']) : esc_html($this->better_payment_global_settings['better_payment_settings_payment_stripe_test_public']),
457 ]
458 );
459
460 $this->add_control(
461 'better_payment_stripe_secret_key',
462 [
463 'label' => __( 'Secret Key', 'better-payment' ),
464 'type' => Controls_Manager::TEXT,
465 'input_type' => 'password',
466 'dynamic' => [
467 'active' => true,
468 ],
469 'label_block' => true,
470 'default' => $better_payment_is_stripe_live ? esc_html($this->better_payment_global_settings['better_payment_settings_payment_stripe_live_secret']) : esc_html($this->better_payment_global_settings['better_payment_settings_payment_stripe_test_secret']),
471 ]
472 );
473
474 $this->add_control(
475 'better_payment_stripe_live_mode',
476 [
477 'label' => __( 'Live Mode', 'better-payment' ),
478 'type' => Controls_Manager::SWITCHER,
479 'label_on' => __( 'Yes', 'better-payment' ),
480 'label_off' => __( 'No', 'better-payment' ),
481 'return_value' => 'yes',
482 'default' => esc_html($this->better_payment_global_settings['better_payment_settings_payment_paypal_live_mode']), //yes or no
483 ]
484 );
485
486 $this->end_controls_section();
487 }
488
489 public function email_element_settings() {
490 $this->start_controls_section(
491 'better_payment_email_element',
492 [
493 'label' => esc_html__( 'Email Settings', 'better-payment' ),
494 'condition' => [
495 'better_payment_form_email_enable' => 'yes'
496 ]
497 ]
498 );
499
500 $this->start_controls_tabs( 'better_payment_email_tabs' );
501
502 //Admin Email Notification
503 $this->start_controls_tab( 'better_payment_email_admin_tab', [
504 'label' => __( 'Admin', 'better-payment' ),
505 ] );
506
507 $this->add_control('better_payment_email_to', [
508 'label' => __('To', 'better-payment'),
509 'type' => Controls_Manager::TEXT,
510 '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')),
511 'placeholder' => get_option('admin_email'),
512 'label_block' => true,
513 'title' => __('Email address to notify site admin after each successful transaction', 'better-payment'),
514 'render_type' => 'none'
515 ]);
516
517 $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')));
518
519 $this->add_control('better_payment_email_subject', [
520 'label' => __('Subject', 'better-payment'),
521 'type' => Controls_Manager::TEXT,
522 'default' => esc_html($default_subject),
523 'placeholder' => esc_html($default_subject),
524 'label_block' => true,
525 'render_type' => 'none'
526 ]);
527
528 $this->add_control('better_payment_email_content', [
529 'label' => __('Message', 'better-payment'),
530 'type' => Controls_Manager::TEXTAREA,
531 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_message_admin']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_message_admin']) : '[bp-all-fields]',
532 'placeholder' => '[bp-all-fields]',
533 'render_type' => 'none'
534 ]);
535
536 $site_url_parsed = parse_url(get_site_url());
537 $better_domain = $site_url_parsed['host'] ? esc_html($site_url_parsed['host']) : 'example.com';
538
539 $this->add_control('better_payment_email_from', [
540 'label' => __('From email', 'better-payment'),
541 'type' => Controls_Manager::TEXT,
542 '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",
543 'render_type' => 'none',
544 'separator' => 'before'
545 ]);
546
547 $this->add_control('better_payment_email_from_name', [
548 'label' => __('From name', 'better-payment'),
549 'type' => Controls_Manager::TEXT,
550 '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')),
551 'render_type' => 'none'
552 ]);
553
554 $this->add_control('better_payment_email_reply_to', [
555 'label' => __('Reply-To', 'better-payment'),
556 'type' => Controls_Manager::TEXT,
557 '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",
558 'placeholder' => "wordpress@$better_domain",
559 'render_type' => 'none'
560 ]);
561
562 $this->add_control('better_payment_email_cc', [
563 'label' => __('Cc', 'better-payment'),
564 'type' => Controls_Manager::TEXT,
565 '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']) : '',
566 'render_type' => 'none'
567 ]);
568
569 $this->add_control('better_payment_email_bcc', [
570 'label' => __('Bcc', 'better-payment'),
571 'type' => Controls_Manager::TEXT,
572 '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']) : '',
573 'render_type' => 'none'
574 ]);
575
576 $this->add_control('better_payment_email_content_type', [
577 'label' => __('Send as', 'better-payment'),
578 'type' => Controls_Manager::SELECT,
579 '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
580 'render_type' => 'none',
581 'options' => [
582 'html' => __('HTML', 'better-payment'),
583 'plain' => __('Plain', 'better-payment')
584 ]
585 ]);
586
587 $this->end_controls_tab();
588
589 //Customer Email Notification
590 $this->start_controls_tab( 'better_payment_email_customer_tab', [
591 'label' => __( 'Customer', 'better-payment' ),
592 ] );
593
594 $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')));
595
596 $this->add_control('better_payment_email_subject_customer', [
597 'label' => __('Subject', 'better-payment'),
598 'type' => Controls_Manager::TEXT,
599 'default' => esc_html($default_subject),
600 'placeholder' => esc_html($default_subject),
601 'label_block' => true,
602 'render_type' => 'none'
603 ]);
604
605 $this->add_control('better_payment_email_content_customer', [
606 'label' => __('Message', 'better-payment'),
607 'type' => Controls_Manager::TEXTAREA,
608 'default' => !empty($this->better_payment_global_settings['better_payment_settings_general_email_message_customer']) ? esc_html($this->better_payment_global_settings['better_payment_settings_general_email_message_customer']) : '[bp-all-fields]',
609 'placeholder' => '[bp-all-fields]',
610 'render_type' => 'none'
611 ]);
612
613 $site_url_parsed = parse_url(get_site_url());
614 $better_domain = $site_url_parsed['host'] ? esc_html($site_url_parsed['host']) : 'example.com';
615
616 $this->add_control('better_payment_email_from_customer', [
617 'label' => __('From email', 'better-payment'),
618 'type' => Controls_Manager::TEXT,
619 '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",
620 'render_type' => 'none',
621 'separator' => 'before'
622 ]);
623
624 $this->add_control('better_payment_email_from_name_customer', [
625 'label' => __('From name', 'better-payment'),
626 'type' => Controls_Manager::TEXT,
627 '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'),
628 'render_type' => 'none'
629 ]);
630
631 $this->add_control('better_payment_email_reply_to_customer', [
632 'label' => __('Reply-To', 'better-payment'),
633 'type' => Controls_Manager::TEXT,
634 '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",
635 'placeholder' => "wordpress@$better_domain",
636 'render_type' => 'none'
637 ]);
638
639 $this->add_control('better_payment_email_cc_customer', [
640 'label' => __('Cc', 'better-payment'),
641 'type' => Controls_Manager::TEXT,
642 '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']) : '',
643 'render_type' => 'none'
644 ]);
645
646 $this->add_control('better_payment_email_bcc_customer', [
647 'label' => __('Bcc', 'better-payment'),
648 'type' => Controls_Manager::TEXT,
649 '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']) : '',
650 'render_type' => 'none'
651 ]);
652
653 $this->add_control('better_payment_email_content_type_customer', [
654 'label' => __('Send as', 'better-payment'),
655 'type' => Controls_Manager::SELECT,
656 '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
657 'render_type' => 'none',
658 'options' => [
659 'html' => __('HTML', 'better-payment'),
660 'plain' => __('Plain', 'better-payment')
661 ]
662 ]);
663
664 $this->end_controls_tab();
665
666 $this->end_controls_tabs();
667
668 $this->end_controls_section();
669 }
670
671 public function success_message_setting() {
672 $this->start_controls_section(
673 'better_payment_form_success_message_settings',
674 [
675 'label' => esc_html__( 'Success Message', 'better-payment' ),
676 'conditions' => [
677 'relation' => 'or',
678 'terms' => [
679 [
680 'name' => 'better_payment_form_stripe_enable',
681 'value' => 'yes',
682 ],
683 [
684 'name' => 'better_payment_form_paypal_enable',
685 'value' => 'yes',
686 ],
687 ],
688 ]
689 ]
690 );
691
692 $this->add_control(
693 'better_payment_form_success_message_icon',
694 [
695 'label' => esc_html__( 'Icon', 'better-payment' ),
696 'type' => Controls_Manager::ICONS,
697
698 ]
699 );
700
701 $this->add_control(
702 'better_payment_form_success_message_heading',
703 [
704 'label' => __( 'Heading Message Text', 'better-payment' ),
705 'type' => Controls_Manager::TEXT,
706 'default' => __( 'Payment Complete', 'better-payment' ),
707 'dynamic' => [
708 'active' => true,
709 ],
710 'label_block' => true
711 ]
712 );
713
714 $this->add_control(
715 'better_payment_form_success_message_transaction',
716 [
717 'label' => __( 'Transaction Text', 'better-payment' ),
718 'type' => Controls_Manager::TEXT,
719 'default' => __( 'Transaction Number', 'better-payment' ),
720 'dynamic' => [
721 'active' => true,
722 ],
723 'label_block' => true
724 ]
725 );
726
727 $this->add_control(
728 'better_payment_form_success_message_thanks',
729 [
730 'label' => __( 'Thanks Text', 'better-payment' ),
731 'type' => Controls_Manager::TEXT,
732 'default' => __( 'Thank you for donation.', 'better-payment' ),
733 'dynamic' => [
734 'active' => true,
735 ],
736 'label_block' => true
737 ]
738 );
739
740 $this->end_controls_section();
741 }
742
743 public function error_message_setting() {
744 $this->start_controls_section(
745 'better_payment_form_error_message_settings',
746 [
747 'label' => esc_html__( 'Error Message', 'better-payment' ),
748 'conditions' => [
749 'relation' => 'or',
750 'terms' => [
751 [
752 'name' => 'better_payment_form_stripe_enable',
753 'value' => 'yes',
754 ],
755 [
756 'name' => 'better_payment_form_paypal_enable',
757 'value' => 'yes',
758 ],
759 ],
760 ]
761 ]
762 );
763
764 $this->add_control(
765 'better_payment_form_error_message_icon',
766 [
767 'label' => esc_html__( 'Icon', 'better-payment' ),
768 'type' => Controls_Manager::ICONS,
769
770 ]
771 );
772
773 $this->add_control(
774 'better_payment_form_error_message_heading',
775 [
776 'label' => __( 'Heading Message Text', 'better-payment' ),
777 'type' => Controls_Manager::TEXT,
778 'default' => __( 'Payment Failed', 'better-payment' ),
779 'dynamic' => [
780 'active' => true,
781 ],
782 'label_block' => true
783 ]
784 );
785
786 $this->end_controls_section();
787 }
788
789 public function form_style() {
790
791 $this->header_form_container();
792
793 $this->form_container();
794
795 $this->input_style();
796
797 $this->amount_field_style();
798
799 $this->placeholder_style();
800
801 $this->paypal_button_style();
802
803 $this->stripe_button();
804
805 $this->success_message_style();
806
807 $this->error_message_style();
808
809 }
810
811 public function header_form_container() {
812 $this->start_controls_section(
813 'header_better_payment_form_settings_style',
814 [
815 'label' => esc_html__( 'Form Container Header Style', 'better-payment' ),
816 'tab' => Controls_Manager::TAB_STYLE,
817 ]
818 );
819
820 $this->add_group_control(
821 Group_Control_Background::get_type(),
822 [
823 'name' => 'header_better_payment_form_topbar_background',
824 'label' => __( 'Top Bar Background', 'better-payment' ),
825 'types' => [ 'classic', 'gradient' ],
826 'selector' => '{{WRAPPER}} .better-payment--container .better-payment-form-layout:before',
827 ]
828 );
829
830 $this->add_responsive_control(
831 'header_better_payment_form_margin',
832 [
833 'label' => esc_html__( 'Margin', 'better-payment' ),
834 'type' => Controls_Manager::DIMENSIONS,
835 'size_units' => [ 'px', 'em', '%' ],
836 'selectors' => [
837 '{{WRAPPER}} .better-payment--container .better-payment-form-layout:before' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
838 ],
839 ]
840 );
841
842 $this->add_responsive_control(
843 'header_better_payment_form_padding',
844 [
845 'label' => esc_html__( 'Padding', 'better-payment' ),
846 'type' => Controls_Manager::DIMENSIONS,
847 'size_units' => [ 'px', 'em', '%' ],
848 'selectors' => [
849 '{{WRAPPER}} .better-payment--container .better-payment-form-layout:before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
850 ],
851 ]
852 );
853
854 $this->add_control(
855 'header_better_payment_form_border_radius',
856 [
857 'label' => esc_html__( 'Border Radius', 'better-payment' ),
858 'type' => Controls_Manager::DIMENSIONS,
859 'separator' => 'before',
860 'size_units' => [ 'px' ],
861 'selectors' => [
862 '{{WRAPPER}} .better-payment--container .better-payment-form-layout:before' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
863 ],
864 ]
865 );
866
867 $this->add_group_control(
868 Group_Control_Border::get_type(),
869 [
870 'name' => 'header_better_payment_form_border',
871 'selector' => '{{WRAPPER}} .better-payment--container .better-payment-form-layout:before',
872 ]
873 );
874
875 $this->add_group_control(
876 Group_Control_Box_Shadow::get_type(),
877 [
878 'name' => 'header_better_payment_form_box_shadow',
879 'selector' => '{{WRAPPER}} .better-payment--container .better-payment-form-layout:before',
880 ]
881 );
882
883 $this->end_controls_section();
884 }
885
886 public function form_container() {
887 $this->start_controls_section(
888 'better_payment_form_settings_style',
889 [
890 'label' => esc_html__( 'Form Container', 'better-payment' ),
891 'tab' => Controls_Manager::TAB_STYLE,
892 ]
893 );
894
895 $this->add_group_control(
896 Group_Control_Background::get_type(),
897 [
898 'name' => 'better_payment_form_background',
899 'label' => __( 'Background', 'better-payment' ),
900 'types' => [ 'classic', 'gradient' ],
901 'selector' => '{{WRAPPER}} .better-payment-form-layout form',
902 ]
903 );
904
905
906 $this->add_responsive_control(
907 'better_payment_form_alignment',
908 [
909 'label' => esc_html__( 'Form Max Width', 'better-payment' ),
910 'type' => Controls_Manager::SLIDER,
911 'size_units' => [ 'px', 'em', '%' ],
912 'range' => [
913 'px' => [
914 'min' => 10,
915 'max' => 1500,
916 ],
917 'em' => [
918 'min' => 1,
919 'max' => 80,
920 ],
921 ],
922 'selectors' => [
923 '{{WRAPPER}} .better-payment-form-layout form' => 'max-width: {{SIZE}}{{UNIT}};',
924 ],
925 ]
926 );
927
928 $this->add_responsive_control(
929 'better_payment_form_margin',
930 [
931 'label' => esc_html__( 'Margin', 'better-payment' ),
932 'type' => Controls_Manager::DIMENSIONS,
933 'size_units' => [ 'px', 'em', '%' ],
934 'selectors' => [
935 '{{WRAPPER}} .better-payment-form-layout form' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
936 ],
937 ]
938 );
939
940 $this->add_responsive_control(
941 'better_payment_form_padding',
942 [
943 'label' => esc_html__( 'Form Padding', 'better-payment' ),
944 'type' => Controls_Manager::DIMENSIONS,
945 'size_units' => [ 'px', 'em', '%' ],
946 'selectors' => [
947 '{{WRAPPER}} .better-payment-form-layout form' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
948 ],
949 ]
950 );
951
952 $this->add_control(
953 'better_payment_form_border_radius',
954 [
955 'label' => esc_html__( 'Border Radius', 'better-payment' ),
956 'type' => Controls_Manager::DIMENSIONS,
957 'separator' => 'before',
958 'size_units' => [ 'px' ],
959 'selectors' => [
960 '{{WRAPPER}} .better-payment-form-layout form' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
961 ],
962 ]
963 );
964
965 $this->add_group_control(
966 Group_Control_Border::get_type(),
967 [
968 'name' => 'better_payment_form_border',
969 'selector' => '{{WRAPPER}} .better-payment-form-layout form',
970 ]
971 );
972
973 $this->add_group_control(
974 Group_Control_Box_Shadow::get_type(),
975 [
976 'name' => 'better_payment_form_box_shadow',
977 'selector' => '{{WRAPPER}} .better-payment-form-layout form',
978 ]
979 );
980
981 $this->end_controls_section();
982 }
983
984 public function input_style() {
985
986 $this->start_controls_section(
987 'better_payment_form_fields_style',
988 [
989 'label' => __( 'Form Input Text', 'better-payment' ),
990 'tab' => Controls_Manager::TAB_STYLE,
991 ]
992 );
993
994 $this->add_control(
995 'better_payment_form_fields_input_field_bg',
996 [
997 'label' => __( 'Background Color', 'better-payment' ),
998 'type' => Controls_Manager::COLOR,
999 'default' => '',
1000 'selectors' => [
1001 '{{WRAPPER}} .better-payment-form-layout form input[type=text]' => 'background-color: {{VALUE}}',
1002 '{{WRAPPER}} .better-payment-form-layout form input[type=email]' => 'background-color: {{VALUE}}',
1003 ],
1004 ]
1005 );
1006
1007 $this->add_control(
1008 'better_payment_form_input_field_text_color',
1009 [
1010 'label' => __( 'Text Color', 'better-payment' ),
1011 'type' => Controls_Manager::COLOR,
1012 'default' => '',
1013 'selectors' => [
1014 '{{WRAPPER}} .better-payment-form-layout form input[type=text]' => 'color: {{VALUE}}',
1015 '{{WRAPPER}} .better-payment-form-layout form input[type=email]' => 'color: {{VALUE}}',
1016 ],
1017 'separator' => 'before',
1018 ]
1019 );
1020
1021 $this->add_responsive_control(
1022 'better_payment_form_input_spacing',
1023 [
1024 'label' => __( 'Spacing', 'better-payment' ),
1025 'type' => Controls_Manager::SLIDER,
1026 'default' => [
1027 'size' => '0',
1028 'unit' => 'px',
1029 ],
1030 'range' => [
1031 'px' => [
1032 'min' => 0,
1033 'max' => 100,
1034 'step' => 1,
1035 ],
1036 ],
1037 'size_units' => [ 'px', 'em', '%' ],
1038 'selectors' => [
1039 '{{WRAPPER}} .better-payment-form-layout form input[type=text]' => 'margin-bottom: {{SIZE}}{{UNIT}}',
1040 '{{WRAPPER}} .better-payment-form-layout form input[type=email]' => 'margin-bottom: {{SIZE}}{{UNIT}}',
1041 ],
1042 ]
1043 );
1044
1045 $this->add_responsive_control(
1046 'better_payment_form_input_field_padding',
1047 [
1048 'label' => __( 'Padding', 'better-payment' ),
1049 'type' => Controls_Manager::DIMENSIONS,
1050 'size_units' => [ 'px', 'em', '%' ],
1051 'selectors' => [
1052 '{{WRAPPER}} .better-payment-form-layout form input[type=text]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1053 '{{WRAPPER}} .better-payment-form-layout form input[type=email]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1054 ],
1055 ]
1056 );
1057
1058 $this->add_responsive_control(
1059 'better_payment_form_input_text_indent',
1060 [
1061 'label' => __( 'Text Indent', 'better-payment' ),
1062 'type' => Controls_Manager::SLIDER,
1063 'range' => [
1064 'px' => [
1065 'min' => 0,
1066 'max' => 60,
1067 'step' => 1,
1068 ],
1069 '%' => [
1070 'min' => 0,
1071 'max' => 30,
1072 'step' => 1,
1073 ],
1074 ],
1075 'size_units' => [ 'px', 'em', '%' ],
1076 'selectors' => [
1077 '{{WRAPPER}} .better-payment-form-layout form input[type=text]' => 'text-indent: {{SIZE}}{{UNIT}}',
1078 '{{WRAPPER}} .better-payment-form-layout form input[type=email]' => 'text-indent: {{SIZE}}{{UNIT}}',
1079 ],
1080 ]
1081 );
1082
1083 $this->add_responsive_control(
1084 'better_payment_form_input_width',
1085 [
1086 'label' => __( 'Input Width', 'better-payment' ),
1087 'type' => Controls_Manager::SLIDER,
1088 'range' => [
1089 'px' => [
1090 'min' => 0,
1091 'max' => 1200,
1092 'step' => 1,
1093 ],
1094 ],
1095 'size_units' => [ 'px', 'em', '%' ],
1096 'selectors' => [
1097 '{{WRAPPER}} .better-payment-form-layout form input[type=text]' => 'width: {{SIZE}}{{UNIT}}',
1098 '{{WRAPPER}} .better-payment-form-layout form input[type=email]' => 'width: {{SIZE}}{{UNIT}}',
1099 ],
1100 ]
1101 );
1102
1103 $this->add_responsive_control(
1104 'better_payment_form_input_height',
1105 [
1106 'label' => __( 'Input Height', 'better-payment' ),
1107 'type' => Controls_Manager::SLIDER,
1108 'range' => [
1109 'px' => [
1110 'min' => 0,
1111 'max' => 1200,
1112 'step' => 1,
1113 ],
1114 ],
1115 'size_units' => [ 'px', 'em', '%' ],
1116 'selectors' => [
1117 '{{WRAPPER}} .better-payment-form-layout form input[type=text]' => 'height: {{SIZE}}{{UNIT}}',
1118 '{{WRAPPER}} .better-payment-form-layout form input[type=email]' => 'height: {{SIZE}}{{UNIT}}',
1119 ],
1120 ]
1121 );
1122
1123 $this->add_group_control(
1124 Group_Control_Border::get_type(),
1125 [
1126 'name' => 'better_payment_form_input_field_border',
1127 'label' => __( 'Border', 'better-payment' ),
1128 'placeholder' => '1px',
1129 'default' => '1px',
1130 'selector' => '{{WRAPPER}} .better-payment-form-layout form input[type=text],{{WRAPPER}} .better-payment-form-layout form input[type=email]',
1131 'separator' => 'before',
1132 ]
1133 );
1134
1135 $this->add_control(
1136 'better_payment_form_input_field_radius',
1137 [
1138 'label' => __( 'Border Radius', 'better-payment' ),
1139 'type' => Controls_Manager::DIMENSIONS,
1140 'size_units' => [ 'px', 'em', '%' ],
1141 'selectors' => [
1142 '{{WRAPPER}} .better-payment-form-layout form input[type=text]' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1143 '{{WRAPPER}} .better-payment-form-layout form input[type=email]' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1144 ],
1145 ]
1146 );
1147
1148 $this->add_group_control(
1149 Group_Control_Typography::get_type(),
1150 [
1151 'name' => 'better_payment_form_input_field_typography',
1152 'label' => __( 'Typography', 'better-payment' ),
1153 'scheme' => Typography::TYPOGRAPHY_4,
1154 'selector' => '{{WRAPPER}} .better-payment-form-layout form input[type=text],{{WRAPPER}} .better-payment-form-layout form input[type=email]',
1155 'separator' => 'before',
1156 ]
1157 );
1158
1159 $this->add_group_control(
1160 Group_Control_Box_Shadow::get_type(),
1161 [
1162 'name' => 'better_payment_form_input_field_box_shadow',
1163 'selector' => '{{WRAPPER}} .better-payment-form-layout form input[type=text],{{WRAPPER}} .better-payment-form-layout form input[type=email]',
1164 'separator' => 'before',
1165 ]
1166 );
1167
1168 $this->end_controls_section();
1169 }
1170
1171 public function amount_field_style() {
1172
1173 $this->start_controls_section(
1174 'better_payment_form_amount_fields_style',
1175 [
1176 'label' => __( 'Form Amount', 'better-payment' ),
1177 'tab' => Controls_Manager::TAB_STYLE,
1178 ]
1179 );
1180
1181 $this->add_responsive_control(
1182 'better_payment_form_amount_width',
1183 [
1184 'label' => __( 'Input Width', 'better-payment' ),
1185 'type' => Controls_Manager::SLIDER,
1186 'default' => [
1187 'size' => '150',
1188 'unit' => 'px',
1189 ],
1190 'range' => [
1191 'px' => [
1192 'min' => 0,
1193 'max' => 1200,
1194 'step' => 1,
1195 ],
1196 ],
1197 'size_units' => [ 'px', 'em', '%' ],
1198 'selectors' => [
1199 '{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]' => 'width: {{SIZE}}{{UNIT}}',
1200 '{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'width: {{SIZE}}{{UNIT}}',
1201 ],
1202 ]
1203 );
1204
1205 $this->add_responsive_control(
1206 'better_payment_form_amount_height',
1207 [
1208 'label' => __( 'Input Height', 'better-payment' ),
1209 'type' => Controls_Manager::SLIDER,
1210 'range' => [
1211 'px' => [
1212 'min' => 0,
1213 'max' => 1200,
1214 'step' => 1,
1215 ],
1216 ],
1217 'size_units' => [ 'px', 'em', '%' ],
1218 'selectors' => [
1219 '{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]' => 'height: {{SIZE}}{{UNIT}}',
1220 '{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'height: {{SIZE}}{{UNIT}}',
1221 ],
1222 ]
1223 );
1224
1225 $this->start_controls_tabs( 'better_payment_form_amount_tabs_button_style' );
1226
1227 $this->start_controls_tab(
1228 'better_payment_form_amount_tab_button_normal',
1229 [
1230 'label' => __( 'Normal', 'better-payment' ),
1231 ]
1232 );
1233
1234 $this->add_control(
1235 'better_payment_form_amount_field_bg',
1236 [
1237 'label' => __( 'Background Color', 'better-payment' ),
1238 'type' => Controls_Manager::COLOR,
1239 'default' => '',
1240 'selectors' => [
1241 '{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]' => 'background-color: {{VALUE}}',
1242 '{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'background-color: {{VALUE}}',
1243 ],
1244 ]
1245 );
1246
1247 $this->add_control(
1248 'better_payment_form_amount_text_color',
1249 [
1250 'label' => __( 'Text Color', 'better-payment' ),
1251 'type' => Controls_Manager::COLOR,
1252 'default' => '',
1253 'selectors' => [
1254 '{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]' => 'color: {{VALUE}}',
1255 '{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'color: {{VALUE}}',
1256 ],
1257 ]
1258 );
1259
1260 $this->end_controls_tab();
1261
1262 $this->start_controls_tab(
1263 'better_payment_form_amount_tab_button_selected',
1264 [
1265 'label' => __( 'Selected', 'better-payment' ),
1266 ]
1267 );
1268
1269 $this->add_control(
1270 'better_payment_form_amount_field_bg_selected',
1271 [
1272 'label' => __( 'Background Color', 'better-payment' ),
1273 'type' => Controls_Manager::COLOR,
1274 'default' => '',
1275 'selectors' => [
1276 '{{WRAPPER}} .better-payment-form-layout .bp-form__group input[type="radio"].bp-form__control:checked ~ label' => 'background-color: {{VALUE}}',
1277 ],
1278 ]
1279 );
1280
1281 $this->add_control(
1282 'better_payment_form_amount_text_color_selected',
1283 [
1284 'label' => __( 'Text Color', 'better-payment' ),
1285 'type' => Controls_Manager::COLOR,
1286 'default' => '',
1287 'selectors' => [
1288 '{{WRAPPER}} .better-payment-form-layout .bp-form__group input[type="radio"].bp-form__control:checked ~ label' => 'color: {{VALUE}}',
1289 ]
1290 ]
1291 );
1292
1293 $this->end_controls_tab();
1294
1295 $this->end_controls_tabs();
1296
1297 $this->add_group_control(
1298 Group_Control_Border::get_type(),
1299 [
1300 'name' => 'better_payment_form_amount_field_border',
1301 'label' => __( 'Border', 'better-payment' ),
1302 'placeholder' => '1px',
1303 'default' => '1px',
1304 'selector' => '{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group label,{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]',
1305 'separator' => 'before',
1306 ]
1307 );
1308
1309 $this->add_control(
1310 'better_payment_form_amount_radius',
1311 [
1312 'label' => __( 'Border Radius', 'better-payment' ),
1313 'type' => Controls_Manager::DIMENSIONS,
1314 'size_units' => [ 'px', 'em', '%' ],
1315 'selectors' => [
1316 '{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1317 '{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1318 ],
1319 ]
1320 );
1321
1322 $this->add_group_control(
1323 Group_Control_Typography::get_type(),
1324 [
1325 'name' => 'better_payment_form_amount_field_typography',
1326 'label' => __( 'Typography', 'better-payment' ),
1327 'scheme' => Typography::TYPOGRAPHY_4,
1328 'selector' => '{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group label,{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]',
1329 'separator' => 'before',
1330 ]
1331 );
1332
1333 $this->add_group_control(
1334 Group_Control_Box_Shadow::get_type(),
1335 [
1336 'name' => 'better_payment_form_amount_field_box_shadow',
1337 'selector' => '{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group label,{{WRAPPER}} .better-payment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]',
1338 'separator' => 'before',
1339 ]
1340 );
1341
1342 $this->end_controls_section();
1343 }
1344
1345 public function placeholder_style() {
1346
1347 $this->start_controls_section(
1348 'better_payment_section_placeholder_style',
1349 [
1350 'label' => __( 'Placeholder', 'better-payment' ),
1351 'tab' => Controls_Manager::TAB_STYLE,
1352 ]
1353 );
1354
1355 $this->add_control(
1356 'better_payment_placeholder_switch',
1357 [
1358 'label' => __( 'Show Placeholder', 'better-payment' ),
1359 'type' => Controls_Manager::SWITCHER,
1360 'default' => 'yes',
1361 'label_on' => __( 'Yes', 'better-payment' ),
1362 'label_off' => __( 'No', 'better-payment' ),
1363 'return_value' => 'yes',
1364 ]
1365 );
1366
1367 $this->add_control(
1368 'better_payment_text_color_placeholder',
1369 [
1370 'label' => __( 'Text Color', 'better-payment' ),
1371 'type' => Controls_Manager::COLOR,
1372 'selectors' => [
1373 '{{WRAPPER}} .better-payment-form-layout form input[type=text]::-webkit-input-placeholder' => 'color: {{VALUE}}',
1374 '{{WRAPPER}} .better-payment-form-layout form input[type=email]::-webkit-input-placeholder' => 'color: {{VALUE}}',
1375 ],
1376 'condition' => [
1377 'better_payment_placeholder_switch' => 'yes',
1378 ],
1379 ]
1380 );
1381
1382 $this->add_group_control(
1383 Group_Control_Typography::get_type(),
1384 [
1385 'name' => 'better_payment_typography_placeholder',
1386 'label' => __( 'Typography', 'better-payment' ),
1387 'scheme' => Typography::TYPOGRAPHY_4,
1388 'selector' => '{{WRAPPER}} .better-payment-form-layout form input[type=text]::-webkit-input-placeholder,{{WRAPPER}} .better-payment-form-layout form input[type=email]::-webkit-input-placeholder',
1389 'condition' => [
1390 'better_payment_placeholder_switch' => 'yes',
1391 ],
1392 ]
1393 );
1394
1395 $this->end_controls_section();
1396 }
1397
1398 public function paypal_button_style() {
1399
1400 $this->start_controls_section(
1401 'better_payment_paypal_button_style',
1402 [
1403 'label' => __( 'PayPal Button', 'better-payment' ),
1404 'tab' => Controls_Manager::TAB_STYLE,
1405 ]
1406 );
1407
1408 $this->add_responsive_control(
1409 'better_payment_paypal_button_align',
1410 [
1411 'label' => __( 'Alignment', 'better-payment' ),
1412 'type' => Controls_Manager::CHOOSE,
1413 'default' => 'center',
1414 'options' => [
1415 'flex-start' => [
1416 'title' => __( 'Left', 'better-payment' ),
1417 'icon' => 'eicon-h-align-left',
1418 ],
1419 'center' => [
1420 'title' => __( 'Center', 'better-payment' ),
1421 'icon' => 'eicon-h-align-center',
1422 ],
1423 'flex-end' => [
1424 'title' => __( 'Right', 'better-payment' ),
1425 'icon' => 'eicon-h-align-right',
1426 ],
1427 ],
1428 'selectors' => [
1429 '{{WRAPPER}} .better_payment__form--one form .payment__option' => 'justify-content: {{VALUE}};',
1430 ],
1431 'condition' => [
1432 'better_payment_form_stripe_enable!' => 'yes',
1433 ],
1434 ]
1435 );
1436
1437 $this->add_responsive_control(
1438 'better_payment_paypal_button_width',
1439 [
1440 'label' => __( 'Width', 'better-payment' ),
1441 'type' => Controls_Manager::SLIDER,
1442 'range' => [
1443 'px' => [
1444 'min' => 0,
1445 'max' => 700,
1446 'step' => 1,
1447 ],
1448 ],
1449 'size_units' => [ 'px', 'em', '%' ],
1450 'selectors' => [
1451 '{{WRAPPER}} .better_payment__form--one form .payment__option .better-payment-paypal-bt' => 'flex: none;width: {{SIZE}}{{UNIT}}',
1452 ],
1453 'condition' => [
1454 'better_payment_form_stripe_enable!' => 'yes',
1455 ],
1456 ]
1457 );
1458
1459 $this->start_controls_tabs( 'better_payment_paypal_tabs_button_style' );
1460
1461 $this->start_controls_tab(
1462 'better_payment_paypal_tab_button_normal',
1463 [
1464 'label' => __( 'Normal', 'better-payment' ),
1465 ]
1466 );
1467
1468 $this->add_control(
1469 'better_payment_paypal_button_bg_color_normal',
1470 [
1471 'label' => __( 'Background Color', 'better-payment' ),
1472 'type' => Controls_Manager::COLOR,
1473 'default' => '',
1474 'selectors' => [
1475 '{{WRAPPER}} .better-payment-form-layout .better-payment-paypal-bt' => 'background-color: {{VALUE}}',
1476 ],
1477 ]
1478 );
1479
1480 $this->add_control(
1481 'better_payment_paypal_button_text_color_normal',
1482 [
1483 'label' => __( 'Text Color', 'better-payment' ),
1484 'type' => Controls_Manager::COLOR,
1485 'default' => '',
1486 'selectors' => [
1487 '{{WRAPPER}} .better-payment-form-layout .better-payment-paypal-bt' => 'color: {{VALUE}}',
1488 ],
1489 ]
1490 );
1491
1492 $this->add_responsive_control(
1493 'better_payment_paypal_button_max_width',
1494 [
1495 'label' => esc_html__( 'Max Width', 'better-payment' ),
1496 'type' => Controls_Manager::SLIDER,
1497 'size_units' => [ 'px', 'em', '%' ],
1498 'range' => [
1499 'px' => [
1500 'min' => 10,
1501 'max' => 1000,
1502 ],
1503 'em' => [
1504 'min' => 1,
1505 'max' => 50,
1506 ],
1507 ],
1508 'selectors' => [
1509 '{{WRAPPER}} .better-payment-form-layout .better-payment-paypal-bt' => 'max-width: {{SIZE}}{{UNIT}};',
1510 ],
1511 ]
1512 );
1513
1514 $this->add_group_control(
1515 Group_Control_Border::get_type(),
1516 [
1517 'name' => 'better_payment_paypal_button_border_normal',
1518 'label' => __( 'Border', 'better-payment' ),
1519 'default' => '1px',
1520 'selector' => '{{WRAPPER}} .better-payment-form-layout .better-payment-paypal-bt',
1521 ]
1522 );
1523
1524 $this->add_control(
1525 'better_payment_paypal_button_border_radius',
1526 [
1527 'label' => __( 'Border Radius', 'better-payment' ),
1528 'type' => Controls_Manager::DIMENSIONS,
1529 'size_units' => [ 'px', 'em', '%' ],
1530 'selectors' => [
1531 '{{WRAPPER}} .better-payment-form-layout .better-payment-paypal-bt' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1532 ],
1533 ]
1534 );
1535
1536 $this->add_responsive_control(
1537 'better_payment_paypal_button_padding',
1538 [
1539 'label' => __( 'Padding', 'better-payment' ),
1540 'type' => Controls_Manager::DIMENSIONS,
1541 'size_units' => [ 'px', 'em', '%' ],
1542 'selectors' => [
1543 '{{WRAPPER}} .better-payment-form-layout .better-payment-paypal-bt' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1544 ],
1545 ]
1546 );
1547
1548 $this->add_responsive_control(
1549 'better_payment_paypal_button_margin',
1550 [
1551 'label' => __( 'Margin Top', 'better-payment' ),
1552 'type' => Controls_Manager::SLIDER,
1553 'range' => [
1554 'px' => [
1555 'min' => 0,
1556 'max' => 100,
1557 'step' => 1,
1558 ],
1559 ],
1560 'size_units' => [ 'px', 'em', '%' ],
1561 'selectors' => [
1562 '{{WRAPPER}} .better-payment-form-layout .better-payment-paypal-bt' => 'margin-top: {{SIZE}}{{UNIT}}',
1563 ],
1564 ]
1565 );
1566
1567 $this->add_group_control(
1568 Group_Control_Typography::get_type(),
1569 [
1570 'name' => 'better_payment_paypal_button_typography',
1571 'label' => __( 'Typography', 'better-payment' ),
1572 'scheme' => Typography::TYPOGRAPHY_4,
1573 'selector' => '{{WRAPPER}} .better-payment-form-layout .better-payment-paypal-bt',
1574 'separator' => 'before',
1575 ]
1576 );
1577
1578 $this->add_group_control(
1579 Group_Control_Box_Shadow::get_type(),
1580 [
1581 'name' => 'better_payment_paypal_button_box_shadow',
1582 'selector' => '{{WRAPPER}} .better-payment-form-layout .better-payment-paypal-bt',
1583 'separator' => 'before',
1584 ]
1585 );
1586
1587 $this->end_controls_tab();
1588
1589 $this->start_controls_tab(
1590 'better_payment_paypal_tab_button_hover',
1591 [
1592 'label' => __( 'Hover', 'better-payment' ),
1593 ]
1594 );
1595
1596 $this->add_control(
1597 'better_payment_paypal_button_bg_color_hover',
1598 [
1599 'label' => __( 'Background Color', 'better-payment' ),
1600 'type' => Controls_Manager::COLOR,
1601 'default' => '',
1602 'selectors' => [
1603 '{{WRAPPER}} .better-payment-form-layout .better-payment-paypal-bt:hover' => 'background-color: {{VALUE}}',
1604 ],
1605 ]
1606 );
1607
1608 $this->add_control(
1609 'better_payment_paypal_button_text_color_hover',
1610 [
1611 'label' => __( 'Text Color', 'better-payment' ),
1612 'type' => Controls_Manager::COLOR,
1613 'default' => '',
1614 'selectors' => [
1615 '{{WRAPPER}} .better-payment-form-layout .better-payment-paypal-bt:hover' => 'color: {{VALUE}}',
1616 ],
1617 ]
1618 );
1619
1620 $this->add_control(
1621 'better_payment_paypal_button_border_color_hover',
1622 [
1623 'label' => __( 'Border Color', 'better-payment' ),
1624 'type' => Controls_Manager::COLOR,
1625 'default' => '',
1626 'selectors' => [
1627 '{{WRAPPER}} .better-payment-form-layout .better-payment-paypal-bt:hover' => 'border-color: {{VALUE}}',
1628 ],
1629 ]
1630 );
1631
1632 $this->end_controls_tab();
1633
1634 $this->end_controls_tabs();
1635
1636 $this->end_controls_section();
1637 }
1638
1639 public function stripe_button() {
1640
1641 $this->start_controls_section(
1642 'better_payment_stripe_button_style',
1643 [
1644 'label' => __( 'Stripe Button', 'better-payment' ),
1645 'tab' => Controls_Manager::TAB_STYLE,
1646 ]
1647 );
1648
1649 $this->add_responsive_control(
1650 'better_payment_stripe_button_align',
1651 [
1652 'label' => __( 'Alignment', 'better-payment' ),
1653 'type' => Controls_Manager::CHOOSE,
1654 'default' => 'center',
1655 'options' => [
1656 'flex-start' => [
1657 'title' => __( 'Left', 'better-payment' ),
1658 'icon' => 'eicon-h-align-left',
1659 ],
1660 'center' => [
1661 'title' => __( 'Center', 'better-payment' ),
1662 'icon' => 'eicon-h-align-center',
1663 ],
1664 'flex-end' => [
1665 'title' => __( 'Right', 'better-payment' ),
1666 'icon' => 'eicon-h-align-right',
1667 ],
1668 ],
1669 'selectors' => [
1670 '{{WRAPPER}} .better_payment__form--one form .payment__option' => 'justify-content: {{VALUE}};',
1671 ],
1672 'condition' => [
1673 'better_payment_form_paypal_enable!' => 'yes',
1674 ],
1675 ]
1676 );
1677
1678 $this->add_responsive_control(
1679 'better_payment_stripe_button_width',
1680 [
1681 'label' => __( 'Width', 'better-payment' ),
1682 'type' => Controls_Manager::SLIDER,
1683 'range' => [
1684 'px' => [
1685 'min' => 0,
1686 'max' => 1200,
1687 'step' => 1,
1688 ],
1689 ],
1690 'size_units' => [ 'px', 'em', '%' ],
1691 'selectors' => [
1692 '{{WRAPPER}} .better_payment__form--one form .payment__option .better-payment-stripe-bt' => 'flex: none;width: {{SIZE}}{{UNIT}}',
1693 ],
1694 'condition' => [
1695 'better_payment_form_paypal_enable!' => 'yes',
1696 ],
1697 ]
1698 );
1699
1700 $this->start_controls_tabs( 'better_payment_stripe_tabs_button_style' );
1701
1702 $this->start_controls_tab(
1703 'better_payment_stripe_tab_button_normal',
1704 [
1705 'label' => __( 'Normal', 'better-payment' ),
1706 ]
1707 );
1708
1709 $this->add_control(
1710 'better_payment_stripe_button_bg_color_normal',
1711 [
1712 'label' => __( 'Background Color', 'better-payment' ),
1713 'type' => Controls_Manager::COLOR,
1714 'default' => '',
1715 'selectors' => [
1716 '{{WRAPPER}} .better-payment-form-layout .better-payment-stripe-bt' => 'background-color: {{VALUE}}',
1717 ],
1718 ]
1719 );
1720
1721 $this->add_control(
1722 'better_payment_stripe_button_text_color_normal',
1723 [
1724 'label' => __( 'Text Color', 'better-payment' ),
1725 'type' => Controls_Manager::COLOR,
1726 'default' => '',
1727 'selectors' => [
1728 '{{WRAPPER}} .better-payment-form-layout .better-payment-stripe-bt' => 'color: {{VALUE}}',
1729 ],
1730 ]
1731 );
1732
1733 $this->add_responsive_control(
1734 'better_payment_stripe_button_max_width',
1735 [
1736 'label' => esc_html__( 'Max Width', 'better-payment' ),
1737 'type' => Controls_Manager::SLIDER,
1738 'size_units' => [ 'px', 'em', '%' ],
1739 'range' => [
1740 'px' => [
1741 'min' => 10,
1742 'max' => 1000,
1743 ],
1744 'em' => [
1745 'min' => 1,
1746 'max' => 50,
1747 ],
1748 ],
1749 'selectors' => [
1750 '{{WRAPPER}} .better-payment-form-layout .better-payment-stripe-bt' => 'max-width: {{SIZE}}{{UNIT}};',
1751 ],
1752 ]
1753 );
1754
1755 $this->add_group_control(
1756 Group_Control_Border::get_type(),
1757 [
1758 'name' => 'better_payment_stripe_button_border_normal',
1759 'label' => __( 'Border', 'better-payment' ),
1760 'default' => '1px',
1761 'selector' => '{{WRAPPER}} .better-payment-form-layout .better-payment-stripe-bt',
1762 ]
1763 );
1764
1765 $this->add_control(
1766 'better_payment_stripe_button_border_radius',
1767 [
1768 'label' => __( 'Border Radius', 'better-payment' ),
1769 'type' => Controls_Manager::DIMENSIONS,
1770 'size_units' => [ 'px', 'em', '%' ],
1771 'selectors' => [
1772 '{{WRAPPER}} .better-payment-form-layout .better-payment-stripe-bt' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1773 ],
1774 ]
1775 );
1776
1777 $this->add_responsive_control(
1778 'better_payment_stripe_button_padding',
1779 [
1780 'label' => __( 'Padding', 'better-payment' ),
1781 'type' => Controls_Manager::DIMENSIONS,
1782 'size_units' => [ 'px', 'em', '%' ],
1783 'selectors' => [
1784 '{{WRAPPER}} .better-payment-form-layout .better-payment-stripe-bt' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1785 ],
1786 ]
1787 );
1788
1789 $this->add_responsive_control(
1790 'better_payment_stripe_button_margin',
1791 [
1792 'label' => __( 'Margin Top', 'better-payment' ),
1793 'type' => Controls_Manager::SLIDER,
1794 'range' => [
1795 'px' => [
1796 'min' => 0,
1797 'max' => 100,
1798 'step' => 1,
1799 ],
1800 ],
1801 'size_units' => [ 'px', 'em', '%' ],
1802 'selectors' => [
1803 '{{WRAPPER}} .better-payment-form-layout .better-payment-stripe-bt' => 'margin-top: {{SIZE}}{{UNIT}}',
1804 ],
1805 ]
1806 );
1807
1808 $this->add_group_control(
1809 Group_Control_Typography::get_type(),
1810 [
1811 'name' => 'better_payment_stripe_button_typography',
1812 'label' => __( 'Typography', 'better-payment' ),
1813 'scheme' => Typography::TYPOGRAPHY_4,
1814 'selector' => '{{WRAPPER}} .better-payment-form-layout .better-payment-stripe-bt',
1815 'separator' => 'before',
1816 ]
1817 );
1818
1819 $this->add_group_control(
1820 Group_Control_Box_Shadow::get_type(),
1821 [
1822 'name' => 'better_payment_stripe_button_box_shadow',
1823 'selector' => '{{WRAPPER}} .better-payment-form-layout .better-payment-stripe-bt',
1824 'separator' => 'before',
1825 ]
1826 );
1827
1828 $this->end_controls_tab();
1829
1830 $this->start_controls_tab(
1831 'better_payment_stripe_tab_button_hover',
1832 [
1833 'label' => __( 'Hover', 'better-payment' ),
1834 ]
1835 );
1836
1837 $this->add_control(
1838 'better_payment_stripe_button_bg_color_hover',
1839 [
1840 'label' => __( 'Background Color', 'better-payment' ),
1841 'type' => Controls_Manager::COLOR,
1842 'default' => '',
1843 'selectors' => [
1844 '{{WRAPPER}} .better-payment-form-layout .better-payment-stripe-bt:hover' => 'background-color: {{VALUE}}',
1845 ],
1846 ]
1847 );
1848
1849 $this->add_control(
1850 'better_payment_stripe_button_text_color_hover',
1851 [
1852 'label' => __( 'Text Color', 'better-payment' ),
1853 'type' => Controls_Manager::COLOR,
1854 'default' => '',
1855 'selectors' => [
1856 '{{WRAPPER}} .better-payment-form-layout .better-payment-stripe-bt:hover' => 'color: {{VALUE}}',
1857 ],
1858 ]
1859 );
1860
1861 $this->add_control(
1862 'better_payment_stripe_button_border_color_hover',
1863 [
1864 'label' => __( 'Border Color', 'better-payment' ),
1865 'type' => Controls_Manager::COLOR,
1866 'default' => '',
1867 'selectors' => [
1868 '{{WRAPPER}} .better-payment-form-layout .better-payment-stripe-bt:hover' => 'border-color: {{VALUE}}',
1869 ],
1870 ]
1871 );
1872
1873 $this->end_controls_tab();
1874
1875 $this->end_controls_tabs();
1876
1877 $this->end_controls_section();
1878 }
1879
1880 public function success_message_style() {
1881
1882 $this->start_controls_section(
1883 'better_payment_section_success_style',
1884 [
1885 'label' => __( 'Success Message', 'better-payment' ),
1886 'tab' => Controls_Manager::TAB_STYLE,
1887 ]
1888 );
1889
1890 $this->add_group_control(
1891 Group_Control_Background::get_type(),
1892 [
1893 'name' => 'better_payment_success_background',
1894 'label' => __( 'Background', 'better-payment' ),
1895 'types' => [ 'classic', 'gradient' ],
1896 'selector' => '{{WRAPPER}} .better-payment-success-report',
1897 ]
1898 );
1899
1900
1901 $this->add_responsive_control(
1902 'better_payment_success_alignment',
1903 [
1904 'label' => esc_html__( 'Form Max Width', 'better-payment' ),
1905 'type' => Controls_Manager::SLIDER,
1906 'size_units' => [ 'px', 'em', '%' ],
1907 'range' => [
1908 'px' => [
1909 'min' => 10,
1910 'max' => 1500,
1911 ],
1912 'em' => [
1913 'min' => 1,
1914 'max' => 80,
1915 ],
1916 ],
1917 'selectors' => [
1918 '{{WRAPPER}} .better-payment-success-report' => 'max-width: {{SIZE}}{{UNIT}};',
1919 ],
1920 ]
1921 );
1922
1923 $this->add_responsive_control(
1924 'better_payment_success_margin',
1925 [
1926 'label' => esc_html__( 'Margin', 'better-payment' ),
1927 'type' => Controls_Manager::DIMENSIONS,
1928 'size_units' => [ 'px', 'em', '%' ],
1929 'selectors' => [
1930 '{{WRAPPER}} .better-payment-success-report' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1931 ],
1932 ]
1933 );
1934
1935 $this->add_responsive_control(
1936 'better_payment_success_padding',
1937 [
1938 'label' => esc_html__( 'Form Padding', 'better-payment' ),
1939 'type' => Controls_Manager::DIMENSIONS,
1940 'size_units' => [ 'px', 'em', '%' ],
1941 'selectors' => [
1942 '{{WRAPPER}} .better-payment-success-report' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1943 ],
1944 ]
1945 );
1946
1947 $this->add_control(
1948 'better_payment_success_border_radius',
1949 [
1950 'label' => esc_html__( 'Border Radius', 'better-payment' ),
1951 'type' => Controls_Manager::DIMENSIONS,
1952 'separator' => 'before',
1953 'size_units' => [ 'px' ],
1954 'selectors' => [
1955 '{{WRAPPER}} .better-payment-success-report' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1956 ],
1957 ]
1958 );
1959
1960 $this->add_group_control(
1961 Group_Control_Border::get_type(),
1962 [
1963 'name' => 'better_payment_success_border',
1964 'selector' => '{{WRAPPER}} .better-payment-success-report',
1965 ]
1966 );
1967
1968 $this->add_group_control(
1969 Group_Control_Box_Shadow::get_type(),
1970 [
1971 'name' => 'better_payment_success_box_shadow',
1972 'selector' => '{{WRAPPER}} .better-payment-success-report',
1973 ]
1974 );
1975
1976 // Success Icon Style : Starts
1977 $this->add_control(
1978 'better_payment_success_icon_style',
1979 [
1980 'label' => __('Icon Style', 'better-payment'),
1981 'type' => Controls_Manager::HEADING,
1982 'separator' => 'before',
1983 ]
1984 );
1985
1986 $this->add_responsive_control(
1987 'better_payment_success_icon_margin',
1988 [
1989 'label' => __('Margin', 'better-payment'),
1990 'type' => Controls_Manager::DIMENSIONS,
1991 'size_units' => ['px', '%', 'em'],
1992 'selectors' => [
1993 '{{WRAPPER}} .better-payment-success-report .report__thumb' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1994 ],
1995 ]
1996 );
1997
1998 $this->add_responsive_control(
1999 'better_payment_success_icon_padding',
2000 [
2001 'label' => __('Padding', 'better-payment'),
2002 'type' => Controls_Manager::DIMENSIONS,
2003 'size_units' => ['px', '%', 'em'],
2004 'selectors' => [
2005 '{{WRAPPER}} .better-payment-success-report .report__thumb' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
2006 ],
2007 ]
2008 );
2009
2010 $this->add_responsive_control(
2011 'better_payment_success_icon_max_width',
2012 [
2013 'label' => esc_html__( 'Max Width', 'better-payment' ),
2014 'type' => Controls_Manager::SLIDER,
2015 'size_units' => [ 'px', 'em', '%' ],
2016 'range' => [
2017 'px' => [
2018 'min' => 10,
2019 'max' => 1000,
2020 ],
2021 'em' => [
2022 'min' => 1,
2023 'max' => 50,
2024 ],
2025 ],
2026 'selectors' => [
2027 '{{WRAPPER}} .better-payment-success-report .report__thumb img' => 'max-width: {{SIZE}}{{UNIT}};',
2028 ],
2029 ]
2030 );
2031
2032 $this->add_responsive_control(
2033 'better_payment_success_icon_font_size',
2034 [
2035 'label' => esc_html__( 'Icon Font Size', 'better-payment' ),
2036 'type' => Controls_Manager::SLIDER,
2037 'size_units' => [ 'px', 'em', '%' ],
2038 'range' => [
2039 'px' => [
2040 'min' => 10,
2041 'max' => 100,
2042 ],
2043 'em' => [
2044 'min' => 1,
2045 'max' => 50,
2046 ],
2047 ],
2048 'selectors' => [
2049 '{{WRAPPER}} .better-payment-success-report .report__thumb i' => 'font-size: {{SIZE}}{{UNIT}};',
2050 ],
2051 ]
2052 );
2053 // Success Icon Style : Ends
2054
2055 $this->add_control(
2056 'better_payment_success_heading_style',
2057 [
2058 'label' => esc_html__( 'Heading Style', 'better-payment' ),
2059 'type' => Controls_Manager::HEADING,
2060 'separator' => 'before',
2061 ]
2062 );
2063
2064 $this->add_control(
2065 'better_payment_success_heading_color',
2066 [
2067 'label' => __( 'Color', 'better-payment' ),
2068 'type' => Controls_Manager::COLOR,
2069 'selectors' => [
2070 '{{WRAPPER}} .better-payment-success-report .transaction__success' => 'color: {{VALUE}}',
2071 ],
2072 ]
2073 );
2074
2075 $this->add_group_control(
2076 Group_Control_Typography::get_type(),
2077 [
2078 'name' => 'better_payment_success_heading_typography',
2079 'label' => __( 'Typography', 'better-payment' ),
2080 'scheme' => Typography::TYPOGRAPHY_4,
2081 'selector' => '{{WRAPPER}} .better-payment-success-report .transaction__success',
2082 ]
2083 );
2084
2085
2086 $this->add_control(
2087 'better_payment_success_transaction_style',
2088 [
2089 'label' => esc_html__( 'Transaction Style', 'better-payment' ),
2090 'type' => Controls_Manager::HEADING,
2091 'separator' => 'before',
2092 ]
2093 );
2094
2095 $this->add_control(
2096 'better_payment_success_transaction_color',
2097 [
2098 'label' => __( 'Color', 'better-payment' ),
2099 'type' => Controls_Manager::COLOR,
2100 'selectors' => [
2101 '{{WRAPPER}} .better-payment-success-report .transaction__number' => 'color: {{VALUE}}',
2102 ],
2103 ]
2104 );
2105
2106 $this->add_group_control(
2107 Group_Control_Typography::get_type(),
2108 [
2109 'name' => 'better_payment_success_transaction_typography',
2110 'label' => __( 'Typography', 'better-payment' ),
2111 'scheme' => Typography::TYPOGRAPHY_4,
2112 'selector' => '{{WRAPPER}} .better-payment-success-report .transaction__number',
2113 ]
2114 );
2115
2116 $this->add_control(
2117 'better_payment_success_thank_you_style',
2118 [
2119 'label' => esc_html__( 'Thank You Message', 'better-payment' ),
2120 'type' => Controls_Manager::HEADING,
2121 'separator' => 'before',
2122 ]
2123 );
2124
2125 $this->add_control(
2126 'better_payment_success_thank_you_color',
2127 [
2128 'label' => __( 'Color', 'better-payment' ),
2129 'type' => Controls_Manager::COLOR,
2130 'selectors' => [
2131 '{{WRAPPER}} .better-payment-success-report .payment__greeting' => 'color: {{VALUE}}',
2132 ],
2133 ]
2134 );
2135
2136 $this->add_group_control(
2137 Group_Control_Typography::get_type(),
2138 [
2139 'name' => 'better_payment_success_thank_you_typography',
2140 'label' => __( 'Typography', 'better-payment' ),
2141 'scheme' => Typography::TYPOGRAPHY_4,
2142 'selector' => '{{WRAPPER}} .better-payment-success-report .payment__greeting',
2143 ]
2144 );
2145
2146 $this->end_controls_section();
2147 }
2148
2149 public function error_message_style() {
2150
2151 $this->start_controls_section(
2152 'better_payment_section_error_style',
2153 [
2154 'label' => __( 'Error Message', 'better-payment' ),
2155 'tab' => Controls_Manager::TAB_STYLE,
2156 ]
2157 );
2158
2159 $this->add_group_control(
2160 Group_Control_Background::get_type(),
2161 [
2162 'name' => 'better_payment_error_background',
2163 'label' => __( 'Background', 'better-payment' ),
2164 'types' => [ 'classic', 'gradient' ],
2165 'selector' => '{{WRAPPER}} .better-payment-error-report',
2166 ]
2167 );
2168
2169
2170 $this->add_responsive_control(
2171 'better_payment_error_alignment',
2172 [
2173 'label' => esc_html__( 'Form Max Width', 'better-payment' ),
2174 'type' => Controls_Manager::SLIDER,
2175 'size_units' => [ 'px', 'em', '%' ],
2176 'range' => [
2177 'px' => [
2178 'min' => 10,
2179 'max' => 1500,
2180 ],
2181 'em' => [
2182 'min' => 1,
2183 'max' => 80,
2184 ],
2185 ],
2186 'selectors' => [
2187 '{{WRAPPER}} .better-payment-error-report' => 'max-width: {{SIZE}}{{UNIT}};',
2188 ],
2189 ]
2190 );
2191
2192 $this->add_responsive_control(
2193 'better_payment_error_margin',
2194 [
2195 'label' => esc_html__( 'Margin', 'better-payment' ),
2196 'type' => Controls_Manager::DIMENSIONS,
2197 'size_units' => [ 'px', 'em', '%' ],
2198 'selectors' => [
2199 '{{WRAPPER}} .better-payment-error-report' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2200 ],
2201 ]
2202 );
2203
2204 $this->add_responsive_control(
2205 'better_payment_error_padding',
2206 [
2207 'label' => esc_html__( 'Form Padding', 'better-payment' ),
2208 'type' => Controls_Manager::DIMENSIONS,
2209 'size_units' => [ 'px', 'em', '%' ],
2210 'selectors' => [
2211 '{{WRAPPER}} .better-payment-error-report' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2212 ],
2213 ]
2214 );
2215
2216 $this->add_control(
2217 'better_payment_error_border_radius',
2218 [
2219 'label' => esc_html__( 'Border Radius', 'better-payment' ),
2220 'type' => Controls_Manager::DIMENSIONS,
2221 'separator' => 'before',
2222 'size_units' => [ 'px' ],
2223 'selectors' => [
2224 '{{WRAPPER}} .better-payment-error-report' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2225 ],
2226 ]
2227 );
2228
2229 $this->add_group_control(
2230 Group_Control_Border::get_type(),
2231 [
2232 'name' => 'better_payment_error_border',
2233 'selector' => '{{WRAPPER}} .better-payment-error-report',
2234 ]
2235 );
2236
2237 $this->add_group_control(
2238 Group_Control_Box_Shadow::get_type(),
2239 [
2240 'name' => 'better_payment_error_box_shadow',
2241 'selector' => '{{WRAPPER}} .better-payment-error-report',
2242 ]
2243 );
2244
2245 // Error Icon Style : Starts
2246 $this->add_control(
2247 'better_payment_error_icon_style',
2248 [
2249 'label' => __('Icon Style', 'better-payment'),
2250 'type' => Controls_Manager::HEADING,
2251 'separator' => 'before',
2252 ]
2253 );
2254
2255 $this->add_responsive_control(
2256 'better_payment_error_icon_margin',
2257 [
2258 'label' => __('Margin', 'better-payment'),
2259 'type' => Controls_Manager::DIMENSIONS,
2260 'size_units' => ['px', '%', 'em'],
2261 'selectors' => [
2262 '{{WRAPPER}} .better-payment-error-report .report__thumb' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
2263 ],
2264 ]
2265 );
2266
2267 $this->add_responsive_control(
2268 'better_payment_error_icon_padding',
2269 [
2270 'label' => __('Padding', 'better-payment'),
2271 'type' => Controls_Manager::DIMENSIONS,
2272 'size_units' => ['px', '%', 'em'],
2273 'selectors' => [
2274 '{{WRAPPER}} .better-payment-error-report .report__thumb' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
2275 ],
2276 ]
2277 );
2278
2279 $this->add_responsive_control(
2280 'better_payment_error_icon_max_width',
2281 [
2282 'label' => esc_html__( 'Max Width', 'better-payment' ),
2283 'type' => Controls_Manager::SLIDER,
2284 'size_units' => [ 'px', 'em', '%' ],
2285 'range' => [
2286 'px' => [
2287 'min' => 10,
2288 'max' => 1000,
2289 ],
2290 'em' => [
2291 'min' => 1,
2292 'max' => 50,
2293 ],
2294 ],
2295 'selectors' => [
2296 '{{WRAPPER}} .better-payment-error-report .report__thumb img' => 'max-width: {{SIZE}}{{UNIT}};',
2297 ],
2298 ]
2299 );
2300
2301 $this->add_responsive_control(
2302 'better_payment_error_icon_font_size',
2303 [
2304 'label' => esc_html__( 'Icon Font Size', 'better-payment' ),
2305 'type' => Controls_Manager::SLIDER,
2306 'size_units' => [ 'px', 'em', '%' ],
2307 'range' => [
2308 'px' => [
2309 'min' => 10,
2310 'max' => 100,
2311 ],
2312 'em' => [
2313 'min' => 1,
2314 'max' => 50,
2315 ],
2316 ],
2317 'selectors' => [
2318 '{{WRAPPER}} .better-payment-error-report .report__thumb i' => 'font-size: {{SIZE}}{{UNIT}};',
2319 ],
2320 ]
2321 );
2322 // Error Icon Style : Ends
2323
2324 $this->add_control(
2325 'better_payment_error_heading_style',
2326 [
2327 'label' => esc_html__( 'Heading Style', 'better-payment' ),
2328 'type' => Controls_Manager::HEADING,
2329 'separator' => 'before',
2330 ]
2331 );
2332
2333 $this->add_control(
2334 'better_payment_error_heading_color',
2335 [
2336 'label' => __( 'Color', 'better-payment' ),
2337 'type' => Controls_Manager::COLOR,
2338 'selectors' => [
2339 '{{WRAPPER}} .better-payment-error-report .transaction__failed' => 'color: {{VALUE}}',
2340 ],
2341 ]
2342 );
2343
2344 $this->add_group_control(
2345 Group_Control_Typography::get_type(),
2346 [
2347 'name' => 'better_payment_error_heading_typography',
2348 'label' => __( 'Typography', 'better-payment' ),
2349 'scheme' => Typography::TYPOGRAPHY_4,
2350 'selector' => '{{WRAPPER}} .better-payment-error-report .transaction__failed',
2351 ]
2352 );
2353
2354 $this->end_controls_section();
2355 }
2356
2357 protected function render() {
2358
2359 $settings = $this->get_settings_for_display();
2360
2361 if ( $settings[ 'better_payment_form_paypal_enable' ] != 'yes' && $settings[ 'better_payment_form_stripe_enable' ] != 'yes' ) {
2362 return false;
2363 }
2364
2365 $field_arr = [
2366 'first_name',
2367 'last_name',
2368 'email'
2369 ];
2370
2371 $payment_field = "number" ;
2372
2373 $response = Better_Payment_Handler::manage_response( $settings );
2374 if ( $response ) {
2375 return false;
2376 }
2377
2378 if(
2379 isset($_REQUEST[ 'better_payment_error_status' ]) ||
2380 isset($_REQUEST[ 'better_payment_stripe_status' ]) ||
2381 isset($_REQUEST[ 'better_payment_paypal_status' ])
2382 ){
2383 //Hide form : when page has success/error message
2384 return false;
2385 }
2386
2387 wp_enqueue_script( 'better-payment' );
2388 $action = esc_url( admin_url( 'admin-post.php' ) );
2389 $setting_meta = json_encode( [
2390 'page_id' => get_the_ID(),
2391 'widget_id' => esc_attr( $this->get_id() ),
2392 ] );
2393
2394 $better_payment_placeholder_class = '';
2395 if ( $settings[ 'better_payment_placeholder_switch' ] != 'yes' ) {
2396 $better_payment_placeholder_class = 'better-payment-hide-placeholder';
2397 }
2398
2399 ?>
2400 <div class="better-payment--wrapper">
2401 <div class="better-payment--container">
2402 <div class="better_payment__form--one better-payment-form-layout <?php echo esc_attr($better_payment_placeholder_class); ?>" >
2403 <form name="better-payment-form-<?php echo esc_attr( $this->get_id() ); ?>"
2404 data-better-payment="<?php echo esc_attr( $setting_meta ); ?>"
2405 class="better-payment-form" id="better-payment-form-<?php echo esc_attr( $this->get_id() ); ?>"
2406 action="<?php echo esc_url( $action ); ?>" method="post">
2407 <input type="hidden" name="better_payment_page_id" value="<?php echo get_the_ID(); ?>">
2408 <input type="hidden" name="better_payment_widget_id" value="<?php echo esc_attr( $this->get_id() ); ?>">
2409 <?php
2410 foreach ( $field_arr as $item ):
2411 if ( $settings[ "better_payment_{$item}_show" ] != 'yes' ) {
2412 continue;
2413 }
2414 $is_item_required = $settings[ "better_payment_{$item}_required" ]== 'yes' ? 1 : 0;
2415 $required_class = $is_item_required ? ' required' : '';
2416 $required_placeholder = $settings[ "better_payment_{$item}_required" ]== 'yes' ? ' *' : '';
2417
2418 $render_attribute_type = ($item=='email') ? 'email':'text';
2419 $render_attribute_name = $item;
2420 $render_attribute_class = "bp-form__control " . $required_class;
2421 $render_attribute_placeholder = $settings[ "better_payment_{$item}_placeholder" ] . $required_placeholder;
2422 $render_attribute_required = $settings[ "better_payment_{$item}_required" ] == 'yes' ? 'required' : '';
2423
2424 ?>
2425 <div class="bp-form__group">
2426 <input
2427 class="bp-form__control <?php echo esc_attr($required_class); ?>"
2428 type="<?php echo esc_attr($render_attribute_type); ?>"
2429 name="<?php echo esc_attr($render_attribute_name); ?>"
2430 class="<?php echo esc_attr($render_attribute_class); ?>"
2431 placeholder="<?php echo esc_attr($render_attribute_placeholder); ?>"
2432
2433 <?php if($render_attribute_required) : ?>
2434 required="<?php echo esc_attr($render_attribute_required); ?>"
2435 <?php endif; ?>
2436
2437 >
2438 </div>
2439 <?php endforeach; ?>
2440
2441 <div class="bp-payment-amount-wrap mb30">
2442 <?php
2443 if ( $settings[ 'better_payment_show_amount_list' ] == 'yes' ) {
2444 $this->render_amount_element( $settings );
2445 }
2446 ?>
2447
2448 <div class="bp-form__group">
2449 <input type="<?php echo esc_attr($payment_field); ?>" name="pay_amount"
2450 class="bp-form__control bp-custom-pay-amount"
2451 placeholder="" required min="1">
2452 </div>
2453 </div>
2454
2455 <div class="payment__option">
2456 <?php
2457
2458 if ( $settings[ 'better_payment_form_paypal_enable' ] == 'yes' ) {
2459 echo Better_Payment_Handler::paypal_button( esc_attr( $this->get_id() ), $settings );
2460 }
2461
2462 if ( $settings[ 'better_payment_form_stripe_enable' ] == 'yes' ) {
2463 echo Better_Payment_Handler::stripe_button();
2464 }
2465
2466 ?>
2467 </div>
2468 </form>
2469 </div>
2470 </div>
2471 </div>
2472 <?php
2473 }
2474
2475 public function render_amount_element( $settings ) {
2476 $id = esc_attr( $this->get_id() );
2477 foreach ( $settings[ 'better_payment_amount' ] as $item ) {
2478 $uid = uniqid();
2479 ?>
2480 <div class="bp-form__group">
2481 <input type="radio" value="<?php echo floatval( $item[ 'better_payment_amount_val' ] ); ?>"
2482 id="bp_pay_amount-<?php echo esc_attr($uid); ?>" class="bp-form__control bp-form_pay-radio "
2483 name="pay_amount[<?php echo esc_attr($id); ?>]">
2484 <label for="bp_pay_amount-<?php echo esc_attr($uid); ?>"><?php printf( "%s%s", Better_Payment_Handler::get_currency_symbols( esc_html($settings[ 'better_payment_form_currency' ]) ), floatval( $item[ 'better_payment_amount_val' ] ) ); ?></label>
2485 </div>
2486 <?php
2487 }
2488 }
2489
2490 }
2491