PluginProbe
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More / 0.0.1
Better Payment – Instant Payments, Donations, Fundraising with Subscriptions & More v0.0.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 / elementor / betterpayment-widget.php

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

2,487 lines 96.6 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 BetterPayment_Widget extends Widget_Base {
15
16 private $betterpayment_global_settings = [];
17
18 public function get_name() {
19 return 'betterpayment';
20 }
21
22 public function get_title() {
23 return esc_html__( 'BetterPayment', '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 [ 'betterpayment-el' ];
38 }
39
40 protected function _register_controls() {
41
42 $this->betterpayment_global_settings = BetterPayment_DB::get_settings();
43
44 $this->start_controls_section(
45 'betterpayment_form_setting',
46 [
47 'label' => esc_html__( 'Payment Settings', 'better-payment' ),
48 ]
49 );
50
51 $this->add_control(
52 'betterpayment_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 'betterpayment_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->betterpayment_global_settings['betterpayment_settings_general_general_paypal']), //yes or no
73 ]
74 );
75
76 $this->add_control(
77 'betterpayment_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->betterpayment_global_settings['betterpayment_settings_general_general_stripe']), //yes or no
85 ]
86 );
87
88 $this->add_control(
89 'betterpayment_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->betterpayment_global_settings['betterpayment_settings_general_general_email']), //yes or no
97 ]
98 );
99
100 $this->add_control(
101 'betterpayment_form_currency',
102 [
103 'label' => esc_html__( 'Currency Symbols', 'better-payment' ),
104 'type' => Controls_Manager::SELECT,
105 'default' => esc_html($this->betterpayment_global_settings['betterpayment_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' => 'betterpayment_form_stripe_enable',
135 'value' => 'yes',
136 ],
137 [
138 'name' => 'betterpayment_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 'betterpayment_form_element',
162 [
163 'label' => esc_html__( 'Form Settings', 'better-payment' ),
164 'conditions' => [
165 'relation' => 'or',
166 'terms' => [
167 [
168 'name' => 'betterpayment_form_stripe_enable',
169 'value' => 'yes',
170 ],
171 [
172 'name' => 'betterpayment_form_paypal_enable',
173 'value' => 'yes',
174 ],
175 ]
176 ]
177 ]
178 );
179
180 $this->add_control(
181 'betterpayment_first_name_heading',
182 [
183 'label' => __( 'First Name', 'better-payment' ),
184 'type' => Controls_Manager::HEADING,
185 ]
186 );
187
188 $this->add_control(
189 'betterpayment_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 'betterpayment_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 'betterpayment_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 'betterpayment_first_name_show' => 'yes'
225 ],
226 'separator' => 'after',
227 ]
228 );
229
230 $this->add_control(
231 'betterpayment_last_heading',
232 [
233 'label' => __( 'Last Name', 'better-payment' ),
234 'type' => Controls_Manager::HEADING,
235 ]
236 );
237
238 $this->add_control(
239 'betterpayment_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 'betterpayment_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 'betterpayment_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 'betterpayment_last_name_show' => 'yes'
274 ],
275 'separator' => 'after',
276 ]
277 );
278
279 $this->add_control(
280 'betterpayment_email_heading',
281 [
282 'label' => __( 'Email', 'better-payment' ),
283 'type' => Controls_Manager::HEADING,
284 ]
285 );
286
287 $this->add_control(
288 'betterpayment_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 'betterpayment_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 'betterpayment_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 'betterpayment_email_show' => 'yes'
323 ],
324 'separator' => 'after',
325 ]
326 );
327
328 $repeater = new Repeater();
329
330
331 $repeater->add_control(
332 'betterpayment_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 'betterpayment_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 'betterpayment_amount',
355 [
356 'label' => esc_html__( 'Amount List', 'better-payment' ),
357 'type' => Controls_Manager::REPEATER,
358 'default' => [
359 [
360 'betterpayment_amount_val' => 5
361 ],
362 [
363 'betterpayment_amount_val' => 10
364 ],
365 [
366 'betterpayment_amount_val' => 15
367 ],
368 ],
369 'fields' => $repeater->get_controls(),
370 'title_field' => '<i class="{{ betterpayment_amount_val }}" aria-hidden="true"></i> {{{ betterpayment_amount_val }}}',
371 'condition' => [
372 'betterpayment_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 'betterpayment_form_paypal_settings',
383 [
384 'label' => esc_html__( 'PayPal Settings', 'better-payment' ),
385 'condition' => [
386 'betterpayment_form_paypal_enable' => 'yes'
387 ]
388 ]
389 );
390
391
392 $this->add_control(
393 'betterpayment_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->betterpayment_global_settings['betterpayment_settings_payment_paypal_email']),
402 ]
403 );
404
405 $this->add_control(
406 'betterpayment_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 'betterpayment_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->betterpayment_global_settings['betterpayment_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 'betterpayment_form_stripe_settings',
437 [
438 'label' => esc_html__( 'Stripe Settings', 'better-payment' ),
439 'condition' => [
440 'betterpayment_form_stripe_enable' => 'yes'
441 ]
442 ]
443 );
444
445 $betterpaymentIsStripeLive = $this->betterpayment_global_settings['betterpayment_settings_payment_stripe_live_mode'] == 'yes' ? 1 : 0;
446
447 $this->add_control(
448 'betterpayment_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' => $betterpaymentIsStripeLive ? esc_html($this->betterpayment_global_settings['betterpayment_settings_payment_stripe_live_public']) : esc_html($this->betterpayment_global_settings['betterpayment_settings_payment_stripe_test_public']),
457 ]
458 );
459
460 $this->add_control(
461 'betterpayment_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' => $betterpaymentIsStripeLive ? esc_html($this->betterpayment_global_settings['betterpayment_settings_payment_stripe_live_secret']) : esc_html($this->betterpayment_global_settings['betterpayment_settings_payment_stripe_test_secret']),
471 ]
472 );
473
474 $this->add_control(
475 'betterpayment_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->betterpayment_global_settings['betterpayment_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 'betterpayment_email_element',
492 [
493 'label' => esc_html__( 'Email Settings', 'better-payment' ),
494 'condition' => [
495 'betterpayment_form_email_enable' => 'yes'
496 ]
497 ]
498 );
499
500 $this->start_controls_tabs( 'betterpayment_email_tabs' );
501
502 //Admin Email Notification
503 $this->start_controls_tab( 'betterpayment_email_admin_tab', [
504 'label' => __( 'Admin', 'better-payment' ),
505 ] );
506
507 $this->add_control('betterpayment_email_to', [
508 'label' => __('To', 'better-payment'),
509 'type' => Controls_Manager::TEXT,
510 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_to']) ? esc_html($this->betterpayment_global_settings['betterpayment_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->betterpayment_global_settings['betterpayment_settings_general_email_subject']) ? esc_html__($this->betterpayment_global_settings['betterpayment_settings_general_email_subject'], 'better-payment') : sprintf(__('BetterPayment transaction on "%s"', 'better-payment'), esc_html(get_option('blogname')));
518
519 $this->add_control('betterpayment_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('betterpayment_email_content', [
529 'label' => __('Message', 'better-payment'),
530 'type' => Controls_Manager::TEXTAREA,
531 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_message_admin']) ? esc_html($this->betterpayment_global_settings['betterpayment_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('betterpayment_email_from', [
540 'label' => __('From email', 'better-payment'),
541 'type' => Controls_Manager::TEXT,
542 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_from_email']) ? esc_html($this->betterpayment_global_settings['betterpayment_settings_general_email_from_email']) : "wordpress@$better_domain",
543 'render_type' => 'none',
544 'separator' => 'before'
545 ]);
546
547 $this->add_control('betterpayment_email_from_name', [
548 'label' => __('From name', 'better-payment'),
549 'type' => Controls_Manager::TEXT,
550 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_from_name']) ? esc_html($this->betterpayment_global_settings['betterpayment_settings_general_email_from_name']) : esc_html(get_bloginfo('name')),
551 'render_type' => 'none'
552 ]);
553
554 $this->add_control('betterpayment_email_reply_to', [
555 'label' => __('Reply-To', 'better-payment'),
556 'type' => Controls_Manager::TEXT,
557 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_reply_to']) ? esc_html($this->betterpayment_global_settings['betterpayment_settings_general_email_reply_to']) : "wordpress@$better_domain",
558 'placeholder' => "wordpress@$better_domain",
559 'render_type' => 'none'
560 ]);
561
562 $this->add_control('betterpayment_email_cc', [
563 'label' => __('Cc', 'better-payment'),
564 'type' => Controls_Manager::TEXT,
565 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_cc']) ? esc_html($this->betterpayment_global_settings['betterpayment_settings_general_email_cc']) : '',
566 'render_type' => 'none'
567 ]);
568
569 $this->add_control('betterpayment_email_bcc', [
570 'label' => __('Bcc', 'better-payment'),
571 'type' => Controls_Manager::TEXT,
572 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_bcc']) ? esc_html($this->betterpayment_global_settings['betterpayment_settings_general_email_bcc']) : '',
573 'render_type' => 'none'
574 ]);
575
576 $this->add_control('betterpayment_email_content_type', [
577 'label' => __('Send as', 'better-payment'),
578 'type' => Controls_Manager::SELECT,
579 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_send_as']) ? esc_html($this->betterpayment_global_settings['betterpayment_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( 'betterpayment_email_customer_tab', [
591 'label' => __( 'Customer', 'better-payment' ),
592 ] );
593
594 $default_subject = !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_subject_customer']) ? esc_html__($this->betterpayment_global_settings['betterpayment_settings_general_email_subject_customer'], 'better-payment') : sprintf(__('BetterPayment transaction on "%s"', 'better-payment'), esc_html(get_option('blogname')));
595
596 $this->add_control('betterpayment_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('betterpayment_email_content_customer', [
606 'label' => __('Message', 'better-payment'),
607 'type' => Controls_Manager::TEXTAREA,
608 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_message_customer']) ? esc_html($this->betterpayment_global_settings['betterpayment_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('betterpayment_email_from_customer', [
617 'label' => __('From email', 'better-payment'),
618 'type' => Controls_Manager::TEXT,
619 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_from_email_customer']) ? esc_html($this->betterpayment_global_settings['betterpayment_settings_general_email_from_email_customer']) : "wordpress@$better_domain",
620 'render_type' => 'none',
621 'separator' => 'before'
622 ]);
623
624 $this->add_control('betterpayment_email_from_name_customer', [
625 'label' => __('From name', 'better-payment'),
626 'type' => Controls_Manager::TEXT,
627 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_from_name_customer']) ? esc_html($this->betterpayment_global_settings['betterpayment_settings_general_email_from_name_customer']) : get_bloginfo('name'),
628 'render_type' => 'none'
629 ]);
630
631 $this->add_control('betterpayment_email_reply_to_customer', [
632 'label' => __('Reply-To', 'better-payment'),
633 'type' => Controls_Manager::TEXT,
634 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_reply_to_customer']) ? esc_html($this->betterpayment_global_settings['betterpayment_settings_general_email_reply_to_customer']) : "wordpress@$better_domain",
635 'placeholder' => "wordpress@$better_domain",
636 'render_type' => 'none'
637 ]);
638
639 $this->add_control('betterpayment_email_cc_customer', [
640 'label' => __('Cc', 'better-payment'),
641 'type' => Controls_Manager::TEXT,
642 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_cc_customer']) ? esc_html($this->betterpayment_global_settings['betterpayment_settings_general_email_cc_customer']) : '',
643 'render_type' => 'none'
644 ]);
645
646 $this->add_control('betterpayment_email_bcc_customer', [
647 'label' => __('Bcc', 'better-payment'),
648 'type' => Controls_Manager::TEXT,
649 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_bcc_customer']) ? esc_html($this->betterpayment_global_settings['betterpayment_settings_general_email_bcc_customer']) : '',
650 'render_type' => 'none'
651 ]);
652
653 $this->add_control('betterpayment_email_content_type_customer', [
654 'label' => __('Send as', 'better-payment'),
655 'type' => Controls_Manager::SELECT,
656 'default' => !empty($this->betterpayment_global_settings['betterpayment_settings_general_email_send_as_customer']) ? esc_html($this->betterpayment_global_settings['betterpayment_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 'betterpayment_form_success_message_settings',
674 [
675 'label' => esc_html__( 'Success Message', 'better-payment' ),
676 'conditions' => [
677 'relation' => 'or',
678 'terms' => [
679 [
680 'name' => 'betterpayment_form_stripe_enable',
681 'value' => 'yes',
682 ],
683 [
684 'name' => 'betterpayment_form_paypal_enable',
685 'value' => 'yes',
686 ],
687 ],
688 ]
689 ]
690 );
691
692 $this->add_control(
693 'betterpayment_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 'betterpayment_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 'betterpayment_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 'betterpayment_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 'betterpayment_form_error_message_settings',
746 [
747 'label' => esc_html__( 'Error Message', 'better-payment' ),
748 'conditions' => [
749 'relation' => 'or',
750 'terms' => [
751 [
752 'name' => 'betterpayment_form_stripe_enable',
753 'value' => 'yes',
754 ],
755 [
756 'name' => 'betterpayment_form_paypal_enable',
757 'value' => 'yes',
758 ],
759 ],
760 ]
761 ]
762 );
763
764 $this->add_control(
765 'betterpayment_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 'betterpayment_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_betterpayment_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_betterpayment_form_topbar_background',
824 'label' => __( 'Top Bar Background', 'better-payment' ),
825 'types' => [ 'classic', 'gradient' ],
826 'selector' => '{{WRAPPER}} .betterpayment--container .betterpayment-form-layout:before',
827 ]
828 );
829
830 $this->add_responsive_control(
831 'header_betterpayment_form_margin',
832 [
833 'label' => esc_html__( 'Margin', 'better-payment' ),
834 'type' => Controls_Manager::DIMENSIONS,
835 'size_units' => [ 'px', 'em', '%' ],
836 'selectors' => [
837 '{{WRAPPER}} .betterpayment--container .betterpayment-form-layout:before' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
838 ],
839 ]
840 );
841
842 $this->add_responsive_control(
843 'header_betterpayment_form_padding',
844 [
845 'label' => esc_html__( 'Padding', 'better-payment' ),
846 'type' => Controls_Manager::DIMENSIONS,
847 'size_units' => [ 'px', 'em', '%' ],
848 'selectors' => [
849 '{{WRAPPER}} .betterpayment--container .betterpayment-form-layout:before' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
850 ],
851 ]
852 );
853
854 $this->add_control(
855 'header_betterpayment_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}} .betterpayment--container .betterpayment-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_betterpayment_form_border',
871 'selector' => '{{WRAPPER}} .betterpayment--container .betterpayment-form-layout:before',
872 ]
873 );
874
875 $this->add_group_control(
876 Group_Control_Box_Shadow::get_type(),
877 [
878 'name' => 'header_betterpayment_form_box_shadow',
879 'selector' => '{{WRAPPER}} .betterpayment--container .betterpayment-form-layout:before',
880 ]
881 );
882
883 $this->end_controls_section();
884 }
885
886 public function form_container() {
887 $this->start_controls_section(
888 'betterpayment_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' => 'betterpayment_form_background',
899 'label' => __( 'Background', 'better-payment' ),
900 'types' => [ 'classic', 'gradient' ],
901 'selector' => '{{WRAPPER}} .betterpayment-form-layout form',
902 ]
903 );
904
905
906 $this->add_responsive_control(
907 'betterpayment_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}} .betterpayment-form-layout form' => 'max-width: {{SIZE}}{{UNIT}};',
924 ],
925 ]
926 );
927
928 $this->add_responsive_control(
929 'betterpayment_form_margin',
930 [
931 'label' => esc_html__( 'Margin', 'better-payment' ),
932 'type' => Controls_Manager::DIMENSIONS,
933 'size_units' => [ 'px', 'em', '%' ],
934 'selectors' => [
935 '{{WRAPPER}} .betterpayment-form-layout form' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
936 ],
937 ]
938 );
939
940 $this->add_responsive_control(
941 'betterpayment_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}} .betterpayment-form-layout form' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
948 ],
949 ]
950 );
951
952 $this->add_control(
953 'betterpayment_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}} .betterpayment-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' => 'betterpayment_form_border',
969 'selector' => '{{WRAPPER}} .betterpayment-form-layout form',
970 ]
971 );
972
973 $this->add_group_control(
974 Group_Control_Box_Shadow::get_type(),
975 [
976 'name' => 'betterpayment_form_box_shadow',
977 'selector' => '{{WRAPPER}} .betterpayment-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 'betterpayment_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 'betterpayment_form_fields_input_field_bg',
996 [
997 'label' => __( 'Background Color', 'better-payment' ),
998 'type' => Controls_Manager::COLOR,
999 'default' => '',
1000 'selectors' => [
1001 '{{WRAPPER}} .betterpayment-form-layout form input[type=text]' => 'background-color: {{VALUE}}',
1002 '{{WRAPPER}} .betterpayment-form-layout form input[type=email]' => 'background-color: {{VALUE}}',
1003 ],
1004 ]
1005 );
1006
1007 $this->add_control(
1008 'betterpayment_form_input_field_text_color',
1009 [
1010 'label' => __( 'Text Color', 'better-payment' ),
1011 'type' => Controls_Manager::COLOR,
1012 'default' => '',
1013 'selectors' => [
1014 '{{WRAPPER}} .betterpayment-form-layout form input[type=text]' => 'color: {{VALUE}}',
1015 '{{WRAPPER}} .betterpayment-form-layout form input[type=email]' => 'color: {{VALUE}}',
1016 ],
1017 'separator' => 'before',
1018 ]
1019 );
1020
1021 $this->add_responsive_control(
1022 'betterpayment_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}} .betterpayment-form-layout form input[type=text]' => 'margin-bottom: {{SIZE}}{{UNIT}}',
1040 '{{WRAPPER}} .betterpayment-form-layout form input[type=email]' => 'margin-bottom: {{SIZE}}{{UNIT}}',
1041 ],
1042 ]
1043 );
1044
1045 $this->add_responsive_control(
1046 'betterpayment_form_input_field_padding',
1047 [
1048 'label' => __( 'Padding', 'better-payment' ),
1049 'type' => Controls_Manager::DIMENSIONS,
1050 'size_units' => [ 'px', 'em', '%' ],
1051 'selectors' => [
1052 '{{WRAPPER}} .betterpayment-form-layout form input[type=text]' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1053 '{{WRAPPER}} .betterpayment-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 'betterpayment_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}} .betterpayment-form-layout form input[type=text]' => 'text-indent: {{SIZE}}{{UNIT}}',
1078 '{{WRAPPER}} .betterpayment-form-layout form input[type=email]' => 'text-indent: {{SIZE}}{{UNIT}}',
1079 ],
1080 ]
1081 );
1082
1083 $this->add_responsive_control(
1084 'betterpayment_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}} .betterpayment-form-layout form input[type=text]' => 'width: {{SIZE}}{{UNIT}}',
1098 '{{WRAPPER}} .betterpayment-form-layout form input[type=email]' => 'width: {{SIZE}}{{UNIT}}',
1099 ],
1100 ]
1101 );
1102
1103 $this->add_responsive_control(
1104 'betterpayment_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}} .betterpayment-form-layout form input[type=text]' => 'height: {{SIZE}}{{UNIT}}',
1118 '{{WRAPPER}} .betterpayment-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' => 'betterpayment_form_input_field_border',
1127 'label' => __( 'Border', 'better-payment' ),
1128 'placeholder' => '1px',
1129 'default' => '1px',
1130 'selector' => '{{WRAPPER}} .betterpayment-form-layout form input[type=text],{{WRAPPER}} .betterpayment-form-layout form input[type=email]',
1131 'separator' => 'before',
1132 ]
1133 );
1134
1135 $this->add_control(
1136 'betterpayment_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}} .betterpayment-form-layout form input[type=text]' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1143 '{{WRAPPER}} .betterpayment-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' => 'betterpayment_form_input_field_typography',
1152 'label' => __( 'Typography', 'better-payment' ),
1153 'scheme' => Typography::TYPOGRAPHY_4,
1154 'selector' => '{{WRAPPER}} .betterpayment-form-layout form input[type=text],{{WRAPPER}} .betterpayment-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' => 'betterpayment_form_input_field_box_shadow',
1163 'selector' => '{{WRAPPER}} .betterpayment-form-layout form input[type=text],{{WRAPPER}} .betterpayment-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 'betterpayment_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 'betterpayment_form_amount_width',
1183 [
1184 'label' => __( 'Input Width', 'better-payment' ),
1185 'type' => Controls_Manager::SLIDER,
1186 'range' => [
1187 'px' => [
1188 'min' => 0,
1189 'max' => 1200,
1190 'step' => 1,
1191 ],
1192 ],
1193 'size_units' => [ 'px', 'em', '%' ],
1194 'selectors' => [
1195 '{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]' => 'width: {{SIZE}}{{UNIT}}',
1196 '{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'width: {{SIZE}}{{UNIT}}',
1197 ],
1198 ]
1199 );
1200
1201 $this->add_responsive_control(
1202 'betterpayment_form_amount_height',
1203 [
1204 'label' => __( 'Input Height', 'better-payment' ),
1205 'type' => Controls_Manager::SLIDER,
1206 'range' => [
1207 'px' => [
1208 'min' => 0,
1209 'max' => 1200,
1210 'step' => 1,
1211 ],
1212 ],
1213 'size_units' => [ 'px', 'em', '%' ],
1214 'selectors' => [
1215 '{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]' => 'height: {{SIZE}}{{UNIT}}',
1216 '{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'height: {{SIZE}}{{UNIT}}',
1217 ],
1218 ]
1219 );
1220
1221 $this->start_controls_tabs( 'betterpayment_form_amount_tabs_button_style' );
1222
1223 $this->start_controls_tab(
1224 'betterpayment_form_amount_tab_button_normal',
1225 [
1226 'label' => __( 'Normal', 'better-payment' ),
1227 ]
1228 );
1229
1230 $this->add_control(
1231 'betterpayment_form_amount_field_bg',
1232 [
1233 'label' => __( 'Background Color', 'better-payment' ),
1234 'type' => Controls_Manager::COLOR,
1235 'default' => '',
1236 'selectors' => [
1237 '{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]' => 'background-color: {{VALUE}}',
1238 '{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'background-color: {{VALUE}}',
1239 ],
1240 ]
1241 );
1242
1243 $this->add_control(
1244 'betterpayment_form_amount_text_color',
1245 [
1246 'label' => __( 'Text Color', 'better-payment' ),
1247 'type' => Controls_Manager::COLOR,
1248 'default' => '',
1249 'selectors' => [
1250 '{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]' => 'color: {{VALUE}}',
1251 '{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'color: {{VALUE}}',
1252 ],
1253 ]
1254 );
1255
1256 $this->end_controls_tab();
1257
1258 $this->start_controls_tab(
1259 'betterpayment_form_amount_tab_button_selected',
1260 [
1261 'label' => __( 'Selected', 'better-payment' ),
1262 ]
1263 );
1264
1265 $this->add_control(
1266 'betterpayment_form_amount_field_bg_selected',
1267 [
1268 'label' => __( 'Background Color', 'better-payment' ),
1269 'type' => Controls_Manager::COLOR,
1270 'default' => '',
1271 'selectors' => [
1272 '{{WRAPPER}} .betterpayment-form-layout .bp-form__group input[type="radio"].bp-form__control:checked ~ label' => 'background-color: {{VALUE}}',
1273 ],
1274 ]
1275 );
1276
1277 $this->add_control(
1278 'betterpayment_form_amount_text_color_selected',
1279 [
1280 'label' => __( 'Text Color', 'better-payment' ),
1281 'type' => Controls_Manager::COLOR,
1282 'default' => '',
1283 'selectors' => [
1284 '{{WRAPPER}} .betterpayment-form-layout .bp-form__group input[type="radio"].bp-form__control:checked ~ label' => 'color: {{VALUE}}',
1285 ]
1286 ]
1287 );
1288
1289 $this->end_controls_tab();
1290
1291 $this->end_controls_tabs();
1292
1293 $this->add_group_control(
1294 Group_Control_Border::get_type(),
1295 [
1296 'name' => 'betterpayment_form_amount_field_border',
1297 'label' => __( 'Border', 'better-payment' ),
1298 'placeholder' => '1px',
1299 'default' => '1px',
1300 'selector' => '{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group label,{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]',
1301 'separator' => 'before',
1302 ]
1303 );
1304
1305 $this->add_control(
1306 'betterpayment_form_amount_radius',
1307 [
1308 'label' => __( 'Border Radius', 'better-payment' ),
1309 'type' => Controls_Manager::DIMENSIONS,
1310 'size_units' => [ 'px', 'em', '%' ],
1311 'selectors' => [
1312 '{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group label' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1313 '{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1314 ],
1315 ]
1316 );
1317
1318 $this->add_group_control(
1319 Group_Control_Typography::get_type(),
1320 [
1321 'name' => 'betterpayment_form_amount_field_typography',
1322 'label' => __( 'Typography', 'better-payment' ),
1323 'scheme' => Typography::TYPOGRAPHY_4,
1324 'selector' => '{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group label,{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]',
1325 'separator' => 'before',
1326 ]
1327 );
1328
1329 $this->add_group_control(
1330 Group_Control_Box_Shadow::get_type(),
1331 [
1332 'name' => 'betterpayment_form_amount_field_box_shadow',
1333 'selector' => '{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group label,{{WRAPPER}} .betterpayment-form-layout .bp-payment-amount-wrap .bp-form__group input[type=number]',
1334 'separator' => 'before',
1335 ]
1336 );
1337
1338 $this->end_controls_section();
1339 }
1340
1341 public function placeholder_style() {
1342
1343 $this->start_controls_section(
1344 'betterpayment_section_placeholder_style',
1345 [
1346 'label' => __( 'Placeholder', 'better-payment' ),
1347 'tab' => Controls_Manager::TAB_STYLE,
1348 ]
1349 );
1350
1351 $this->add_control(
1352 'betterpayment_placeholder_switch',
1353 [
1354 'label' => __( 'Show Placeholder', 'better-payment' ),
1355 'type' => Controls_Manager::SWITCHER,
1356 'default' => 'yes',
1357 'label_on' => __( 'Yes', 'better-payment' ),
1358 'label_off' => __( 'No', 'better-payment' ),
1359 'return_value' => 'yes',
1360 ]
1361 );
1362
1363 $this->add_control(
1364 'betterpayment_text_color_placeholder',
1365 [
1366 'label' => __( 'Text Color', 'better-payment' ),
1367 'type' => Controls_Manager::COLOR,
1368 'selectors' => [
1369 '{{WRAPPER}} .betterpayment-form-layout form input[type=text]::-webkit-input-placeholder' => 'color: {{VALUE}}',
1370 '{{WRAPPER}} .betterpayment-form-layout form input[type=email]::-webkit-input-placeholder' => 'color: {{VALUE}}',
1371 ],
1372 'condition' => [
1373 'betterpayment_placeholder_switch' => 'yes',
1374 ],
1375 ]
1376 );
1377
1378 $this->add_group_control(
1379 Group_Control_Typography::get_type(),
1380 [
1381 'name' => 'betterpayment_typography_placeholder',
1382 'label' => __( 'Typography', 'better-payment' ),
1383 'scheme' => Typography::TYPOGRAPHY_4,
1384 'selector' => '{{WRAPPER}} .betterpayment-form-layout form input[type=text]::-webkit-input-placeholder,{{WRAPPER}} .betterpayment-form-layout form input[type=email]::-webkit-input-placeholder',
1385 'condition' => [
1386 'betterpayment_placeholder_switch' => 'yes',
1387 ],
1388 ]
1389 );
1390
1391 $this->end_controls_section();
1392 }
1393
1394 public function paypal_button_style() {
1395
1396 $this->start_controls_section(
1397 'betterpayment_paypal_button_style',
1398 [
1399 'label' => __( 'PayPal Button', 'better-payment' ),
1400 'tab' => Controls_Manager::TAB_STYLE,
1401 ]
1402 );
1403
1404 $this->add_responsive_control(
1405 'betterpayment_paypal_button_align',
1406 [
1407 'label' => __( 'Alignment', 'better-payment' ),
1408 'type' => Controls_Manager::CHOOSE,
1409 'default' => 'center',
1410 'options' => [
1411 'flex-start' => [
1412 'title' => __( 'Left', 'better-payment' ),
1413 'icon' => 'eicon-h-align-left',
1414 ],
1415 'center' => [
1416 'title' => __( 'Center', 'better-payment' ),
1417 'icon' => 'eicon-h-align-center',
1418 ],
1419 'flex-end' => [
1420 'title' => __( 'Right', 'better-payment' ),
1421 'icon' => 'eicon-h-align-right',
1422 ],
1423 ],
1424 'selectors' => [
1425 '{{WRAPPER}} .betterpayment__form--one form .payment__option' => 'justify-content: {{VALUE}};',
1426 ],
1427 'condition' => [
1428 'betterpayment_form_stripe_enable!' => 'yes',
1429 ],
1430 ]
1431 );
1432
1433 $this->add_responsive_control(
1434 'betterpayment_paypal_button_width',
1435 [
1436 'label' => __( 'Width', 'better-payment' ),
1437 'type' => Controls_Manager::SLIDER,
1438 'range' => [
1439 'px' => [
1440 'min' => 0,
1441 'max' => 700,
1442 'step' => 1,
1443 ],
1444 ],
1445 'size_units' => [ 'px', 'em', '%' ],
1446 'selectors' => [
1447 '{{WRAPPER}} .betterpayment__form--one form .payment__option .betterpayment-paypal-bt' => 'flex: none;width: {{SIZE}}{{UNIT}}',
1448 ],
1449 'condition' => [
1450 'betterpayment_form_stripe_enable!' => 'yes',
1451 ],
1452 ]
1453 );
1454
1455 $this->start_controls_tabs( 'betterpayment_paypal_tabs_button_style' );
1456
1457 $this->start_controls_tab(
1458 'betterpayment_paypal_tab_button_normal',
1459 [
1460 'label' => __( 'Normal', 'better-payment' ),
1461 ]
1462 );
1463
1464 $this->add_control(
1465 'betterpayment_paypal_button_bg_color_normal',
1466 [
1467 'label' => __( 'Background Color', 'better-payment' ),
1468 'type' => Controls_Manager::COLOR,
1469 'default' => '',
1470 'selectors' => [
1471 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-paypal-bt' => 'background-color: {{VALUE}}',
1472 ],
1473 ]
1474 );
1475
1476 $this->add_control(
1477 'betterpayment_paypal_button_text_color_normal',
1478 [
1479 'label' => __( 'Text Color', 'better-payment' ),
1480 'type' => Controls_Manager::COLOR,
1481 'default' => '',
1482 'selectors' => [
1483 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-paypal-bt' => 'color: {{VALUE}}',
1484 ],
1485 ]
1486 );
1487
1488 $this->add_responsive_control(
1489 'betterpayment_paypal_button_max_width',
1490 [
1491 'label' => esc_html__( 'Max Width', 'better-payment' ),
1492 'type' => Controls_Manager::SLIDER,
1493 'size_units' => [ 'px', 'em', '%' ],
1494 'range' => [
1495 'px' => [
1496 'min' => 10,
1497 'max' => 1000,
1498 ],
1499 'em' => [
1500 'min' => 1,
1501 'max' => 50,
1502 ],
1503 ],
1504 'selectors' => [
1505 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-paypal-bt' => 'max-width: {{SIZE}}{{UNIT}};',
1506 ],
1507 ]
1508 );
1509
1510 $this->add_group_control(
1511 Group_Control_Border::get_type(),
1512 [
1513 'name' => 'betterpayment_paypal_button_border_normal',
1514 'label' => __( 'Border', 'better-payment' ),
1515 'default' => '1px',
1516 'selector' => '{{WRAPPER}} .betterpayment-form-layout .betterpayment-paypal-bt',
1517 ]
1518 );
1519
1520 $this->add_control(
1521 'betterpayment_paypal_button_border_radius',
1522 [
1523 'label' => __( 'Border Radius', 'better-payment' ),
1524 'type' => Controls_Manager::DIMENSIONS,
1525 'size_units' => [ 'px', 'em', '%' ],
1526 'selectors' => [
1527 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-paypal-bt' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1528 ],
1529 ]
1530 );
1531
1532 $this->add_responsive_control(
1533 'betterpayment_paypal_button_padding',
1534 [
1535 'label' => __( 'Padding', 'better-payment' ),
1536 'type' => Controls_Manager::DIMENSIONS,
1537 'size_units' => [ 'px', 'em', '%' ],
1538 'selectors' => [
1539 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-paypal-bt' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1540 ],
1541 ]
1542 );
1543
1544 $this->add_responsive_control(
1545 'betterpayment_paypal_button_margin',
1546 [
1547 'label' => __( 'Margin Top', 'better-payment' ),
1548 'type' => Controls_Manager::SLIDER,
1549 'range' => [
1550 'px' => [
1551 'min' => 0,
1552 'max' => 100,
1553 'step' => 1,
1554 ],
1555 ],
1556 'size_units' => [ 'px', 'em', '%' ],
1557 'selectors' => [
1558 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-paypal-bt' => 'margin-top: {{SIZE}}{{UNIT}}',
1559 ],
1560 ]
1561 );
1562
1563 $this->add_group_control(
1564 Group_Control_Typography::get_type(),
1565 [
1566 'name' => 'betterpayment_paypal_button_typography',
1567 'label' => __( 'Typography', 'better-payment' ),
1568 'scheme' => Typography::TYPOGRAPHY_4,
1569 'selector' => '{{WRAPPER}} .betterpayment-form-layout .betterpayment-paypal-bt',
1570 'separator' => 'before',
1571 ]
1572 );
1573
1574 $this->add_group_control(
1575 Group_Control_Box_Shadow::get_type(),
1576 [
1577 'name' => 'betterpayment_paypal_button_box_shadow',
1578 'selector' => '{{WRAPPER}} .betterpayment-form-layout .betterpayment-paypal-bt',
1579 'separator' => 'before',
1580 ]
1581 );
1582
1583 $this->end_controls_tab();
1584
1585 $this->start_controls_tab(
1586 'betterpayment_paypal_tab_button_hover',
1587 [
1588 'label' => __( 'Hover', 'better-payment' ),
1589 ]
1590 );
1591
1592 $this->add_control(
1593 'betterpayment_paypal_button_bg_color_hover',
1594 [
1595 'label' => __( 'Background Color', 'better-payment' ),
1596 'type' => Controls_Manager::COLOR,
1597 'default' => '',
1598 'selectors' => [
1599 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-paypal-bt:hover' => 'background-color: {{VALUE}}',
1600 ],
1601 ]
1602 );
1603
1604 $this->add_control(
1605 'betterpayment_paypal_button_text_color_hover',
1606 [
1607 'label' => __( 'Text Color', 'better-payment' ),
1608 'type' => Controls_Manager::COLOR,
1609 'default' => '',
1610 'selectors' => [
1611 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-paypal-bt:hover' => 'color: {{VALUE}}',
1612 ],
1613 ]
1614 );
1615
1616 $this->add_control(
1617 'betterpayment_paypal_button_border_color_hover',
1618 [
1619 'label' => __( 'Border Color', 'better-payment' ),
1620 'type' => Controls_Manager::COLOR,
1621 'default' => '',
1622 'selectors' => [
1623 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-paypal-bt:hover' => 'border-color: {{VALUE}}',
1624 ],
1625 ]
1626 );
1627
1628 $this->end_controls_tab();
1629
1630 $this->end_controls_tabs();
1631
1632 $this->end_controls_section();
1633 }
1634
1635 public function stripe_button() {
1636
1637 $this->start_controls_section(
1638 'betterpayment_stripe_button_style',
1639 [
1640 'label' => __( 'Stripe Button', 'better-payment' ),
1641 'tab' => Controls_Manager::TAB_STYLE,
1642 ]
1643 );
1644
1645 $this->add_responsive_control(
1646 'betterpayment_stripe_button_align',
1647 [
1648 'label' => __( 'Alignment', 'better-payment' ),
1649 'type' => Controls_Manager::CHOOSE,
1650 'default' => 'center',
1651 'options' => [
1652 'flex-start' => [
1653 'title' => __( 'Left', 'better-payment' ),
1654 'icon' => 'eicon-h-align-left',
1655 ],
1656 'center' => [
1657 'title' => __( 'Center', 'better-payment' ),
1658 'icon' => 'eicon-h-align-center',
1659 ],
1660 'flex-end' => [
1661 'title' => __( 'Right', 'better-payment' ),
1662 'icon' => 'eicon-h-align-right',
1663 ],
1664 ],
1665 'selectors' => [
1666 '{{WRAPPER}} .betterpayment__form--one form .payment__option' => 'justify-content: {{VALUE}};',
1667 ],
1668 'condition' => [
1669 'betterpayment_form_paypal_enable!' => 'yes',
1670 ],
1671 ]
1672 );
1673
1674 $this->add_responsive_control(
1675 'betterpayment_stripe_button_width',
1676 [
1677 'label' => __( 'Width', 'better-payment' ),
1678 'type' => Controls_Manager::SLIDER,
1679 'range' => [
1680 'px' => [
1681 'min' => 0,
1682 'max' => 1200,
1683 'step' => 1,
1684 ],
1685 ],
1686 'size_units' => [ 'px', 'em', '%' ],
1687 'selectors' => [
1688 '{{WRAPPER}} .betterpayment__form--one form .payment__option .betterpayment-stripe-bt' => 'flex: none;width: {{SIZE}}{{UNIT}}',
1689 ],
1690 'condition' => [
1691 'betterpayment_form_paypal_enable!' => 'yes',
1692 ],
1693 ]
1694 );
1695
1696 $this->start_controls_tabs( 'betterpayment_stripe_tabs_button_style' );
1697
1698 $this->start_controls_tab(
1699 'betterpayment_stripe_tab_button_normal',
1700 [
1701 'label' => __( 'Normal', 'better-payment' ),
1702 ]
1703 );
1704
1705 $this->add_control(
1706 'betterpayment_stripe_button_bg_color_normal',
1707 [
1708 'label' => __( 'Background Color', 'better-payment' ),
1709 'type' => Controls_Manager::COLOR,
1710 'default' => '',
1711 'selectors' => [
1712 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-stripe-bt' => 'background-color: {{VALUE}}',
1713 ],
1714 ]
1715 );
1716
1717 $this->add_control(
1718 'betterpayment_stripe_button_text_color_normal',
1719 [
1720 'label' => __( 'Text Color', 'better-payment' ),
1721 'type' => Controls_Manager::COLOR,
1722 'default' => '',
1723 'selectors' => [
1724 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-stripe-bt' => 'color: {{VALUE}}',
1725 ],
1726 ]
1727 );
1728
1729 $this->add_responsive_control(
1730 'betterpayment_stripe_button_max_width',
1731 [
1732 'label' => esc_html__( 'Max Width', 'better-payment' ),
1733 'type' => Controls_Manager::SLIDER,
1734 'size_units' => [ 'px', 'em', '%' ],
1735 'range' => [
1736 'px' => [
1737 'min' => 10,
1738 'max' => 1000,
1739 ],
1740 'em' => [
1741 'min' => 1,
1742 'max' => 50,
1743 ],
1744 ],
1745 'selectors' => [
1746 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-stripe-bt' => 'max-width: {{SIZE}}{{UNIT}};',
1747 ],
1748 ]
1749 );
1750
1751 $this->add_group_control(
1752 Group_Control_Border::get_type(),
1753 [
1754 'name' => 'betterpayment_stripe_button_border_normal',
1755 'label' => __( 'Border', 'better-payment' ),
1756 'default' => '1px',
1757 'selector' => '{{WRAPPER}} .betterpayment-form-layout .betterpayment-stripe-bt',
1758 ]
1759 );
1760
1761 $this->add_control(
1762 'betterpayment_stripe_button_border_radius',
1763 [
1764 'label' => __( 'Border Radius', 'better-payment' ),
1765 'type' => Controls_Manager::DIMENSIONS,
1766 'size_units' => [ 'px', 'em', '%' ],
1767 'selectors' => [
1768 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-stripe-bt' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1769 ],
1770 ]
1771 );
1772
1773 $this->add_responsive_control(
1774 'betterpayment_stripe_button_padding',
1775 [
1776 'label' => __( 'Padding', 'better-payment' ),
1777 'type' => Controls_Manager::DIMENSIONS,
1778 'size_units' => [ 'px', 'em', '%' ],
1779 'selectors' => [
1780 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-stripe-bt' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1781 ],
1782 ]
1783 );
1784
1785 $this->add_responsive_control(
1786 'betterpayment_stripe_button_margin',
1787 [
1788 'label' => __( 'Margin Top', 'better-payment' ),
1789 'type' => Controls_Manager::SLIDER,
1790 'range' => [
1791 'px' => [
1792 'min' => 0,
1793 'max' => 100,
1794 'step' => 1,
1795 ],
1796 ],
1797 'size_units' => [ 'px', 'em', '%' ],
1798 'selectors' => [
1799 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-stripe-bt' => 'margin-top: {{SIZE}}{{UNIT}}',
1800 ],
1801 ]
1802 );
1803
1804 $this->add_group_control(
1805 Group_Control_Typography::get_type(),
1806 [
1807 'name' => 'betterpayment_stripe_button_typography',
1808 'label' => __( 'Typography', 'better-payment' ),
1809 'scheme' => Typography::TYPOGRAPHY_4,
1810 'selector' => '{{WRAPPER}} .betterpayment-form-layout .betterpayment-stripe-bt',
1811 'separator' => 'before',
1812 ]
1813 );
1814
1815 $this->add_group_control(
1816 Group_Control_Box_Shadow::get_type(),
1817 [
1818 'name' => 'betterpayment_stripe_button_box_shadow',
1819 'selector' => '{{WRAPPER}} .betterpayment-form-layout .betterpayment-stripe-bt',
1820 'separator' => 'before',
1821 ]
1822 );
1823
1824 $this->end_controls_tab();
1825
1826 $this->start_controls_tab(
1827 'betterpayment_stripe_tab_button_hover',
1828 [
1829 'label' => __( 'Hover', 'better-payment' ),
1830 ]
1831 );
1832
1833 $this->add_control(
1834 'betterpayment_stripe_button_bg_color_hover',
1835 [
1836 'label' => __( 'Background Color', 'better-payment' ),
1837 'type' => Controls_Manager::COLOR,
1838 'default' => '',
1839 'selectors' => [
1840 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-stripe-bt:hover' => 'background-color: {{VALUE}}',
1841 ],
1842 ]
1843 );
1844
1845 $this->add_control(
1846 'betterpayment_stripe_button_text_color_hover',
1847 [
1848 'label' => __( 'Text Color', 'better-payment' ),
1849 'type' => Controls_Manager::COLOR,
1850 'default' => '',
1851 'selectors' => [
1852 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-stripe-bt:hover' => 'color: {{VALUE}}',
1853 ],
1854 ]
1855 );
1856
1857 $this->add_control(
1858 'betterpayment_stripe_button_border_color_hover',
1859 [
1860 'label' => __( 'Border Color', 'better-payment' ),
1861 'type' => Controls_Manager::COLOR,
1862 'default' => '',
1863 'selectors' => [
1864 '{{WRAPPER}} .betterpayment-form-layout .betterpayment-stripe-bt:hover' => 'border-color: {{VALUE}}',
1865 ],
1866 ]
1867 );
1868
1869 $this->end_controls_tab();
1870
1871 $this->end_controls_tabs();
1872
1873 $this->end_controls_section();
1874 }
1875
1876 public function success_message_style() {
1877
1878 $this->start_controls_section(
1879 'betterpayment_section_success_style',
1880 [
1881 'label' => __( 'Success Message', 'better-payment' ),
1882 'tab' => Controls_Manager::TAB_STYLE,
1883 ]
1884 );
1885
1886 $this->add_group_control(
1887 Group_Control_Background::get_type(),
1888 [
1889 'name' => 'betterpayment_success_background',
1890 'label' => __( 'Background', 'better-payment' ),
1891 'types' => [ 'classic', 'gradient' ],
1892 'selector' => '{{WRAPPER}} .betterpayment-success-report',
1893 ]
1894 );
1895
1896
1897 $this->add_responsive_control(
1898 'betterpayment_success_alignment',
1899 [
1900 'label' => esc_html__( 'Form Max Width', 'better-payment' ),
1901 'type' => Controls_Manager::SLIDER,
1902 'size_units' => [ 'px', 'em', '%' ],
1903 'range' => [
1904 'px' => [
1905 'min' => 10,
1906 'max' => 1500,
1907 ],
1908 'em' => [
1909 'min' => 1,
1910 'max' => 80,
1911 ],
1912 ],
1913 'selectors' => [
1914 '{{WRAPPER}} .betterpayment-success-report' => 'max-width: {{SIZE}}{{UNIT}};',
1915 ],
1916 ]
1917 );
1918
1919 $this->add_responsive_control(
1920 'betterpayment_success_margin',
1921 [
1922 'label' => esc_html__( 'Margin', 'better-payment' ),
1923 'type' => Controls_Manager::DIMENSIONS,
1924 'size_units' => [ 'px', 'em', '%' ],
1925 'selectors' => [
1926 '{{WRAPPER}} .betterpayment-success-report' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1927 ],
1928 ]
1929 );
1930
1931 $this->add_responsive_control(
1932 'betterpayment_success_padding',
1933 [
1934 'label' => esc_html__( 'Form Padding', 'better-payment' ),
1935 'type' => Controls_Manager::DIMENSIONS,
1936 'size_units' => [ 'px', 'em', '%' ],
1937 'selectors' => [
1938 '{{WRAPPER}} .betterpayment-success-report' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1939 ],
1940 ]
1941 );
1942
1943 $this->add_control(
1944 'betterpayment_success_border_radius',
1945 [
1946 'label' => esc_html__( 'Border Radius', 'better-payment' ),
1947 'type' => Controls_Manager::DIMENSIONS,
1948 'separator' => 'before',
1949 'size_units' => [ 'px' ],
1950 'selectors' => [
1951 '{{WRAPPER}} .betterpayment-success-report' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
1952 ],
1953 ]
1954 );
1955
1956 $this->add_group_control(
1957 Group_Control_Border::get_type(),
1958 [
1959 'name' => 'betterpayment_success_border',
1960 'selector' => '{{WRAPPER}} .betterpayment-success-report',
1961 ]
1962 );
1963
1964 $this->add_group_control(
1965 Group_Control_Box_Shadow::get_type(),
1966 [
1967 'name' => 'betterpayment_success_box_shadow',
1968 'selector' => '{{WRAPPER}} .betterpayment-success-report',
1969 ]
1970 );
1971
1972 // Success Icon Style : Starts
1973 $this->add_control(
1974 'betterpayment_success_icon_style',
1975 [
1976 'label' => __('Icon Style', 'better-payment'),
1977 'type' => Controls_Manager::HEADING,
1978 'separator' => 'before',
1979 ]
1980 );
1981
1982 $this->add_responsive_control(
1983 'betterpayment_success_icon_margin',
1984 [
1985 'label' => __('Margin', 'better-payment'),
1986 'type' => Controls_Manager::DIMENSIONS,
1987 'size_units' => ['px', '%', 'em'],
1988 'selectors' => [
1989 '{{WRAPPER}} .betterpayment-success-report .report__thumb' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
1990 ],
1991 ]
1992 );
1993
1994 $this->add_responsive_control(
1995 'betterpayment_success_icon_padding',
1996 [
1997 'label' => __('Padding', 'better-payment'),
1998 'type' => Controls_Manager::DIMENSIONS,
1999 'size_units' => ['px', '%', 'em'],
2000 'selectors' => [
2001 '{{WRAPPER}} .betterpayment-success-report .report__thumb' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
2002 ],
2003 ]
2004 );
2005
2006 $this->add_responsive_control(
2007 'betterpayment_success_icon_max_width',
2008 [
2009 'label' => esc_html__( 'Max Width', 'better-payment' ),
2010 'type' => Controls_Manager::SLIDER,
2011 'size_units' => [ 'px', 'em', '%' ],
2012 'range' => [
2013 'px' => [
2014 'min' => 10,
2015 'max' => 1000,
2016 ],
2017 'em' => [
2018 'min' => 1,
2019 'max' => 50,
2020 ],
2021 ],
2022 'selectors' => [
2023 '{{WRAPPER}} .betterpayment-success-report .report__thumb img' => 'max-width: {{SIZE}}{{UNIT}};',
2024 ],
2025 ]
2026 );
2027
2028 $this->add_responsive_control(
2029 'betterpayment_success_icon_font_size',
2030 [
2031 'label' => esc_html__( 'Icon Font Size', 'better-payment' ),
2032 'type' => Controls_Manager::SLIDER,
2033 'size_units' => [ 'px', 'em', '%' ],
2034 'range' => [
2035 'px' => [
2036 'min' => 10,
2037 'max' => 100,
2038 ],
2039 'em' => [
2040 'min' => 1,
2041 'max' => 50,
2042 ],
2043 ],
2044 'selectors' => [
2045 '{{WRAPPER}} .betterpayment-success-report .report__thumb i' => 'font-size: {{SIZE}}{{UNIT}};',
2046 ],
2047 ]
2048 );
2049 // Success Icon Style : Ends
2050
2051 $this->add_control(
2052 'betterpayment_success_heading_style',
2053 [
2054 'label' => esc_html__( 'Heading Style', 'better-payment' ),
2055 'type' => Controls_Manager::HEADING,
2056 'separator' => 'before',
2057 ]
2058 );
2059
2060 $this->add_control(
2061 'betterpayment_success_heading_color',
2062 [
2063 'label' => __( 'Color', 'better-payment' ),
2064 'type' => Controls_Manager::COLOR,
2065 'selectors' => [
2066 '{{WRAPPER}} .betterpayment-success-report .transaction__success' => 'color: {{VALUE}}',
2067 ],
2068 ]
2069 );
2070
2071 $this->add_group_control(
2072 Group_Control_Typography::get_type(),
2073 [
2074 'name' => 'betterpayment_success_heading_typography',
2075 'label' => __( 'Typography', 'better-payment' ),
2076 'scheme' => Typography::TYPOGRAPHY_4,
2077 'selector' => '{{WRAPPER}} .betterpayment-success-report .transaction__success',
2078 ]
2079 );
2080
2081
2082 $this->add_control(
2083 'betterpayment_success_transaction_style',
2084 [
2085 'label' => esc_html__( 'Transaction Style', 'better-payment' ),
2086 'type' => Controls_Manager::HEADING,
2087 'separator' => 'before',
2088 ]
2089 );
2090
2091 $this->add_control(
2092 'betterpayment_success_transaction_color',
2093 [
2094 'label' => __( 'Color', 'better-payment' ),
2095 'type' => Controls_Manager::COLOR,
2096 'selectors' => [
2097 '{{WRAPPER}} .betterpayment-success-report .transaction__number' => 'color: {{VALUE}}',
2098 ],
2099 ]
2100 );
2101
2102 $this->add_group_control(
2103 Group_Control_Typography::get_type(),
2104 [
2105 'name' => 'betterpayment_success_transaction_typography',
2106 'label' => __( 'Typography', 'better-payment' ),
2107 'scheme' => Typography::TYPOGRAPHY_4,
2108 'selector' => '{{WRAPPER}} .betterpayment-success-report .transaction__number',
2109 ]
2110 );
2111
2112 $this->add_control(
2113 'betterpayment_success_thank_you_style',
2114 [
2115 'label' => esc_html__( 'Thank You Message', 'better-payment' ),
2116 'type' => Controls_Manager::HEADING,
2117 'separator' => 'before',
2118 ]
2119 );
2120
2121 $this->add_control(
2122 'betterpayment_success_thank_you_color',
2123 [
2124 'label' => __( 'Color', 'better-payment' ),
2125 'type' => Controls_Manager::COLOR,
2126 'selectors' => [
2127 '{{WRAPPER}} .betterpayment-success-report .payment__greeting' => 'color: {{VALUE}}',
2128 ],
2129 ]
2130 );
2131
2132 $this->add_group_control(
2133 Group_Control_Typography::get_type(),
2134 [
2135 'name' => 'betterpayment_success_thank_you_typography',
2136 'label' => __( 'Typography', 'better-payment' ),
2137 'scheme' => Typography::TYPOGRAPHY_4,
2138 'selector' => '{{WRAPPER}} .betterpayment-success-report .payment__greeting',
2139 ]
2140 );
2141
2142 $this->end_controls_section();
2143 }
2144
2145 public function error_message_style() {
2146
2147 $this->start_controls_section(
2148 'betterpayment_section_error_style',
2149 [
2150 'label' => __( 'Error Message', 'better-payment' ),
2151 'tab' => Controls_Manager::TAB_STYLE,
2152 ]
2153 );
2154
2155 $this->add_group_control(
2156 Group_Control_Background::get_type(),
2157 [
2158 'name' => 'betterpayment_error_background',
2159 'label' => __( 'Background', 'better-payment' ),
2160 'types' => [ 'classic', 'gradient' ],
2161 'selector' => '{{WRAPPER}} .betterpayment-error-report',
2162 ]
2163 );
2164
2165
2166 $this->add_responsive_control(
2167 'betterpayment_error_alignment',
2168 [
2169 'label' => esc_html__( 'Form Max Width', 'better-payment' ),
2170 'type' => Controls_Manager::SLIDER,
2171 'size_units' => [ 'px', 'em', '%' ],
2172 'range' => [
2173 'px' => [
2174 'min' => 10,
2175 'max' => 1500,
2176 ],
2177 'em' => [
2178 'min' => 1,
2179 'max' => 80,
2180 ],
2181 ],
2182 'selectors' => [
2183 '{{WRAPPER}} .betterpayment-error-report' => 'max-width: {{SIZE}}{{UNIT}};',
2184 ],
2185 ]
2186 );
2187
2188 $this->add_responsive_control(
2189 'betterpayment_error_margin',
2190 [
2191 'label' => esc_html__( 'Margin', 'better-payment' ),
2192 'type' => Controls_Manager::DIMENSIONS,
2193 'size_units' => [ 'px', 'em', '%' ],
2194 'selectors' => [
2195 '{{WRAPPER}} .betterpayment-error-report' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2196 ],
2197 ]
2198 );
2199
2200 $this->add_responsive_control(
2201 'betterpayment_error_padding',
2202 [
2203 'label' => esc_html__( 'Form Padding', 'better-payment' ),
2204 'type' => Controls_Manager::DIMENSIONS,
2205 'size_units' => [ 'px', 'em', '%' ],
2206 'selectors' => [
2207 '{{WRAPPER}} .betterpayment-error-report' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2208 ],
2209 ]
2210 );
2211
2212 $this->add_control(
2213 'betterpayment_error_border_radius',
2214 [
2215 'label' => esc_html__( 'Border Radius', 'better-payment' ),
2216 'type' => Controls_Manager::DIMENSIONS,
2217 'separator' => 'before',
2218 'size_units' => [ 'px' ],
2219 'selectors' => [
2220 '{{WRAPPER}} .betterpayment-error-report' => 'border-radius: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};',
2221 ],
2222 ]
2223 );
2224
2225 $this->add_group_control(
2226 Group_Control_Border::get_type(),
2227 [
2228 'name' => 'betterpayment_error_border',
2229 'selector' => '{{WRAPPER}} .betterpayment-error-report',
2230 ]
2231 );
2232
2233 $this->add_group_control(
2234 Group_Control_Box_Shadow::get_type(),
2235 [
2236 'name' => 'betterpayment_error_box_shadow',
2237 'selector' => '{{WRAPPER}} .betterpayment-error-report',
2238 ]
2239 );
2240
2241 // Error Icon Style : Starts
2242 $this->add_control(
2243 'betterpayment_error_icon_style',
2244 [
2245 'label' => __('Icon Style', 'better-payment'),
2246 'type' => Controls_Manager::HEADING,
2247 'separator' => 'before',
2248 ]
2249 );
2250
2251 $this->add_responsive_control(
2252 'betterpayment_error_icon_margin',
2253 [
2254 'label' => __('Margin', 'better-payment'),
2255 'type' => Controls_Manager::DIMENSIONS,
2256 'size_units' => ['px', '%', 'em'],
2257 'selectors' => [
2258 '{{WRAPPER}} .betterpayment-error-report .report__thumb' => 'margin: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
2259 ],
2260 ]
2261 );
2262
2263 $this->add_responsive_control(
2264 'betterpayment_error_icon_padding',
2265 [
2266 'label' => __('Padding', 'better-payment'),
2267 'type' => Controls_Manager::DIMENSIONS,
2268 'size_units' => ['px', '%', 'em'],
2269 'selectors' => [
2270 '{{WRAPPER}} .betterpayment-error-report .report__thumb' => 'padding: {{TOP}}{{UNIT}} {{RIGHT}}{{UNIT}} {{BOTTOM}}{{UNIT}} {{LEFT}}{{UNIT}};'
2271 ],
2272 ]
2273 );
2274
2275 $this->add_responsive_control(
2276 'betterpayment_error_icon_max_width',
2277 [
2278 'label' => esc_html__( 'Max Width', 'better-payment' ),
2279 'type' => Controls_Manager::SLIDER,
2280 'size_units' => [ 'px', 'em', '%' ],
2281 'range' => [
2282 'px' => [
2283 'min' => 10,
2284 'max' => 1000,
2285 ],
2286 'em' => [
2287 'min' => 1,
2288 'max' => 50,
2289 ],
2290 ],
2291 'selectors' => [
2292 '{{WRAPPER}} .betterpayment-error-report .report__thumb img' => 'max-width: {{SIZE}}{{UNIT}};',
2293 ],
2294 ]
2295 );
2296
2297 $this->add_responsive_control(
2298 'betterpayment_error_icon_font_size',
2299 [
2300 'label' => esc_html__( 'Icon Font Size', 'better-payment' ),
2301 'type' => Controls_Manager::SLIDER,
2302 'size_units' => [ 'px', 'em', '%' ],
2303 'range' => [
2304 'px' => [
2305 'min' => 10,
2306 'max' => 100,
2307 ],
2308 'em' => [
2309 'min' => 1,
2310 'max' => 50,
2311 ],
2312 ],
2313 'selectors' => [
2314 '{{WRAPPER}} .betterpayment-error-report .report__thumb i' => 'font-size: {{SIZE}}{{UNIT}};',
2315 ],
2316 ]
2317 );
2318 // Error Icon Style : Ends
2319
2320 $this->add_control(
2321 'betterpayment_error_heading_style',
2322 [
2323 'label' => esc_html__( 'Heading Style', 'better-payment' ),
2324 'type' => Controls_Manager::HEADING,
2325 'separator' => 'before',
2326 ]
2327 );
2328
2329 $this->add_control(
2330 'betterpayment_error_heading_color',
2331 [
2332 'label' => __( 'Color', 'better-payment' ),
2333 'type' => Controls_Manager::COLOR,
2334 'selectors' => [
2335 '{{WRAPPER}} .betterpayment-error-report .transaction__failed' => 'color: {{VALUE}}',
2336 ],
2337 ]
2338 );
2339
2340 $this->add_group_control(
2341 Group_Control_Typography::get_type(),
2342 [
2343 'name' => 'betterpayment_error_heading_typography',
2344 'label' => __( 'Typography', 'better-payment' ),
2345 'scheme' => Typography::TYPOGRAPHY_4,
2346 'selector' => '{{WRAPPER}} .betterpayment-error-report .transaction__failed',
2347 ]
2348 );
2349
2350 $this->end_controls_section();
2351 }
2352
2353 protected function render() {
2354
2355 $settings = $this->get_settings_for_display();
2356
2357 if ( $settings[ 'betterpayment_form_paypal_enable' ] != 'yes' && $settings[ 'betterpayment_form_stripe_enable' ] != 'yes' ) {
2358 return false;
2359 }
2360
2361 $field_arr = [
2362 'first_name',
2363 'last_name',
2364 'email'
2365 ];
2366
2367 $payment_field = "number" ;
2368
2369 $response = BetterPayment_Handler::manage_response( $settings );
2370 if ( $response ) {
2371 return false;
2372 }
2373
2374 if(
2375 isset($_REQUEST[ 'betterpayment_error_status' ]) ||
2376 isset($_REQUEST[ 'betterpayment_stripe_status' ]) ||
2377 isset($_REQUEST[ 'betterpayment_paypal_status' ])
2378 ){
2379 //Hide form : when page has success/error message
2380 return false;
2381 }
2382
2383 wp_enqueue_script( 'betterpayment' );
2384 $action = esc_url( admin_url( 'admin-post.php' ) );
2385 $setting_meta = json_encode( [
2386 'page_id' => get_the_ID(),
2387 'widget_id' => esc_attr( $this->get_id() ),
2388 ] );
2389
2390 $betterpayment_placeholder_class = '';
2391 if ( $settings[ 'betterpayment_placeholder_switch' ] != 'yes' ) {
2392 $betterpayment_placeholder_class = 'betterpayment-hide-placeholder';
2393 }
2394
2395 ?>
2396 <div class="betterpayment--wrapper">
2397 <div class="betterpayment--container">
2398 <div class="betterpayment__form--one betterpayment-form-layout <?php echo esc_attr($betterpayment_placeholder_class); ?>" >
2399 <form name="betterpayment-form-<?php echo esc_attr( $this->get_id() ); ?>"
2400 data-betterpayment="<?php echo esc_attr( $setting_meta ); ?>"
2401 class="betterpayment-form" id="betterpayment-form-<?php echo esc_attr( $this->get_id() ); ?>"
2402 action="<?php echo esc_url( $action ); ?>" method="post">
2403 <input type="hidden" name="betterpayment_page_id" value="<?php echo get_the_ID(); ?>">
2404 <input type="hidden" name="betterpayment_widget_id" value="<?php echo esc_attr( $this->get_id() ); ?>">
2405 <?php
2406 foreach ( $field_arr as $item ):
2407 if ( $settings[ "betterpayment_{$item}_show" ] != 'yes' ) {
2408 continue;
2409 }
2410 $is_item_required = $settings[ "betterpayment_{$item}_required" ]== 'yes' ? 1 : 0;
2411 $required_class = $is_item_required ? ' required' : '';
2412 $required_placeholder = $settings[ "betterpayment_{$item}_required" ]== 'yes' ? ' *' : '';
2413
2414 $render_attribute_type = ($item=='email') ? 'email':'text';
2415 $render_attribute_name = $item;
2416 $render_attribute_class = "bp-form__control " . $required_class;
2417 $render_attribute_placeholder = $settings[ "betterpayment_{$item}_placeholder" ] . $required_placeholder;
2418 $render_attribute_required = $settings[ "betterpayment_{$item}_required" ] == 'yes' ? 'required' : '';
2419
2420 ?>
2421 <div class="bp-form__group">
2422 <input
2423 class="bp-form__control <?php echo esc_attr($required_class); ?>"
2424 type="<?php echo esc_attr($render_attribute_type); ?>"
2425 name="<?php echo esc_attr($render_attribute_name); ?>"
2426 class="<?php echo esc_attr($render_attribute_class); ?>"
2427 placeholder="<?php echo esc_attr($render_attribute_placeholder); ?>"
2428
2429 <?php if($render_attribute_required) : ?>
2430 required="<?php echo esc_attr($render_attribute_required); ?>"
2431 <?php endif; ?>
2432
2433 >
2434 </div>
2435 <?php endforeach; ?>
2436
2437 <div class="bp-payment-amount-wrap mb30">
2438 <?php
2439 if ( $settings[ 'betterpayment_show_amount_list' ] == 'yes' ) {
2440 $this->render_amount_element( $settings );
2441 }
2442 ?>
2443
2444 <div class="bp-form__group">
2445 <input type="<?php echo esc_attr($payment_field); ?>" name="pay_amount"
2446 class="bp-form__control bp-custom-pay-amount"
2447 placeholder="" required min="1">
2448 </div>
2449 </div>
2450
2451 <div class="payment__option">
2452 <?php
2453
2454 if ( $settings[ 'betterpayment_form_paypal_enable' ] == 'yes' ) {
2455 echo BetterPayment_Handler::paypal_button( esc_attr( $this->get_id() ), $settings );
2456 }
2457
2458 if ( $settings[ 'betterpayment_form_stripe_enable' ] == 'yes' ) {
2459 echo BetterPayment_Handler::stripe_button();
2460 }
2461
2462 ?>
2463 </div>
2464 </form>
2465 </div>
2466 </div>
2467 </div>
2468 <?php
2469 }
2470
2471 public function render_amount_element( $settings ) {
2472 $id = esc_attr( $this->get_id() );
2473 foreach ( $settings[ 'betterpayment_amount' ] as $item ) {
2474 $uid = uniqid();
2475 ?>
2476 <div class="bp-form__group">
2477 <input type="radio" value="<?php echo floatval( $item[ 'betterpayment_amount_val' ] ); ?>"
2478 id="bp_pay_amount-<?php echo esc_attr($uid); ?>" class="bp-form__control bp-form_pay-radio "
2479 name="pay_amount[<?php echo esc_attr($id); ?>]">
2480 <label for="bp_pay_amount-<?php echo esc_attr($uid); ?>"><?php printf( "%s%s", BetterPayment_Handler::get_currency_symbols( esc_html($settings[ 'betterpayment_form_currency' ]) ), floatval( $item[ 'betterpayment_amount_val' ] ) ); ?></label>
2481 </div>
2482 <?php
2483 }
2484 }
2485
2486 }
2487