8889841cDonationFormSettingPage.php000064400000004511150514556620012021 0ustar00canRegisterTab()) { return $settings; } $settings['stripe_form_account_options'] = [ 'id' => 'stripe_form_account_options', 'title' => esc_html__('Stripe Account', 'give'), 'icon-html' => '', 'fields' => $this->getMainSettingFields($formId), ]; return $settings; } /** * @since 2.13.0 * * @param int $formId * * @return array[] */ private function getMainSettingFields($formId) { $formAccount = give_is_setting_enabled( give_get_meta( $formId, 'give_stripe_per_form_accounts', true ) ); return [ [ 'id' => 'give_stripe_per_form_accounts', 'type' => 'give_stripe_per_form_accounts', 'callback' => [give(CustomizeAccountField::class), 'handle'], 'default' => CustomizeAccountField::DEFAULT_VALUE, ], [ 'id' => 'give_manage_accounts', 'type' => 'give_manage_accounts', 'callback' => [give(AccountManagerSettingField::class), 'handle'], 'wrapper_class' => $formAccount ? 'give-stripe-manage-account-options' : 'give-stripe-manage-account-options give-hidden', ], [ 'name' => 'donation_stripe_per_form_docs', 'type' => 'docs_link', 'url' => 'http://docs.givewp.com/stripe-free', 'title' => esc_html__('Stripe Documentation', 'give'), ], ]; } /** * @since 2.13.0 * @return bool */ private function canRegisterTab() { return give_stripe_is_any_payment_method_active(); } } Admin/AccountManagerSettingField.php000064400000064636150514556620013526 0ustar00accountDetailRepository = $accountDetailRepository; $this->settings = $settings; $this->connectClient = $connectClient; } /** * @since 2.13.0 */ private function setUpProperties() { global $post; $this->stripeAccounts = $this->settings->getAllStripeAccounts(); $this->defaultStripeAccountSlug = $this->isGlobalSettingPage() ? $this->settings->getDefaultStripeAccountSlug() : $this->settings->getDefaultStripeAccountSlugForDonationForm($post->ID); } /** * Render Stripe account manager setting field. * * @since 2.13.0 * * @param array $field */ public function handle($field) { $this->setUpProperties(); $classes = ! empty($field['wrapper_class']) ? esc_attr($field['wrapper_class']) : '' ?>
getIntroductionSectionMarkup(); ?>

getStripeAccountListSectionMarkup(); $this->getAddNewStripeAccountSectionMarkup(); ?>
getDefaultStripeAccountNotice(); ?>
isGlobalSettingPage()) { return; } ?>

canShowFreeStripeVersionNotice()) { $this->getFreeStripeVersionNoticeMarkup(); } ?>
getStripeAccountOnBoardingModalMarkup(); if ( ! $this->stripeAccounts || ( ! $this->isGlobalSettingPage() && 1 === count($this->stripeAccounts))) : $this->getNoStripeAccountMarkup(); return; endif; ?>
stripeAccounts as $stripeAccountDetails) { $this->getStripeAccountMarkup($stripeAccountDetails); } ?>
canShowCompatibilityNotice()) { $this->getCompatibilityNoticeMarkup(); return; } ?>

getStripeConnectButtonMarkup(); // Check if premium is active. if (give_stripe_is_premium_active()) { /** * This action hook will be used to load Manual API fields for premium addon. * * @since 2.7.0 * * @param array $stripeAccounts All Stripe accounts. * */ do_action('give_stripe_premium_manual_api_fields', $this->stripeAccounts); } ?>
isGlobalDefaultStripeAccount($stripeAccountSlug)) { return; } $disconnectUrl = esc_url_raw(add_query_arg( [ 'account_type' => $stripeAccount['type'], 'action' => 'disconnect_stripe_account', 'account_slug' => $stripeAccountSlug, ], wp_nonce_url(admin_url('admin-ajax.php'), 'give_disconnect_connected_stripe_account_' . $stripeAccountSlug) )); $editStatementDescriptorUrl = esc_url_raw(add_query_arg( [ 'action' => 'edit_stripe_account_statement_descriptor', 'account-slug' => $stripeAccountSlug, ], admin_url('admin-ajax.php') )); $classes = $stripeAccountSlug === $this->defaultStripeAccountSlug ? ' give-stripe-boxshadow-option-wrap__selected' : ''; ?>
defaultStripeAccountSlug) : ?>
%s', 'https://stripe.com/docs/statement-descriptors#requirements', Give()->tooltips->render_help([ 'label' => esc_html__( 'This is the text that appears on your donor\'s bank statements. This is typically the name of your website or organization. Click on this icon to read more about Stripe statement text requirements.', 'give' ), 'size' => 'medium', ] ) ); ?>
isGlobalSettingPage()): ?>
stripeAccounts, $this->defaultStripeAccountSlug ); if ($stripeAccountActionsHtml) { printf( '
%s
', $stripeAccountActionsHtml ); } ?>
defaultStripeAccountSlug) : ?>
isGlobalSettingPage() ? admin_url('edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=stripe-settings') : admin_url("post.php?post=$post->ID&action=edit&give_tab=stripe_form_account_options"); $modal_title = sprintf( '%1$s', esc_html__( 'You are connected! Now this is important: Please configure your Stripe webhook to finalize the setup.', 'give' ) ); $modal_first_detail = sprintf( '%1$s %2$s', esc_html__( 'In order for Stripe to function properly, you must add a new Stripe webhook endpoint. To do this please visit the Webhooks Section of your Stripe Dashboard and click the Add endpoint button and paste the following URL:', 'give' ), "{$site_url}?give-listener=stripe" ); $modal_second_detail = esc_html__( 'Stripe webhooks are required so GiveWP can communicate properly with the payment gateway to confirm payment completion, renewals, and more.', 'give' ); $can_display = ! empty($_GET['stripe_account']) ? '0' : '1'; ?>
notices->print_admin_notices( [ 'description' => sprintf( '%1$s %3$s %4$s', esc_html__( '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. ', 'give' ), esc_url(admin_url('edit.php?post_type=give_forms&page=give-updates')), esc_html__('Click here', 'give'), esc_html__('to complete your pending database updates.', 'give') ), 'dismissible' => false, ] ); ?>

Stripe add-on and never applies to subscription donations made through the Recurring Donations add-on. Learn More >', 'give' ), esc_url('http://docs.givewp.com/settings-stripe-addon'), esc_url('http://docs.givewp.com/settings-stripe-recurring'), esc_url('http://docs.givewp.com/settings-stripe-free') ); ?>

isGlobalSettingPage() ? esc_html__('No Stripe Accounts Connected', 'give') : esc_html__('Connect a New Stripe Account', 'give'); ?>

isGlobalSettingPage() ? esc_html__('Connect an account to get started!', 'give') : esc_html__( 'Add a new account to customize the Stripe account used for this donation form.', 'give' ) ?>

getStripeConnectButtonMarkup(); ?>
'connect', 'mode' => give_is_test_mode() ? 'test' : 'live', 'return_url' => ! $this->isGlobalSettingPage() ? rawurlencode( sprintf( admin_url('post.php?post=%d&action=edit&give_tab=stripe_form_account_options'), get_the_ID() ) ) : rawurlencode( admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=stripe-settings' ) ), 'website_url' => get_bloginfo('url'), 'give_stripe_connected' => '0', ], esc_url_raw($this->connectClient->getApiUrl('stripe/connect.php')) ); $stripeSvgIcon = ' '; return sprintf( '%2$s', esc_url($link), esc_html__('Connect with Stripe', 'give'), $stripeSvgIcon ); } /** * @since 2.13.0 */ private function getDefaultStripeAccountNotice() { ?>

isGlobalSettingPage() ? esc_html__( 'You can set this globally (for all donation forms) or override the Stripe account per donation form.', 'give' ) : esc_html__('This overrides the global default account setting for this donation form.', 'give'); ?>

isGlobalSettingPage() && $globalDefaultStripeAccountDetail['account_slug'] === $accountSlug; } } Admin/CustomizeAccountField.php000064400000014616150514556620012571 0ustar00
getIntroductionSectionMarkup(); ?> getRadioButtons(); ?>

getValue(); ?>
form_meta->get_meta($post->ID, 'give_stripe_per_form_accounts', true); return $value ?: self::DEFAULT_VALUE; } } Admin/CreditCardSettingField.php000064400000014367150514556620012637 0ustar00
getIntroductionSectionMarkup(); ?> getRadioButtons($field, $value); ?>

0 && $formHasStripeAccount) { // Return default Stripe account of the form, if enabled. $accountId = give_get_meta($formId, '_give_stripe_default_account', true); } else { // Global Stripe account. $accountId = give_get_option('_give_stripe_default_account', ''); } return $this->getAccountDetail($accountId); } /** * Get account detail by Stripe account id. * * @since 2.10.2 * * @param string $accountId * * @return AccountDetailModel * @throws InvalidPropertyName */ public function getAccountDetail($accountId) { $accountDetail = array_filter( give_stripe_get_all_accounts(), static function ($data) use ($accountId) { return $data['account_id'] === $accountId; } ); $accountDetail = $accountDetail ? current($accountDetail) : $accountDetail; return new AccountDetailModel($accountDetail); } /** * Get account detail by Stripe account slug. * * @since 2.13.3 * * @param string $accountSlug * * @return AccountDetailModel * @throws InvalidArgumentException|InvalidPropertyName */ public function getAccountDetailBySlug($accountSlug) { $accountDetail = array_filter( give_stripe_get_all_accounts(), static function ($data) use ($accountSlug) { return $data['account_slug'] === $accountSlug; } ); if ( ! $accountDetail) { throw new InvalidArgumentException( sprintf( 'Stripe account with %s account slug does not exist', $accountSlug ) ); } $accountDetail = current($accountDetail); return new AccountDetailModel($accountDetail); } } Repositories/Settings.php000064400000013314150514556620011557 0ustar00form_meta->get_meta($formId, '_give_stripe_default_account', true); } /** * @since 2.13.0 * * @param int $formId * @param $stripeAccountSlug * * @return bool */ public static function setDefaultStripeAccountSlugForDonationForm($formId, $stripeAccountSlug) { return give()->form_meta->update_meta($formId, '_give_stripe_default_account', $stripeAccountSlug); } /** * @since 2.13.0 * @return string */ public function getDefaultStripeAccountSlug() { return give_stripe_get_default_account_slug(); } /** * @since 2.13.0 * @return bool */ public function hasDefaultGlobalStripeAccountSlug() { return (bool)$this->getDefaultStripeAccountSlug(); } /** * @since 2.13.0 * * @param string $accountSlug * * @return bool */ public function setDefaultGlobalStripeAccountSlug($accountSlug) { return give_update_option('_give_stripe_default_account', $accountSlug); } /** * @since 2.13.0 * @throws StripeAccountAlreadyConnected * @throws DuplicateStripeAccountName|InvalidPropertyName */ public function addNewStripeAccount(AccountDetailModel $stripeAccount) { $allAccounts = give_stripe_get_all_accounts(); $accountSlug = $stripeAccount->accountSlug; if (!$this->isUniqueAccountName($stripeAccount->accountName, $allAccounts)) { throw new DuplicateStripeAccountName(esc_html__('Stripe account already exist with same name.', 'give')); } if ( array_key_exists($accountSlug, $allAccounts) || $this->isAccountAlreadyConnected($stripeAccount, $allAccounts) ) { throw new StripeAccountAlreadyConnected(esc_html__('Stripe account already connected', 'give')); } $allAccounts[$accountSlug] = $stripeAccount->toArray(); return give_update_option('_give_stripe_get_all_accounts', $allAccounts); } /** * @since 2.13.0 */ public function updateStripeAccount(AccountDetailModel $stripeAccount) { $allAccounts = give_stripe_get_all_accounts(); $accountSlug = $stripeAccount->accountSlug; if (array_key_exists($accountSlug, $allAccounts)) { $accountDetails = $stripeAccount->toArray(); // account_id, account_slug are unique value which used to reference to connect stripe account. // They can not be renamed. unset($accountDetails['account_id'], $accountDetails['account_slug']); $allAccounts[$accountSlug] = $stripeAccount->toArray(); return give_update_option('_give_stripe_get_all_accounts', $allAccounts); } return false; } /** * @since 2.13.0 * * @param AccountDetailModel $stripeAccount * @param array $allAccounts * * @return bool * @throws InvalidPropertyName */ public function isAccountAlreadyConnected(AccountDetailModel $stripeAccount, $allAccounts) { foreach ($allAccounts as $account) { $savedStripeAccount = AccountDetailModel::fromArray($account); if ( $savedStripeAccount->liveSecretKey === $stripeAccount->liveSecretKey && $savedStripeAccount->livePublishableKey === $stripeAccount->livePublishableKey && $savedStripeAccount->testSecretKey === $stripeAccount->testSecretKey && $savedStripeAccount->testPublishableKey === $stripeAccount->testPublishableKey ) { return true; } } return false; } /** * @since 2.13.0 * * @param string $stripeAccountName * @param array $allAccounts * * @return bool * @throws InvalidPropertyName */ public function isUniqueAccountName($stripeAccountName, $allAccounts) { foreach ($allAccounts as $account) { $savedStripeAccount = AccountDetailModel::fromArray($account); if ($savedStripeAccount->accountName === $stripeAccountName) { return false; } } return true; } } Models/AccountDetail.php000064400000010712150514556620011231 0ustar00args = $args; $args = $this->addSupportFormNewStatementDescriptorParam($args); $this->propertiesArgs = ArrayDataSet::camelCaseKeys($args); $this->validate($args); } /** * @since 2.13.0 * @throws InvalidPropertyName */ public static function fromArray($array) { return new static($array); } /** * @since 2.13.0 * * @return array */ public function toArray() { return [ 'type' => $this->type, 'account_id' => $this->accountId, 'account_slug' => $this->accountSlug, 'account_name' => $this->accountName, 'account_country' => $this->accountCountry, 'account_email' => $this->accountEmail, 'live_secret_key' => $this->liveSecretKey, 'test_secret_key' => $this->testSecretKey, 'live_publishable_key' => $this->livePublishableKey, 'test_publishable_key' => $this->testPublishableKey, 'statement_descriptor' => $this->statementDescriptor, ]; } /** * @since 2.10.2 * * @param string $key * * @return mixed * @throws InvalidPropertyName */ public function __get($key) { if ( ! array_key_exists($key, $this->propertiesArgs)) { throw new InvalidPropertyName( sprintf( '$1%s property does not exist in %2$s class', $key, __CLASS__ ) ); } return $this->propertiesArgs[$key]; } /** * Validate array format. * * @since 2.10.2 * * @param array $array * * @throws InvalidPropertyName */ private function validate($array) { if (array_diff($this->requiredArgs, array_keys($array))) { throw new InvalidPropertyName( sprintf( 'To create a %1$s object, please provide valid: %2$s', __CLASS__, implode(' , ', $this->requiredArgs) ) ); } } /** * We decided to define statement descriptor per stripe account. * Statement descriptor default text for each account will be set to blog title. * @see : https://github.com/impress-org/givewp/issues/6021 * * @since 2.19.0 * @since 2.19.1 Use old stripe statement descriptor requirements to filter text. * https://github.com/impress-org/givewp/pull/6269 * @deprecated * * @param array $args * * @return array */ private function addSupportFormNewStatementDescriptorParam($args) { $propertyName = 'statement_descriptor'; if ( ! array_key_exists($propertyName, $args) || empty($args[$propertyName])) { $statementDescriptor = give_get_option('stripe_statement_descriptor', get_bloginfo('name')); $args[$propertyName] = $this->filterOldStatementDescriptor($statementDescriptor); } return $args; } } Traits/HasStripeStatementDescriptorText.php000064400000004255150514556620015235 0ustar00', '"', '\\', '\'', '*']; // Stripe reserve keywords. if ($minLength > strlen($statementDescriptor) || $maxLength < strlen($statementDescriptor)) { throw new InvalidArgumentException( esc_html__('Stripe statement descriptor text should contain between 5 - 22 letters, inclusive.', 'give') ); } if (is_numeric($statementDescriptor)) { throw new InvalidArgumentException( esc_html__('Stripe statement descriptor text should contain at least one letter.', 'give') ); } if (array_intersect($unsupportedCharacters, str_split($statementDescriptor))) { throw new InvalidArgumentException( __( 'Stripe statement descriptor text should not contain any of the special characters < > \ \' " *.', 'give' ) ); } } /** * Return filtered statement descriptor. * This function should be used to filter statement description * which was storing in stripe_statement_descriptor give setting prior to Giver 2.19. * * @since 2.19.1 * @deprecated * * @param string $text * * @return false|string */ protected function filterOldStatementDescriptor($text) { $statementDescriptor = trim($text); $unsupportedCharacters = ['<', '>', '"', '\'']; $statementDescriptor = str_replace($unsupportedCharacters, '', $statementDescriptor); return substr($statementDescriptor, 0, 22); } } Exceptions/StripeAccountAlreadyConnected.php000064400000000435150514556620015321 0ustar00settingsRepository = $settingsRepository; } /** * @since 2.13.0 */ public function __invoke() { $this->validateRequest(); $requestData = SetDefaultStripeAccountDto::fromArray(give_clean($_POST)); try { if ($requestData->formId) { $this->settingsRepository ->setDefaultStripeAccountSlugForDonationForm( $requestData->formId, $requestData->accountSlug ); give()->form_meta->update_meta( $requestData->formId, 'give_stripe_per_form_accounts', 'enabled' ); wp_send_json_success(); } $this->settingsRepository->setDefaultGlobalStripeAccountSlug($requestData->accountSlug); wp_send_json_success(); } catch (\Exception $e) { wp_send_json_error( [ 'error' => $e->getMessage(), ] ); } } /** * @since 2.13.0 */ private function validateRequest() { if ( ! current_user_can('manage_give_settings')) { die(); } } } Controllers/DisconnectStripeAccountController.php000064400000002122150514556620016432 0ustar00validateRequest(); $requestedData = DisconnectStripeAccountDto::fromArray(give_clean($_GET)); $this->securityCheck($requestedData->accountSlug); give_stripe_disconnect_account($requestedData->accountSlug); wp_send_json_success(); } /** * @since 2.13.0 */ private function validateRequest() { if ( ! current_user_can('manage_give_settings')) { die(); } } /** * @since 2.13.0 * * @param $accountSlug */ private function securityCheck($accountSlug) { if ( ! check_admin_referer('give_disconnect_connected_stripe_account_' . $accountSlug)) { die(); } } } Controllers/NewStripeAccountOnBoardingController.php000064400000012165150514556620017045 0ustar00settings = $settings; } /** * @since 2.13.0 */ public function __invoke() { if (!current_user_can('manage_give_settings')) { return; } $requestedData = NewStripeAccountOnBoardingDto::fromArray(give_clean($_GET)); if (!$requestedData->hasValidateData()) { return; } $stripe_accounts = give_stripe_get_all_accounts(); $secret_key = !give_is_test_mode() ? $requestedData->stripeAccessToken : $requestedData->stripeAccessTokenTest; Stripe::setApiKey($secret_key); // Get Account Details. $account_details = give_stripe_get_account_details($requestedData->stripeUserId); // Setup Account Details for Connected Stripe Accounts. if (empty($account_details->id)) { Give_Admin_Settings::add_error( 'give-stripe-account-id-fetching-error', sprintf( '%1$s %2$s', esc_html__('Stripe Error:', 'give'), esc_html__( 'We are unable to connect your Stripe account. Please contact the support team for assistance.', 'give' ) ) ); return; } $account_name = !empty($account_details->business_profile->name) ? $account_details->business_profile->name : $account_details->settings->dashboard->display_name; $account_slug = $account_details->id; $account_email = $account_details->email; $account_country = $account_details->country; // Set first Stripe account as default. if (!$stripe_accounts) { give_update_option('_give_stripe_default_account', $account_slug); } try { $accountDetailModel = AccountDetailModel::fromArray( [ 'type' => 'connect', 'account_name' => $account_name, 'account_slug' => $account_slug, 'account_email' => $account_email, 'account_country' => $account_country, 'account_id' => $requestedData->stripeUserId, 'live_secret_key' => $requestedData->stripeAccessToken, 'test_secret_key' => $requestedData->stripeAccessTokenTest, 'live_publishable_key' => $requestedData->stripePublishableKey, 'test_publishable_key' => $requestedData->stripePublishableKeyTest, 'statement_descriptor' => $account_details->settings->payments->statement_descriptor, ] ); $this->settings->addNewStripeAccount($accountDetailModel); if ($requestedData->formId) { if (!Settings::getDefaultStripeAccountSlugForDonationForm($requestedData->formId)) { Settings::setDefaultStripeAccountSlugForDonationForm( $requestedData->formId, $accountDetailModel->accountSlug ); } give()->form_meta->update_meta( $requestedData->formId, 'give_stripe_per_form_accounts', 'enabled' ); } wp_redirect( esc_url_raw( add_query_arg( ['stripe_account' => 'connected'], $requestedData->formId ? admin_url( "post.php?post=$requestedData->formId&action=edit&give_tab=stripe_form_account_options" ) : admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways§ion=stripe-settings' ) ) ) ); exit(); } catch (\Exception $e) { Give_Admin_Settings::add_error( 'give-stripe-account-on-boarding-error', sprintf( '%1$s %2$s', esc_html__('Stripe Error:', 'give'), esc_html__( 'We are unable to connect your Stripe account. Please contact the support team for assistance.', 'give' ) ) ); return; } } } Controllers/GetStripeAccountDetailsController.php000064400000002706150514556620016376 0ustar00accountDetailServiceProvider = $accountDetailServiceProvider; } /** * @since 2.13.3 */ public function __invoke() { $this->validateRequest(); $requestedData = GetStripeAccountDetailsDto::fromArray(give_clean($_POST)); try { wp_send_json_success( $this->accountDetailServiceProvider ->getAccountDetailBySlug($requestedData->accountSlug) ->toArray() ); } catch (InvalidArgumentException $e) { wp_send_json_error(); } } /** * @since 2.13.0 */ private function validateRequest() { if ( ! current_user_can('manage_give_settings')) { die(); } } } DataTransferObjects/SetDefaultStripeAccountDto.php000064400000001322150514556620016367 0ustar00accountSlug = ! empty($array['account_slug']) ? $array['account_slug'] : ''; $self->formId = ! empty($array['form_id']) ? absint($array['form_id']) : ''; return $self; } } DataTransferObjects/GetStripeAccountDetailsDto.php000064400000001126150514556620016356 0ustar00accountSlug = ! empty($array['account_slug']) ? $array['account_slug'] : ''; return $self; } } DataTransferObjects/NewStripeAccountOnBoardingDto.php000064400000003703150514556620017030 0ustar00formId = ! empty($array['post']) ? absint($array['post']) : 0; $self->stripePublishableKey = ! empty($array['stripe_publishable_key']) ? $array['stripe_publishable_key'] : ''; $self->stripePublishableKeyTest = ! empty($array['stripe_publishable_key_test']) ? $array['stripe_publishable_key_test'] : ''; $self->stripeUserId = ! empty($array['stripe_user_id']) ? $array['stripe_user_id'] : ''; $self->stripeAccessToken = ! empty($array['stripe_access_token']) ? $array['stripe_access_token'] : ''; $self->stripeAccessTokenTest = ! empty($array['stripe_access_token_test']) ? $array['stripe_access_token_test'] : ''; $self->isConnected = ! empty($array['connected']) && absint($array['connected']); return $self; } /** * @since 2.13.0 * @return bool */ public function hasValidateData() { return $this->stripePublishableKey && $this->stripeUserId && $this->stripeAccessToken && $this->stripeAccessTokenTest && $this->isConnected; } } DataTransferObjects/DisconnectStripeAccountDto.php000064400000001364150514556620016426 0ustar00accountType = ! empty($array['account_type']) ? $array['account_type'] : ''; $self->accountSlug = ! empty($array['account_slug']) ? $array['account_slug'] : ''; return $self; } } ApplicationFee.php000064400000005212150514556620010151 0ustar00accountDetail = $accountDetail; } /** * Returns true or false based on whether the Stripe fee should be applied or not * * @since 2.10.2 * @return bool */ public static function canAddFee() { /* @var self $gate */ $gate = give(static::class); return $gate->doesCountrySupportApplicationFee() && ! ($gate->isStripeProAddonActive() || $gate->isStripeProAddonInstalled( get_plugins() ) || $gate->hasLicense()); } /** * Returns true or false based on whether the Stripe Pro add-on is activated * * @since 2.10.2 * * @return bool */ public function isStripeProAddonActive() { return defined('GIVE_STRIPE_VERSION'); } /** * Returns true or false based on whether the plugin is installed (but not necessarily active) * * @param array $plugins Array of arrays of plugin data, keyed by plugin file name. See get_plugin_data(). * * @return bool */ public function isStripeProAddonInstalled(array $plugins) { return (bool)array_filter( $plugins, static function ($plugin) { return static::PluginName === $plugin['Name']; } ); } /** * Returns true or false based on whether a license has been provided for the Stripe add-on * * @since 2.10.2 * * @return bool */ public function hasLicense() { return (bool)Give_License::get_license_by_plugin_dirname(static::PluginSlug); } /** * Return whether or not country support application fee. * * @since 2.10.2 * * @return bool */ public function doesCountrySupportApplicationFee() { return 'BR' !== $this->accountDetail->accountCountry; } } DonationFormElements.php000064400000001201150514556620011354 0ustar00