PluginProbe
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More / trunk
Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More vtrunk
6.35 6.34 6.33.1 6.33 6.32.1 6.32 6.31 6.25 6.25.1 6.26 6.26.1 6.27 6.28 6.29 6.3 6.3.1 6.3.2 6.30 6.4 6.4.1 6.4.2 6.5 6.5.1 6.5.2 6.5.3 All 141 releases
formidable / stripe / views / action-settings / payments-options.php

payments-options.php in Formidable Forms – WordPress Form Builder for Contact Forms, Calculators, Quizzes & More trunk, at stripe/views/action-settings/payments-options.php

318 lines 12.3 KB
No matching file
Up and down to move Enter to open Esc to close
Raw Download Zip
1 <?php
2 if ( ! defined( 'ABSPATH' ) ) {
3 die( 'You are not allowed to call this page directly.' );
4 }
5
6 $stripe_connected = FrmStrpLiteConnectHelper::at_least_one_mode_is_setup();
7 $square_connected = FrmSquareLiteConnectHelper::at_least_one_mode_is_setup();
8 $paypal_connected = FrmPayPalLiteConnectHelper::at_least_one_mode_is_setup();
9
10 if ( $stripe_connected ) {
11 FrmStrpLiteAppHelper::fee_education( 'stripe-action-tip', $form_action->post_content['gateway'] );
12 }
13
14 if ( $square_connected ) {
15 FrmSquareLiteAppHelper::fee_education( 'square-action-tip', $form_action->post_content['gateway'] );
16 }
17
18 if ( $paypal_connected ) {
19 FrmPayPalLiteAppHelper::fee_education( 'paypal-action-tip', $form_action->post_content['gateway'] );
20 }
21
22 if ( ! $stripe_connected && ! $square_connected && ! $paypal_connected ) {
23 FrmStrpLiteAppHelper::not_connected_warning();
24 }
25 ?>
26
27 <?php
28 // Only show gateway tabs if there are multiple gateways available.
29 if ( count( $gateways ) > 1 ) {
30 FrmTransLiteAppHelper::show_gateway_buttons( $gateways, $form_action, $action_control );
31 }
32 ?>
33
34 <?php
35 /**
36 * Show warning if amount is empty.
37 * Only show for existing actions (has ID), not new actions.
38 *
39 * @since 6.31
40 */
41 if ( ! empty( $form_action->ID ) && empty( $form_action->post_content['amount'] ) ) :
42 ?>
43 <div class="frm_warning_style frm-with-icon">
44 <?php FrmAppHelper::icon_by_class( 'frmfont frm_alert_icon', array( 'style' => 'width:24px' ) ); ?>
45 <span><?php esc_html_e( 'Amount is required or payments will not work.', 'formidable' ); ?></span>
46 </div>
47 <?php endif; ?>
48
49 <p class="frm6">
50 <label>
51 <?php esc_html_e( 'Payment Type', 'formidable' ); ?>
52 </label>
53 <select name="<?php echo esc_attr( $action_control->get_field_name( 'type' ) ); ?>" class="frm_trans_type">
54 <option value="single" <?php selected( $form_action->post_content['type'], 'one_time' ); ?>><?php esc_html_e( 'One-time Payment', 'formidable' ); ?></option>
55 <option value="recurring" <?php selected( $form_action->post_content['type'], 'recurring' ); ?>><?php esc_html_e( 'Recurring', 'formidable' ); ?></option>
56 </select>
57 </p>
58
59 <div class="frm_grid_container">
60 <p>
61 <label for="<?php echo esc_attr( $action_control->get_field_id( 'description' ) ); ?>">
62 <?php esc_html_e( 'Description', 'formidable' ); ?>
63 </label>
64 <input type="text" name="<?php echo esc_attr( $action_control->get_field_name( 'description' ) ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'description' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['description'] ); ?>" class="frm_not_email_subject large-text" />
65 </p>
66
67 <p class="frm6">
68 <label for="<?php echo esc_attr( $action_control->get_field_id( 'amount' ) ); ?>">
69 <?php esc_html_e( 'Amount', 'formidable' ); ?> <span class="frm_required">*</span>
70 </label>
71 <input type="text" value="<?php echo esc_attr( $form_action->post_content['amount'] ); ?>" name="<?php echo esc_attr( $action_control->get_field_name( 'amount' ) ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'amount' ) ); ?>" class="frm_not_email_subject large-text" />
72 </p>
73
74 <p class="frm6">
75 <label for="<?php echo esc_attr( $action_control->get_field_id( 'currency' ) ); ?>">
76 <?php esc_html_e( 'Currency', 'formidable' ); ?>
77 </label>
78 <?php FrmTransLiteAppHelper::show_currency_dropdown( $action_control->get_field_id( 'currency' ), $action_control->get_field_name( 'currency' ), $form_action->post_content ); ?>
79 </p>
80
81 <?php
82 // Only show radio buttons when there's a single gateway (tabs are shown for multiple gateways).
83 if ( count( $gateways ) === 1 ) :
84 ?>
85 <p>
86 <span class="frm-block frm-mb-6"><?php esc_html_e( 'Gateway(s)', 'formidable' ); ?></span>
87 <?php
88 foreach ( $gateways as $gateway_name => $gateway ) {
89 $gateway_classes = $gateway['recurring'] ? '' : 'frm_gateway_no_recur';
90 $gateway_classes .= $form_action->post_content['type'] === 'recurring' && ! $gateway['recurring'] ? ' frm_hidden' : '';
91 $gateway_id = $action_control->get_field_id( 'gateways' ) . '_' . $gateway_name;
92 $radio_atts = array(
93 'type' => 'radio',
94 'value' => $gateway_name,
95 'name' => $action_control->get_field_name( 'gateway' ),
96 'id' => $gateway_id,
97 );
98 ?>
99 <label for="<?php echo esc_attr( $gateway_id ); ?>" class="frm_gateway_opt <?php echo esc_attr( $gateway_classes ); ?>">
100 <input
101 <?php
102 FrmAppHelper::array_to_html_params( $radio_atts, true );
103 echo ' ';
104 FrmAppHelper::checked( $form_action->post_content['gateway'], $gateway_name );
105 ?>
106 />
107 <?php echo esc_html( $gateway['label'] ); ?> &nbsp;
108 </label>
109 <?php
110 }//end foreach
111 ?>
112 </p>
113 <?php endif; ?>
114
115 <?php
116 FrmStrpLiteActionsController::add_action_options(
117 array(
118 'form_action' => $form_action,
119 'action_control' => $action_control,
120 )
121 );
122 ?>
123
124 <?php $cc_field_id = $action_control->get_credit_card_field_id( $field_dropdown_atts ); ?>
125 <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'credit_card' ) ); ?>" value="<?php echo esc_attr( $cc_field_id ); ?>" />
126
127 <?php $action_control->echo_capture_payment_upsell( $form_action->post_content['gateway'] ); ?>
128
129 <div class="frm_trans_sub_opts <?php echo $form_action->post_content['type'] === 'recurring' ? '' : 'frm_hidden'; ?>">
130 <div class="frm_grid_container">
131 <h3><?php esc_html_e( 'Recurring Payment Settings', 'formidable' ); ?></h3>
132 <?php
133 /**
134 * Show warning if PayPal is selected and product name is empty.
135 * Only show for existing actions (has ID), not new actions.
136 * Only show when payment type is recurring.
137 *
138 * @since 6.31
139 */
140 if ( ! empty( $form_action->ID ) && 'recurring' === $form_action->post_content['type'] && in_array( 'paypal', (array) $form_action->post_content['gateway'], true ) && empty( $form_action->post_content['product_name'] ) ) :
141 ?>
142 <div class="frm_warning_style frm-with-icon frm-mt-0">
143 <?php FrmAppHelper::icon_by_class( 'frmfont frm_alert_icon', array( 'style' => 'width:24px' ) ); ?>
144 <span><?php esc_html_e( 'Product Name is required for PayPal recurring payments.', 'formidable' ); ?></span>
145 </div>
146 <?php endif; ?>
147
148 <?php
149 /**
150 * @since 6.31
151 *
152 * @param array $args
153 */
154 do_action(
155 'frm_payments_settings_recurring_product_info',
156 array(
157 'form_action' => $form_action,
158 'action_control' => $action_control,
159 )
160 );
161 ?>
162
163 <p class="frm6">
164 <label>
165 <?php esc_html_e( 'Repeat', 'formidable' ); ?>
166 </label>
167 <span>
168 <span class="frm_grid_container">
169 <input class="frm6" type="number" name="<?php echo esc_attr( $action_control->get_field_name( 'interval_count' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['interval_count'] ); ?>" max="90" min="1" step="1" />
170 <select class="frm6" name="<?php echo esc_attr( $action_control->get_field_name( 'interval' ) ); ?>" class="auto_width">
171 <?php foreach ( $repeat_times as $k => $v ) { ?>
172 <option value="<?php echo esc_attr( $k ); ?>" <?php selected( $form_action->post_content['interval'], $k ); ?>><?php echo esc_html( $v ); ?></option>
173 <?php } ?>
174 </select>
175 <input type="hidden" name="<?php echo esc_attr( $action_control->get_field_name( 'payment_count' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['payment_count'] ); ?>" />
176 </span>
177 </span>
178 </p>
179
180 <?php
181 /*
182 Note: The Repeat Cadence setting is added with JavaScript.
183 This hidden input is added so the JS knows what value is set.
184 */
185 ?>
186 <input type="hidden" class="frm-repeat-cadence-value" value="<?php echo esc_attr( $form_action->post_content['repeat_cadence'] ?? 'DAILY' ); ?>" />
187
188 <p class="frm6">
189 <label>
190 <?php esc_html_e( 'Recurring Payment Limit', 'formidable' ); ?>
191 </label>
192 <input type="text" name="<?php echo esc_attr( $action_control->get_field_name( 'payment_limit' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['payment_limit'] ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'payment_limit' ) ); ?>" class="frm_not_email_subject" />
193 </p>
194
195 <p class="frm6">
196 <label>
197 <?php esc_html_e( 'Trial Period', 'formidable' ); ?>
198 </label>
199 <input type="text" name="<?php echo esc_attr( $action_control->get_field_name( 'trial_interval_count' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['trial_interval_count'] ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'trial_interval_count' ) ); ?>" class="frm_not_email_subject" />
200 <?php esc_html_e( 'day(s)', 'formidable' ); ?>
201 </p>
202 </div>
203 </div>
204
205 <?php
206 /**
207 * Allow add-ons to inject settings after the Recurring Payment Settings section.
208 *
209 * @since 6.31
210 *
211 * @param array $args {
212 *
213 * @type object $form_action The form action post object.
214 * @type object $action_control The action controller object.
215 * }
216 */
217 do_action(
218 'frm_payments_settings_after_recurring',
219 array(
220 'form_action' => $form_action,
221 'action_control' => $action_control,
222 )
223 );
224 ?>
225 </div>
226 <div class="frm_grid_container frm-mb-xs">
227 <?php
228 $billing_label = __( 'Billing Information', 'formidable' );
229 $customer_label = __( 'Customer Information', 'formidable' );
230 $is_paypal = in_array( 'paypal', (array) $form_action->post_content['gateway'], true );
231 ?>
232 <h3 class="frm-billing-section-heading frm-mt-0" data-billing-label="<?php echo esc_attr( $billing_label ); ?>" data-customer-label="<?php echo esc_attr( $customer_label ); ?>">
233 <?php echo esc_html( $is_paypal ? $billing_label : $customer_label ); ?>
234 </h3>
235
236 <p class="frm6">
237 <label for="<?php echo esc_attr( $action_control->get_field_id( 'email' ) ); ?>">
238 <?php esc_html_e( 'Email', 'formidable' ); ?>
239 </label>
240 <input type="text" name="<?php echo esc_attr( $action_control->get_field_name( 'email' ) ); ?>" id="<?php echo esc_attr( $action_control->get_field_id( 'email' ) ); ?>" value="<?php echo esc_attr( $form_action->post_content['email'] ); ?>" class="frm_not_email_to large-text" />
241 </p>
242
243 <?php if ( ! has_action( 'frm_stripe_lite_customer_info_after_email' ) ) : ?>
244 <p class="frm6">
245 <label for="<?php echo esc_attr( $action_control->get_field_id( 'billing_address' ) ); ?>">
246 <?php esc_html_e( 'Address', 'formidable' ); ?>
247 </label>
248 <?php
249 $action_control->show_fields_dropdown(
250 $field_dropdown_atts,
251 array(
252 'name' => 'billing_address',
253 'allowed_fields' => 'address',
254 )
255 );
256 ?>
257 </p>
258 <?php endif; ?>
259
260 <?php
261 /**
262 * Trigger an action so Pro can include an Address dropdown.
263 * When a plugin hooks in here, the default Address dropdown above is not rendered.
264 *
265 * @since 6.5
266 *
267 * @param array $args {
268 *
269 * @type WP_Post $form_action The form action post object.
270 * @type FrmFormAction $action_control The action controller object.
271 * @type array $field_dropdown_atts Attributes for field dropdown rendering.
272 * }
273 */
274 do_action(
275 'frm_stripe_lite_customer_info_after_email',
276 compact( 'form_action', 'action_control', 'field_dropdown_atts' )
277 );
278 ?>
279
280 <p class="frm6">
281 <label for="<?php echo esc_attr( $action_control->get_field_id( 'billing_first_name' ) ); ?>">
282 <?php esc_html_e( 'First Name', 'formidable' ); ?>
283 </label>
284 <?php $action_control->show_fields_dropdown( $field_dropdown_atts, array( 'name' => 'billing_first_name' ) ); ?>
285 </p>
286 <p class="frm6">
287 <label for="<?php echo esc_attr( $action_control->get_field_id( 'billing_last_name' ) ); ?>">
288 <?php esc_html_e( 'Last Name', 'formidable' ); ?>
289 </label>
290 <?php $action_control->show_fields_dropdown( $field_dropdown_atts, array( 'name' => 'billing_last_name' ) ); ?>
291 </p>
292 </div>
293
294 <?php
295 if ( ! has_action( 'frm_payment_settings_after_customer_info' ) ) {
296 include FrmTransLiteAppHelper::plugin_path() . '/views/action-settings/paypal-shipping.php';
297 }
298
299 /**
300 * Fires after the Customer Information section in payment action settings.
301 * Used by Pro to add gateway-specific Shipping and Billing sections.
302 * When a plugin hooks in here, the default Shipping Information section above is not rendered.
303 *
304 * @since 6.31
305 *
306 * @param array $args {
307 *
308 * @type WP_Post $form_action The form action post object.
309 * @type FrmFormAction $action_control The action controller object.
310 * @type array $field_dropdown_atts Attributes for field dropdown rendering.
311 * }
312 */
313 do_action(
314 'frm_payment_settings_after_customer_info',
315 compact( 'form_action', 'action_control', 'field_dropdown_atts' )
316 );
317 ?>
318