PluginProbe ʕ •ᴥ•ʔ
GiveWP – Donation Plugin and Fundraising Platform / 2.9.1
GiveWP – Donation Plugin and Fundraising Platform v2.9.1
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 / PayPalCommerce / AdminSettingFields.php
give / src / PaymentGateways / PayPalCommerce Last commit date
DataTransferObjects 5 years ago Models 5 years ago Repositories 5 years ago Webhooks 5 years ago AccountAdminNotices.php 5 years ago AdminSettingFields.php 5 years ago AdvancedCardFields.php 5 years ago AjaxRequestHandler.php 5 years ago DonationDetailsPage.php 5 years ago DonationProcessor.php 5 years ago PayPalClient.php 5 years ago PayPalCommerce.php 5 years ago RefreshToken.php 5 years ago RefundPaymentHandler.php 5 years ago ScriptLoader.php 5 years ago Utils.php 5 years ago onBoardingRedirectHandler.php 5 years ago
AdminSettingFields.php
225 lines
1 <?php
2
3 namespace Give\PaymentGateways\PayPalCommerce;
4
5 use Give\PaymentGateways\PayPalCommerce\Models\MerchantDetail;
6 use Give\PaymentGateways\PayPalCommerce\Repositories\MerchantDetails;
7 use Give\PaymentGateways\PayPalCommerce\Repositories\Settings;
8 use Give_HTML_Elements;
9 use Give_License;
10
11 /**
12 * Class AdminSettingFields
13 * @since 2.9.0
14 * @package Give\PaymentGateways\PayPalCommerce
15 *
16 */
17 class AdminSettingFields {
18 /**
19 * Bootstrap fields.
20 *
21 * @since 2.9.0
22 */
23 public function boot() {
24 add_action( 'give_admin_field_paypal_commerce_account_manger', [ $this, 'payPalCommerceAccountManagerField' ] );
25 add_action( 'give_admin_field_paypal_commerce_account_country', [ $this, 'accountCountryField' ] );
26 add_action( 'give_admin_field_paypal_commerce_introduction', [ $this, 'introductionSection' ] );
27 }
28
29 /**
30 * Render account country field.
31 *
32 * @since 2.9.0
33 */
34 public function accountCountryField() {
35 /* @var MerchantDetail $merchantModel */
36 $merchantModel = give( MerchantDetail::class );
37
38 /* @var MerchantDetails $merchantRepository */
39 $merchantRepository = give( MerchantDetails::class );
40
41 /* @var Give_HTML_Elements $htmlElements */
42 $htmlElements = give( 'html' );
43
44 /* @var Settings $settingRepository */
45 $settingRepository = give( Settings::class );
46
47 $settingHtml = $htmlElements->select(
48 [
49 'id' => 'paypal_commerce_account_country',
50 'options' => give_get_country_list(),
51 'chosen' => true,
52 'placeholder' => esc_html__( 'Choose a country', 'give' ),
53 'show_option_all' => false,
54 'show_option_none' => false,
55 'data' => [
56 'search-type' => 'no_ajax',
57 ],
58 'selected' => $merchantModel->accountCountry ?: $settingRepository->getAccountCountry(),
59 ]
60 );
61
62 $trClass = $merchantRepository->accountIsConnected() ?
63 'js-fields-has-custom-saving-logic hide-with-position' :
64 'js-fields-has-custom-saving-logic';
65 ?>
66 <tr valign="top" class="<?php echo $trClass; ?>">
67 <th scope="row" class="titledesc">
68 <label for="give_paypal_commerce_country"><?php esc_html_e( 'Account Country', 'give' ); ?></label>
69 </th>
70 <td class="give-forminp">
71 <?php
72 printf(
73 '%1$s<div class="give-field-description">%2$s</div>',
74 $settingHtml,
75 esc_html__( 'The country your site operates from.', 'give' )
76 )
77 ?>
78 </td>
79 </tr>
80 <?php
81 }
82
83 /**
84 * Paypal Checkout account manager custom field
85 *
86 * @since 2.9.0
87 */
88 public function payPalCommerceAccountManagerField() {
89 $recurringAddonInfo = Give_License::get_plugin_by_slug( 'give-recurring' );
90 $isRecurringAddonActive = isset( $recurringAddonInfo['Status'] ) && 'active' === $recurringAddonInfo['Status'];
91 ?>
92 <tr valign="top">
93 <th scope="row" class="titledesc">
94 <label for="give_paypal_commerce_country"><?php esc_html_e( 'PayPal Connection', 'give' ); ?></label>
95 </th>
96 <td class="give-forminp">
97 <div id="give-paypal-commerce-account-manager-field-wrap">
98 <div class="connect-button-wrap">
99 <?php
100 /** @var MerchantDetails $accountRepository */
101 $accountRepository = give( MerchantDetails::class );
102 ?>
103 <div
104 class="button-wrap connection-setting <?php echo $accountRepository->accountIsConnected() ? 'give-hidden' : ''; ?>">
105 <div>
106 <button class="button button-primary button-large" id="js-give-paypal-on-boarding-handler">
107 <i class="fab fa-paypal"></i>&nbsp;&nbsp;
108 <?php
109 esc_html_e(
110 'Connect with PayPal',
111 'give'
112 );
113 ?>
114 </button>
115 <a class="give-hidden" target="_blank"
116 data-paypal-onboard-complete="givePayPalOnBoardedCallback" href="#"
117 data-paypal-button="true">
118 <?php esc_html_e( 'Sign up for PayPal', 'give' ); ?>
119 </a>
120 <span class="tooltip">
121 <span class="left-arrow"></span>
122 <?php esc_html_e( 'Click to get started!', 'give' ); ?>
123 </span>
124 </div>
125 <span class="give-field-description">
126 <i class="fa fa-exclamation"></i>
127 <?php esc_html_e( 'PayPal is currently NOT connected.', 'give' ); ?>
128 </span>
129 </div>
130 <div
131 class="button-wrap disconnection-setting <?php echo ! $accountRepository->accountIsConnected() ? 'give-hidden' : ''; ?>">
132 <div>
133 <button class="button button-large disabled" disabled="disabled">
134 <i class="fab fa-paypal"></i>&nbsp;&nbsp;<?php esc_html_e( 'Connected', 'give' ); ?>
135 </button>
136 </div>
137 <div>
138 <span class="give-field-description">
139 <i class="fa fa-check"></i>
140 <?php
141 printf(
142 '%1$s <span class="paypal-account-email">%2$s</span>',
143 esc_html__( 'Connected for payments as', 'give' ),
144 give( MerchantDetail::class )->merchantId
145 );
146 ?>
147 </span>
148 <span class="actions">
149 <a href="#"
150 id="js-give-paypal-disconnect-paypal-account"><?php esc_html_e( 'Disconnect', 'give' ); ?></a>
151 </span>
152 </div>
153 <div class="api-access-feature-list-wrap">
154 <p><?php esc_html_e( 'APIs Connected:', 'give' ); ?></p>
155 <ul>
156 <li><?php esc_html_e( 'Payments', 'give' ); ?></li>
157 <?php if ( $isRecurringAddonActive ) : ?>
158 <li><?php esc_html_e( 'Subscriptions', 'give' ); ?></li>
159 <?php endif; ?>
160 <li><?php esc_html_e( 'Refunds', 'give' ); ?></li>
161 </ul>
162 </div>
163
164 <?php $accountErrors = give( MerchantDetails::class )->getAccountErrors(); ?>
165 <?php if ( ! empty( $accountErrors ) ) : ?>
166 <div>
167 <span>
168 <p class="error-message"><?php esc_html_e( 'Warning, your account is not ready to accept donations. Please review the following list:', 'give' ); ?></p>
169 <ul class="ul-disc">
170 <?php
171 foreach ( $accountErrors as $error ) {
172 echo "<li>{$error}</li>";
173 }
174 ?>
175 </ul>
176 <p><a href="<?php echo admin_url( 'edit.php?post_type=give_forms&page=give-settings&tab=gateways&section=paypal&paypalStatusCheck' ); ?>"><?php esc_html_e( 'Re-Check Account Status', 'give' ); ?></a></p>
177 </span>
178 </div>
179 <?php endif; ?>
180 </div>
181 </div>
182 </div>
183 </td>
184 </tr>
185 <?php
186 }
187
188
189 /**
190 * PayPal Commerce introduction section.
191 *
192 * @since 2.9.0
193 */
194 public function introductionSection() {
195 ?>
196 <div id="give-paypal-commerce-introduction-wrap">
197 <div class="hero-section">
198 <div>
199 <h2><?php esc_html_e( 'Accept Donations with PayPal Donations', 'give' ); ?></h2>
200 <p class="give-field-description"><?php esc_html_e( 'Allow your donors to give using Debit or Credit Cards directly on your website with no additional fees.', 'give' ); ?></p>
201 </div>
202 <div class="paypal-logo">
203 <img src="<?php echo GIVE_PLUGIN_URL . '/assets/dist/images/admin/paypal-logo.svg'; ?>" width="316" height="84" alt="<?php esc_attr_e( 'PayPal Logo Image', 'give' ); ?>">
204 </div>
205 </div>
206 <div class="feature-list">
207 <div><i class="fa fa-angle-right"></i><?php esc_html_e( 'Credit and Debit Card Donations', 'give' ); ?>
208 </div>
209 <div>
210 <i class="fa fa-angle-right"></i><?php esc_html_e( 'Improve donation conversion rates', 'give' ); ?>
211 </div>
212 <div><i class="fa fa-angle-right"></i><?php esc_html_e( 'Easy no-API key connection', 'give' ); ?></div>
213 <div>
214 <i class="fa fa-angle-right"></i><?php esc_html_e( 'Accept payments from around the world', 'give' ); ?>
215 </div>
216 <div><i class="fa fa-angle-right"></i><?php esc_html_e( 'Donate via PayPal accounts', 'give' ); ?>
217 </div>
218 <div><i class="fa fa-angle-right"></i><?php esc_html_e( 'Supports 3D Secure payments', 'give' ); ?>
219 </div>
220 </div>
221 </div>
222 <?php
223 }
224 }
225