PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 2.17.3
GiveWP – Donation Plugin and Fundraising Platform v2.17.3
4.16.4 4.16.3 4.16.2 4.16.1 4.16.0 4.15.5 4.15.4 4.15.3 4.15.2 4.15.1 4.15.0 2.3.0 2.3.1 2.3.2 2.30.0 2.31.0 2.31.1 2.32.0 2.33.0 2.33.1 2.33.2 2.33.3 2.33.4 2.33.5 2.4.0 2.4.1 2.4.2 2.4.3 2.4.4 2.4.5 2.4.6 2.4.7 2.5.0 2.5.1 2.5.10 2.5.11 2.5.12 2.5.13 2.5.2 2.5.3 2.5.4 2.5.5 2.5.6 2.5.7 2.5.8 2.5.9 2.6.0 2.6.1 2.6.2 2.6.3 2.7.0 2.7.1 2.7.2 2.7.3 2.7.4 2.7.5 2.8.0 2.8.1 2.9.0 2.9.1 2.9.2 2.9.3 2.9.4 2.9.5 2.9.6 2.9.7 3.0.0 3.0.1 3.0.2 3.0.3 3.0.4 3.1.0 3.1.1 3.1.2 3.10.0 3.11.0 3.12.0 3.12.1 3.12.2 3.12.3 3.13.0 3.14.0 3.14.1 3.14.2 3.15.0 3.15.1 3.16.0 3.16.1 3.16.2 3.16.3 3.16.4 3.16.5 3.17.0 3.17.1 3.17.2 3.18.0 3.19.0 3.19.1 3.19.2 3.19.3 3.19.4 3.2.0 3.2.1 3.2.2 3.20.0 3.21.0 3.21.1 3.22.0 3.22.1 3.22.2 3.3.0 3.3.1 3.4.0 3.4.1 3.4.2 3.5.0 3.5.1 3.6.0 3.6.1 3.6.2 3.7.0 3.8.0 3.9.0 4.0.0 4.1.0 4.1.1 4.10.0 4.10.1 4.11.0 4.12.0 4.13.0 4.13.1 4.13.2 4.14.0 4.14.1 4.14.2 4.14.3 4.14.4 4.14.5 4.14.6 4.2.0 4.2.1 4.3.0 4.3.1 4.3.2 4.4.0 4.5.0 4.6.1 4.7.0 4.7.1 4.8.0 4.8.1 4.9.0 trunk 1.9.0 2.0.0 2.0.1 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 2.0.7 2.1.0 2.1.1 2.1.2 2.1.3 2.1.4 2.1.5 2.1.6 2.1.7 2.1.8 2.10.0 2.10.1 2.10.2 2.10.3 2.10.4 2.11.0 2.11.1 2.11.2 2.11.3 2.12.0 2.12.1 2.12.2 2.12.3 2.13.0 2.13.1 2.13.2 2.13.3 2.13.4 2.14.0 2.15.0 2.16.0 2.16.1 2.17.0 2.17.1 2.17.3 2.18.0 2.18.1 2.19.1 2.19.2 2.19.3 2.19.4 2.19.5 2.19.6 2.19.7 2.19.8 2.2.0 2.2.1 2.2.2 2.2.3 2.2.4 2.2.5 2.2.6 2.20.0 2.20.1 2.20.2 2.21.0 2.21.1 2.21.2 2.21.3 2.21.4 2.22.0 2.22.1 2.22.2 2.22.3 2.23.0 2.23.1 2.23.2 2.24.0 2.24.1 2.24.2 2.25.0 2.25.1 2.25.2 2.25.3 2.26.0 2.27.0 2.27.1 2.27.2 2.27.3 2.28.0 2.29.0 2.29.1 2.29.2
give / src / PaymentGateways / Stripe / Admin / AccountManagerSettingField.php
give / src / PaymentGateways / Stripe / Admin Last commit date
AccountManagerSettingField.php 4 years ago CreditCardSettingField.php 4 years ago CustomizeAccountField.php 4 years ago
AccountManagerSettingField.php
653 lines
1 <?php
2
3 namespace Give\PaymentGateways\Stripe\Admin;
4
5 use Give\PaymentGateways\Stripe\Repositories\AccountDetail;
6 use Give\PaymentGateways\Stripe\Repositories\Settings;
7 use Give_Admin_Settings;
8
9 use function add_query_arg;
10 use function do_action;
11 use function esc_attr;
12 use function esc_html;
13 use function esc_html__;
14 use function esc_html_e;
15 use function esc_url_raw;
16 use function get_site_url;
17 use function give;
18 use function give_has_upgrade_completed;
19 use function give_stripe_connection_type_name;
20 use function give_stripe_is_premium_active;
21
22 /**
23 * Class AccountManagerSettingField
24 *
25 * @package Give\PaymentGateways\Stripe\Admin
26 * @since 2.13.0
27 */
28 class AccountManagerSettingField
29 {
30
31 /**
32 * @var AccountDetail
33 */
34 private $accountDetailRepository;
35
36 /**
37 * @var array
38 */
39 private $stripeAccounts;
40
41 /**
42 * @var string
43 */
44 private $defaultStripeAccountSlug;
45 /**
46 * @var Settings
47 */
48 private $settings;
49
50 /**
51 * AccountManagerSettingField constructor.
52 *
53 * @since 2.13.0
54 *
55 * @param AccountDetail $accountDetailRepository
56 * @param Settings $settings
57 */
58 public function __construct(AccountDetail $accountDetailRepository, Settings $settings)
59 {
60 $this->accountDetailRepository = $accountDetailRepository;
61 $this->settings = $settings;
62 }
63
64 /**
65 * @since 2.13.0
66 */
67 private function setUpProperties()
68 {
69 global $post;
70 $this->stripeAccounts = $this->settings->getAllStripeAccounts();
71 $this->defaultStripeAccountSlug = $this->isGlobalSettingPage() ?
72 $this->settings->getDefaultStripeAccountSlug() :
73 $this->settings->getDefaultStripeAccountSlugForDonationForm($post->ID);
74 }
75
76 /**
77 * Render Stripe account manager setting field.
78 *
79 * @since 2.13.0
80 *
81 * @param array $field
82 */
83 public function handle($field)
84 {
85 $this->setUpProperties();
86 $classes = ! empty($field['wrapper_class']) ? esc_attr($field['wrapper_class']) : ''
87 ?>
88 <div class="<?php
89 echo $classes; ?>">
90
91 <div id="give-stripe-account-manager-errors"></div>
92 <?php
93 $this->getIntroductionSectionMarkup(); ?>
94 <div class="give-stripe-account-manager-container">
95 <div class="main-heading">
96 <h2 class="give-stripe-setting-heading"><?php
97 esc_html_e('Connected Accounts', 'give'); ?></h2>
98 </div>
99 <?php
100 $this->getStripeAccountListSectionMarkup();
101 $this->getAddNewStripeAccountSectionMarkup();
102 ?>
103 </div>
104 <?php
105 $this->getDefaultStripeAccountNotice(); ?>
106 </div>
107 <?php
108 }
109
110 /**
111 * @since 2.13.0
112 */
113 private function getIntroductionSectionMarkup()
114 {
115 // Show introduction content only on global setting edit screen.
116 if ( ! $this->isGlobalSettingPage()) {
117 return;
118 }
119 ?>
120 <div id="give-stripe-account-manager-description">
121 <h2><?php
122 esc_html_e('Accept Donations with Stripe', 'give'); ?></h2>
123
124 <?php
125 if (give_stripe_is_premium_active()) : ?>
126 <div class="give-stripe-pro-badge">
127 <div class="give-tooltip" data-tooltip="
128 <?php
129 esc_html_e(
130 'You are using the Pro version of the GiveWP add-on which includes additional payment methods, zero additional fees, and premium support.',
131 'give'
132 );
133 ?>
134 ">
135 <span class="dashicons dashicons-yes"></span>
136 <?php
137 esc_html_e('Pro Version Active', 'give'); ?>
138 </div>
139 </div>
140 <?php
141 endif; ?>
142
143 <p class="give-stripe-subheading-description">
144 <?php
145 esc_html_e(
146 'Connect to the Stripe payment gateway using this section. Multiple Stripe accounts can be connected simultaneously. All donation forms will use the "Default Account" unless configured otherwise. To specify a different Stripe account for a form, configure the settings within the "Stripe Account" tab on the individual form edit screen.',
147 'give'
148 );
149 ?>
150 </p>
151 <?php
152 if ($this->canShowFreeStripeVersionNotice()) {
153 $this->getFreeStripeVersionNoticeMarkup();
154 }
155 ?>
156 <hr style="margin: 25px 0; display: block" />
157 </div>
158 <?php
159 }
160
161 /**
162 * @since 2.13.0
163 */
164 private function getStripeAccountListSectionMarkup()
165 {
166 $this->getStripeAccountOnBoardingModalMarkup();
167 if ( ! $this->stripeAccounts || ( ! $this->isGlobalSettingPage() && 1 === count($this->stripeAccounts))) :
168 $this->getNoStripeAccountMarkup();
169
170 return;
171 endif;
172 ?>
173
174 <div class="give-stripe-account-manager-list">
175 <?php
176 foreach ($this->stripeAccounts as $stripeAccountDetails) {
177 $this->getStripeAccountMarkup($stripeAccountDetails);
178 }
179 ?>
180 </div>
181 <?php
182 }
183
184 /**
185 * @since 2.13.0
186 */
187 private function getAddNewStripeAccountSectionMarkup()
188 {
189 if ($this->canShowCompatibilityNotice()) {
190 $this->getCompatibilityNoticeMarkup();
191
192 return;
193 }
194 ?>
195 <div class="give-stripe-account-manager-add-section<?php
196 echo give_stripe_is_premium_active() ? ' give-settings-premium-active' : ''; ?>">
197
198 <div class="stripe-logo-with-circle">
199 <svg width="21" height="31" viewBox="0 0 21 31" fill="none" xmlns="http://www.w3.org/2000/svg">
200 <path fill-rule="evenodd" clip-rule="evenodd"
201 d="M8.41683 9.55871C8.41683 8.29941 9.4501 7.81507 11.1614 7.81507C13.6155 7.81507 16.7153 8.55773 19.1693 9.8816V2.29355C16.4892 1.22799 13.8415 0.808228 11.1614 0.808228C4.60666 0.808228 0.247559 4.23093 0.247559 9.94618C0.247559 18.8581 12.5176 17.4374 12.5176 21.2798C12.5176 22.7652 11.226 23.2495 9.4178 23.2495C6.73777 23.2495 3.31507 22.1517 0.602744 20.6663V28.3513C3.60568 29.6428 6.6409 30.1918 9.4178 30.1918C16.134 30.1918 20.7515 26.8659 20.7515 21.0861C20.7192 11.4638 8.41683 13.1751 8.41683 9.55871Z"
202 fill="#6772E5" />
203 </svg>
204 </div>
205 <h3 class="give-stripe-heading"><?php
206 esc_html_e('Add a New Stripe Account', 'give'); ?></h3>
207
208 <div class="give-setting-tab-body-gateways">
209
210 <?php
211
212 // Output Stripe Connect Button.
213 echo $this->getStripeConnectButtonMarkup();
214
215 // Check if premium is active.
216 if (give_stripe_is_premium_active()) {
217 /**
218 * This action hook will be used to load Manual API fields for premium addon.
219 *
220 * @since 2.7.0
221 *
222 * @param array $this- >stripeAccounts All Stripe accounts.
223 *
224 */
225 do_action('give_stripe_premium_manual_api_fields', $this->stripeAccounts);
226 }
227 ?>
228 </div>
229 </div>
230 <?php
231 }
232
233 /**
234 * @since 2.13.0
235 *
236 * @param array $stripeAccount
237 */
238 private function getStripeAccountMarkup($stripeAccount)
239 {
240 $accountName = $stripeAccount['account_name'];
241 $accountEmail = $stripeAccount['account_email'];
242 $stripeAccountId = $stripeAccount['account_id'];
243 $stripeAccountSlug = $stripeAccount['account_slug'];
244
245 // Do not print global default Stripe account in donation form setting.
246 if ($this->isGlobalDefaultStripeAccount($stripeAccountSlug)) {
247 return;
248 }
249
250 $disconnectUrl = add_query_arg(
251 [
252 'account_type' => $stripeAccount['type'],
253 'action' => 'disconnect_stripe_account',
254 'account_slug' => $stripeAccountSlug,
255 ],
256 wp_nonce_url(admin_url('admin-ajax.php'), 'give_disconnect_connected_stripe_account_' . $stripeAccountSlug)
257 );
258
259 $classes = $stripeAccountSlug === $this->defaultStripeAccountSlug ? ' give-stripe-boxshadow-option-wrap__selected' : '';
260 ?>
261 <div
262 id="give-stripe-<?php
263 echo $stripeAccountSlug; ?>"
264 class="give-stripe-account-manager-list-item give-stripe-boxshadow-option-wrap<?php
265 echo $classes; ?>"
266 >
267 <input type="hidden" name="stripe-account-slug" value="<?php
268 echo $stripeAccountSlug; ?>" readonly>
269 <input type="hidden" name="setting-page" value="<?php
270 echo $this->isGlobalSettingPage() ? 'global' : 'form'; ?>" readonly>
271 <?php
272 if ($stripeAccountSlug === $this->defaultStripeAccountSlug) : ?>
273 <div class="give-stripe-account-default-checkmark">
274 <svg width="33" height="33" viewBox="0 0 33 33" fill="none" xmlns="http://www.w3.org/2000/svg">
275 <path
276 d="M32.375 16.1875C32.375 25.1276 25.1276 32.375 16.1875 32.375C7.24737 32.375 0 25.1276 0 16.1875C0 7.24737 7.24737 0 16.1875 0C25.1276 0 32.375 7.24737 32.375 16.1875ZM14.3151 24.7586L26.3252 12.7486C26.733 12.3407 26.733 11.6795 26.3252 11.2717L24.8483 9.79474C24.4404 9.38686 23.7792 9.38686 23.3713 9.79474L13.5766 19.5894L9.00371 15.0165C8.59589 14.6086 7.93462 14.6086 7.52673 15.0165L6.04982 16.4934C5.642 16.9012 5.642 17.5625 6.04982 17.9703L12.8381 24.7586C13.246 25.1665 13.9072 25.1665 14.3151 24.7586Z"
277 fill="#69B868" />
278 </svg>
279 </div>
280 <?php
281 endif; ?>
282
283 <div class="give-stripe-account-fieldset give-stripe-account-name">
284 <span class="give-stripe-label"><?php
285 esc_html_e('Account name:', 'give'); ?></span>
286 <span class="give-stripe-connect-data-field">
287 <?php
288 echo esc_html($accountName); ?>
289 </span>
290 </div>
291
292 <?php
293 if ( ! empty($accountEmail)) : ?>
294 <div class="give-stripe-account-fieldset give-stripe-account-email">
295 <span class="give-stripe-label"><?php
296 esc_html_e('Account email:', 'give'); ?></span>
297 <div class="give-stripe-connect-data-field">
298 <?php
299 echo esc_html($accountEmail); ?>
300 </div>
301 </div>
302 <?php
303 endif; ?>
304
305 <?php
306 if ( ! empty($stripeAccountId)) : ?>
307 <div class="give-stripe-account-fieldset give-stripe-account-id">
308 <span class="give-stripe-label"><?php
309 esc_html_e('Account ID:', 'give'); ?></span>
310 <div class="give-stripe-connect-data-field">
311 <?php
312 echo esc_html($stripeAccountId); ?>
313 </div>
314 </div>
315 <?php
316 endif; ?>
317
318 <div class="give-stripe-account-fieldset give-stripe-connection-method">
319 <span class="give-stripe-label">
320 <?php
321 esc_html_e('Connection Method:', 'give'); ?>
322 </span>
323 <div class="give-stripe-connect-data-field">
324 <?php
325 echo give_stripe_connection_type_name($stripeAccount['type']); ?>
326 </div>
327 </div>
328
329 <?php
330 /**
331 * Filter fire.
332 *
333 * Developer can utilize this hook to add custom action to stripe account
334 *
335 * @since 2.13.3
336 */
337 $stripeAccountActionsHtml = apply_filters(
338 'give_stripe_manage_account_actions_html',
339 '',
340 $stripeAccount,
341 $this->stripeAccounts,
342 $this->defaultStripeAccountSlug
343 );
344
345 if ($stripeAccountActionsHtml) {
346 printf(
347 '<div class="give-stripe-account-fieldset give-stripe-account-edit">%s</div>',
348 $stripeAccountActionsHtml
349 );
350 }
351 ?>
352
353 <div class="give-stripe-account-fieldset">
354 <span class="give-stripe-label"><?php
355 esc_html_e('Connection Status:', 'give'); ?></span>
356 <div class="give-stripe-account-actions">
357 <span class="give-stripe-account-connected give-stripe-connect-data-field">
358 <?php
359 esc_html_e('Connected', 'give'); ?>
360 </span>
361 <?php
362 if ($stripeAccountSlug !== $this->defaultStripeAccountSlug || 1 === count(
363 $this->stripeAccounts
364 )) : ?>
365 <span class="give-stripe-account-disconnect">
366 <a
367 class="give-stripe-disconnect-account-btn"
368 href="<?php
369 echo $disconnectUrl; ?>"
370 ><span class="dashicons dashicons-editor-unlink"></span><?php
371 esc_html_e('Remove', 'give'); ?></a>
372 </span>
373 <?php
374 endif; ?>
375 </div>
376 </div>
377
378 <?php
379 if ($stripeAccountSlug === $this->defaultStripeAccountSlug) : ?>
380 <div class="give-stripe-account-badge">
381 <?php
382 esc_html_e('Default Account', 'give'); ?>
383 </div>
384 <?php
385 else : ?>
386 <div class="give-stripe-account-default">
387 <a
388 data-account="<?php
389 echo $stripeAccountSlug; ?>"
390 class="give-stripe-account-set-default"
391 href="#"
392 ><?php
393 esc_html_e('Set as Default', 'give'); ?></a>
394 </div>
395 <?php
396 endif; ?>
397 </div>
398 <?php
399 }
400
401 /**
402 * @since 2.13.0
403 */
404 private function getStripeAccountOnBoardingModalMarkup()
405 {
406 global $post;
407
408 $site_url = get_site_url();
409 $redirectUrl = $this->isGlobalSettingPage() ?
410 admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=stripe-settings') :
411 admin_url("post.php?post=$post->ID&action=edit&give_tab=stripe_form_account_options");
412
413 $modal_title = sprintf(
414 '<strong>%1$s</strong>',
415 esc_html__(
416 'You are connected! Now this is important: Please configure your Stripe webhook to finalize the setup.',
417 'give'
418 )
419 );
420 $modal_first_detail = sprintf(
421 '%1$s %2$s',
422 esc_html__(
423 'In order for Stripe to function properly, you must add a new Stripe webhook endpoint. To do this please visit the <a href=\'https://dashboard.stripe.com/webhooks\' target=\'_blank\'>Webhooks Section of your Stripe Dashboard</a> and click the <strong>Add endpoint</strong> button and paste the following URL:',
424 'give'
425 ),
426 "<strong>{$site_url}?give-listener=stripe</strong>"
427 );
428 $modal_second_detail = esc_html__(
429 'Stripe webhooks are required so GiveWP can communicate properly with the payment gateway to confirm payment completion, renewals, and more.',
430 'give'
431 );
432 $can_display = ! empty($_GET['stripe_account']) ? '0' : '1';
433 ?>
434 <div
435 id="give-stripe-connected"
436 class="stripe-btn-disabled give-hidden"
437 data-status="connected"
438 data-title="<?php
439 echo $modal_title; ?>"
440 data-first-detail="<?php
441 echo $modal_first_detail; ?>"
442 data-second-detail="<?php
443 echo $modal_second_detail; ?>"
444 data-display="<?php
445 echo $can_display; ?>"
446 data-redirect-url="<?php
447 echo esc_url_raw($redirectUrl); ?>"
448 >
449 </div>
450 <?php
451 }
452
453 /**
454 * @since 2.13.0
455 */
456 private function getCompatibilityNoticeMarkup()
457 {
458 ?>
459 <div class="give-stripe-account-manager-add-section">
460 <?php
461 Give()->notices->print_admin_notices(
462 [
463 'description' => sprintf(
464 '%1$s <a href="%2$s">%3$s</a> %4$s',
465 esc_html__(
466 'Give 2.7.0 introduces the ability to connect a single site to multiple Stripe accounts. To use this feature, you need to complete database updates. ',
467 'give'
468 ),
469 esc_url(admin_url('edit.php?post_type=give_forms&page=give-updates')),
470 esc_html__('Click here', 'give'),
471 esc_html__('to complete your pending database updates.', 'give')
472 ),
473 'dismissible' => false,
474 ]
475 );
476 ?>
477 </div>
478 <?php
479 }
480
481 /**
482 * @since 2.13.0
483 */
484 private function getFreeStripeVersionNoticeMarkup()
485 {
486 ?>
487 <p class="give-stripe-subheading-description">
488 <?php
489 printf(
490 __(
491 'NOTE: You are using the free Stripe payment gateway integration. This includes an additional 2%% fee for processing one-time donations. This fee is removed by activating the premium <a href="%1$s" target="_blank">Stripe add-on</a> and never applies to subscription donations made through the <a href="%2$s" target="_blank">Recurring Donations add-on</a>. <a href="%3$s" target="_blank">Learn More ></a>',
492 'give'
493 ),
494 esc_url('http://docs.givewp.com/settings-stripe-addon'),
495 esc_url('http://docs.givewp.com/settings-stripe-recurring'),
496 esc_url('http://docs.givewp.com/settings-stripe-free')
497 );
498 ?>
499 </p>
500 <?php
501 }
502
503 /**
504 * @since 2.13.0
505 */
506 public function getNoStripeAccountMarkup()
507 {
508 ?>
509 <div class="no-stripe-account-connected">
510 <div class="no-stripe-account-connected-inner">
511 <span class="dashicons dashicons-info"></span>
512 <h3 class="give-stripe-settings-heading">
513 <?php
514 echo $this->isGlobalSettingPage() ?
515 esc_html__('No Stripe Accounts Connected', 'give') :
516 esc_html__('Connect a New Stripe Account', 'give');
517 ?>
518 </h3>
519 <p id="give-stripe-connect-invite">
520 <?php
521 echo $this->isGlobalSettingPage() ?
522 esc_html__('Connect an account to get started!', 'give') :
523 esc_html__(
524 'Add a new account to customize the Stripe account used for this donation form.',
525 'give'
526 )
527 ?>
528 </p>
529 <?php
530 echo $this->getStripeConnectButtonMarkup(); ?>
531 </div>
532 </div>
533 <?php
534 }
535
536 /**
537 * @since 2.13.0
538 * @return string
539 */
540 public function getStripeConnectButtonMarkup()
541 {
542 // Prepare Stripe Connect URL.
543 $link = add_query_arg(
544 [
545 'stripe_action' => 'connect',
546 'mode' => give_is_test_mode() ? 'test' : 'live',
547 'return_url' => ! $this->isGlobalSettingPage() ?
548 rawurlencode(
549 sprintf(
550 admin_url('post.php?post=%d&action=edit&give_tab=stripe_form_account_options'),
551 get_the_ID()
552 )
553 ) :
554 rawurlencode(
555 admin_url(
556 'edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=stripe-settings'
557 )
558 ),
559 'website_url' => get_bloginfo('url'),
560 'give_stripe_connected' => '0',
561 ],
562 esc_url_raw('https://connect.givewp.com/stripe/connect.php')
563 );
564
565 $stripeSvgIcon = '<svg width="15" height="21" viewBox="0 0 15 21" fill="none" xmlns="http://www.w3.org/2000/svg">
566 <path d="M6.05469 6.55469C6.05469 5.69531 6.75781 5.34375 7.92969 5.34375C9.64844 5.34375 11.7969 5.85156 13.4766 6.78906V1.55469C11.6406 0.8125 9.80469 0.5 7.92969 0.5C3.4375 0.5 0.429688 2.88281 0.429688 6.82812C0.429688 13 8.86719 11.9844 8.86719 14.6406C8.86719 15.6953 7.96875 16.0078 6.75781 16.0078C4.88281 16.0078 2.5 15.2656 0.664062 14.25V19.25C2.5 20.0703 4.57031 20.5 6.75781 20.5391C11.3672 20.5391 14.5703 18.5469 14.5703 14.5234C14.5703 7.88281 6.05469 9.05469 6.05469 6.55469Z" fill="white"/>
567 </svg>
568 ';
569
570 return sprintf(
571 '<a href="%1$s" class="give-stripe-connect" title="%2$s"><span class="stripe-logo">%3$s</span><span>%2$s</span></a>',
572 esc_url($link),
573 esc_html__('Connect with Stripe', 'give'),
574 $stripeSvgIcon
575 );
576 }
577
578 /**
579 * @since 2.13.0
580 */
581 private function getDefaultStripeAccountNotice()
582 {
583 ?>
584 <div class="give-stripe-default-account-notice">
585 <span class="dashicons dashicons-info"></span>
586 <div class="give-stripe-default-account-notice__inner">
587 <p class="give-stripe-default-account-notice__bold"><strong>
588 <?php
589 echo $this->isGlobalSettingPage() ?
590 esc_html__('All payments go to the default account', 'give') :
591 esc_html__('Stripe donations process through the account set above', 'give');
592 ?>
593 </strong></p>
594 <p>
595 <?php
596 echo $this->isGlobalSettingPage() ?
597 esc_html__(
598 'You can set this globally (for all donation forms) or override the Stripe account per donation form.',
599 'give'
600 ) :
601 esc_html__('This overrides the global default account setting for this donation form.', 'give');
602 ?>
603 </p>
604 </div>
605 </div>
606 <?php
607 }
608
609 /**
610 * @since 2.13.0
611 * @return bool
612 */
613 private function canShowFreeStripeVersionNotice()
614 {
615 return ! give_stripe_is_premium_active();
616 }
617
618 /**
619 * @return bool
620 */
621 private function canShowCompatibilityNotice()
622 {
623 return ! give_has_upgrade_completed('v270_store_stripe_account_for_donation');
624 }
625
626 /**
627 * @since 2.13.0
628 * @return bool
629 */
630 private function isGlobalSettingPage()
631 {
632 return Give_Admin_Settings::is_setting_page('gateways', 'stripe-settings');
633 }
634
635 /**
636 * @since 2.13.0
637 *
638 * @param string $accountSlug Stripe account slug
639 *
640 * @return bool
641 */
642 private function isGlobalDefaultStripeAccount($accountSlug)
643 {
644 $globalDefaultStripeAccountDetail = give_stripe_get_default_account();
645
646 if (empty($globalDefaultStripeAccountDetail)) {
647 return false;
648 }
649
650 return ! $this->isGlobalSettingPage() && $globalDefaultStripeAccountDetail['account_slug'] === $accountSlug;
651 }
652 }
653