Passed
Push — master ( 44c66e...70e9e5 )
by Brian
05:05
created
templates/payment-forms/cart-item.php 1 patch
Indentation   +107 added lines, -107 removed lines patch added patch discarded remove patch
@@ -26,110 +26,110 @@  discard block
 block discarded – undo
26 26
 
27 27
 				<?php
28 28
 
29
-					// Fires before printing a line item column.
30
-					do_action( "getpaid_form_cart_item_before_$key", $item, $form );
29
+                    // Fires before printing a line item column.
30
+                    do_action( "getpaid_form_cart_item_before_$key", $item, $form );
31 31
 
32
-					// Item name.
33
-					if ( 'name' == $key ) {
32
+                    // Item name.
33
+                    if ( 'name' == $key ) {
34 34
 
35
-						ob_start();
36
-						// And an optional description.
35
+                        ob_start();
36
+                        // And an optional description.
37 37
                         $description = $item->get_description();
38 38
 
39 39
                         if ( ! empty( $description ) ) {
40 40
                             $description = wp_kses_post( $description );
41 41
                             echo "<small class='form-text text-muted pr-2 m-0'>$description</small>";
42
-						}
42
+                        }
43 43
 
44
-						// Price help text.
44
+                        // Price help text.
45 45
                         $description = getpaid_item_recurring_price_help_text( $item, $currency );
46 46
                         if ( $description ) {
47 47
                             echo "<small class='getpaid-form-item-price-desc form-text text-muted pr-2 m-0'>$description</small>";
48
-						}
48
+                        }
49 49
 
50
-						if ( wpinv_current_user_can_manage_invoicing() ) {
50
+                        if ( wpinv_current_user_can_manage_invoicing() ) {
51 51
 
52
-							edit_post_link(
53
-								__( 'Edit this item.', 'invoicing' ),
54
-								'<small class="form-text text-muted">',
55
-								'</small>',
56
-								$item->get_id(),
57
-								'text-danger'
58
-							);
52
+                            edit_post_link(
53
+                                __( 'Edit this item.', 'invoicing' ),
54
+                                '<small class="form-text text-muted">',
55
+                                '</small>',
56
+                                $item->get_id(),
57
+                                'text-danger'
58
+                            );
59 59
 
60
-						}
60
+                        }
61 61
 
62
-						$description = ob_get_clean();
62
+                        $description = ob_get_clean();
63 63
 
64
-						// Display the name.
65
-						$tootip = empty( $description ) ? '' : "&nbsp;" . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
66
-						echo '<div class="mb-1">' . esc_html( $item->get_name() ) . $tootip . '</div>';
64
+                        // Display the name.
65
+                        $tootip = empty( $description ) ? '' : "&nbsp;" . '<i class="fas fa-xs fa-info gp-tooltip d-sm-none text-muted"></i>';
66
+                        echo '<div class="mb-1">' . esc_html( $item->get_name() ) . $tootip . '</div>';
67 67
 
68
-						if ( ! empty( $description ) ) {
69
-							printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description );
70
-						}
71
-
72
-						if ( $item->allows_quantities() ) {
73
-							printf(
74
-								'<small class="d-sm-none text-muted form-text">%s</small>',
75
-								sprintf(
76
-									__( 'Qty %s', 'invoicing' ),
77
-									sprintf(
78
-										'<input
68
+                        if ( ! empty( $description ) ) {
69
+                            printf( '<span class="d-none d-sm-block getpaid-item-desc">%s</span>', $description );
70
+                        }
71
+
72
+                        if ( $item->allows_quantities() ) {
73
+                            printf(
74
+                                '<small class="d-sm-none text-muted form-text">%s</small>',
75
+                                sprintf(
76
+                                    __( 'Qty %s', 'invoicing' ),
77
+                                    sprintf(
78
+                                        '<input
79 79
 											type="text"
80 80
 											style="width: 48px;"
81 81
 											class="getpaid-item-mobile-quantity-input p-1 m-0 text-center"
82 82
 											value="%s"
83 83
 											min="1">',
84
-											(float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity()
85
-									)
86
-								)
87
-							);
88
-						} else {
89
-							printf(
90
-								'<small class="d-sm-none text-muted form-text">%s</small>',
91
-								sprintf(
92
-									__( 'Qty %s', 'invoicing' ),
93
-									(float) $item->get_quantity()
94
-								)
95
-							);
96
-						}
97
-
98
-					}
99
-
100
-					// Item price.
101
-					if ( 'price' == $key ) {
102
-
103
-						// Set the currency position.
104
-						$position = wpinv_currency_position();
105
-
106
-						if ( $position == 'left_space' ) {
107
-							$position = 'left';
108
-						}
109
-
110
-						if ( $position == 'right_space' ) {
111
-							$position = 'right';
112
-						}
113
-
114
-						if ( $item->user_can_set_their_price() ) {
115
-							$price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
116
-							$minimum          = (float) $item->get_minimum_price();
117
-							$validate_minimum = '';
118
-							$class            = '';
119
-							$data_minimum     = '';
120
-
121
-							if ( $minimum > 0 ) {
122
-								$validate_minimum = sprintf(
123
-									esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
124
-									strip_tags( wpinv_price( $minimum, $currency ) )
125
-								);
126
-
127
-								$class = 'getpaid-validate-minimum-amount';
128
-
129
-								$data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
130
-							}
131
-
132
-							?>
84
+                                            (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity()
85
+                                    )
86
+                                )
87
+                            );
88
+                        } else {
89
+                            printf(
90
+                                '<small class="d-sm-none text-muted form-text">%s</small>',
91
+                                sprintf(
92
+                                    __( 'Qty %s', 'invoicing' ),
93
+                                    (float) $item->get_quantity()
94
+                                )
95
+                            );
96
+                        }
97
+
98
+                    }
99
+
100
+                    // Item price.
101
+                    if ( 'price' == $key ) {
102
+
103
+                        // Set the currency position.
104
+                        $position = wpinv_currency_position();
105
+
106
+                        if ( $position == 'left_space' ) {
107
+                            $position = 'left';
108
+                        }
109
+
110
+                        if ( $position == 'right_space' ) {
111
+                            $position = 'right';
112
+                        }
113
+
114
+                        if ( $item->user_can_set_their_price() ) {
115
+                            $price            = max( (float) $item->get_price(), (float) $item->get_minimum_price() );
116
+                            $minimum          = (float) $item->get_minimum_price();
117
+                            $validate_minimum = '';
118
+                            $class            = '';
119
+                            $data_minimum     = '';
120
+
121
+                            if ( $minimum > 0 ) {
122
+                                $validate_minimum = sprintf(
123
+                                    esc_attr__( 'The minimum allowed amount is %s', 'invoicing' ),
124
+                                    strip_tags( wpinv_price( $minimum, $currency ) )
125
+                                );
126
+
127
+                                $class = 'getpaid-validate-minimum-amount';
128
+
129
+                                $data_minimum     = "data-minimum-amount='" . esc_attr( getpaid_unstandardize_amount( $minimum ) ) . "'";
130
+                            }
131
+
132
+                            ?>
133 133
 								<div class="input-group input-group-sm">
134 134
 									<?php if( 'left' == $position ) : ?>
135 135
 										<div class="input-group-prepend">
@@ -154,44 +154,44 @@  discard block
 block discarded – undo
154 154
 
155 155
 							<?php
156 156
 
157
-						} else {
158
-							echo wpinv_price( $item->get_price(), $currency );
157
+                        } else {
158
+                            echo wpinv_price( $item->get_price(), $currency );
159 159
 
160
-							?>
160
+                            ?>
161 161
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][price]' type='hidden' class='getpaid-item-price-input' value='<?php echo esc_attr( $item->get_price() ); ?>'>
162 162
 							<?php
163
-						}
163
+                        }
164 164
 
165
-						printf(
166
-							'<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
167
-							sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) )
168
-						);
169
-					}
165
+                        printf(
166
+                            '<small class="d-sm-none text-muted form-text getpaid-mobile-item-subtotal">%s</small>',
167
+                            sprintf( __( 'Subtotal: %s', 'invoicing' ), wpinv_price( $item->get_sub_total(), $currency ) )
168
+                        );
169
+                    }
170 170
 
171
-					// Item quantity.
172
-					if ( 'quantity' == $key ) {
171
+                    // Item quantity.
172
+                    if ( 'quantity' == $key ) {
173 173
 
174
-						if ( $item->allows_quantities() ) {
175
-							?>
174
+                        if ( $item->allows_quantities() ) {
175
+                            ?>
176 176
 								<input name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' type='text' style='width: 64px; line-height: 1; min-height: 35px;' class='getpaid-item-quantity-input p-1 align-middle font-weight-normal shadow-none m-0 rounded-0 text-center border' value='<?php echo (float) $item->get_quantity() == 0 ? 1 : (float) $item->get_quantity(); ?>' min='1' required>
177 177
 							<?php
178
-						} else {
179
-							echo (float) $item->get_quantity();
180
-							echo '&nbsp;&nbsp;&nbsp;';
181
-							?>
178
+                        } else {
179
+                            echo (float) $item->get_quantity();
180
+                            echo '&nbsp;&nbsp;&nbsp;';
181
+                            ?>
182 182
 								<input type='hidden' name='getpaid-items[<?php echo (int) $item->get_id(); ?>][quantity]' class='getpaid-item-quantity-input' value='<?php echo (float) $item->get_quantity(); ?>'>
183 183
 							<?php
184
-						}
184
+                        }
185 185
 
186
-					}
186
+                    }
187 187
 
188
-					// Item sub total.
189
-					if ( 'subtotal' == $key ) {
190
-						echo wpinv_price( $item->get_sub_total(), $currency );
191
-					}
188
+                    // Item sub total.
189
+                    if ( 'subtotal' == $key ) {
190
+                        echo wpinv_price( $item->get_sub_total(), $currency );
191
+                    }
192 192
 
193
-					do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
194
-				?>
193
+                    do_action( "getpaid_payment_form_cart_item_$key", $item, $form );
194
+                ?>
195 195
 
196 196
 			</div>
197 197
 
Please login to merge, or discard this patch.
includes/payments/class-getpaid-payment-form-submission-refresh-prices.php 1 patch
Indentation   +267 added lines, -267 removed lines patch added patch discarded remove patch
@@ -12,294 +12,294 @@
 block discarded – undo
12 12
  */
13 13
 class GetPaid_Payment_Form_Submission_Refresh_Prices {
14 14
 
15
-	/**
16
-	 * Contains the response for refreshing prices.
17
-	 * @var array
18
-	 */
19
-	public $response = array();
15
+    /**
16
+     * Contains the response for refreshing prices.
17
+     * @var array
18
+     */
19
+    public $response = array();
20 20
 
21 21
     /**
22
-	 * Class constructor
23
-	 *
24
-	 * @param GetPaid_Payment_Form_Submission $submission
25
-	 */
26
-	public function __construct( $submission ) {
27
-
28
-		$this->response = array(
29
-			'submission_id'                    => $submission->id,
22
+     * Class constructor
23
+     *
24
+     * @param GetPaid_Payment_Form_Submission $submission
25
+     */
26
+    public function __construct( $submission ) {
27
+
28
+        $this->response = array(
29
+            'submission_id'                    => $submission->id,
30 30
             'has_recurring'                    => $submission->has_recurring,
31
-			'has_subscription_group'           => $submission->has_subscription_group(),
32
-			'has_multiple_subscription_groups' => $submission->has_multiple_subscription_groups(),
31
+            'has_subscription_group'           => $submission->has_subscription_group(),
32
+            'has_multiple_subscription_groups' => $submission->has_multiple_subscription_groups(),
33 33
             'is_free'                          => ! $submission->should_collect_payment_details(),
34
-		);
35
-
36
-		$this->add_totals( $submission );
37
-		$this->add_texts( $submission );
38
-		$this->add_items( $submission );
39
-		$this->add_fees( $submission );
40
-		$this->add_discounts( $submission );
41
-		$this->add_taxes( $submission );
42
-		$this->add_gateways( $submission );
43
-		$this->add_data( $submission );
44
-
45
-	}
46
-
47
-	/**
48
-	 * Adds totals to a response for submission refresh prices.
49
-	 *
50
-	 * @param GetPaid_Payment_Form_Submission $submission
51
-	 */
52
-	public function add_totals( $submission ) {
53
-
54
-		$this->response = array_merge(
55
-			$this->response,
56
-			array(
57
-
58
-				'totals'        => array(
59
-					'subtotal'  => $submission->format_amount( $submission->get_subtotal() ),
60
-					'discount'  => $submission->format_amount( $submission->get_discount() ),
61
-					'fees'      => $submission->format_amount( $submission->get_fee() ),
62
-					'tax'       => $submission->format_amount( $submission->get_tax() ),
63
-					'total'     => $submission->format_amount( $submission->get_total() ),
64
-					'raw_total' => html_entity_decode( sanitize_text_field( $submission->format_amount( $submission->get_total() ) ), ENT_QUOTES ),
65
-				),
66
-
67
-				'recurring'     => array(
68
-					'subtotal'  => $submission->format_amount( $submission->get_recurring_subtotal() ),
69
-					'discount'  => $submission->format_amount( $submission->get_recurring_discount() ),
70
-					'fees'      => $submission->format_amount( $submission->get_recurring_fee() ),
71
-					'tax'       => $submission->format_amount( $submission->get_recurring_tax() ),
72
-					'total'     => $submission->format_amount( $submission->get_recurring_total() ),
73
-				),
74
-
75
-				'initial_amt'   => wpinv_round_amount( $submission->get_total(), null, true ),
76
-				'currency'      => $submission->get_currency(),
77
-
78
-			)
79
-		);
80
-
81
-	}
82
-
83
-	/**
84
-	 * Adds texts to a response for submission refresh prices.
85
-	 *
86
-	 * @param GetPaid_Payment_Form_Submission $submission
87
-	 */
88
-	public function add_texts( $submission ) {
89
-
90
-		$payable = $submission->format_amount( $submission->get_total() );
91
-		$groups  = getpaid_get_subscription_groups( $submission );
92
-
93
-		if ( $submission->has_recurring && 2 > count( $groups ) ) {
94
-
95
-			$recurring = new WPInv_Item( $submission->has_recurring );
96
-			$period    = getpaid_get_subscription_period_label( $recurring->get_recurring_period( true ), $recurring->get_recurring_interval(), '' );
97
-			$main_item = reset( $groups );
98
-
99
-			if ( $submission->get_total() == $submission->get_recurring_total() ) {
100
-				$payable = "$payable / $period";
101
-			} else if ( $main_item ) {
102
-
103
-				$main_item = reset( $main_item );
104
-
105
-				// Calculate the next renewal date.
106
-				$_period      = $main_item->get_recurring_period( true );
107
-				$_interval    = $main_item->get_recurring_interval();
108
-
109
-				// If the subscription item has a trial period...
110
-				if ( $main_item->has_free_trial() ) {
111
-					$_period   = $main_item->get_trial_period( true );
112
-					$_interval = $main_item->get_trial_interval();
113
-				}
114
-
115
-				$payable = sprintf(
116
-					__( '%1$s (renews at %2$s / %3$s)', 'invoicing' ),
117
-					$submission->format_amount( $submission->get_total() ),
118
-					$submission->format_amount( $submission->get_recurring_total() ),
119
-					$period
120
-				);
121
-
122
-				$payable .= sprintf(
123
-					'<small class="text-muted form-text">%s</small>',
124
-					sprintf(
125
-						__( 'First renewal on %s', 'invoicing' ),
126
-						getpaid_format_date( date( 'Y-m-d H:i:s', strtotime( "+$_interval $_period", current_time( 'timestamp' ) ) ) )
127
-					)
128
-				);
129
-
130
-			} else {
131
-				$payable = sprintf(
132
-					__( '%1$s (renews at %2$s / %3$s)', 'invoicing' ),
133
-					$submission->format_amount( $submission->get_total() ),
134
-					$submission->format_amount( $submission->get_recurring_total() ),
135
-					$period
136
-				);
137
-			}
138
-
139
-		}
140
-
141
-		$texts = array(
142
-			'.getpaid-checkout-total-payable' => $payable,
143
-		);
144
-
145
-		foreach ( $submission->get_items() as $item ) {
146
-			$item_id                                               = $item->get_id();
147
-			$initial_price                                         = $submission->format_amount( $item->get_sub_total() - $item->item_discount );
148
-			$recurring_price                                       = $submission->format_amount( $item->get_recurring_sub_total() - $item->recurring_item_discount );
149
-			$texts[".item-$item_id .getpaid-form-item-price-desc"] = getpaid_item_recurring_price_help_text( $item, $submission->get_currency(), $initial_price, $recurring_price );
150
-			$texts[".item-$item_id .getpaid-mobile-item-subtotal"] = sprintf( __( 'Subtotal: %s', 'invoicing' ), $submission->format_amount( $item->get_sub_total() ) );
151
-
152
-			if ( $item->get_quantity() == 1 ) {
153
-				$texts[".item-$item_id .getpaid-mobile-item-subtotal"] = '';
154
-			}
155
-
156
-		}
157
-
158
-		$this->response = array_merge( $this->response, array( 'texts' => $texts ) );
159
-
160
-	}
161
-
162
-	/**
163
-	 * Adds items to a response for submission refresh prices.
164
-	 *
165
-	 * @param GetPaid_Payment_Form_Submission $submission
166
-	 */
167
-	public function add_items( $submission ) {
168
-
169
-		// Add items.
170
-		$items = array();
34
+        );
35
+
36
+        $this->add_totals( $submission );
37
+        $this->add_texts( $submission );
38
+        $this->add_items( $submission );
39
+        $this->add_fees( $submission );
40
+        $this->add_discounts( $submission );
41
+        $this->add_taxes( $submission );
42
+        $this->add_gateways( $submission );
43
+        $this->add_data( $submission );
44
+
45
+    }
46
+
47
+    /**
48
+     * Adds totals to a response for submission refresh prices.
49
+     *
50
+     * @param GetPaid_Payment_Form_Submission $submission
51
+     */
52
+    public function add_totals( $submission ) {
53
+
54
+        $this->response = array_merge(
55
+            $this->response,
56
+            array(
57
+
58
+                'totals'        => array(
59
+                    'subtotal'  => $submission->format_amount( $submission->get_subtotal() ),
60
+                    'discount'  => $submission->format_amount( $submission->get_discount() ),
61
+                    'fees'      => $submission->format_amount( $submission->get_fee() ),
62
+                    'tax'       => $submission->format_amount( $submission->get_tax() ),
63
+                    'total'     => $submission->format_amount( $submission->get_total() ),
64
+                    'raw_total' => html_entity_decode( sanitize_text_field( $submission->format_amount( $submission->get_total() ) ), ENT_QUOTES ),
65
+                ),
66
+
67
+                'recurring'     => array(
68
+                    'subtotal'  => $submission->format_amount( $submission->get_recurring_subtotal() ),
69
+                    'discount'  => $submission->format_amount( $submission->get_recurring_discount() ),
70
+                    'fees'      => $submission->format_amount( $submission->get_recurring_fee() ),
71
+                    'tax'       => $submission->format_amount( $submission->get_recurring_tax() ),
72
+                    'total'     => $submission->format_amount( $submission->get_recurring_total() ),
73
+                ),
74
+
75
+                'initial_amt'   => wpinv_round_amount( $submission->get_total(), null, true ),
76
+                'currency'      => $submission->get_currency(),
77
+
78
+            )
79
+        );
80
+
81
+    }
82
+
83
+    /**
84
+     * Adds texts to a response for submission refresh prices.
85
+     *
86
+     * @param GetPaid_Payment_Form_Submission $submission
87
+     */
88
+    public function add_texts( $submission ) {
89
+
90
+        $payable = $submission->format_amount( $submission->get_total() );
91
+        $groups  = getpaid_get_subscription_groups( $submission );
92
+
93
+        if ( $submission->has_recurring && 2 > count( $groups ) ) {
94
+
95
+            $recurring = new WPInv_Item( $submission->has_recurring );
96
+            $period    = getpaid_get_subscription_period_label( $recurring->get_recurring_period( true ), $recurring->get_recurring_interval(), '' );
97
+            $main_item = reset( $groups );
98
+
99
+            if ( $submission->get_total() == $submission->get_recurring_total() ) {
100
+                $payable = "$payable / $period";
101
+            } else if ( $main_item ) {
102
+
103
+                $main_item = reset( $main_item );
104
+
105
+                // Calculate the next renewal date.
106
+                $_period      = $main_item->get_recurring_period( true );
107
+                $_interval    = $main_item->get_recurring_interval();
108
+
109
+                // If the subscription item has a trial period...
110
+                if ( $main_item->has_free_trial() ) {
111
+                    $_period   = $main_item->get_trial_period( true );
112
+                    $_interval = $main_item->get_trial_interval();
113
+                }
114
+
115
+                $payable = sprintf(
116
+                    __( '%1$s (renews at %2$s / %3$s)', 'invoicing' ),
117
+                    $submission->format_amount( $submission->get_total() ),
118
+                    $submission->format_amount( $submission->get_recurring_total() ),
119
+                    $period
120
+                );
121
+
122
+                $payable .= sprintf(
123
+                    '<small class="text-muted form-text">%s</small>',
124
+                    sprintf(
125
+                        __( 'First renewal on %s', 'invoicing' ),
126
+                        getpaid_format_date( date( 'Y-m-d H:i:s', strtotime( "+$_interval $_period", current_time( 'timestamp' ) ) ) )
127
+                    )
128
+                );
129
+
130
+            } else {
131
+                $payable = sprintf(
132
+                    __( '%1$s (renews at %2$s / %3$s)', 'invoicing' ),
133
+                    $submission->format_amount( $submission->get_total() ),
134
+                    $submission->format_amount( $submission->get_recurring_total() ),
135
+                    $period
136
+                );
137
+            }
138
+
139
+        }
140
+
141
+        $texts = array(
142
+            '.getpaid-checkout-total-payable' => $payable,
143
+        );
144
+
145
+        foreach ( $submission->get_items() as $item ) {
146
+            $item_id                                               = $item->get_id();
147
+            $initial_price                                         = $submission->format_amount( $item->get_sub_total() - $item->item_discount );
148
+            $recurring_price                                       = $submission->format_amount( $item->get_recurring_sub_total() - $item->recurring_item_discount );
149
+            $texts[".item-$item_id .getpaid-form-item-price-desc"] = getpaid_item_recurring_price_help_text( $item, $submission->get_currency(), $initial_price, $recurring_price );
150
+            $texts[".item-$item_id .getpaid-mobile-item-subtotal"] = sprintf( __( 'Subtotal: %s', 'invoicing' ), $submission->format_amount( $item->get_sub_total() ) );
151
+
152
+            if ( $item->get_quantity() == 1 ) {
153
+                $texts[".item-$item_id .getpaid-mobile-item-subtotal"] = '';
154
+            }
155
+
156
+        }
157
+
158
+        $this->response = array_merge( $this->response, array( 'texts' => $texts ) );
159
+
160
+    }
161
+
162
+    /**
163
+     * Adds items to a response for submission refresh prices.
164
+     *
165
+     * @param GetPaid_Payment_Form_Submission $submission
166
+     */
167
+    public function add_items( $submission ) {
168
+
169
+        // Add items.
170
+        $items = array();
171 171
 
172 172
         foreach ( $submission->get_items() as $item ) {
173
-			$item_id           = $item->get_id();
174
-			$items["$item_id"] = $submission->format_amount( $item->get_sub_total() );
175
-		}
173
+            $item_id           = $item->get_id();
174
+            $items["$item_id"] = $submission->format_amount( $item->get_sub_total() );
175
+        }
176 176
 
177
-		$this->response = array_merge(
178
-			$this->response,
179
-			array( 'items' => $items )
180
-		);
177
+        $this->response = array_merge(
178
+            $this->response,
179
+            array( 'items' => $items )
180
+        );
181 181
 
182
-	}
182
+    }
183 183
 
184
-	/**
185
-	 * Adds fees to a response for submission refresh prices.
186
-	 *
187
-	 * @param GetPaid_Payment_Form_Submission $submission
188
-	 */
189
-	public function add_fees( $submission ) {
184
+    /**
185
+     * Adds fees to a response for submission refresh prices.
186
+     *
187
+     * @param GetPaid_Payment_Form_Submission $submission
188
+     */
189
+    public function add_fees( $submission ) {
190 190
 
191
-		$fees = array();
191
+        $fees = array();
192 192
 
193 193
         foreach ( $submission->get_fees() as $name => $data ) {
194
-			$fees[$name] = $submission->format_amount( $data['initial_fee'] );
195
-		}
194
+            $fees[$name] = $submission->format_amount( $data['initial_fee'] );
195
+        }
196 196
 
197
-		$this->response = array_merge(
198
-			$this->response,
199
-			array( 'fees' => $fees )
200
-		);
197
+        $this->response = array_merge(
198
+            $this->response,
199
+            array( 'fees' => $fees )
200
+        );
201 201
 
202
-	}
202
+    }
203 203
 
204
-	/**
205
-	 * Adds discounts to a response for submission refresh prices.
206
-	 *
207
-	 * @param GetPaid_Payment_Form_Submission $submission
208
-	 */
209
-	public function add_discounts( $submission ) {
204
+    /**
205
+     * Adds discounts to a response for submission refresh prices.
206
+     *
207
+     * @param GetPaid_Payment_Form_Submission $submission
208
+     */
209
+    public function add_discounts( $submission ) {
210 210
 
211
-		$discounts = array();
211
+        $discounts = array();
212 212
 
213 213
         foreach ( $submission->get_discounts() as $name => $data ) {
214
-			$discounts[$name] = $submission->format_amount( $data['initial_discount'] );
215
-		}
214
+            $discounts[$name] = $submission->format_amount( $data['initial_discount'] );
215
+        }
216 216
 
217
-		$this->response = array_merge(
218
-			$this->response,
219
-			array( 'discounts' => $discounts )
220
-		);
217
+        $this->response = array_merge(
218
+            $this->response,
219
+            array( 'discounts' => $discounts )
220
+        );
221 221
 
222
-	}
222
+    }
223 223
 
224
-	/**
225
-	 * Adds taxes to a response for submission refresh prices.
226
-	 *
227
-	 * @param GetPaid_Payment_Form_Submission $submission
228
-	 */
229
-	public function add_taxes( $submission ) {
230
-
231
-		$taxes  = array();
232
-		$markup = '';
224
+    /**
225
+     * Adds taxes to a response for submission refresh prices.
226
+     *
227
+     * @param GetPaid_Payment_Form_Submission $submission
228
+     */
229
+    public function add_taxes( $submission ) {
230
+
231
+        $taxes  = array();
232
+        $markup = '';
233 233
         foreach ( $submission->get_taxes() as $name => $data ) {
234
-			$name          = sanitize_text_field( $name );
235
-			$amount        = $submission->format_amount( $data['initial_tax'] );
236
-			$taxes[$name]  = $amount;
237
-			$markup       .= "<small class='form-text'>$name : $amount</small>";
238
-		}
239
-
240
-		if ( wpinv_display_individual_tax_rates() && ! empty( $taxes ) ) {
241
-			$this->response['texts']['.getpaid-form-cart-totals-total-tax'] = $markup;
242
-		}
243
-
244
-		$this->response = array_merge(
245
-			$this->response,
246
-			array( 'taxes' => $taxes )
247
-		);
248
-
249
-	}
250
-
251
-	/**
252
-	 * Adds gateways to a response for submission refresh prices.
253
-	 *
254
-	 * @param GetPaid_Payment_Form_Submission $submission
255
-	 */
256
-	public function add_gateways( $submission ) {
257
-
258
-		$gateways = array_keys( wpinv_get_enabled_payment_gateways() );
259
-
260
-		if ( $this->response['has_recurring'] ) {
261
-
262
-			foreach ( $gateways as $i => $gateway ) {
263
-
264
-				if (
265
-					! getpaid_payment_gateway_supports( $gateway, 'subscription' )
266
-					|| ( $this->response['has_subscription_group'] && ! getpaid_payment_gateway_supports( $gateway, 'single_subscription_group' ) )
267
-					|| ( $this->response['has_multiple_subscription_groups'] && ! getpaid_payment_gateway_supports( $gateway, 'multiple_subscription_groups' ) ) ) {
268
-					unset( $gateways[ $i ] );
269
-				}
270
-
271
-			}
272
-
273
-		}
274
-
275
-		$gateways = apply_filters( 'getpaid_submission_gateways', $gateways, $submission );
276
-		$this->response = array_merge(
277
-			$this->response,
278
-			array( 'gateways' => $gateways )
279
-		);
280
-
281
-	}
282
-
283
-	/**
284
-	 * Adds data to a response for submission refresh prices.
285
-	 *
286
-	 * @param GetPaid_Payment_Form_Submission $submission
287
-	 */
288
-	public function add_data( $submission ) {
289
-
290
-		$this->response = array_merge(
291
-			$this->response,
292
-			array(
293
-				'js_data' => apply_filters(
294
-					'getpaid_submission_js_data',
295
-					array(
296
-						'is_recurring' => $this->response['has_recurring'],
297
-					),
298
-					$submission
299
-				)
300
-			)
301
-		);
302
-
303
-	}
234
+            $name          = sanitize_text_field( $name );
235
+            $amount        = $submission->format_amount( $data['initial_tax'] );
236
+            $taxes[$name]  = $amount;
237
+            $markup       .= "<small class='form-text'>$name : $amount</small>";
238
+        }
239
+
240
+        if ( wpinv_display_individual_tax_rates() && ! empty( $taxes ) ) {
241
+            $this->response['texts']['.getpaid-form-cart-totals-total-tax'] = $markup;
242
+        }
243
+
244
+        $this->response = array_merge(
245
+            $this->response,
246
+            array( 'taxes' => $taxes )
247
+        );
248
+
249
+    }
250
+
251
+    /**
252
+     * Adds gateways to a response for submission refresh prices.
253
+     *
254
+     * @param GetPaid_Payment_Form_Submission $submission
255
+     */
256
+    public function add_gateways( $submission ) {
257
+
258
+        $gateways = array_keys( wpinv_get_enabled_payment_gateways() );
259
+
260
+        if ( $this->response['has_recurring'] ) {
261
+
262
+            foreach ( $gateways as $i => $gateway ) {
263
+
264
+                if (
265
+                    ! getpaid_payment_gateway_supports( $gateway, 'subscription' )
266
+                    || ( $this->response['has_subscription_group'] && ! getpaid_payment_gateway_supports( $gateway, 'single_subscription_group' ) )
267
+                    || ( $this->response['has_multiple_subscription_groups'] && ! getpaid_payment_gateway_supports( $gateway, 'multiple_subscription_groups' ) ) ) {
268
+                    unset( $gateways[ $i ] );
269
+                }
270
+
271
+            }
272
+
273
+        }
274
+
275
+        $gateways = apply_filters( 'getpaid_submission_gateways', $gateways, $submission );
276
+        $this->response = array_merge(
277
+            $this->response,
278
+            array( 'gateways' => $gateways )
279
+        );
280
+
281
+    }
282
+
283
+    /**
284
+     * Adds data to a response for submission refresh prices.
285
+     *
286
+     * @param GetPaid_Payment_Form_Submission $submission
287
+     */
288
+    public function add_data( $submission ) {
289
+
290
+        $this->response = array_merge(
291
+            $this->response,
292
+            array(
293
+                'js_data' => apply_filters(
294
+                    'getpaid_submission_js_data',
295
+                    array(
296
+                        'is_recurring' => $this->response['has_recurring'],
297
+                    ),
298
+                    $submission
299
+                )
300
+            )
301
+        );
302
+
303
+    }
304 304
 
305 305
 }
Please login to merge, or discard this patch.