@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Bank transfer Payment Gateway class. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - protected $supports = array( 'addons' ); |
|
27 | + protected $supports = array('addons'); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Payment method order. |
@@ -39,14 +39,14 @@ discard block |
||
39 | 39 | public function __construct() { |
40 | 40 | parent::__construct(); |
41 | 41 | |
42 | - $this->title = __( 'Direct bank transfer', 'invoicing' ); |
|
43 | - $this->method_title = __( 'Bank transfer', 'invoicing' ); |
|
44 | - $this->checkout_button_text = __( 'Proceed', 'invoicing' ); |
|
45 | - $this->instructions = apply_filters( 'wpinv_bank_instructions', $this->get_option( 'info' ) ); |
|
42 | + $this->title = __('Direct bank transfer', 'invoicing'); |
|
43 | + $this->method_title = __('Bank transfer', 'invoicing'); |
|
44 | + $this->checkout_button_text = __('Proceed', 'invoicing'); |
|
45 | + $this->instructions = apply_filters('wpinv_bank_instructions', $this->get_option('info')); |
|
46 | 46 | |
47 | - add_action( 'wpinv_receipt_end', array( $this, 'thankyou_page' ) ); |
|
48 | - add_action( 'getpaid_invoice_line_items', array( $this, 'thankyou_page' ), 40 ); |
|
49 | - add_action( 'wpinv_email_invoice_details', array( $this, 'email_instructions' ), 10, 3 ); |
|
47 | + add_action('wpinv_receipt_end', array($this, 'thankyou_page')); |
|
48 | + add_action('getpaid_invoice_line_items', array($this, 'thankyou_page'), 40); |
|
49 | + add_action('wpinv_email_invoice_details', array($this, 'email_instructions'), 10, 3); |
|
50 | 50 | |
51 | 51 | } |
52 | 52 | |
@@ -59,23 +59,23 @@ discard block |
||
59 | 59 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
60 | 60 | * @return array |
61 | 61 | */ |
62 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
62 | + public function process_payment($invoice, $submission_data, $submission) { |
|
63 | 63 | |
64 | 64 | // Add a transaction id. |
65 | - $invoice->set_transaction_id( $invoice->generate_key('trans_') ); |
|
65 | + $invoice->set_transaction_id($invoice->generate_key('trans_')); |
|
66 | 66 | |
67 | 67 | // Set it as pending payment. |
68 | - if ( ! $invoice->needs_payment() ) { |
|
68 | + if (!$invoice->needs_payment()) { |
|
69 | 69 | $invoice->mark_paid(); |
70 | - } else if ( ! $invoice->is_paid() ) { |
|
71 | - $invoice->set_status( 'wpi-onhold' ); |
|
70 | + } else if (!$invoice->is_paid()) { |
|
71 | + $invoice->set_status('wpi-onhold'); |
|
72 | 72 | } |
73 | 73 | |
74 | 74 | // Save it. |
75 | 75 | $invoice->save(); |
76 | 76 | |
77 | 77 | // Send to the success page. |
78 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
78 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
79 | 79 | |
80 | 80 | } |
81 | 81 | |
@@ -84,17 +84,17 @@ discard block |
||
84 | 84 | * |
85 | 85 | * @param WPInv_Invoice $invoice Invoice. |
86 | 86 | */ |
87 | - public function thankyou_page( $invoice ) { |
|
87 | + public function thankyou_page($invoice) { |
|
88 | 88 | |
89 | - if ( 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) { |
|
89 | + if ('bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) { |
|
90 | 90 | |
91 | 91 | echo '<div class="mt-4 mb-2 getpaid-bank-transfer-details">' . PHP_EOL; |
92 | 92 | |
93 | - if ( ! empty( $this->instructions ) ) { |
|
94 | - echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) ); |
|
93 | + if (!empty($this->instructions)) { |
|
94 | + echo wp_kses_post(wpautop(wptexturize($this->instructions))); |
|
95 | 95 | } |
96 | 96 | |
97 | - $this->bank_details( $invoice ); |
|
97 | + $this->bank_details($invoice); |
|
98 | 98 | |
99 | 99 | echo '</div>'; |
100 | 100 | |
@@ -109,17 +109,17 @@ discard block |
||
109 | 109 | * @param string $email_type Email format: plain text or HTML. |
110 | 110 | * @param bool $sent_to_admin Sent to admin. |
111 | 111 | */ |
112 | - public function email_instructions( $invoice, $email_type, $sent_to_admin ) { |
|
112 | + public function email_instructions($invoice, $email_type, $sent_to_admin) { |
|
113 | 113 | |
114 | - if ( ! $sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment() ) { |
|
114 | + if (!$sent_to_admin && 'bank_transfer' === $invoice->get_gateway() && $invoice->needs_payment()) { |
|
115 | 115 | |
116 | 116 | echo '<div class="wpi-email-row getpaid-bank-transfer-details">'; |
117 | 117 | |
118 | - if ( $this->instructions ) { |
|
119 | - echo wp_kses_post( wpautop( wptexturize( $this->instructions ) ) . PHP_EOL ); |
|
118 | + if ($this->instructions) { |
|
119 | + echo wp_kses_post(wpautop(wptexturize($this->instructions)) . PHP_EOL); |
|
120 | 120 | } |
121 | 121 | |
122 | - $this->bank_details( $invoice ); |
|
122 | + $this->bank_details($invoice); |
|
123 | 123 | |
124 | 124 | echo '</div>'; |
125 | 125 | |
@@ -132,51 +132,51 @@ discard block |
||
132 | 132 | * |
133 | 133 | * @param WPInv_Invoice $invoice Invoice. |
134 | 134 | */ |
135 | - protected function bank_details( $invoice ) { |
|
135 | + protected function bank_details($invoice) { |
|
136 | 136 | |
137 | 137 | // Get the invoice country and country $locale. |
138 | 138 | $country = $invoice->get_country(); |
139 | 139 | $locale = $this->get_country_locale(); |
140 | 140 | |
141 | 141 | // Get sortcode label in the $locale array and use appropriate one. |
142 | - $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' ); |
|
142 | + $sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing'); |
|
143 | 143 | |
144 | 144 | $bank_fields = array( |
145 | - 'ac_name' => __( 'Account Name', 'invoicing' ), |
|
146 | - 'ac_no' => __( 'Account Number', 'invoicing' ), |
|
147 | - 'bank_name' => __( 'Bank Name', 'invoicing' ), |
|
148 | - 'ifsc' => __( 'IFSC code', 'invoicing' ), |
|
149 | - 'iban' => __( 'IBAN', 'invoicing' ), |
|
150 | - 'bic' => __( 'BIC/Swift code', 'invoicing' ), |
|
145 | + 'ac_name' => __('Account Name', 'invoicing'), |
|
146 | + 'ac_no' => __('Account Number', 'invoicing'), |
|
147 | + 'bank_name' => __('Bank Name', 'invoicing'), |
|
148 | + 'ifsc' => __('IFSC code', 'invoicing'), |
|
149 | + 'iban' => __('IBAN', 'invoicing'), |
|
150 | + 'bic' => __('BIC/Swift code', 'invoicing'), |
|
151 | 151 | 'sort_code' => $sortcode, |
152 | 152 | ); |
153 | 153 | |
154 | 154 | $bank_info = array(); |
155 | 155 | |
156 | - foreach ( $bank_fields as $field => $label ) { |
|
157 | - $value = $this->get_option( $field ); |
|
156 | + foreach ($bank_fields as $field => $label) { |
|
157 | + $value = $this->get_option($field); |
|
158 | 158 | |
159 | - if ( ! empty( $value ) ) { |
|
160 | - $bank_info[$field] = array( 'label' => $label, 'value' => $value ); |
|
159 | + if (!empty($value)) { |
|
160 | + $bank_info[$field] = array('label' => $label, 'value' => $value); |
|
161 | 161 | } |
162 | 162 | |
163 | 163 | } |
164 | 164 | |
165 | - $bank_info = apply_filters( 'wpinv_bank_info', $bank_info ); |
|
165 | + $bank_info = apply_filters('wpinv_bank_info', $bank_info); |
|
166 | 166 | |
167 | - if ( empty( $bank_info ) ) { |
|
167 | + if (empty($bank_info)) { |
|
168 | 168 | return; |
169 | 169 | } |
170 | 170 | |
171 | - echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters( 'wpinv_receipt_bank_details_title', __( 'Bank Details', 'invoicing' ) ) . '</h3>' . PHP_EOL; |
|
171 | + echo '<h3 class="getpaid-bank-transfer-title"> ' . apply_filters('wpinv_receipt_bank_details_title', __('Bank Details', 'invoicing')) . '</h3>' . PHP_EOL; |
|
172 | 172 | |
173 | 173 | echo '<table class="table table-bordered getpaid-bank-transfer-details">' . PHP_EOL; |
174 | 174 | |
175 | - foreach ( $bank_info as $key => $data ) { |
|
175 | + foreach ($bank_info as $key => $data) { |
|
176 | 176 | |
177 | - $key = sanitize_html_class( $key ); |
|
178 | - $label = wp_kses_post( $data['label'] ); |
|
179 | - $value = wp_kses_post( wptexturize( $data['value'] ) ); |
|
177 | + $key = sanitize_html_class($key); |
|
178 | + $label = wp_kses_post($data['label']); |
|
179 | + $value = wp_kses_post(wptexturize($data['value'])); |
|
180 | 180 | |
181 | 181 | echo "<tr class='getpaid-bank-transfer-$key'><th>$label</th><td>$value</td></tr>" . PHP_EOL; |
182 | 182 | } |
@@ -192,7 +192,7 @@ discard block |
||
192 | 192 | */ |
193 | 193 | public function get_country_locale() { |
194 | 194 | |
195 | - if ( empty( $this->locale ) ) { |
|
195 | + if (empty($this->locale)) { |
|
196 | 196 | |
197 | 197 | // Locale information to be used - only those that are not 'Sort Code'. |
198 | 198 | $this->locale = apply_filters( |
@@ -200,42 +200,42 @@ discard block |
||
200 | 200 | array( |
201 | 201 | 'AU' => array( |
202 | 202 | 'sortcode' => array( |
203 | - 'label' => __( 'BSB', 'invoicing' ), |
|
203 | + 'label' => __('BSB', 'invoicing'), |
|
204 | 204 | ), |
205 | 205 | ), |
206 | 206 | 'CA' => array( |
207 | 207 | 'sortcode' => array( |
208 | - 'label' => __( 'Bank transit number', 'invoicing' ), |
|
208 | + 'label' => __('Bank transit number', 'invoicing'), |
|
209 | 209 | ), |
210 | 210 | ), |
211 | 211 | 'IN' => array( |
212 | 212 | 'sortcode' => array( |
213 | - 'label' => __( 'IFSC', 'invoicing' ), |
|
213 | + 'label' => __('IFSC', 'invoicing'), |
|
214 | 214 | ), |
215 | 215 | ), |
216 | 216 | 'IT' => array( |
217 | 217 | 'sortcode' => array( |
218 | - 'label' => __( 'Branch sort', 'invoicing' ), |
|
218 | + 'label' => __('Branch sort', 'invoicing'), |
|
219 | 219 | ), |
220 | 220 | ), |
221 | 221 | 'NZ' => array( |
222 | 222 | 'sortcode' => array( |
223 | - 'label' => __( 'Bank code', 'invoicing' ), |
|
223 | + 'label' => __('Bank code', 'invoicing'), |
|
224 | 224 | ), |
225 | 225 | ), |
226 | 226 | 'SE' => array( |
227 | 227 | 'sortcode' => array( |
228 | - 'label' => __( 'Bank code', 'invoicing' ), |
|
228 | + 'label' => __('Bank code', 'invoicing'), |
|
229 | 229 | ), |
230 | 230 | ), |
231 | 231 | 'US' => array( |
232 | 232 | 'sortcode' => array( |
233 | - 'label' => __( 'Routing number', 'invoicing' ), |
|
233 | + 'label' => __('Routing number', 'invoicing'), |
|
234 | 234 | ), |
235 | 235 | ), |
236 | 236 | 'ZA' => array( |
237 | 237 | 'sortcode' => array( |
238 | - 'label' => __( 'Branch code', 'invoicing' ), |
|
238 | + 'label' => __('Branch code', 'invoicing'), |
|
239 | 239 | ), |
240 | 240 | ), |
241 | 241 | ) |
@@ -252,51 +252,51 @@ discard block |
||
252 | 252 | * |
253 | 253 | * @param array $admin_settings |
254 | 254 | */ |
255 | - public function admin_settings( $admin_settings ) { |
|
255 | + public function admin_settings($admin_settings) { |
|
256 | 256 | |
257 | - $admin_settings['worldpay_desc']['std'] = __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ); |
|
258 | - $admin_settings['worldpay_active']['desc'] = __( 'Enable bank transfer', 'invoicing' ); |
|
257 | + $admin_settings['worldpay_desc']['std'] = __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'); |
|
258 | + $admin_settings['worldpay_active']['desc'] = __('Enable bank transfer', 'invoicing'); |
|
259 | 259 | |
260 | - $locale = $this->get_country_locale(); |
|
260 | + $locale = $this->get_country_locale(); |
|
261 | 261 | |
262 | 262 | // Get sortcode label in the $locale array and use appropriate one. |
263 | 263 | $country = wpinv_default_billing_country(); |
264 | - $sortcode = isset( $locale[ $country ]['sortcode']['label'] ) ? $locale[ $country ]['sortcode']['label'] : __( 'Sort code', 'invoicing' ); |
|
264 | + $sortcode = isset($locale[$country]['sortcode']['label']) ? $locale[$country]['sortcode']['label'] : __('Sort code', 'invoicing'); |
|
265 | 265 | |
266 | 266 | $admin_settings['bank_transfer_ac_name'] = array( |
267 | 267 | 'type' => 'text', |
268 | 268 | 'id' => 'bank_transfer_ac_name', |
269 | - 'name' => __( 'Account Name', 'invoicing' ), |
|
269 | + 'name' => __('Account Name', 'invoicing'), |
|
270 | 270 | ); |
271 | 271 | |
272 | 272 | $admin_settings['bank_transfer_ac_no'] = array( |
273 | 273 | 'type' => 'text', |
274 | 274 | 'id' => 'bank_transfer_ac_no', |
275 | - 'name' => __( 'Account Number', 'invoicing' ), |
|
275 | + 'name' => __('Account Number', 'invoicing'), |
|
276 | 276 | ); |
277 | 277 | |
278 | 278 | $admin_settings['bank_transfer_bank_name'] = array( |
279 | 279 | 'type' => 'text', |
280 | 280 | 'id' => 'bank_transfer_bank_name', |
281 | - 'name' => __( 'Bank Name', 'invoicing' ), |
|
281 | + 'name' => __('Bank Name', 'invoicing'), |
|
282 | 282 | ); |
283 | 283 | |
284 | 284 | $admin_settings['bank_transfer_ifsc'] = array( |
285 | 285 | 'type' => 'text', |
286 | 286 | 'id' => 'bank_transfer_ifsc', |
287 | - 'name' => __( 'IFSC Code', 'invoicing' ), |
|
287 | + 'name' => __('IFSC Code', 'invoicing'), |
|
288 | 288 | ); |
289 | 289 | |
290 | 290 | $admin_settings['bank_transfer_iban'] = array( |
291 | 291 | 'type' => 'text', |
292 | 292 | 'id' => 'bank_transfer_iban', |
293 | - 'name' => __( 'IBAN', 'invoicing' ), |
|
293 | + 'name' => __('IBAN', 'invoicing'), |
|
294 | 294 | ); |
295 | 295 | |
296 | 296 | $admin_settings['bank_transfer_bic'] = array( |
297 | 297 | 'type' => 'text', |
298 | 298 | 'id' => 'bank_transfer_bic', |
299 | - 'name' => __( 'BIC/Swift Code', 'invoicing' ), |
|
299 | + 'name' => __('BIC/Swift Code', 'invoicing'), |
|
300 | 300 | ); |
301 | 301 | |
302 | 302 | $admin_settings['bank_transfer_sort_code'] = array( |
@@ -307,10 +307,10 @@ discard block |
||
307 | 307 | |
308 | 308 | $admin_settings['bank_transfer_info'] = array( |
309 | 309 | 'id' => 'bank_transfer_info', |
310 | - 'name' => __( 'Instructions', 'invoicing' ), |
|
311 | - 'desc' => __( 'Instructions that will be added to the thank you page and emails.', 'invoicing' ), |
|
310 | + 'name' => __('Instructions', 'invoicing'), |
|
311 | + 'desc' => __('Instructions that will be added to the thank you page and emails.', 'invoicing'), |
|
312 | 312 | 'type' => 'textarea', |
313 | - 'std' => __( "Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing' ), |
|
313 | + 'std' => __("Make your payment directly into our bank account. Please use your Invoice Number as the payment reference. Your invoice won't be processed until the funds have cleared in our account.", 'invoicing'), |
|
314 | 314 | 'cols' => 50, |
315 | 315 | 'rows' => 5 |
316 | 316 | ); |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Manual Payment Gateway class. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - protected $supports = array( 'subscription', 'addons' ); |
|
27 | + protected $supports = array('subscription', 'addons'); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Payment method order. |
@@ -39,10 +39,10 @@ discard block |
||
39 | 39 | public function __construct() { |
40 | 40 | parent::__construct(); |
41 | 41 | |
42 | - $this->title = __( 'Manual Payment', 'invoicing' ); |
|
43 | - $this->method_title = __( 'Manual Payment', 'invoicing' ); |
|
42 | + $this->title = __('Manual Payment', 'invoicing'); |
|
43 | + $this->method_title = __('Manual Payment', 'invoicing'); |
|
44 | 44 | |
45 | - add_filter( 'getpaid_daily_maintenance_should_expire_subscription', array( $this, 'maybe_renew_subscription' ), 10, 2 ); |
|
45 | + add_filter('getpaid_daily_maintenance_should_expire_subscription', array($this, 'maybe_renew_subscription'), 10, 2); |
|
46 | 46 | } |
47 | 47 | |
48 | 48 | /** |
@@ -54,16 +54,16 @@ discard block |
||
54 | 54 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
55 | 55 | * @return array |
56 | 56 | */ |
57 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
57 | + public function process_payment($invoice, $submission_data, $submission) { |
|
58 | 58 | |
59 | 59 | // Mark it as paid. |
60 | 60 | $invoice->mark_paid(); |
61 | 61 | |
62 | 62 | // (Maybe) activate subscription. |
63 | - getpaid_activate_invoice_subscription( $invoice ); |
|
63 | + getpaid_activate_invoice_subscription($invoice); |
|
64 | 64 | |
65 | 65 | // Send to the success page. |
66 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
66 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
67 | 67 | |
68 | 68 | } |
69 | 69 | |
@@ -74,15 +74,15 @@ discard block |
||
74 | 74 | * @param bool $should_expire |
75 | 75 | * @param WPInv_Subscription $subscription |
76 | 76 | */ |
77 | - public function maybe_renew_subscription( $should_expire, $subscription ) { |
|
77 | + public function maybe_renew_subscription($should_expire, $subscription) { |
|
78 | 78 | |
79 | 79 | // Ensure its our subscription && it's active. |
80 | - if ( 'manual' != $subscription->get_gateway() || ! $subscription->has_status( 'active trialling' ) ) { |
|
80 | + if ('manual' != $subscription->get_gateway() || !$subscription->has_status('active trialling')) { |
|
81 | 81 | return $should_expire; |
82 | 82 | } |
83 | 83 | |
84 | 84 | // If this is the last renewal, complete the subscription. |
85 | - if ( $subscription->is_last_renewal() ) { |
|
85 | + if ($subscription->is_last_renewal()) { |
|
86 | 86 | $subscription->complete(); |
87 | 87 | return false; |
88 | 88 | } |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Abstaract Payment Gateway class. |
@@ -139,55 +139,55 @@ discard block |
||
139 | 139 | public function __construct() { |
140 | 140 | |
141 | 141 | // Register gateway. |
142 | - add_filter( 'wpinv_payment_gateways', array( $this, 'register_gateway' ) ); |
|
142 | + add_filter('wpinv_payment_gateways', array($this, 'register_gateway')); |
|
143 | 143 | |
144 | - $this->enabled = wpinv_is_gateway_active( $this->id ); |
|
144 | + $this->enabled = wpinv_is_gateway_active($this->id); |
|
145 | 145 | |
146 | 146 | // Enable Subscriptions. |
147 | - if ( $this->supports( 'subscription' ) ) { |
|
148 | - add_filter( "wpinv_{$this->id}_support_subscription", '__return_true' ); |
|
147 | + if ($this->supports('subscription')) { |
|
148 | + add_filter("wpinv_{$this->id}_support_subscription", '__return_true'); |
|
149 | 149 | } |
150 | 150 | |
151 | 151 | // Enable sandbox. |
152 | - if ( $this->supports( 'sandbox' ) ) { |
|
153 | - add_filter( "wpinv_{$this->id}_supports_sandbox", '__return_true' ); |
|
152 | + if ($this->supports('sandbox')) { |
|
153 | + add_filter("wpinv_{$this->id}_supports_sandbox", '__return_true'); |
|
154 | 154 | } |
155 | 155 | |
156 | 156 | // Invoice addons. |
157 | - if ( $this->supports( 'addons' ) ) { |
|
158 | - add_filter( "getpaid_{$this->id}_supports_addons", '__return_true' ); |
|
159 | - add_action( "getpaid_process_{$this->id}_invoice_addons", array( $this, 'process_addons' ) ); |
|
157 | + if ($this->supports('addons')) { |
|
158 | + add_filter("getpaid_{$this->id}_supports_addons", '__return_true'); |
|
159 | + add_action("getpaid_process_{$this->id}_invoice_addons", array($this, 'process_addons')); |
|
160 | 160 | } |
161 | 161 | |
162 | 162 | // Gateway settings. |
163 | - add_filter( "wpinv_gateway_settings_{$this->id}", array( $this, 'admin_settings' ) ); |
|
163 | + add_filter("wpinv_gateway_settings_{$this->id}", array($this, 'admin_settings')); |
|
164 | 164 | |
165 | 165 | |
166 | 166 | // Gateway checkout fiellds. |
167 | - add_action( "wpinv_{$this->id}_cc_form", array( $this, 'payment_fields' ), 10, 2 ); |
|
167 | + add_action("wpinv_{$this->id}_cc_form", array($this, 'payment_fields'), 10, 2); |
|
168 | 168 | |
169 | 169 | // Process payment. |
170 | - add_action( "getpaid_gateway_{$this->id}", array( $this, 'process_payment' ), 10, 3 ); |
|
170 | + add_action("getpaid_gateway_{$this->id}", array($this, 'process_payment'), 10, 3); |
|
171 | 171 | |
172 | 172 | // Change the checkout button text. |
173 | - if ( ! empty( $this->checkout_button_text ) ) { |
|
174 | - add_filter( "getpaid_gateway_{$this->id}_checkout_button_label", array( $this, 'rename_checkout_button' ) ); |
|
173 | + if (!empty($this->checkout_button_text)) { |
|
174 | + add_filter("getpaid_gateway_{$this->id}_checkout_button_label", array($this, 'rename_checkout_button')); |
|
175 | 175 | } |
176 | 176 | |
177 | 177 | // Check if a gateway is valid for a given currency. |
178 | - add_filter( "getpaid_gateway_{$this->id}_is_valid_for_currency", array( $this, 'validate_currency' ), 10, 2 ); |
|
178 | + add_filter("getpaid_gateway_{$this->id}_is_valid_for_currency", array($this, 'validate_currency'), 10, 2); |
|
179 | 179 | |
180 | 180 | // Generate the transaction url. |
181 | - add_filter( "getpaid_gateway_{$this->id}_transaction_url", array( $this, 'filter_transaction_url' ), 10, 2 ); |
|
181 | + add_filter("getpaid_gateway_{$this->id}_transaction_url", array($this, 'filter_transaction_url'), 10, 2); |
|
182 | 182 | |
183 | 183 | // Generate the subscription url. |
184 | - add_filter( "getpaid_gateway_{$this->id}_subscription_url", array( $this, 'filter_subscription_url' ), 10, 2 ); |
|
184 | + add_filter("getpaid_gateway_{$this->id}_subscription_url", array($this, 'filter_subscription_url'), 10, 2); |
|
185 | 185 | |
186 | 186 | // Confirm payments. |
187 | - add_filter( "wpinv_payment_confirm_{$this->id}", array( $this, 'confirm_payment' ), 10, 2 ); |
|
187 | + add_filter("wpinv_payment_confirm_{$this->id}", array($this, 'confirm_payment'), 10, 2); |
|
188 | 188 | |
189 | 189 | // Verify IPNs. |
190 | - add_action( "wpinv_verify_{$this->id}_ipn", array( $this, 'verify_ipn' ) ); |
|
190 | + add_action("wpinv_verify_{$this->id}_ipn", array($this, 'verify_ipn')); |
|
191 | 191 | |
192 | 192 | } |
193 | 193 | |
@@ -197,7 +197,7 @@ discard block |
||
197 | 197 | * @since 1.0.19 |
198 | 198 | * @return bool |
199 | 199 | */ |
200 | - public function is( $gateway ) { |
|
200 | + public function is($gateway) { |
|
201 | 201 | return $gateway == $this->id; |
202 | 202 | } |
203 | 203 | |
@@ -207,23 +207,23 @@ discard block |
||
207 | 207 | * @since 1.0.19 |
208 | 208 | * @return array |
209 | 209 | */ |
210 | - public function get_tokens( $sandbox = null ) { |
|
210 | + public function get_tokens($sandbox = null) { |
|
211 | 211 | |
212 | - if ( is_user_logged_in() && $this->supports( 'tokens' ) && 0 == count( $this->tokens ) ) { |
|
213 | - $tokens = get_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", true ); |
|
212 | + if (is_user_logged_in() && $this->supports('tokens') && 0 == count($this->tokens)) { |
|
213 | + $tokens = get_user_meta(get_current_user_id(), "getpaid_{$this->id}_tokens", true); |
|
214 | 214 | |
215 | - if ( is_array( $tokens ) ) { |
|
215 | + if (is_array($tokens)) { |
|
216 | 216 | $this->tokens = $tokens; |
217 | 217 | } |
218 | 218 | |
219 | 219 | } |
220 | 220 | |
221 | - if ( ! is_bool( $sandbox ) ) { |
|
221 | + if (!is_bool($sandbox)) { |
|
222 | 222 | return $this->tokens; |
223 | 223 | } |
224 | 224 | |
225 | - $args = array( 'type' => $sandbox ? 'sandbox' : 'live' ); |
|
226 | - return wp_list_filter( $this->tokens, $args ); |
|
225 | + $args = array('type' => $sandbox ? 'sandbox' : 'live'); |
|
226 | + return wp_list_filter($this->tokens, $args); |
|
227 | 227 | |
228 | 228 | } |
229 | 229 | |
@@ -232,12 +232,12 @@ discard block |
||
232 | 232 | * |
233 | 233 | * @since 1.0.19 |
234 | 234 | */ |
235 | - public function save_token( $token ) { |
|
235 | + public function save_token($token) { |
|
236 | 236 | |
237 | 237 | $tokens = $this->get_tokens(); |
238 | 238 | $tokens[] = $token; |
239 | 239 | |
240 | - update_user_meta( get_current_user_id(), "getpaid_{$this->id}_tokens", $tokens ); |
|
240 | + update_user_meta(get_current_user_id(), "getpaid_{$this->id}_tokens", $tokens); |
|
241 | 241 | |
242 | 242 | $this->tokens = $tokens; |
243 | 243 | |
@@ -249,7 +249,7 @@ discard block |
||
249 | 249 | * @return string |
250 | 250 | */ |
251 | 251 | public function get_method_title() { |
252 | - return apply_filters( 'getpaid_gateway_method_title', $this->method_title, $this ); |
|
252 | + return apply_filters('getpaid_gateway_method_title', $this->method_title, $this); |
|
253 | 253 | } |
254 | 254 | |
255 | 255 | /** |
@@ -258,7 +258,7 @@ discard block |
||
258 | 258 | * @return string |
259 | 259 | */ |
260 | 260 | public function get_method_description() { |
261 | - return apply_filters( 'getpaid_gateway_method_description', $this->method_description, $this ); |
|
261 | + return apply_filters('getpaid_gateway_method_description', $this->method_description, $this); |
|
262 | 262 | } |
263 | 263 | |
264 | 264 | /** |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @param WPInv_Invoice $invoice Invoice object. |
268 | 268 | * @return string |
269 | 269 | */ |
270 | - public function get_return_url( $invoice ) { |
|
270 | + public function get_return_url($invoice) { |
|
271 | 271 | |
272 | 272 | // Payment success url |
273 | 273 | $return_url = add_query_arg( |
@@ -279,7 +279,7 @@ discard block |
||
279 | 279 | wpinv_get_success_page_uri() |
280 | 280 | ); |
281 | 281 | |
282 | - return apply_filters( 'getpaid_gateway_success_url', $return_url, $invoice, $this ); |
|
282 | + return apply_filters('getpaid_gateway_success_url', $return_url, $invoice, $this); |
|
283 | 283 | } |
284 | 284 | |
285 | 285 | /** |
@@ -288,24 +288,24 @@ discard block |
||
288 | 288 | * @param string $content Success page content. |
289 | 289 | * @return string |
290 | 290 | */ |
291 | - public function confirm_payment( $content ) { |
|
291 | + public function confirm_payment($content) { |
|
292 | 292 | |
293 | 293 | // Retrieve the invoice. |
294 | 294 | $invoice_id = getpaid_get_current_invoice_id(); |
295 | - $invoice = wpinv_get_invoice( $invoice_id ); |
|
295 | + $invoice = wpinv_get_invoice($invoice_id); |
|
296 | 296 | |
297 | 297 | // Ensure that it exists and that it is pending payment. |
298 | - if ( empty( $invoice_id ) || ! $invoice->needs_payment() ) { |
|
298 | + if (empty($invoice_id) || !$invoice->needs_payment()) { |
|
299 | 299 | return $content; |
300 | 300 | } |
301 | 301 | |
302 | 302 | // Can the user view this invoice?? |
303 | - if ( ! wpinv_user_can_view_invoice( $invoice ) ) { |
|
303 | + if (!wpinv_user_can_view_invoice($invoice)) { |
|
304 | 304 | return $content; |
305 | 305 | } |
306 | 306 | |
307 | 307 | // Show payment processing indicator. |
308 | - return wpinv_get_template_html( 'wpinv-payment-processing.php', compact( 'invoice' ) ); |
|
308 | + return wpinv_get_template_html('wpinv-payment-processing.php', compact('invoice')); |
|
309 | 309 | } |
310 | 310 | |
311 | 311 | /** |
@@ -322,7 +322,7 @@ discard block |
||
322 | 322 | * @param GetPaid_Form_Item[] $items |
323 | 323 | * @return WPInv_Invoice |
324 | 324 | */ |
325 | - public function process_addons( $invoice, $items ) { |
|
325 | + public function process_addons($invoice, $items) { |
|
326 | 326 | |
327 | 327 | } |
328 | 328 | |
@@ -333,14 +333,14 @@ discard block |
||
333 | 333 | * @param WPInv_Invoice $invoice Invoice object. |
334 | 334 | * @return string transaction URL, or empty string. |
335 | 335 | */ |
336 | - public function filter_transaction_url( $transaction_url, $invoice ) { |
|
336 | + public function filter_transaction_url($transaction_url, $invoice) { |
|
337 | 337 | |
338 | - $transaction_id = $invoice->get_transaction_id(); |
|
338 | + $transaction_id = $invoice->get_transaction_id(); |
|
339 | 339 | |
340 | - if ( ! empty( $this->view_transaction_url ) && ! empty( $transaction_id ) ) { |
|
341 | - $transaction_url = sprintf( $this->view_transaction_url, $transaction_id ); |
|
342 | - $replace = $this->is_sandbox( $invoice ) ? 'sandbox' : ''; |
|
343 | - $transaction_url = str_replace( '{sandbox}', $replace, $transaction_url ); |
|
340 | + if (!empty($this->view_transaction_url) && !empty($transaction_id)) { |
|
341 | + $transaction_url = sprintf($this->view_transaction_url, $transaction_id); |
|
342 | + $replace = $this->is_sandbox($invoice) ? 'sandbox' : ''; |
|
343 | + $transaction_url = str_replace('{sandbox}', $replace, $transaction_url); |
|
344 | 344 | } |
345 | 345 | |
346 | 346 | return $transaction_url; |
@@ -353,15 +353,15 @@ discard block |
||
353 | 353 | * @param WPInv_Invoice $invoice Invoice object. |
354 | 354 | * @return string subscription URL, or empty string. |
355 | 355 | */ |
356 | - public function filter_subscription_url( $subscription_url, $invoice ) { |
|
356 | + public function filter_subscription_url($subscription_url, $invoice) { |
|
357 | 357 | |
358 | - $profile_id = $invoice->get_subscription_id(); |
|
358 | + $profile_id = $invoice->get_subscription_id(); |
|
359 | 359 | |
360 | - if ( ! empty( $this->view_subscription_url ) && ! empty( $profile_id ) ) { |
|
360 | + if (!empty($this->view_subscription_url) && !empty($profile_id)) { |
|
361 | 361 | |
362 | - $subscription_url = sprintf( $this->view_subscription_url, $profile_id ); |
|
363 | - $replace = $this->is_sandbox( $invoice ) ? 'sandbox' : ''; |
|
364 | - $subscription_url = str_replace( '{sandbox}', $replace, $subscription_url ); |
|
362 | + $subscription_url = sprintf($this->view_subscription_url, $profile_id); |
|
363 | + $replace = $this->is_sandbox($invoice) ? 'sandbox' : ''; |
|
364 | + $subscription_url = str_replace('{sandbox}', $replace, $subscription_url); |
|
365 | 365 | |
366 | 366 | } |
367 | 367 | |
@@ -374,7 +374,7 @@ discard block |
||
374 | 374 | * @return bool |
375 | 375 | */ |
376 | 376 | public function is_available() { |
377 | - return ! empty( $this->enabled ); |
|
377 | + return !empty($this->enabled); |
|
378 | 378 | } |
379 | 379 | |
380 | 380 | /** |
@@ -383,7 +383,7 @@ discard block |
||
383 | 383 | * @return string |
384 | 384 | */ |
385 | 385 | public function get_title() { |
386 | - return apply_filters( 'getpaid_gateway_title', $this->title, $this ); |
|
386 | + return apply_filters('getpaid_gateway_title', $this->title, $this); |
|
387 | 387 | } |
388 | 388 | |
389 | 389 | /** |
@@ -392,7 +392,7 @@ discard block |
||
392 | 392 | * @return string |
393 | 393 | */ |
394 | 394 | public function get_description() { |
395 | - return apply_filters( 'getpaid_gateway_description', $this->description, $this ); |
|
395 | + return apply_filters('getpaid_gateway_description', $this->description, $this); |
|
396 | 396 | } |
397 | 397 | |
398 | 398 | /** |
@@ -404,9 +404,9 @@ discard block |
||
404 | 404 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
405 | 405 | * @return void |
406 | 406 | */ |
407 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
407 | + public function process_payment($invoice, $submission_data, $submission) { |
|
408 | 408 | // Process the payment then either redirect to the success page or the gateway. |
409 | - do_action( 'getpaid_process_invoice_payment_' . $this->id, $invoice, $submission_data, $submission ); |
|
409 | + do_action('getpaid_process_invoice_payment_' . $this->id, $invoice, $submission_data, $submission); |
|
410 | 410 | } |
411 | 411 | |
412 | 412 | /** |
@@ -420,8 +420,8 @@ discard block |
||
420 | 420 | * @param string $reason Refund reason. |
421 | 421 | * @return WP_Error|bool True or false based on success, or a WP_Error object. |
422 | 422 | */ |
423 | - public function process_refund( $invoice, $amount = null, $reason = '' ) { |
|
424 | - return apply_filters( 'getpaid_process_invoice_refund_' . $this->id, false, $invoice, $amount, $reason ); |
|
423 | + public function process_refund($invoice, $amount = null, $reason = '') { |
|
424 | + return apply_filters('getpaid_process_invoice_refund_' . $this->id, false, $invoice, $amount, $reason); |
|
425 | 425 | } |
426 | 426 | |
427 | 427 | /** |
@@ -430,8 +430,8 @@ discard block |
||
430 | 430 | * @param int $invoice_id 0 or invoice id. |
431 | 431 | * @param GetPaid_Payment_Form $form Current payment form. |
432 | 432 | */ |
433 | - public function payment_fields( $invoice_id, $form ) { |
|
434 | - do_action( 'getpaid_getpaid_gateway_payment_fields_' . $this->id, $invoice_id, $form ); |
|
433 | + public function payment_fields($invoice_id, $form) { |
|
434 | + do_action('getpaid_getpaid_gateway_payment_fields_' . $this->id, $invoice_id, $form); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | /** |
@@ -439,7 +439,7 @@ discard block |
||
439 | 439 | * |
440 | 440 | * @param array $admin_settings |
441 | 441 | */ |
442 | - public function admin_settings( $admin_settings ) { |
|
442 | + public function admin_settings($admin_settings) { |
|
443 | 443 | return $admin_settings; |
444 | 444 | } |
445 | 445 | |
@@ -448,8 +448,8 @@ discard block |
||
448 | 448 | * |
449 | 449 | * @param string $option |
450 | 450 | */ |
451 | - public function get_option( $option, $default = false ) { |
|
452 | - return wpinv_get_option( $this->id . '_' . $option, $default ); |
|
451 | + public function get_option($option, $default = false) { |
|
452 | + return wpinv_get_option($this->id . '_' . $option, $default); |
|
453 | 453 | } |
454 | 454 | |
455 | 455 | /** |
@@ -462,8 +462,8 @@ discard block |
||
462 | 462 | * @return bool True if the gateway supports the feature, false otherwise. |
463 | 463 | * @since 1.0.19 |
464 | 464 | */ |
465 | - public function supports( $feature ) { |
|
466 | - return apply_filters( 'getpaid_payment_gateway_supports', in_array( $feature, $this->supports ), $feature, $this ); |
|
465 | + public function supports($feature) { |
|
466 | + return apply_filters('getpaid_payment_gateway_supports', in_array($feature, $this->supports), $feature, $this); |
|
467 | 467 | } |
468 | 468 | |
469 | 469 | /** |
@@ -471,36 +471,36 @@ discard block |
||
471 | 471 | * |
472 | 472 | * @param bool $save whether or not to display the save button. |
473 | 473 | */ |
474 | - public function get_cc_form( $save = false ) { |
|
474 | + public function get_cc_form($save = false) { |
|
475 | 475 | |
476 | 476 | ob_start(); |
477 | 477 | |
478 | - $id_prefix = esc_attr( uniqid( $this->id ) ); |
|
478 | + $id_prefix = esc_attr(uniqid($this->id)); |
|
479 | 479 | |
480 | 480 | $months = array( |
481 | - '01' => __( 'January', 'invoicing' ), |
|
482 | - '02' => __( 'February', 'invoicing' ), |
|
483 | - '03' => __( 'March', 'invoicing' ), |
|
484 | - '04' => __( 'April', 'invoicing' ), |
|
485 | - '05' => __( 'May', 'invoicing' ), |
|
486 | - '06' => __( 'June', 'invoicing' ), |
|
487 | - '07' => __( 'July', 'invoicing' ), |
|
488 | - '08' => __( 'August', 'invoicing' ), |
|
489 | - '09' => __( 'September', 'invoicing' ), |
|
490 | - '10' => __( 'October', 'invoicing' ), |
|
491 | - '11' => __( 'November', 'invoicing' ), |
|
492 | - '12' => __( 'December', 'invoicing' ), |
|
481 | + '01' => __('January', 'invoicing'), |
|
482 | + '02' => __('February', 'invoicing'), |
|
483 | + '03' => __('March', 'invoicing'), |
|
484 | + '04' => __('April', 'invoicing'), |
|
485 | + '05' => __('May', 'invoicing'), |
|
486 | + '06' => __('June', 'invoicing'), |
|
487 | + '07' => __('July', 'invoicing'), |
|
488 | + '08' => __('August', 'invoicing'), |
|
489 | + '09' => __('September', 'invoicing'), |
|
490 | + '10' => __('October', 'invoicing'), |
|
491 | + '11' => __('November', 'invoicing'), |
|
492 | + '12' => __('December', 'invoicing'), |
|
493 | 493 | ); |
494 | 494 | |
495 | - $year = (int) date( 'Y', current_time( 'timestamp' ) ); |
|
495 | + $year = (int) date('Y', current_time('timestamp')); |
|
496 | 496 | $years = array(); |
497 | 497 | |
498 | - for ( $i = 0; $i <= 10; $i++ ) { |
|
499 | - $years[ $year + $i ] = $year + $i; |
|
498 | + for ($i = 0; $i <= 10; $i++) { |
|
499 | + $years[$year + $i] = $year + $i; |
|
500 | 500 | } |
501 | 501 | |
502 | 502 | ?> |
503 | - <div class="<?php echo esc_attr( $this->id );?>-cc-form getpaid-cc-form mt-1"> |
|
503 | + <div class="<?php echo esc_attr($this->id); ?>-cc-form getpaid-cc-form mt-1"> |
|
504 | 504 | |
505 | 505 | |
506 | 506 | <div class="getpaid-cc-card-inner"> |
@@ -509,14 +509,14 @@ discard block |
||
509 | 509 | <div class="col-12"> |
510 | 510 | |
511 | 511 | <div class="form-group"> |
512 | - <label for="<?php echo esc_attr( "$id_prefix-cc-number" ) ?>"><?php _e( 'Card number', 'invoicing' ); ?></label> |
|
512 | + <label for="<?php echo esc_attr("$id_prefix-cc-number") ?>"><?php _e('Card number', 'invoicing'); ?></label> |
|
513 | 513 | <div class="input-group input-group-sm"> |
514 | 514 | <div class="input-group-prepend "> |
515 | 515 | <span class="input-group-text"> |
516 | 516 | <i class="fa fa-credit-card"></i> |
517 | 517 | </span> |
518 | 518 | </div> |
519 | - <input type="text" name="<?php echo esc_attr( $this->id . '[cc_number]' ) ?>authorizenet[cc_number]" id="<?php echo esc_attr( "$id_prefix-cc-number" ) ?>" class="form-control form-control-sm"> |
|
519 | + <input type="text" name="<?php echo esc_attr($this->id . '[cc_number]') ?>authorizenet[cc_number]" id="<?php echo esc_attr("$id_prefix-cc-number") ?>" class="form-control form-control-sm"> |
|
520 | 520 | </div> |
521 | 521 | </div> |
522 | 522 | |
@@ -524,17 +524,17 @@ discard block |
||
524 | 524 | |
525 | 525 | <div class="col-12"> |
526 | 526 | <div class="form-group"> |
527 | - <label><?php _e( 'Expiration', 'invoicing' ); ?></label> |
|
527 | + <label><?php _e('Expiration', 'invoicing'); ?></label> |
|
528 | 528 | <div class="form-row"> |
529 | 529 | |
530 | 530 | <div class="col"> |
531 | - <select class="form-control form-control-sm" name="<?php echo esc_attr( $this->id );?>[cc_expire_month]"> |
|
532 | - <option disabled selected="selected"><?php _e( 'MM', 'invoicing' ); ?></option> |
|
531 | + <select class="form-control form-control-sm" name="<?php echo esc_attr($this->id); ?>[cc_expire_month]"> |
|
532 | + <option disabled selected="selected"><?php _e('MM', 'invoicing'); ?></option> |
|
533 | 533 | |
534 | 534 | <?php |
535 | - foreach ( $months as $key => $month ) { |
|
536 | - $key = esc_attr( $key ); |
|
537 | - $month = wpinv_clean( $month ); |
|
535 | + foreach ($months as $key => $month) { |
|
536 | + $key = esc_attr($key); |
|
537 | + $month = wpinv_clean($month); |
|
538 | 538 | echo "<option value='$key'>$month</option>" . PHP_EOL; |
539 | 539 | } |
540 | 540 | ?> |
@@ -543,13 +543,13 @@ discard block |
||
543 | 543 | </div> |
544 | 544 | |
545 | 545 | <div class="col"> |
546 | - <select class="form-control form-control-sm" name="<?php echo esc_attr( $this->id );?>[cc_expire_year]"> |
|
547 | - <option disabled selected="selected"><?php _e( 'YY', 'invoicing' ); ?></option> |
|
546 | + <select class="form-control form-control-sm" name="<?php echo esc_attr($this->id); ?>[cc_expire_year]"> |
|
547 | + <option disabled selected="selected"><?php _e('YY', 'invoicing'); ?></option> |
|
548 | 548 | |
549 | 549 | <?php |
550 | - foreach ( $years as $key => $year ) { |
|
551 | - $key = esc_attr( $key ); |
|
552 | - $year = wpinv_clean( $year ); |
|
550 | + foreach ($years as $key => $year) { |
|
551 | + $key = esc_attr($key); |
|
552 | + $year = wpinv_clean($year); |
|
553 | 553 | echo "<option value='$key'>$year</option>" . PHP_EOL; |
554 | 554 | } |
555 | 555 | ?> |
@@ -567,7 +567,7 @@ discard block |
||
567 | 567 | array( |
568 | 568 | 'name' => $this->id . '[cc_cvv2]', |
569 | 569 | 'id' => "$id_prefix-cc-cvv2", |
570 | - 'label' => __( 'CCV', 'invoicing' ), |
|
570 | + 'label' => __('CCV', 'invoicing'), |
|
571 | 571 | 'label_type' => 'vertical', |
572 | 572 | 'class' => 'form-control-sm', |
573 | 573 | ) |
@@ -579,7 +579,7 @@ discard block |
||
579 | 579 | |
580 | 580 | <?php |
581 | 581 | |
582 | - if ( $save ) { |
|
582 | + if ($save) { |
|
583 | 583 | echo $this->save_payment_method_checkbox(); |
584 | 584 | } |
585 | 585 | |
@@ -598,7 +598,7 @@ discard block |
||
598 | 598 | * |
599 | 599 | * @since 1.0.19 |
600 | 600 | */ |
601 | - public function new_payment_method_entry( $form ) { |
|
601 | + public function new_payment_method_entry($form) { |
|
602 | 602 | echo "<div class='getpaid-new-payment-method-form' style='display:none;'>$form</div>"; |
603 | 603 | } |
604 | 604 | |
@@ -608,16 +608,16 @@ discard block |
||
608 | 608 | * @since 1.0.19 |
609 | 609 | */ |
610 | 610 | public function saved_payment_methods() { |
611 | - $html = '<ul class="getpaid-saved-payment-methods m-0 mt-2" data-count="' . esc_attr( count( $this->get_tokens( $this->is_sandbox() ) ) ) . '">'; |
|
611 | + $html = '<ul class="getpaid-saved-payment-methods m-0 mt-2" data-count="' . esc_attr(count($this->get_tokens($this->is_sandbox()))) . '">'; |
|
612 | 612 | |
613 | - foreach ( $this->get_tokens( $this->is_sandbox() ) as $token ) { |
|
614 | - $html .= $this->get_saved_payment_method_option_html( $token ); |
|
613 | + foreach ($this->get_tokens($this->is_sandbox()) as $token) { |
|
614 | + $html .= $this->get_saved_payment_method_option_html($token); |
|
615 | 615 | } |
616 | 616 | |
617 | 617 | $html .= $this->get_new_payment_method_option_html(); |
618 | 618 | $html .= '</ul>'; |
619 | 619 | |
620 | - echo apply_filters( 'getpaid_payment_gateway_form_saved_payment_methods_html', $html, $this ); |
|
620 | + echo apply_filters('getpaid_payment_gateway_form_saved_payment_methods_html', $html, $this); |
|
621 | 621 | } |
622 | 622 | |
623 | 623 | /** |
@@ -627,7 +627,7 @@ discard block |
||
627 | 627 | * @param array $token Payment Token. |
628 | 628 | * @return string Generated payment method HTML |
629 | 629 | */ |
630 | - public function get_saved_payment_method_option_html( $token ) { |
|
630 | + public function get_saved_payment_method_option_html($token) { |
|
631 | 631 | |
632 | 632 | return sprintf( |
633 | 633 | '<li class="getpaid-payment-method form-group"> |
@@ -636,10 +636,10 @@ discard block |
||
636 | 636 | <span>%3$s</span> |
637 | 637 | </label> |
638 | 638 | </li>', |
639 | - esc_attr( $this->id ), |
|
640 | - esc_attr( $token['id'] ), |
|
641 | - esc_html( $token['name'] ), |
|
642 | - checked( empty( $token['default'] ), false, false ) |
|
639 | + esc_attr($this->id), |
|
640 | + esc_attr($token['id']), |
|
641 | + esc_html($token['name']), |
|
642 | + checked(empty($token['default']), false, false) |
|
643 | 643 | ); |
644 | 644 | |
645 | 645 | } |
@@ -651,7 +651,7 @@ discard block |
||
651 | 651 | */ |
652 | 652 | public function get_new_payment_method_option_html() { |
653 | 653 | |
654 | - $label = apply_filters( 'getpaid_new_payment_method_label', $this->new_method_label ? $this->new_method_label : __( 'Use a new payment method', 'invoicing' ), $this ); |
|
654 | + $label = apply_filters('getpaid_new_payment_method_label', $this->new_method_label ? $this->new_method_label : __('Use a new payment method', 'invoicing'), $this); |
|
655 | 655 | |
656 | 656 | return sprintf( |
657 | 657 | '<li class="getpaid-new-payment-method"> |
@@ -660,8 +660,8 @@ discard block |
||
660 | 660 | <span>%2$s</span> |
661 | 661 | </label> |
662 | 662 | </li>', |
663 | - esc_attr( $this->id ), |
|
664 | - esc_html( $label ) |
|
663 | + esc_attr($this->id), |
|
664 | + esc_html($label) |
|
665 | 665 | ); |
666 | 666 | |
667 | 667 | } |
@@ -680,8 +680,8 @@ discard block |
||
680 | 680 | <span>%2$s</span> |
681 | 681 | </label> |
682 | 682 | </p>', |
683 | - esc_attr( $this->id ), |
|
684 | - esc_html__( 'Save payment method', 'invoicing' ) |
|
683 | + esc_attr($this->id), |
|
684 | + esc_html__('Save payment method', 'invoicing') |
|
685 | 685 | ); |
686 | 686 | |
687 | 687 | } |
@@ -691,9 +691,9 @@ discard block |
||
691 | 691 | * |
692 | 692 | * @return array |
693 | 693 | */ |
694 | - public function register_gateway( $gateways ) { |
|
694 | + public function register_gateway($gateways) { |
|
695 | 695 | |
696 | - $gateways[ $this->id ] = array( |
|
696 | + $gateways[$this->id] = array( |
|
697 | 697 | |
698 | 698 | 'admin_label' => $this->method_title, |
699 | 699 | 'checkout_label' => $this->title, |
@@ -711,13 +711,13 @@ discard block |
||
711 | 711 | * @param WPInv_Invoice|null $invoice Invoice object or null. |
712 | 712 | * @return bool |
713 | 713 | */ |
714 | - public function is_sandbox( $invoice = null ) { |
|
714 | + public function is_sandbox($invoice = null) { |
|
715 | 715 | |
716 | - if ( ! empty( $invoice ) && ! $invoice->needs_payment() ) { |
|
716 | + if (!empty($invoice) && !$invoice->needs_payment()) { |
|
717 | 717 | return $invoice->get_mode() == 'test'; |
718 | 718 | } |
719 | 719 | |
720 | - return wpinv_is_test_mode( $this->id ); |
|
720 | + return wpinv_is_test_mode($this->id); |
|
721 | 721 | |
722 | 722 | } |
723 | 723 | |
@@ -735,15 +735,15 @@ discard block |
||
735 | 735 | * |
736 | 736 | * @return bool |
737 | 737 | */ |
738 | - public function validate_currency( $validation, $currency ) { |
|
738 | + public function validate_currency($validation, $currency) { |
|
739 | 739 | |
740 | 740 | // Required currencies. |
741 | - if ( ! empty( $this->currencies ) && ! in_array( $currency, $this->currencies ) ) { |
|
741 | + if (!empty($this->currencies) && !in_array($currency, $this->currencies)) { |
|
742 | 742 | return false; |
743 | 743 | } |
744 | 744 | |
745 | 745 | // Excluded currencies. |
746 | - if ( ! empty( $this->exclude_currencies ) && in_array( $currency, $this->exclude_currencies ) ) { |
|
746 | + if (!empty($this->exclude_currencies) && in_array($currency, $this->exclude_currencies)) { |
|
747 | 747 | return false; |
748 | 748 | } |
749 | 749 |
@@ -4,7 +4,7 @@ discard block |
||
4 | 4 | * |
5 | 5 | */ |
6 | 6 | |
7 | -defined( 'ABSPATH' ) || exit; |
|
7 | +defined('ABSPATH') || exit; |
|
8 | 8 | |
9 | 9 | /** |
10 | 10 | * Authorize.net Payment Gateway class. |
@@ -24,7 +24,7 @@ discard block |
||
24 | 24 | * |
25 | 25 | * @var array |
26 | 26 | */ |
27 | - protected $supports = array( 'subscription', 'sandbox', 'tokens', 'addons' ); |
|
27 | + protected $supports = array('subscription', 'sandbox', 'tokens', 'addons'); |
|
28 | 28 | |
29 | 29 | /** |
30 | 30 | * Payment method order. |
@@ -52,7 +52,7 @@ discard block |
||
52 | 52 | * |
53 | 53 | * @var array |
54 | 54 | */ |
55 | - public $currencies = array( 'USD', 'CAD', 'GBP', 'DKK', 'NOK', 'PLN', 'SEK', 'AUD', 'EUR', 'NZD' ); |
|
55 | + public $currencies = array('USD', 'CAD', 'GBP', 'DKK', 'NOK', 'PLN', 'SEK', 'AUD', 'EUR', 'NZD'); |
|
56 | 56 | |
57 | 57 | /** |
58 | 58 | * URL to view a transaction. |
@@ -66,12 +66,12 @@ discard block |
||
66 | 66 | */ |
67 | 67 | public function __construct() { |
68 | 68 | |
69 | - $this->title = __( 'Credit Card / Debit Card', 'invoicing' ); |
|
70 | - $this->method_title = __( 'Authorize.Net', 'invoicing' ); |
|
71 | - $this->notify_url = wpinv_get_ipn_url( $this->id ); |
|
69 | + $this->title = __('Credit Card / Debit Card', 'invoicing'); |
|
70 | + $this->method_title = __('Authorize.Net', 'invoicing'); |
|
71 | + $this->notify_url = wpinv_get_ipn_url($this->id); |
|
72 | 72 | |
73 | - add_filter( 'getpaid_daily_maintenance_should_expire_subscription', array( $this, 'maybe_renew_subscription' ), 10, 2 ); |
|
74 | - add_filter( 'getpaid_authorizenet_sandbox_notice', array( $this, 'sandbox_notice' ) ); |
|
73 | + add_filter('getpaid_daily_maintenance_should_expire_subscription', array($this, 'maybe_renew_subscription'), 10, 2); |
|
74 | + add_filter('getpaid_authorizenet_sandbox_notice', array($this, 'sandbox_notice')); |
|
75 | 75 | parent::__construct(); |
76 | 76 | } |
77 | 77 | |
@@ -81,13 +81,13 @@ discard block |
||
81 | 81 | * @param int $invoice_id 0 or invoice id. |
82 | 82 | * @param GetPaid_Payment_Form $form Current payment form. |
83 | 83 | */ |
84 | - public function payment_fields( $invoice_id, $form ) { |
|
84 | + public function payment_fields($invoice_id, $form) { |
|
85 | 85 | |
86 | 86 | // Let the user select a payment method. |
87 | 87 | echo $this->saved_payment_methods(); |
88 | 88 | |
89 | 89 | // Show the credit card entry form. |
90 | - echo $this->new_payment_method_entry( $this->get_cc_form( true ) ); |
|
90 | + echo $this->new_payment_method_entry($this->get_cc_form(true)); |
|
91 | 91 | } |
92 | 92 | |
93 | 93 | /** |
@@ -100,64 +100,64 @@ discard block |
||
100 | 100 | * @link https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-profile |
101 | 101 | * @return string|WP_Error Payment profile id. |
102 | 102 | */ |
103 | - public function create_customer_profile( $invoice, $submission_data, $save = true ) { |
|
103 | + public function create_customer_profile($invoice, $submission_data, $save = true) { |
|
104 | 104 | |
105 | 105 | // Remove non-digits from the number |
106 | - $submission_data['authorizenet']['cc_number'] = preg_replace('/\D/', '', $submission_data['authorizenet']['cc_number'] ); |
|
106 | + $submission_data['authorizenet']['cc_number'] = preg_replace('/\D/', '', $submission_data['authorizenet']['cc_number']); |
|
107 | 107 | |
108 | 108 | // Generate args. |
109 | 109 | $args = array( |
110 | 110 | 'createCustomerProfileRequest' => array( |
111 | 111 | 'merchantAuthentication' => $this->get_auth_params(), |
112 | 112 | 'profile' => array( |
113 | - 'merchantCustomerId' => getpaid_limit_length( $invoice->get_user_id(), 20 ), |
|
114 | - 'description' => getpaid_limit_length( $invoice->get_full_name(), 255 ), |
|
115 | - 'email' => getpaid_limit_length( $invoice->get_email(), 255 ), |
|
113 | + 'merchantCustomerId' => getpaid_limit_length($invoice->get_user_id(), 20), |
|
114 | + 'description' => getpaid_limit_length($invoice->get_full_name(), 255), |
|
115 | + 'email' => getpaid_limit_length($invoice->get_email(), 255), |
|
116 | 116 | 'paymentProfiles' => array( |
117 | 117 | 'customerType' => 'individual', |
118 | 118 | |
119 | 119 | // Billing information. |
120 | 120 | 'billTo' => array( |
121 | - 'firstName' => getpaid_limit_length( $invoice->get_first_name(), 50 ), |
|
122 | - 'lastName' => getpaid_limit_length( $invoice->get_last_name(), 50 ), |
|
123 | - 'address' => getpaid_limit_length( $invoice->get_last_name(), 60 ), |
|
124 | - 'city' => getpaid_limit_length( $invoice->get_city(), 40 ), |
|
125 | - 'state' => getpaid_limit_length( $invoice->get_state(), 40 ), |
|
126 | - 'zip' => getpaid_limit_length( $invoice->get_zip(), 20 ), |
|
127 | - 'country' => getpaid_limit_length( $invoice->get_country(), 60 ), |
|
121 | + 'firstName' => getpaid_limit_length($invoice->get_first_name(), 50), |
|
122 | + 'lastName' => getpaid_limit_length($invoice->get_last_name(), 50), |
|
123 | + 'address' => getpaid_limit_length($invoice->get_last_name(), 60), |
|
124 | + 'city' => getpaid_limit_length($invoice->get_city(), 40), |
|
125 | + 'state' => getpaid_limit_length($invoice->get_state(), 40), |
|
126 | + 'zip' => getpaid_limit_length($invoice->get_zip(), 20), |
|
127 | + 'country' => getpaid_limit_length($invoice->get_country(), 60), |
|
128 | 128 | ), |
129 | 129 | |
130 | 130 | // Payment information. |
131 | - 'payment' => $this->get_payment_information( $submission_data['authorizenet'] ), |
|
131 | + 'payment' => $this->get_payment_information($submission_data['authorizenet']), |
|
132 | 132 | ) |
133 | 133 | ), |
134 | - 'validationMode' => $this->is_sandbox( $invoice ) ? 'testMode' : 'liveMode', |
|
134 | + 'validationMode' => $this->is_sandbox($invoice) ? 'testMode' : 'liveMode', |
|
135 | 135 | ) |
136 | 136 | ); |
137 | 137 | |
138 | - $response = $this->post( apply_filters( 'getpaid_authorizenet_customer_profile_args', $args, $invoice ), $invoice ); |
|
138 | + $response = $this->post(apply_filters('getpaid_authorizenet_customer_profile_args', $args, $invoice), $invoice); |
|
139 | 139 | |
140 | - if ( is_wp_error( $response ) ) { |
|
140 | + if (is_wp_error($response)) { |
|
141 | 141 | return $response; |
142 | 142 | } |
143 | 143 | |
144 | - update_user_meta( $invoice->get_user_id(), $this->get_customer_profile_meta_name( $invoice ), $response->customerProfileId ); |
|
144 | + update_user_meta($invoice->get_user_id(), $this->get_customer_profile_meta_name($invoice), $response->customerProfileId); |
|
145 | 145 | |
146 | 146 | // Save the payment token. |
147 | - if ( $save ) { |
|
147 | + if ($save) { |
|
148 | 148 | $this->save_token( |
149 | 149 | array( |
150 | 150 | 'id' => $response->customerPaymentProfileIdList[0], |
151 | - 'name' => getpaid_get_card_name( $submission_data['authorizenet']['cc_number'] ) . '····' . substr( $submission_data['authorizenet']['cc_number'], -4 ), |
|
151 | + 'name' => getpaid_get_card_name($submission_data['authorizenet']['cc_number']) . '····' . substr($submission_data['authorizenet']['cc_number'], -4), |
|
152 | 152 | 'default' => true, |
153 | - 'type' => $this->is_sandbox( $invoice ) ? 'sandbox' : 'live', |
|
153 | + 'type' => $this->is_sandbox($invoice) ? 'sandbox' : 'live', |
|
154 | 154 | ) |
155 | 155 | ); |
156 | 156 | } |
157 | 157 | |
158 | 158 | // Add a note about the validation response. |
159 | 159 | $invoice->add_note( |
160 | - sprintf( __( 'Created Authorize.NET customer profile: %s', 'invoicing' ), $response->validationDirectResponseList[0] ), |
|
160 | + sprintf(__('Created Authorize.NET customer profile: %s', 'invoicing'), $response->validationDirectResponseList[0]), |
|
161 | 161 | false, |
162 | 162 | false, |
163 | 163 | true |
@@ -174,7 +174,7 @@ discard block |
||
174 | 174 | * @return string|WP_Error Profile id. |
175 | 175 | * @link https://developer.authorize.net/api/reference/index.html#customer-profiles-get-customer-profile |
176 | 176 | */ |
177 | - public function get_customer_profile( $profile_id ) { |
|
177 | + public function get_customer_profile($profile_id) { |
|
178 | 178 | |
179 | 179 | // Generate args. |
180 | 180 | $args = array( |
@@ -184,7 +184,7 @@ discard block |
||
184 | 184 | ) |
185 | 185 | ); |
186 | 186 | |
187 | - return $this->post( $args, false ); |
|
187 | + return $this->post($args, false); |
|
188 | 188 | |
189 | 189 | } |
190 | 190 | |
@@ -199,10 +199,10 @@ discard block |
||
199 | 199 | * @link https://developer.authorize.net/api/reference/index.html#customer-profiles-create-customer-profile |
200 | 200 | * @return string|WP_Error Profile id. |
201 | 201 | */ |
202 | - public function create_customer_payment_profile( $customer_profile, $invoice, $submission_data, $save ) { |
|
202 | + public function create_customer_payment_profile($customer_profile, $invoice, $submission_data, $save) { |
|
203 | 203 | |
204 | 204 | // Remove non-digits from the number |
205 | - $submission_data['authorizenet']['cc_number'] = preg_replace('/\D/', '', $submission_data['authorizenet']['cc_number'] ); |
|
205 | + $submission_data['authorizenet']['cc_number'] = preg_replace('/\D/', '', $submission_data['authorizenet']['cc_number']); |
|
206 | 206 | |
207 | 207 | // Generate args. |
208 | 208 | $args = array( |
@@ -213,34 +213,34 @@ discard block |
||
213 | 213 | |
214 | 214 | // Billing information. |
215 | 215 | 'billTo' => array( |
216 | - 'firstName' => getpaid_limit_length( $invoice->get_first_name(), 50 ), |
|
217 | - 'lastName' => getpaid_limit_length( $invoice->get_last_name(), 50 ), |
|
218 | - 'address' => getpaid_limit_length( $invoice->get_last_name(), 60 ), |
|
219 | - 'city' => getpaid_limit_length( $invoice->get_city(), 40 ), |
|
220 | - 'state' => getpaid_limit_length( $invoice->get_state(), 40 ), |
|
221 | - 'zip' => getpaid_limit_length( $invoice->get_zip(), 20 ), |
|
222 | - 'country' => getpaid_limit_length( $invoice->get_country(), 60 ), |
|
216 | + 'firstName' => getpaid_limit_length($invoice->get_first_name(), 50), |
|
217 | + 'lastName' => getpaid_limit_length($invoice->get_last_name(), 50), |
|
218 | + 'address' => getpaid_limit_length($invoice->get_last_name(), 60), |
|
219 | + 'city' => getpaid_limit_length($invoice->get_city(), 40), |
|
220 | + 'state' => getpaid_limit_length($invoice->get_state(), 40), |
|
221 | + 'zip' => getpaid_limit_length($invoice->get_zip(), 20), |
|
222 | + 'country' => getpaid_limit_length($invoice->get_country(), 60), |
|
223 | 223 | ), |
224 | 224 | |
225 | 225 | // Payment information. |
226 | - 'payment' => $this->get_payment_information( $submission_data['authorizenet'] ) |
|
226 | + 'payment' => $this->get_payment_information($submission_data['authorizenet']) |
|
227 | 227 | ), |
228 | - 'validationMode' => $this->is_sandbox( $invoice ) ? 'testMode' : 'liveMode', |
|
228 | + 'validationMode' => $this->is_sandbox($invoice) ? 'testMode' : 'liveMode', |
|
229 | 229 | ) |
230 | 230 | ); |
231 | 231 | |
232 | - $response = $this->post( apply_filters( 'getpaid_authorizenet_create_customer_payment_profile_args', $args, $invoice ), $invoice ); |
|
232 | + $response = $this->post(apply_filters('getpaid_authorizenet_create_customer_payment_profile_args', $args, $invoice), $invoice); |
|
233 | 233 | |
234 | - if ( is_wp_error( $response ) ) { |
|
234 | + if (is_wp_error($response)) { |
|
235 | 235 | return $response; |
236 | 236 | } |
237 | 237 | |
238 | 238 | // Save the payment token. |
239 | - if ( $save ) { |
|
239 | + if ($save) { |
|
240 | 240 | $this->save_token( |
241 | 241 | array( |
242 | 242 | 'id' => $response->customerPaymentProfileId, |
243 | - 'name' => getpaid_get_card_name( $submission_data['authorizenet']['cc_number'] ) . ' ···· ' . substr( $submission_data['authorizenet']['cc_number'], -4 ), |
|
243 | + 'name' => getpaid_get_card_name($submission_data['authorizenet']['cc_number']) . ' ···· ' . substr($submission_data['authorizenet']['cc_number'], -4), |
|
244 | 244 | 'default' => true |
245 | 245 | ) |
246 | 246 | ); |
@@ -248,7 +248,7 @@ discard block |
||
248 | 248 | |
249 | 249 | // Add a note about the validation response. |
250 | 250 | $invoice->add_note( |
251 | - sprintf( __( 'Saved Authorize.NET payment profile: %s', 'invoicing' ), $response->validationDirectResponse ), |
|
251 | + sprintf(__('Saved Authorize.NET payment profile: %s', 'invoicing'), $response->validationDirectResponse), |
|
252 | 252 | false, |
253 | 253 | false, |
254 | 254 | true |
@@ -267,7 +267,7 @@ discard block |
||
267 | 267 | * @return string|WP_Error Profile id. |
268 | 268 | * @link https://developer.authorize.net/api/reference/index.html#customer-profiles-get-customer-payment-profile |
269 | 269 | */ |
270 | - public function get_customer_payment_profile( $customer_profile_id, $payment_profile_id ) { |
|
270 | + public function get_customer_payment_profile($customer_profile_id, $payment_profile_id) { |
|
271 | 271 | |
272 | 272 | // Generate args. |
273 | 273 | $args = array( |
@@ -278,7 +278,7 @@ discard block |
||
278 | 278 | ) |
279 | 279 | ); |
280 | 280 | |
281 | - return $this->post( $args, false ); |
|
281 | + return $this->post($args, false); |
|
282 | 282 | |
283 | 283 | } |
284 | 284 | |
@@ -291,7 +291,7 @@ discard block |
||
291 | 291 | * @link https://developer.authorize.net/api/reference/index.html#payment-transactions-charge-a-customer-profile |
292 | 292 | * @return WP_Error|object |
293 | 293 | */ |
294 | - public function charge_customer_payment_profile( $customer_profile_id, $payment_profile_id, $invoice ) { |
|
294 | + public function charge_customer_payment_profile($customer_profile_id, $payment_profile_id, $invoice) { |
|
295 | 295 | |
296 | 296 | // Generate args. |
297 | 297 | $args = array( |
@@ -311,28 +311,28 @@ discard block |
||
311 | 311 | ) |
312 | 312 | ), |
313 | 313 | 'order' => array( |
314 | - 'invoiceNumber' => getpaid_limit_length( $invoice->get_number(), 20 ), |
|
314 | + 'invoiceNumber' => getpaid_limit_length($invoice->get_number(), 20), |
|
315 | 315 | ), |
316 | - 'lineItems' => array( 'lineItem' => $this->get_line_items( $invoice ) ), |
|
316 | + 'lineItems' => array('lineItem' => $this->get_line_items($invoice)), |
|
317 | 317 | 'tax' => array( |
318 | 318 | 'amount' => $invoice->get_total_tax(), |
319 | - 'name' => __( 'TAX', 'invoicing' ), |
|
319 | + 'name' => __('TAX', 'invoicing'), |
|
320 | 320 | ), |
321 | - 'poNumber' => getpaid_limit_length( $invoice->get_number(), 25 ), |
|
321 | + 'poNumber' => getpaid_limit_length($invoice->get_number(), 25), |
|
322 | 322 | 'customer' => array( |
323 | - 'id' => getpaid_limit_length( $invoice->get_user_id(), 25 ), |
|
324 | - 'email' => getpaid_limit_length( $invoice->get_email(), 25 ), |
|
323 | + 'id' => getpaid_limit_length($invoice->get_user_id(), 25), |
|
324 | + 'email' => getpaid_limit_length($invoice->get_email(), 25), |
|
325 | 325 | ), |
326 | 326 | 'customerIP' => $invoice->get_ip(), |
327 | 327 | ) |
328 | 328 | ) |
329 | 329 | ); |
330 | 330 | |
331 | - if ( 0 == $invoice->get_total_tax() ) { |
|
332 | - unset( $args['createTransactionRequest']['transactionRequest']['tax'] ); |
|
331 | + if (0 == $invoice->get_total_tax()) { |
|
332 | + unset($args['createTransactionRequest']['transactionRequest']['tax']); |
|
333 | 333 | } |
334 | 334 | |
335 | - return $this->post( apply_filters( 'getpaid_authorizenet_charge_customer_payment_profile_args', $args, $invoice ), $invoice ); |
|
335 | + return $this->post(apply_filters('getpaid_authorizenet_charge_customer_payment_profile_args', $args, $invoice), $invoice); |
|
336 | 336 | |
337 | 337 | } |
338 | 338 | |
@@ -342,29 +342,29 @@ discard block |
||
342 | 342 | * @param stdClass $result Api response. |
343 | 343 | * @param WPInv_Invoice $invoice Invoice. |
344 | 344 | */ |
345 | - public function process_charge_response( $result, $invoice ) { |
|
345 | + public function process_charge_response($result, $invoice) { |
|
346 | 346 | |
347 | 347 | wpinv_clear_errors(); |
348 | 348 | $response_code = (int) $result->transactionResponse->responseCode; |
349 | 349 | |
350 | 350 | // Succeeded. |
351 | - if ( 1 == $response_code || 4 == $response_code ) { |
|
351 | + if (1 == $response_code || 4 == $response_code) { |
|
352 | 352 | |
353 | 353 | // Maybe set a transaction id. |
354 | - if ( ! empty( $result->transactionResponse->transId ) ) { |
|
355 | - $invoice->set_transaction_id( $result->transactionResponse->transId ); |
|
354 | + if (!empty($result->transactionResponse->transId)) { |
|
355 | + $invoice->set_transaction_id($result->transactionResponse->transId); |
|
356 | 356 | } |
357 | 357 | |
358 | - $invoice->add_note( sprintf( __( 'Authentication code: %s (%s).', 'invoicing' ), $result->transactionResponse->authCode, $result->transactionResponse->accountNumber ), false, false, true ); |
|
358 | + $invoice->add_note(sprintf(__('Authentication code: %s (%s).', 'invoicing'), $result->transactionResponse->authCode, $result->transactionResponse->accountNumber), false, false, true); |
|
359 | 359 | |
360 | - if ( 1 == $response_code ) { |
|
360 | + if (1 == $response_code) { |
|
361 | 361 | return $invoice->mark_paid(); |
362 | 362 | } |
363 | 363 | |
364 | - $invoice->set_status( 'wpi-onhold' ); |
|
364 | + $invoice->set_status('wpi-onhold'); |
|
365 | 365 | $invoice->add_note( |
366 | 366 | sprintf( |
367 | - __( 'Held for review: %s', 'invoicing' ), |
|
367 | + __('Held for review: %s', 'invoicing'), |
|
368 | 368 | $result->transactionResponse->messages->message[0]->description |
369 | 369 | ) |
370 | 370 | ); |
@@ -373,11 +373,11 @@ discard block |
||
373 | 373 | |
374 | 374 | } |
375 | 375 | |
376 | - wpinv_set_error( 'card_declined', __( 'Credit card declined.', 'invoicing' ) ); |
|
376 | + wpinv_set_error('card_declined', __('Credit card declined.', 'invoicing')); |
|
377 | 377 | |
378 | - if ( ! empty( $result->transactionResponse->errors ) ) { |
|
378 | + if (!empty($result->transactionResponse->errors)) { |
|
379 | 379 | $errors = (object) $result->transactionResponse->errors; |
380 | - wpinv_set_error( $errors->error[0]->errorCode, esc_html( $errors->error[0]->errorText ) ); |
|
380 | + wpinv_set_error($errors->error[0]->errorCode, esc_html($errors->error[0]->errorText)); |
|
381 | 381 | } |
382 | 382 | |
383 | 383 | } |
@@ -389,10 +389,10 @@ discard block |
||
389 | 389 | * @param array $card Card details. |
390 | 390 | * @return array |
391 | 391 | */ |
392 | - public function get_payment_information( $card ) { |
|
392 | + public function get_payment_information($card) { |
|
393 | 393 | return array( |
394 | 394 | |
395 | - 'creditCard' => array ( |
|
395 | + 'creditCard' => array( |
|
396 | 396 | 'cardNumber' => $card['cc_number'], |
397 | 397 | 'expirationDate' => $card['cc_expire_year'] . '-' . $card['cc_expire_month'], |
398 | 398 | 'cardCode' => $card['cc_cvv2'], |
@@ -408,8 +408,8 @@ discard block |
||
408 | 408 | * @param WPInv_Invoice $invoice Invoice. |
409 | 409 | * @return string |
410 | 410 | */ |
411 | - public function get_customer_profile_meta_name( $invoice ) { |
|
412 | - return $this->is_sandbox( $invoice ) ? 'getpaid_authorizenet_sandbox_customer_profile_id' : 'getpaid_authorizenet_customer_profile_id'; |
|
411 | + public function get_customer_profile_meta_name($invoice) { |
|
412 | + return $this->is_sandbox($invoice) ? 'getpaid_authorizenet_sandbox_customer_profile_id' : 'getpaid_authorizenet_customer_profile_id'; |
|
413 | 413 | } |
414 | 414 | |
415 | 415 | /** |
@@ -420,34 +420,34 @@ discard block |
||
420 | 420 | * @param WPInv_Invoice $invoice |
421 | 421 | * @return WP_Error|string The payment profile id |
422 | 422 | */ |
423 | - public function validate_submission_data( $submission_data, $invoice ) { |
|
423 | + public function validate_submission_data($submission_data, $invoice) { |
|
424 | 424 | |
425 | 425 | // Validate authentication details. |
426 | 426 | $auth = $this->get_auth_params(); |
427 | 427 | |
428 | - if ( empty( $auth['name'] ) || empty( $auth['transactionKey'] ) ) { |
|
429 | - return new WP_Error( 'invalid_settings', __( 'Please set-up your login id and transaction key before using this gateway.', 'invoicing') ); |
|
428 | + if (empty($auth['name']) || empty($auth['transactionKey'])) { |
|
429 | + return new WP_Error('invalid_settings', __('Please set-up your login id and transaction key before using this gateway.', 'invoicing')); |
|
430 | 430 | } |
431 | 431 | |
432 | 432 | // Validate the payment method. |
433 | - if ( empty( $submission_data['getpaid-authorizenet-payment-method'] ) ) { |
|
434 | - return new WP_Error( 'invalid_payment_method', __( 'Please select a different payment method or add a new card.', 'invoicing') ); |
|
433 | + if (empty($submission_data['getpaid-authorizenet-payment-method'])) { |
|
434 | + return new WP_Error('invalid_payment_method', __('Please select a different payment method or add a new card.', 'invoicing')); |
|
435 | 435 | } |
436 | 436 | |
437 | 437 | // Are we adding a new payment method? |
438 | - if ( 'new' != $submission_data['getpaid-authorizenet-payment-method'] ) { |
|
438 | + if ('new' != $submission_data['getpaid-authorizenet-payment-method']) { |
|
439 | 439 | return $submission_data['getpaid-authorizenet-payment-method']; |
440 | 440 | } |
441 | 441 | |
442 | 442 | // Retrieve the customer profile id. |
443 | - $profile_id = get_user_meta( $invoice->get_user_id(), $this->get_customer_profile_meta_name( $invoice ), true ); |
|
443 | + $profile_id = get_user_meta($invoice->get_user_id(), $this->get_customer_profile_meta_name($invoice), true); |
|
444 | 444 | |
445 | 445 | // Create payment method. |
446 | - if ( empty( $profile_id ) ) { |
|
447 | - return $this->create_customer_profile( $invoice, $submission_data, ! empty( $submission_data['getpaid-authorizenet-new-payment-method'] ) ); |
|
446 | + if (empty($profile_id)) { |
|
447 | + return $this->create_customer_profile($invoice, $submission_data, !empty($submission_data['getpaid-authorizenet-new-payment-method'])); |
|
448 | 448 | } |
449 | 449 | |
450 | - return $this->create_customer_payment_profile( $profile_id, $invoice, $submission_data, ! empty( $submission_data['getpaid-authorizenet-new-payment-method'] ) ); |
|
450 | + return $this->create_customer_payment_profile($profile_id, $invoice, $submission_data, !empty($submission_data['getpaid-authorizenet-new-payment-method'])); |
|
451 | 451 | |
452 | 452 | } |
453 | 453 | |
@@ -458,16 +458,16 @@ discard block |
||
458 | 458 | * @param WPInv_Invoice $invoice Invoice. |
459 | 459 | * @return array |
460 | 460 | */ |
461 | - public function get_line_items( $invoice ) { |
|
461 | + public function get_line_items($invoice) { |
|
462 | 462 | $items = array(); |
463 | 463 | |
464 | - foreach ( $invoice->get_items() as $item ) { |
|
464 | + foreach ($invoice->get_items() as $item) { |
|
465 | 465 | |
466 | 466 | $amount = $invoice->is_renewal() ? $item->get_price() : $item->get_initial_price(); |
467 | 467 | $items[] = array( |
468 | - 'itemId' => getpaid_limit_length( $item->get_id(), 31 ), |
|
469 | - 'name' => getpaid_limit_length( $item->get_raw_name(), 31 ), |
|
470 | - 'description' => getpaid_limit_length( $item->get_description(), 255 ), |
|
468 | + 'itemId' => getpaid_limit_length($item->get_id(), 31), |
|
469 | + 'name' => getpaid_limit_length($item->get_raw_name(), 31), |
|
470 | + 'description' => getpaid_limit_length($item->get_description(), 255), |
|
471 | 471 | 'quantity' => (string) $invoice->get_template() == 'amount' ? 1 : $item->get_quantity(), |
472 | 472 | 'unitPrice' => (float) $amount, |
473 | 473 | 'taxable' => wpinv_use_taxes() && $invoice->is_taxable() && 'tax-exempt' != $item->get_vat_rule(), |
@@ -475,15 +475,15 @@ discard block |
||
475 | 475 | |
476 | 476 | } |
477 | 477 | |
478 | - foreach ( $invoice->get_fees() as $fee_name => $fee ) { |
|
478 | + foreach ($invoice->get_fees() as $fee_name => $fee) { |
|
479 | 479 | |
480 | - $amount = $invoice->is_renewal() ? $fee['recurring_fee'] : $fee['initial_fee']; |
|
480 | + $amount = $invoice->is_renewal() ? $fee['recurring_fee'] : $fee['initial_fee']; |
|
481 | 481 | |
482 | - if ( $amount > 0 ) { |
|
482 | + if ($amount > 0) { |
|
483 | 483 | $items[] = array( |
484 | - 'itemId' => getpaid_limit_length( $fee_name, 31 ), |
|
485 | - 'name' => getpaid_limit_length( $fee_name, 31 ), |
|
486 | - 'description' => getpaid_limit_length( $fee_name, 255 ), |
|
484 | + 'itemId' => getpaid_limit_length($fee_name, 31), |
|
485 | + 'name' => getpaid_limit_length($fee_name, 31), |
|
486 | + 'description' => getpaid_limit_length($fee_name, 255), |
|
487 | 487 | 'quantity' => '1', |
488 | 488 | 'unitPrice' => (float) $amount, |
489 | 489 | 'taxable' => false, |
@@ -504,36 +504,36 @@ discard block |
||
504 | 504 | * @param GetPaid_Payment_Form_Submission $submission Checkout submission. |
505 | 505 | * @return array |
506 | 506 | */ |
507 | - public function process_payment( $invoice, $submission_data, $submission ) { |
|
507 | + public function process_payment($invoice, $submission_data, $submission) { |
|
508 | 508 | |
509 | 509 | // Validate the submitted data. |
510 | - $payment_profile_id = $this->validate_submission_data( $submission_data, $invoice ); |
|
510 | + $payment_profile_id = $this->validate_submission_data($submission_data, $invoice); |
|
511 | 511 | |
512 | 512 | // Do we have an error? |
513 | - if ( is_wp_error( $payment_profile_id ) ) { |
|
514 | - wpinv_set_error( $payment_profile_id->get_error_code(), $payment_profile_id->get_error_message() ); |
|
513 | + if (is_wp_error($payment_profile_id)) { |
|
514 | + wpinv_set_error($payment_profile_id->get_error_code(), $payment_profile_id->get_error_message()); |
|
515 | 515 | wpinv_send_back_to_checkout(); |
516 | 516 | } |
517 | 517 | |
518 | 518 | // Save the payment method to the order. |
519 | - update_post_meta( $invoice->get_id(), 'getpaid_authorizenet_profile_id', $payment_profile_id ); |
|
519 | + update_post_meta($invoice->get_id(), 'getpaid_authorizenet_profile_id', $payment_profile_id); |
|
520 | 520 | |
521 | 521 | // Check if this is a subscription or not. |
522 | - $subscription = getpaid_get_invoice_subscription( $invoice ); |
|
523 | - if ( ! empty( $subscription ) ) { |
|
524 | - $this->process_subscription( $invoice, $subscription ); |
|
522 | + $subscription = getpaid_get_invoice_subscription($invoice); |
|
523 | + if (!empty($subscription)) { |
|
524 | + $this->process_subscription($invoice, $subscription); |
|
525 | 525 | } |
526 | 526 | |
527 | 527 | // If it is free, send to the success page. |
528 | - if ( ! $invoice->needs_payment() ) { |
|
528 | + if (!$invoice->needs_payment()) { |
|
529 | 529 | $invoice->mark_paid(); |
530 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
530 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
531 | 531 | } |
532 | 532 | |
533 | 533 | // Charge the payment profile. |
534 | - $this->process_initial_payment( $invoice ); |
|
534 | + $this->process_initial_payment($invoice); |
|
535 | 535 | |
536 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
536 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
537 | 537 | |
538 | 538 | exit; |
539 | 539 | |
@@ -544,22 +544,22 @@ discard block |
||
544 | 544 | * |
545 | 545 | * @param WPInv_Invoice $invoice Invoice. |
546 | 546 | */ |
547 | - protected function process_initial_payment( $invoice ) { |
|
547 | + protected function process_initial_payment($invoice) { |
|
548 | 548 | |
549 | - $payment_profile_id = get_post_meta( $invoice->get_id(), 'getpaid_authorizenet_profile_id', true ); |
|
550 | - $customer_profile = get_user_meta( $invoice->get_user_id(), $this->get_customer_profile_meta_name( $invoice ), true ); |
|
551 | - $result = $this->charge_customer_payment_profile( $customer_profile, $payment_profile_id, $invoice ); |
|
549 | + $payment_profile_id = get_post_meta($invoice->get_id(), 'getpaid_authorizenet_profile_id', true); |
|
550 | + $customer_profile = get_user_meta($invoice->get_user_id(), $this->get_customer_profile_meta_name($invoice), true); |
|
551 | + $result = $this->charge_customer_payment_profile($customer_profile, $payment_profile_id, $invoice); |
|
552 | 552 | |
553 | 553 | // Do we have an error? |
554 | - if ( is_wp_error( $result ) ) { |
|
555 | - wpinv_set_error( $result->get_error_code(), $result->get_error_message() ); |
|
554 | + if (is_wp_error($result)) { |
|
555 | + wpinv_set_error($result->get_error_code(), $result->get_error_message()); |
|
556 | 556 | wpinv_send_back_to_checkout(); |
557 | 557 | } |
558 | 558 | |
559 | 559 | // Process the response. |
560 | - $this->process_charge_response( $result, $invoice ); |
|
560 | + $this->process_charge_response($result, $invoice); |
|
561 | 561 | |
562 | - if ( wpinv_get_errors() ) { |
|
562 | + if (wpinv_get_errors()) { |
|
563 | 563 | wpinv_send_back_to_checkout(); |
564 | 564 | } |
565 | 565 | |
@@ -571,24 +571,24 @@ discard block |
||
571 | 571 | * @param WPInv_Invoice $invoice Invoice. |
572 | 572 | * @param WPInv_Subscription $subscription Subscription. |
573 | 573 | */ |
574 | - public function process_subscription( $invoice, $subscription ) { |
|
574 | + public function process_subscription($invoice, $subscription) { |
|
575 | 575 | |
576 | 576 | // Check if there is an initial amount to charge. |
577 | - if ( (float) $invoice->get_total() > 0 ) { |
|
578 | - $this->process_initial_payment( $invoice ); |
|
577 | + if ((float) $invoice->get_total() > 0) { |
|
578 | + $this->process_initial_payment($invoice); |
|
579 | 579 | } |
580 | 580 | |
581 | 581 | // Activate the subscription. |
582 | - $duration = strtotime( $subscription->get_expiration() ) - strtotime( $subscription->get_date_created() ); |
|
583 | - $expiry = date( 'Y-m-d H:i:s', ( current_time( 'timestamp' ) + $duration ) ); |
|
582 | + $duration = strtotime($subscription->get_expiration()) - strtotime($subscription->get_date_created()); |
|
583 | + $expiry = date('Y-m-d H:i:s', (current_time('timestamp') + $duration)); |
|
584 | 584 | |
585 | - $subscription->set_next_renewal_date( $expiry ); |
|
586 | - $subscription->set_date_created( current_time( 'mysql' ) ); |
|
587 | - $subscription->set_profile_id( $invoice->generate_key() ); |
|
585 | + $subscription->set_next_renewal_date($expiry); |
|
586 | + $subscription->set_date_created(current_time('mysql')); |
|
587 | + $subscription->set_profile_id($invoice->generate_key()); |
|
588 | 588 | $subscription->activate(); |
589 | 589 | |
590 | 590 | // Redirect to the success page. |
591 | - wpinv_send_to_success_page( array( 'invoice_key' => $invoice->get_key() ) ); |
|
591 | + wpinv_send_to_success_page(array('invoice_key' => $invoice->get_key())); |
|
592 | 592 | |
593 | 593 | } |
594 | 594 | |
@@ -599,20 +599,20 @@ discard block |
||
599 | 599 | * @param bool $should_expire |
600 | 600 | * @param WPInv_Subscription $subscription |
601 | 601 | */ |
602 | - public function maybe_renew_subscription( $should_expire, $subscription ) { |
|
602 | + public function maybe_renew_subscription($should_expire, $subscription) { |
|
603 | 603 | |
604 | 604 | // Ensure its our subscription && it's active. |
605 | - if ( $this->id != $subscription->get_gateway() || ! $subscription->has_status( 'active trialling' ) ) { |
|
605 | + if ($this->id != $subscription->get_gateway() || !$subscription->has_status('active trialling')) { |
|
606 | 606 | return $should_expire; |
607 | 607 | } |
608 | 608 | |
609 | 609 | // If this is the last renewal, complete the subscription. |
610 | - if ( $subscription->is_last_renewal() ) { |
|
610 | + if ($subscription->is_last_renewal()) { |
|
611 | 611 | $subscription->complete(); |
612 | 612 | return false; |
613 | 613 | } |
614 | 614 | |
615 | - $this->renew_subscription( $subscription ); |
|
615 | + $this->renew_subscription($subscription); |
|
616 | 616 | |
617 | 617 | return false; |
618 | 618 | |
@@ -623,28 +623,28 @@ discard block |
||
623 | 623 | * |
624 | 624 | * @param WPInv_Subscription $subscription |
625 | 625 | */ |
626 | - public function renew_subscription( $subscription ) { |
|
626 | + public function renew_subscription($subscription) { |
|
627 | 627 | |
628 | 628 | // Generate the renewal invoice. |
629 | 629 | $new_invoice = $subscription->create_payment(); |
630 | 630 | $old_invoice = $subscription->get_parent_payment(); |
631 | 631 | |
632 | - if ( empty( $new_invoice ) ) { |
|
633 | - $old_invoice->add_note( __( 'Error generating a renewal invoice.', 'invoicing' ), false, false, false ); |
|
632 | + if (empty($new_invoice)) { |
|
633 | + $old_invoice->add_note(__('Error generating a renewal invoice.', 'invoicing'), false, false, false); |
|
634 | 634 | $subscription->failing(); |
635 | 635 | return; |
636 | 636 | } |
637 | 637 | |
638 | 638 | // Charge the payment method. |
639 | - $payment_profile_id = get_post_meta( $old_invoice->get_id(), 'getpaid_authorizenet_profile_id', true ); |
|
640 | - $customer_profile = get_user_meta( $old_invoice->get_user_id(), $this->get_customer_profile_meta_name( $old_invoice ), true ); |
|
641 | - $result = $this->charge_customer_payment_profile( $customer_profile, $payment_profile_id, $new_invoice ); |
|
639 | + $payment_profile_id = get_post_meta($old_invoice->get_id(), 'getpaid_authorizenet_profile_id', true); |
|
640 | + $customer_profile = get_user_meta($old_invoice->get_user_id(), $this->get_customer_profile_meta_name($old_invoice), true); |
|
641 | + $result = $this->charge_customer_payment_profile($customer_profile, $payment_profile_id, $new_invoice); |
|
642 | 642 | |
643 | 643 | // Do we have an error? |
644 | - if ( is_wp_error( $result ) ) { |
|
644 | + if (is_wp_error($result)) { |
|
645 | 645 | |
646 | 646 | $old_invoice->add_note( |
647 | - sprintf( __( 'Error renewing subscription : ( %s ).', 'invoicing' ), $result->get_error_message() ), |
|
647 | + sprintf(__('Error renewing subscription : ( %s ).', 'invoicing'), $result->get_error_message()), |
|
648 | 648 | true, |
649 | 649 | false, |
650 | 650 | true |
@@ -655,12 +655,12 @@ discard block |
||
655 | 655 | } |
656 | 656 | |
657 | 657 | // Process the response. |
658 | - $this->process_charge_response( $result, $new_invoice ); |
|
658 | + $this->process_charge_response($result, $new_invoice); |
|
659 | 659 | |
660 | - if ( wpinv_get_errors() ) { |
|
660 | + if (wpinv_get_errors()) { |
|
661 | 661 | |
662 | 662 | $old_invoice->add_note( |
663 | - sprintf( __( 'Error renewing subscription : ( %s ).', 'invoicing' ), getpaid_get_errors_html() ), |
|
663 | + sprintf(__('Error renewing subscription : ( %s ).', 'invoicing'), getpaid_get_errors_html()), |
|
664 | 664 | true, |
665 | 665 | false, |
666 | 666 | true |
@@ -670,7 +670,7 @@ discard block |
||
670 | 670 | |
671 | 671 | } |
672 | 672 | |
673 | - $subscription->add_payment( array(), $new_invoice ); |
|
673 | + $subscription->add_payment(array(), $new_invoice); |
|
674 | 674 | $subscription->renew(); |
675 | 675 | } |
676 | 676 | |
@@ -680,7 +680,7 @@ discard block |
||
680 | 680 | public function sandbox_notice() { |
681 | 681 | |
682 | 682 | return sprintf( |
683 | - __( 'SANDBOX ENABLED. You can use sandbox testing details only. See the %sAuthorize.NET Sandbox Testing Guide%s for more details.', 'invoicing' ), |
|
683 | + __('SANDBOX ENABLED. You can use sandbox testing details only. See the %sAuthorize.NET Sandbox Testing Guide%s for more details.', 'invoicing'), |
|
684 | 684 | '<a href="https://developer.authorize.net/hello_world/testing_guide.html">', |
685 | 685 | '</a>' |
686 | 686 | ); |
@@ -692,42 +692,42 @@ discard block |
||
692 | 692 | * |
693 | 693 | * @param array $admin_settings |
694 | 694 | */ |
695 | - public function admin_settings( $admin_settings ) { |
|
695 | + public function admin_settings($admin_settings) { |
|
696 | 696 | |
697 | 697 | $currencies = sprintf( |
698 | - __( 'Supported Currencies: %s', 'invoicing' ), |
|
699 | - implode( ', ', $this->currencies ) |
|
698 | + __('Supported Currencies: %s', 'invoicing'), |
|
699 | + implode(', ', $this->currencies) |
|
700 | 700 | ); |
701 | 701 | |
702 | 702 | $admin_settings['authorizenet_active']['desc'] .= " ($currencies)"; |
703 | - $admin_settings['authorizenet_desc']['std'] = __( 'Pay securely using your credit or debit card.', 'invoicing' ); |
|
703 | + $admin_settings['authorizenet_desc']['std'] = __('Pay securely using your credit or debit card.', 'invoicing'); |
|
704 | 704 | |
705 | 705 | $admin_settings['authorizenet_login_id'] = array( |
706 | 706 | 'type' => 'text', |
707 | 707 | 'id' => 'authorizenet_login_id', |
708 | - 'name' => __( 'API Login ID', 'invoicing' ), |
|
709 | - 'desc' => '<a href="https://support.authorize.net/s/article/How-do-I-obtain-my-API-Login-ID-and-Transaction-Key"><em>' . __( 'How do I obtain my API Login ID and Transaction Key?', 'invoicing' ) . '</em></a>', |
|
708 | + 'name' => __('API Login ID', 'invoicing'), |
|
709 | + 'desc' => '<a href="https://support.authorize.net/s/article/How-do-I-obtain-my-API-Login-ID-and-Transaction-Key"><em>' . __('How do I obtain my API Login ID and Transaction Key?', 'invoicing') . '</em></a>', |
|
710 | 710 | ); |
711 | 711 | |
712 | 712 | $admin_settings['authorizenet_transaction_key'] = array( |
713 | 713 | 'type' => 'text', |
714 | 714 | 'id' => 'authorizenet_transaction_key', |
715 | - 'name' => __( 'Transaction Key', 'invoicing' ), |
|
715 | + 'name' => __('Transaction Key', 'invoicing'), |
|
716 | 716 | ); |
717 | 717 | |
718 | 718 | $admin_settings['authorizenet_signature_key'] = array( |
719 | 719 | 'type' => 'text', |
720 | 720 | 'id' => 'authorizenet_signature_key', |
721 | - 'name' => __( 'Signature Key', 'invoicing' ), |
|
722 | - 'desc' => '<a href="https://support.authorize.net/s/article/What-is-a-Signature-Key"><em>' . __( 'Learn more.', 'invoicing' ) . '</em></a>', |
|
721 | + 'name' => __('Signature Key', 'invoicing'), |
|
722 | + 'desc' => '<a href="https://support.authorize.net/s/article/What-is-a-Signature-Key"><em>' . __('Learn more.', 'invoicing') . '</em></a>', |
|
723 | 723 | ); |
724 | 724 | |
725 | 725 | $admin_settings['authorizenet_ipn_url'] = array( |
726 | 726 | 'type' => 'ipn_url', |
727 | 727 | 'id' => 'authorizenet_ipn_url', |
728 | - 'name' => __( 'Webhook URL', 'invoicing' ), |
|
728 | + 'name' => __('Webhook URL', 'invoicing'), |
|
729 | 729 | 'std' => $this->notify_url, |
730 | - 'desc' => __( 'Create a new webhook using this URL as the endpoint URL and set it to receive all payment events.', 'invoicing' ) . ' <a href="https://support.authorize.net/s/article/How-do-I-add-edit-Webhook-notification-end-points"><em>' . __( 'Learn more.', 'invoicing' ) . '</em></a>', |
|
730 | + 'desc' => __('Create a new webhook using this URL as the endpoint URL and set it to receive all payment events.', 'invoicing') . ' <a href="https://support.authorize.net/s/article/How-do-I-add-edit-Webhook-notification-end-points"><em>' . __('Learn more.', 'invoicing') . '</em></a>', |
|
731 | 731 | 'custom' => 'authorizenet', |
732 | 732 | 'readonly' => true, |
733 | 733 | ); |