@@ -404,10 +404,6 @@ |
||
404 | 404 | /** |
405 | 405 | * Log a "Cleared" request. |
406 | 406 | * |
407 | - * @param array $response |
|
408 | - * @param EEI_Payment $payment |
|
409 | - * @param string $info |
|
410 | - * @return void |
|
411 | 407 | */ |
412 | 408 | private function _log_clean_request( $request_prms, $payment, $info ) { |
413 | 409 | $cleaned_request_data = $request_prms; |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit('NO direct script access allowed'); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('NO direct script access allowed'); } |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * ---------------------------------------------- |
@@ -76,10 +76,10 @@ discard block |
||
76 | 76 | * |
77 | 77 | * @param type $settings_array |
78 | 78 | */ |
79 | - public function set_settings( $settings_array ) { |
|
79 | + public function set_settings($settings_array) { |
|
80 | 80 | parent::set_settings($settings_array); |
81 | 81 | // Redirect URL. |
82 | - if ( $this->_debug_mode ) { |
|
82 | + if ($this->_debug_mode) { |
|
83 | 83 | $this->_base_gateway_url = 'https://api-3t.sandbox.paypal.com/nvp'; |
84 | 84 | } else { |
85 | 85 | $this->_base_gateway_url = 'https://api-3t.paypal.com/nvp'; |
@@ -94,19 +94,19 @@ discard block |
||
94 | 94 | * @param type $return_url |
95 | 95 | * @param type $cancel_url |
96 | 96 | */ |
97 | - public function set_redirection_info( $payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL ) { |
|
98 | - if ( ! $payment instanceof EEI_Payment ) { |
|
99 | - $payment->set_gateway_response( __( 'Error. No associated payment was found.', 'event_espresso' ) ); |
|
100 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
97 | + public function set_redirection_info($payment, $billing_info = array(), $return_url = NULL, $notify_url = NULL, $cancel_url = NULL) { |
|
98 | + if ( ! $payment instanceof EEI_Payment) { |
|
99 | + $payment->set_gateway_response(__('Error. No associated payment was found.', 'event_espresso')); |
|
100 | + $payment->set_status($this->_pay_model->failed_status()); |
|
101 | 101 | return $payment; |
102 | 102 | } |
103 | 103 | $transaction = $payment->transaction(); |
104 | - if ( ! $transaction instanceof EEI_Transaction ) { |
|
105 | - $payment->set_gateway_response( __( 'Could not process this payment because it has no associated transaction.', 'event_espresso' ) ); |
|
106 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
104 | + if ( ! $transaction instanceof EEI_Transaction) { |
|
105 | + $payment->set_gateway_response(__('Could not process this payment because it has no associated transaction.', 'event_espresso')); |
|
106 | + $payment->set_status($this->_pay_model->failed_status()); |
|
107 | 107 | return $payment; |
108 | 108 | } |
109 | - $order_description = substr( sprintf( __('Event Registrations from %s', 'event_espresso'), get_bloginfo('name') ), 0, 127 ); |
|
109 | + $order_description = substr(sprintf(__('Event Registrations from %s', 'event_espresso'), get_bloginfo('name')), 0, 127); |
|
110 | 110 | $primary_registration = $transaction->primary_registration(); |
111 | 111 | $primary_attendee = $primary_registration instanceof EE_Registration ? $primary_registration->attendee() : false; |
112 | 112 | $locale = explode('-', get_bloginfo('language')); |
@@ -120,28 +120,28 @@ discard block |
||
120 | 120 | 'RETURNURL' => $return_url, |
121 | 121 | 'CANCELURL' => $cancel_url, |
122 | 122 | 'PAYMENTREQUEST_0_PAYMENTACTION' => 'Sale', |
123 | - 'SOLUTIONTYPE' => 'Sole', // Buyer does not need to create a PayPal account to check out. This is referred to as PayPal Account Optional. |
|
124 | - 'BUTTONSOURCE' => 'EventEspresso_SP',//EE will blow up if you change this |
|
123 | + 'SOLUTIONTYPE' => 'Sole', // Buyer does not need to create a PayPal account to check out. This is referred to as PayPal Account Optional. |
|
124 | + 'BUTTONSOURCE' => 'EventEspresso_SP', //EE will blow up if you change this |
|
125 | 125 | 'LOCALECODE' => $locale[1] // Locale of the pages displayed by PayPal during Express Checkout. |
126 | 126 | ); |
127 | 127 | |
128 | 128 | // Show itemized list. |
129 | - if ( EEH_Money::compare_floats( $payment->amount(), $transaction->total(), '==' ) ) { |
|
129 | + if (EEH_Money::compare_floats($payment->amount(), $transaction->total(), '==')) { |
|
130 | 130 | $item_num = 0; |
131 | 131 | $itemized_sum = 0; |
132 | 132 | $total_line_items = $transaction->total_line_item(); |
133 | 133 | // Go through each item in the list. |
134 | - foreach ( $total_line_items->get_items() as $line_item ) { |
|
135 | - if ( $line_item instanceof EE_Line_Item ) { |
|
134 | + foreach ($total_line_items->get_items() as $line_item) { |
|
135 | + if ($line_item instanceof EE_Line_Item) { |
|
136 | 136 | // PayPal doesn't like line items with 0.00 amount, so we may skip those. |
137 | - if ( EEH_Money::compare_floats( $line_item->total(), '0.00', '==' ) ) { |
|
137 | + if (EEH_Money::compare_floats($line_item->total(), '0.00', '==')) { |
|
138 | 138 | continue; |
139 | 139 | } |
140 | 140 | |
141 | 141 | $unit_price = $line_item->unit_price(); |
142 | 142 | $line_item_quantity = $line_item->quantity(); |
143 | 143 | // This is a discount. |
144 | - if ( $line_item->is_percent() ) { |
|
144 | + if ($line_item->is_percent()) { |
|
145 | 145 | $unit_price = $line_item->total(); |
146 | 146 | $line_item_quantity = 1; |
147 | 147 | } |
@@ -150,7 +150,7 @@ discard block |
||
150 | 150 | // Item description. |
151 | 151 | $token_request_dtls['L_PAYMENTREQUEST_0_DESC'.$item_num] = substr($line_item->desc(), 0, 127); |
152 | 152 | // Cost of individual item. |
153 | - $token_request_dtls['L_PAYMENTREQUEST_0_AMT'.$item_num] = $this->format_currency( $unit_price ); |
|
153 | + $token_request_dtls['L_PAYMENTREQUEST_0_AMT'.$item_num] = $this->format_currency($unit_price); |
|
154 | 154 | // Item Number. |
155 | 155 | $token_request_dtls['L_PAYMENTREQUEST_0_NUMBER'.$item_num] = $item_num + 1; |
156 | 156 | // Item quantity. |
@@ -167,16 +167,16 @@ discard block |
||
167 | 167 | $token_request_dtls['PAYMENTREQUEST_0_SHIPPINGAMT'] = '0'; |
168 | 168 | $token_request_dtls['PAYMENTREQUEST_0_HANDLINGAMT'] = '0'; |
169 | 169 | |
170 | - $itemized_sum_diff_from_txn_total = round( $transaction->total() - $itemized_sum - $total_line_items->get_total_tax(), 2 ); |
|
170 | + $itemized_sum_diff_from_txn_total = round($transaction->total() - $itemized_sum - $total_line_items->get_total_tax(), 2); |
|
171 | 171 | // If we were not able to recognize some item like promotion, surcharge or cancellation, |
172 | 172 | // add the difference as an extra line item. |
173 | - if ( $itemized_sum_diff_from_txn_total != 0 ) { |
|
173 | + if ($itemized_sum_diff_from_txn_total != 0) { |
|
174 | 174 | // Item Name. |
175 | - $token_request_dtls['L_PAYMENTREQUEST_0_NAME'.$item_num] = substr( __( 'Other (promotion/surcharge/cancellation)', 'event_espresso' ), 0, 127 ); |
|
175 | + $token_request_dtls['L_PAYMENTREQUEST_0_NAME'.$item_num] = substr(__('Other (promotion/surcharge/cancellation)', 'event_espresso'), 0, 127); |
|
176 | 176 | // Item description. |
177 | - $token_request_dtls['L_PAYMENTREQUEST_0_DESC'.$item_num] = substr( $line_item->desc(), 0, 127 ); |
|
177 | + $token_request_dtls['L_PAYMENTREQUEST_0_DESC'.$item_num] = substr($line_item->desc(), 0, 127); |
|
178 | 178 | // Cost of individual item. |
179 | - $token_request_dtls['L_PAYMENTREQUEST_0_AMT'.$item_num] = $this->format_currency( $itemized_sum_diff_from_txn_total ); |
|
179 | + $token_request_dtls['L_PAYMENTREQUEST_0_AMT'.$item_num] = $this->format_currency($itemized_sum_diff_from_txn_total); |
|
180 | 180 | // Item Number. |
181 | 181 | $token_request_dtls['L_PAYMENTREQUEST_0_NUMBER'.$item_num] = $item_num + 1; |
182 | 182 | // Item quantity. |
@@ -186,11 +186,11 @@ discard block |
||
186 | 186 | } else { |
187 | 187 | // Just one Item. |
188 | 188 | // Item Name. |
189 | - $token_request_dtls['L_PAYMENTREQUEST_0_NAME0'] = substr( sprintf( __('Payment for %1$s', 'event_espresso'), $primary_registration->reg_code() ), 0, 127 ); |
|
189 | + $token_request_dtls['L_PAYMENTREQUEST_0_NAME0'] = substr(sprintf(__('Payment for %1$s', 'event_espresso'), $primary_registration->reg_code()), 0, 127); |
|
190 | 190 | // Item description. |
191 | - $token_request_dtls['L_PAYMENTREQUEST_0_DESC0'] = substr( sprintf( __('Payment of %1$s for %2$s', 'event_espresso'), $payment->amount(), $primary_registration->reg_code() ), 0, 127 ); |
|
191 | + $token_request_dtls['L_PAYMENTREQUEST_0_DESC0'] = substr(sprintf(__('Payment of %1$s for %2$s', 'event_espresso'), $payment->amount(), $primary_registration->reg_code()), 0, 127); |
|
192 | 192 | // Cost of individual item. |
193 | - $token_request_dtls['L_PAYMENTREQUEST_0_AMT0'] = $this->format_currency( $payment->amount() ); |
|
193 | + $token_request_dtls['L_PAYMENTREQUEST_0_AMT0'] = $this->format_currency($payment->amount()); |
|
194 | 194 | // Item Number. |
195 | 195 | $token_request_dtls['L_PAYMENTREQUEST_0_NUMBER0'] = 1; |
196 | 196 | // Item quantity. |
@@ -198,14 +198,14 @@ discard block |
||
198 | 198 | // Digital item is sold. |
199 | 199 | $token_request_dtls['L_PAYMENTREQUEST_0_ITEMCATEGORY0'] = 'Digital'; |
200 | 200 | // Item's sales S/H and tax amount. |
201 | - $token_request_dtls['PAYMENTREQUEST_0_ITEMAMT'] = $this->format_currency( $payment->amount() ); |
|
201 | + $token_request_dtls['PAYMENTREQUEST_0_ITEMAMT'] = $this->format_currency($payment->amount()); |
|
202 | 202 | $token_request_dtls['PAYMENTREQUEST_0_TAXAMT'] = '0'; |
203 | 203 | $token_request_dtls['PAYMENTREQUEST_0_SHIPPINGAMT'] = '0'; |
204 | 204 | $token_request_dtls['PAYMENTREQUEST_0_HANDLINGAMT'] = '0'; |
205 | 205 | } |
206 | 206 | // Automatically filling out shipping and contact information. |
207 | - if ( $primary_attendee instanceof EEI_Attendee ) { |
|
208 | - $token_request_dtls['NOSHIPPING'] = '2'; // If you do not pass the shipping address, PayPal obtains it from the buyer's account profile. |
|
207 | + if ($primary_attendee instanceof EEI_Attendee) { |
|
208 | + $token_request_dtls['NOSHIPPING'] = '2'; // If you do not pass the shipping address, PayPal obtains it from the buyer's account profile. |
|
209 | 209 | $token_request_dtls['PAYMENTREQUEST_0_SHIPTOSTREET'] = $primary_attendee->address(); |
210 | 210 | $token_request_dtls['PAYMENTREQUEST_0_SHIPTOSTREET2'] = $primary_attendee->address2(); |
211 | 211 | $token_request_dtls['PAYMENTREQUEST_0_SHIPTOCITY'] = $primary_attendee->city(); |
@@ -216,25 +216,25 @@ discard block |
||
216 | 216 | $token_request_dtls['PAYMENTREQUEST_0_SHIPTOPHONENUM'] = $primary_attendee->phone(); |
217 | 217 | } |
218 | 218 | // Used a business/personal logo on the PayPal page. |
219 | - if ( ! empty($this->_image_url) ) { |
|
219 | + if ( ! empty($this->_image_url)) { |
|
220 | 220 | $token_request_dtls['LOGOIMG'] = $this->_image_url; |
221 | 221 | } |
222 | 222 | // Request PayPal token. |
223 | - $token_request_response = $this->_ppExpress_request( $token_request_dtls, 'Payment Token', $payment ); |
|
224 | - $token_rstatus = $this->_ppExpress_check_response( $token_request_response ); |
|
225 | - $response_args = ( isset($token_rstatus['args']) ) ? $token_rstatus['args'] : array(); |
|
226 | - if ( $token_rstatus['status'] ) { |
|
223 | + $token_request_response = $this->_ppExpress_request($token_request_dtls, 'Payment Token', $payment); |
|
224 | + $token_rstatus = $this->_ppExpress_check_response($token_request_response); |
|
225 | + $response_args = (isset($token_rstatus['args'])) ? $token_rstatus['args'] : array(); |
|
226 | + if ($token_rstatus['status']) { |
|
227 | 227 | // We got the Token so we may continue with the payment and redirect the client. |
228 | - $payment->set_details( $response_args ); |
|
229 | - $payment->set_redirect_url( 'https://www.sandbox.paypal.com/cgi-bin/webscr?useraction=commit&cmd=_express-checkout&token=' . $response_args['TOKEN'] ); |
|
228 | + $payment->set_details($response_args); |
|
229 | + $payment->set_redirect_url('https://www.sandbox.paypal.com/cgi-bin/webscr?useraction=commit&cmd=_express-checkout&token='.$response_args['TOKEN']); |
|
230 | 230 | } else { |
231 | - if ( isset($response_args['L_ERRORCODE']) ) { |
|
232 | - $payment->set_gateway_response( $response_args['L_ERRORCODE'] . '; ' . $response_args['L_SHORTMESSAGE'] ); |
|
231 | + if (isset($response_args['L_ERRORCODE'])) { |
|
232 | + $payment->set_gateway_response($response_args['L_ERRORCODE'].'; '.$response_args['L_SHORTMESSAGE']); |
|
233 | 233 | } else { |
234 | - $payment->set_gateway_response( __( 'Error occurred while trying to setup the Express Checkout.', 'event_espresso' ) ); |
|
234 | + $payment->set_gateway_response(__('Error occurred while trying to setup the Express Checkout.', 'event_espresso')); |
|
235 | 235 | } |
236 | - $payment->set_details( $response_args ); |
|
237 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
236 | + $payment->set_details($response_args); |
|
237 | + $payment->set_status($this->_pay_model->failed_status()); |
|
238 | 238 | } |
239 | 239 | |
240 | 240 | return $payment; |
@@ -250,24 +250,24 @@ discard block |
||
250 | 250 | * @param type $transaction |
251 | 251 | * @return EEI_Payment |
252 | 252 | */ |
253 | - public function handle_payment_update( $update_info, $transaction ) { |
|
254 | - $payment = ( $transaction instanceof EEI_Transaction ) ? $transaction->last_payment() : null; |
|
253 | + public function handle_payment_update($update_info, $transaction) { |
|
254 | + $payment = ($transaction instanceof EEI_Transaction) ? $transaction->last_payment() : null; |
|
255 | 255 | |
256 | - if ( $payment instanceof EEI_Payment ) { |
|
257 | - $this->log( array( 'Return from Authorization' => $update_info ), $payment ); |
|
256 | + if ($payment instanceof EEI_Payment) { |
|
257 | + $this->log(array('Return from Authorization' => $update_info), $payment); |
|
258 | 258 | |
259 | 259 | $payment_details = $payment->details(); |
260 | 260 | $transaction = $payment->transaction(); |
261 | - if ( ! $transaction instanceof EEI_Transaction ) { |
|
262 | - $payment->set_gateway_response( __( 'Could not process this payment because it has no associated transaction.', 'event_espresso' ) ); |
|
263 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
261 | + if ( ! $transaction instanceof EEI_Transaction) { |
|
262 | + $payment->set_gateway_response(__('Could not process this payment because it has no associated transaction.', 'event_espresso')); |
|
263 | + $payment->set_status($this->_pay_model->failed_status()); |
|
264 | 264 | return $payment; |
265 | 265 | } |
266 | 266 | $primary_registrant = $transaction->primary_registration(); |
267 | 267 | |
268 | 268 | // Check if we still have the token. |
269 | - if ( ! isset($payment_details['TOKEN']) || empty($payment_details['TOKEN']) ) { |
|
270 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
269 | + if ( ! isset($payment_details['TOKEN']) || empty($payment_details['TOKEN'])) { |
|
270 | + $payment->set_status($this->_pay_model->failed_status()); |
|
271 | 271 | return $payment; |
272 | 272 | } |
273 | 273 | |
@@ -276,10 +276,10 @@ discard block |
||
276 | 276 | 'TOKEN' => $payment_details['TOKEN'] |
277 | 277 | ); |
278 | 278 | // Request Customer Details. |
279 | - $cdetails_request_response = $this->_ppExpress_request( $cdetails_request_dtls, 'Customer Details', $payment ); |
|
280 | - $cdetails_rstatus = $this->_ppExpress_check_response( $cdetails_request_response ); |
|
281 | - $cdata_response_args = ( isset($cdetails_rstatus['args']) ) ? $cdetails_rstatus['args'] : array(); |
|
282 | - if ( $cdetails_rstatus['status'] ) { |
|
279 | + $cdetails_request_response = $this->_ppExpress_request($cdetails_request_dtls, 'Customer Details', $payment); |
|
280 | + $cdetails_rstatus = $this->_ppExpress_check_response($cdetails_request_response); |
|
281 | + $cdata_response_args = (isset($cdetails_rstatus['args'])) ? $cdetails_rstatus['args'] : array(); |
|
282 | + if ($cdetails_rstatus['status']) { |
|
283 | 283 | // We got the PayerID so now we can Complete the transaction. |
284 | 284 | $docheckout_request_dtls = array( |
285 | 285 | 'METHOD' => 'DoExpressCheckoutPayment', |
@@ -290,39 +290,39 @@ discard block |
||
290 | 290 | 'PAYMENTREQUEST_0_CURRENCYCODE' => $payment->currency_code() |
291 | 291 | ); |
292 | 292 | // Payment Checkout/Capture. |
293 | - $docheckout_request_response = $this->_ppExpress_request( $docheckout_request_dtls, 'Do Payment', $payment ); |
|
294 | - $docheckout_rstatus = $this->_ppExpress_check_response( $docheckout_request_response ); |
|
295 | - $docheckout_response_args = ( isset($docheckout_rstatus['args']) ) ? $docheckout_rstatus['args'] : array(); |
|
296 | - if ( $docheckout_rstatus['status'] ) { |
|
293 | + $docheckout_request_response = $this->_ppExpress_request($docheckout_request_dtls, 'Do Payment', $payment); |
|
294 | + $docheckout_rstatus = $this->_ppExpress_check_response($docheckout_request_response); |
|
295 | + $docheckout_response_args = (isset($docheckout_rstatus['args'])) ? $docheckout_rstatus['args'] : array(); |
|
296 | + if ($docheckout_rstatus['status']) { |
|
297 | 297 | // All is well, payment approved. |
298 | 298 | $primary_registration_code = $primary_registrant instanceof EE_Registration ? $primary_registrant->reg_code() : ''; |
299 | - $payment->set_extra_accntng( $primary_registration_code ); |
|
300 | - $payment->set_amount( isset($docheckout_response_args['PAYMENTINFO_0_AMT']) ? floatval( $docheckout_response_args['PAYMENTINFO_0_AMT'] ) : 0 ); |
|
301 | - $payment->set_txn_id_chq_nmbr( isset( $docheckout_response_args['PAYMENTINFO_0_TRANSACTIONID'] ) ? $docheckout_response_args['PAYMENTINFO_0_TRANSACTIONID'] : null ); |
|
302 | - $payment->set_details( $cdata_response_args ); |
|
303 | - $payment->set_gateway_response( isset( $docheckout_response_args['PAYMENTINFO_0_ACK'] ) ? $docheckout_response_args['PAYMENTINFO_0_ACK'] : '' ); |
|
304 | - $payment->set_status( $this->_pay_model->approved_status() ); |
|
299 | + $payment->set_extra_accntng($primary_registration_code); |
|
300 | + $payment->set_amount(isset($docheckout_response_args['PAYMENTINFO_0_AMT']) ? floatval($docheckout_response_args['PAYMENTINFO_0_AMT']) : 0); |
|
301 | + $payment->set_txn_id_chq_nmbr(isset($docheckout_response_args['PAYMENTINFO_0_TRANSACTIONID']) ? $docheckout_response_args['PAYMENTINFO_0_TRANSACTIONID'] : null); |
|
302 | + $payment->set_details($cdata_response_args); |
|
303 | + $payment->set_gateway_response(isset($docheckout_response_args['PAYMENTINFO_0_ACK']) ? $docheckout_response_args['PAYMENTINFO_0_ACK'] : ''); |
|
304 | + $payment->set_status($this->_pay_model->approved_status()); |
|
305 | 305 | } else { |
306 | - if ( isset($docheckout_response_args['L_ERRORCODE']) ) { |
|
307 | - $payment->set_gateway_response( $docheckout_response_args['L_ERRORCODE'] . '; ' . $docheckout_response_args['L_SHORTMESSAGE'] ); |
|
306 | + if (isset($docheckout_response_args['L_ERRORCODE'])) { |
|
307 | + $payment->set_gateway_response($docheckout_response_args['L_ERRORCODE'].'; '.$docheckout_response_args['L_SHORTMESSAGE']); |
|
308 | 308 | } else { |
309 | - $payment->set_gateway_response( __( 'Error occurred while trying to Capture the funds.', 'event_espresso' ) ); |
|
309 | + $payment->set_gateway_response(__('Error occurred while trying to Capture the funds.', 'event_espresso')); |
|
310 | 310 | } |
311 | - $payment->set_details( $docheckout_response_args ); |
|
312 | - $payment->set_status( $this->_pay_model->declined_status() ); |
|
311 | + $payment->set_details($docheckout_response_args); |
|
312 | + $payment->set_status($this->_pay_model->declined_status()); |
|
313 | 313 | } |
314 | 314 | } else { |
315 | - if ( isset($cdata_response_args['L_ERRORCODE']) ) { |
|
316 | - $payment->set_gateway_response( $cdata_response_args['L_ERRORCODE'] . '; ' . $cdata_response_args['L_SHORTMESSAGE'] ); |
|
315 | + if (isset($cdata_response_args['L_ERRORCODE'])) { |
|
316 | + $payment->set_gateway_response($cdata_response_args['L_ERRORCODE'].'; '.$cdata_response_args['L_SHORTMESSAGE']); |
|
317 | 317 | } else { |
318 | - $payment->set_gateway_response( __( 'Error occurred while trying to get payment Details from PayPal.', 'event_espresso' ) ); |
|
318 | + $payment->set_gateway_response(__('Error occurred while trying to get payment Details from PayPal.', 'event_espresso')); |
|
319 | 319 | } |
320 | - $payment->set_details( $cdata_response_args ); |
|
321 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
320 | + $payment->set_details($cdata_response_args); |
|
321 | + $payment->set_status($this->_pay_model->failed_status()); |
|
322 | 322 | } |
323 | 323 | } else { |
324 | - $payment->set_gateway_response( __( 'Error occurred while trying to process the payment.', 'event_espresso' ) ); |
|
325 | - $payment->set_status( $this->_pay_model->failed_status() ); |
|
324 | + $payment->set_gateway_response(__('Error occurred while trying to process the payment.', 'event_espresso')); |
|
325 | + $payment->set_status($this->_pay_model->failed_status()); |
|
326 | 326 | } |
327 | 327 | |
328 | 328 | return $payment; |
@@ -337,16 +337,16 @@ discard block |
||
337 | 337 | * @param EEI_Payment $payment |
338 | 338 | * @return mixed |
339 | 339 | */ |
340 | - public function _ppExpress_request( $request_params, $request_text, $payment ) { |
|
340 | + public function _ppExpress_request($request_params, $request_text, $payment) { |
|
341 | 341 | $request_dtls = array( |
342 | 342 | 'VERSION' => '204.0', |
343 | - 'USER' => urlencode( $this->_api_username ), |
|
344 | - 'PWD' => urlencode( $this->_api_password ), |
|
345 | - 'SIGNATURE' => urlencode( $this->_api_signature ) |
|
343 | + 'USER' => urlencode($this->_api_username), |
|
344 | + 'PWD' => urlencode($this->_api_password), |
|
345 | + 'SIGNATURE' => urlencode($this->_api_signature) |
|
346 | 346 | ); |
347 | - $dtls = array_merge( $request_dtls, $request_params ); |
|
347 | + $dtls = array_merge($request_dtls, $request_params); |
|
348 | 348 | |
349 | - $this->_log_clean_request( $dtls, $payment, $request_text . ' Request' ); |
|
349 | + $this->_log_clean_request($dtls, $payment, $request_text.' Request'); |
|
350 | 350 | // Request Customer Details. |
351 | 351 | $request_response = wp_remote_post( |
352 | 352 | $this->_base_gateway_url, |
@@ -356,11 +356,11 @@ discard block |
||
356 | 356 | 'httpversion' => '1.1', |
357 | 357 | 'cookies' => array(), |
358 | 358 | 'headers' => array(), |
359 | - 'body' => http_build_query( $dtls ) |
|
359 | + 'body' => http_build_query($dtls) |
|
360 | 360 | ) |
361 | 361 | ); |
362 | 362 | // Log the response. |
363 | - $this->log( array( $request_text . ' Response' => $request_response), $payment ); |
|
363 | + $this->log(array($request_text.' Response' => $request_response), $payment); |
|
364 | 364 | |
365 | 365 | return $request_response; |
366 | 366 | } |
@@ -372,31 +372,31 @@ discard block |
||
372 | 372 | * @param mixed $request_response |
373 | 373 | * @return array |
374 | 374 | */ |
375 | - public function _ppExpress_check_response( $request_response ) { |
|
376 | - if ( ! is_wp_error( $request_response ) && $request_response['body'] && ! empty($request_response['body'] ) ) { |
|
375 | + public function _ppExpress_check_response($request_response) { |
|
376 | + if ( ! is_wp_error($request_response) && $request_response['body'] && ! empty($request_response['body'])) { |
|
377 | 377 | $response_args = array(); |
378 | - parse_str( urldecode($request_response['body']), $response_args ); |
|
379 | - if ( isset($response_args['ACK']) |
|
378 | + parse_str(urldecode($request_response['body']), $response_args); |
|
379 | + if (isset($response_args['ACK']) |
|
380 | 380 | && $response_args['ACK'] === 'Success' |
381 | - && ( isset($response_args['PAYERID']) |
|
381 | + && (isset($response_args['PAYERID']) |
|
382 | 382 | || isset($response_args['PAYMENTINFO_0_TRANSACTIONID']) |
383 | - || ( isset($response_args['PAYMENTSTATUS']) && $response_args['PAYMENTSTATUS'] === 'Completed' ) |
|
383 | + || (isset($response_args['PAYMENTSTATUS']) && $response_args['PAYMENTSTATUS'] === 'Completed') |
|
384 | 384 | || isset($response_args['TOKEN']) |
385 | 385 | ) |
386 | 386 | ) { |
387 | 387 | // Response status OK, return response parameters for further processing. |
388 | 388 | return array('status' => true, 'args' => $response_args); |
389 | 389 | } else { |
390 | - if ( isset($response_args['ACK']) ) { |
|
390 | + if (isset($response_args['ACK'])) { |
|
391 | 391 | $errors = $this->_get_errors($response_args); |
392 | - return array( 'status' => false, 'args' => $errors ); |
|
392 | + return array('status' => false, 'args' => $errors); |
|
393 | 393 | } else { |
394 | - return array( 'status' => false, 'args' => $request_response ); |
|
394 | + return array('status' => false, 'args' => $request_response); |
|
395 | 395 | } |
396 | 396 | } |
397 | 397 | } else { |
398 | 398 | // If we got here then there was an error in this request. |
399 | - return array( 'status' => false, 'args' => $request_response ); |
|
399 | + return array('status' => false, 'args' => $request_response); |
|
400 | 400 | } |
401 | 401 | } |
402 | 402 | |
@@ -409,12 +409,12 @@ discard block |
||
409 | 409 | * @param string $info |
410 | 410 | * @return void |
411 | 411 | */ |
412 | - private function _log_clean_request( $request_prms, $payment, $info ) { |
|
412 | + private function _log_clean_request($request_prms, $payment, $info) { |
|
413 | 413 | $cleaned_request_data = $request_prms; |
414 | 414 | unset($cleaned_request_data['PWD']); |
415 | 415 | unset($cleaned_request_data['USER']); |
416 | 416 | unset($cleaned_request_data['SIGNATURE']); |
417 | - $this->log( array($info => $cleaned_request_data), $payment ); |
|
417 | + $this->log(array($info => $cleaned_request_data), $payment); |
|
418 | 418 | } |
419 | 419 | |
420 | 420 | |
@@ -424,16 +424,16 @@ discard block |
||
424 | 424 | * @param array $data_array |
425 | 425 | * @return array |
426 | 426 | */ |
427 | - private function _get_errors( $data_array ) { |
|
427 | + private function _get_errors($data_array) { |
|
428 | 428 | $errors = array(); |
429 | 429 | $n = 0; |
430 | - while ( isset($data_array['L_ERRORCODE' . $n . '']) ) { |
|
431 | - $l_error_code = isset($data_array['L_ERRORCODE' . $n . '']) ? $data_array['L_ERRORCODE' . $n . ''] : ''; |
|
432 | - $l_severity_code = isset($data_array['L_SEVERITYCODE' . $n . '']) ? $data_array['L_SEVERITYCODE' . $n . ''] : ''; |
|
433 | - $l_short_message = isset($data_array['L_SHORTMESSAGE' . $n . '']) ? $data_array['L_SHORTMESSAGE' . $n . ''] : ''; |
|
434 | - $l_long_message = isset($data_array['L_LONGMESSAGE' . $n . '']) ? $data_array['L_LONGMESSAGE' . $n . ''] : ''; |
|
430 | + while (isset($data_array['L_ERRORCODE'.$n.''])) { |
|
431 | + $l_error_code = isset($data_array['L_ERRORCODE'.$n.'']) ? $data_array['L_ERRORCODE'.$n.''] : ''; |
|
432 | + $l_severity_code = isset($data_array['L_SEVERITYCODE'.$n.'']) ? $data_array['L_SEVERITYCODE'.$n.''] : ''; |
|
433 | + $l_short_message = isset($data_array['L_SHORTMESSAGE'.$n.'']) ? $data_array['L_SHORTMESSAGE'.$n.''] : ''; |
|
434 | + $l_long_message = isset($data_array['L_LONGMESSAGE'.$n.'']) ? $data_array['L_LONGMESSAGE'.$n.''] : ''; |
|
435 | 435 | |
436 | - if ( $n == 0 ) { |
|
436 | + if ($n == 0) { |
|
437 | 437 | $errors = array( |
438 | 438 | 'L_ERRORCODE' => $l_error_code, |
439 | 439 | 'L_SHORTMESSAGE' => $l_short_message, |
@@ -441,10 +441,10 @@ discard block |
||
441 | 441 | 'L_SEVERITYCODE' => $l_severity_code |
442 | 442 | ); |
443 | 443 | } else { |
444 | - $errors['L_ERRORCODE'] .= ', ' . $l_error_code; |
|
445 | - $errors['L_SHORTMESSAGE'] .= ', ' . $l_short_message; |
|
446 | - $errors['L_LONGMESSAGE'] .= ', ' . $l_long_message; |
|
447 | - $errors['L_SEVERITYCODE'] .= ', ' . $l_severity_code; |
|
444 | + $errors['L_ERRORCODE'] .= ', '.$l_error_code; |
|
445 | + $errors['L_SHORTMESSAGE'] .= ', '.$l_short_message; |
|
446 | + $errors['L_LONGMESSAGE'] .= ', '.$l_long_message; |
|
447 | + $errors['L_SEVERITYCODE'] .= ', '.$l_severity_code; |
|
448 | 448 | } |
449 | 449 | |
450 | 450 | $n++; |
@@ -1,1 +1,1 @@ |
||
1 | -<?php printf( __('PayPal Express (Express Checkout) is an off-site payment method for accepting payments via PayPal and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalexpress/" target="_blank">','</a>' ); ?> |
|
2 | 1 | \ No newline at end of file |
2 | +<?php printf(__('PayPal Express (Express Checkout) is an off-site payment method for accepting payments via PayPal and is available to event organizers in many countries. A PayPal premier or business account is needed to accept payments. Need a PayPal account? Call 1-855-456-1338 or %1$sclick here to sign up for a merchant account%2$s.', 'event_espresso'), '<a href="https://eventespresso.com/go/paypalexpress/" target="_blank">', '</a>'); ?> |
|
3 | 3 | \ No newline at end of file |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' ) ) { exit('No direct script access allowed'); } ?> |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('No direct script access allowed'); } ?> |
|
2 | 2 | |
3 | 3 | <div id="ppexpress-sandbox-panel" class="sandbox-panel"> |
4 | 4 | |
@@ -6,13 +6,13 @@ discard block |
||
6 | 6 | |
7 | 7 | <h4><?php _e('How do I test specific error codes?', 'event_espresso'); ?></h4> |
8 | 8 | <p> |
9 | - <?php _e( 'To trigger an error condition on an amount-related field, |
|
9 | + <?php _e('To trigger an error condition on an amount-related field, |
|
10 | 10 | specify a error code value as a number with two digits to the right of the decimal point. |
11 | 11 | For example, specify a value of 107.55 to trigger the 10755 error.', |
12 | - 'event_espresso');?> |
|
12 | + 'event_espresso'); ?> |
|
13 | 13 | </p> |
14 | 14 | <p> |
15 | - <?php printf( __( 'More details can be found here: %1$s Testing Error Conditions %2$s.', 'event_espresso'), '<a href="https://developer.paypal.com/docs/classic/lifecycle/sb_error-conditions">', '</a>');?> |
|
15 | + <?php printf(__('More details can be found here: %1$s Testing Error Conditions %2$s.', 'event_espresso'), '<a href="https://developer.paypal.com/docs/classic/lifecycle/sb_error-conditions">', '</a>'); ?> |
|
16 | 16 | </p> |
17 | 17 | |
18 | 18 | </div> |
19 | 19 | \ No newline at end of file |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <p> |
2 | - <strong><?php _e( 'PayPal Express Checkout', 'event_espresso' ); ?></strong> |
|
2 | + <strong><?php _e('PayPal Express Checkout', 'event_espresso'); ?></strong> |
|
3 | 3 | </p> |
4 | 4 | <p> |
5 | 5 | <?php _e('Adjust the settings for the PayPal Express Checkout.', 'event_espresso'); ?> |
@@ -13,21 +13,21 @@ discard block |
||
13 | 13 | </p> |
14 | 14 | <ul> |
15 | 15 | <li> |
16 | - <strong><?php _e( 'API Username', 'event_espresso' ); ?></strong><br/> |
|
17 | - <?php _e( 'Your PayPal API Username.'); ?> |
|
16 | + <strong><?php _e('API Username', 'event_espresso'); ?></strong><br/> |
|
17 | + <?php _e('Your PayPal API Username.'); ?> |
|
18 | 18 | </li> |
19 | 19 | <li> |
20 | - <strong><?php _e( 'API Password', 'event_espresso' ); ?></strong><br/> |
|
21 | - <?php _e( 'Your PayPal API Password.' ); ?> |
|
20 | + <strong><?php _e('API Password', 'event_espresso'); ?></strong><br/> |
|
21 | + <?php _e('Your PayPal API Password.'); ?> |
|
22 | 22 | </li> |
23 | 23 | <li> |
24 | - <strong><?php _e( 'API Signature', 'event_espresso' ); ?></strong><br/> |
|
25 | - <?php _e( 'Your PayPal Account Signature.' ); ?> |
|
24 | + <strong><?php _e('API Signature', 'event_espresso'); ?></strong><br/> |
|
25 | + <?php _e('Your PayPal Account Signature.'); ?> |
|
26 | 26 | </li> |
27 | 27 | </ul> |
28 | 28 | <p> |
29 | - <?php printf( __('For testing please use a %1$s PaypPal Sandbox account%2$s.', 'event_espresso'), '<a target="_blank" href="https://developer.paypal.com">', '</a>' ); ?> |
|
29 | + <?php printf(__('For testing please use a %1$s PaypPal Sandbox account%2$s.', 'event_espresso'), '<a target="_blank" href="https://developer.paypal.com">', '</a>'); ?> |
|
30 | 30 | </p> |
31 | 31 | <p> |
32 | - <?php printf( __('%1$sClick here%2$s for more information on how to get your API credentials.', 'event_espresso'), '<a target="_blank" href="https://developer.paypal.com/docs/classic/api/apiCredentials/?mark=api%20signature#creating-an-api-signature">', '</a>' ); ?> |
|
32 | + <?php printf(__('%1$sClick here%2$s for more information on how to get your API credentials.', 'event_espresso'), '<a target="_blank" href="https://developer.paypal.com/docs/classic/api/apiCredentials/?mark=api%20signature#creating-an-api-signature">', '</a>'); ?> |
|
33 | 33 | </p> |
34 | 34 | \ No newline at end of file |
@@ -15,8 +15,8 @@ |
||
15 | 15 | class EE_PMT_Paypal_Express extends EE_PMT_Base { |
16 | 16 | |
17 | 17 | /** |
18 | - * Class constructor. |
|
19 | - */ |
|
18 | + * Class constructor. |
|
19 | + */ |
|
20 | 20 | public function __construct( $pm_instance = NULL ) { |
21 | 21 | require_once( $this->file_folder() . 'EEG_Paypal_Express.gateway.php' ); |
22 | 22 | $this->_gateway = new EEG_Paypal_Express(); |
@@ -1,4 +1,4 @@ discard block |
||
1 | -<?php if ( ! defined( 'EVENT_ESPRESSO_VERSION' )) { exit('NO direct script access allowed'); } |
|
1 | +<?php if ( ! defined('EVENT_ESPRESSO_VERSION')) { exit('NO direct script access allowed'); } |
|
2 | 2 | |
3 | 3 | /** |
4 | 4 | * ---------------------------------------------- |
@@ -17,16 +17,16 @@ discard block |
||
17 | 17 | /** |
18 | 18 | * Class constructor. |
19 | 19 | */ |
20 | - public function __construct( $pm_instance = NULL ) { |
|
21 | - require_once( $this->file_folder() . 'EEG_Paypal_Express.gateway.php' ); |
|
20 | + public function __construct($pm_instance = NULL) { |
|
21 | + require_once($this->file_folder().'EEG_Paypal_Express.gateway.php'); |
|
22 | 22 | $this->_gateway = new EEG_Paypal_Express(); |
23 | 23 | |
24 | - $this->_pretty_name = __( 'PayPal Express', 'event_espresso' ); |
|
25 | - $this->_template_path = $this->file_folder() . 'templates' . DS; |
|
26 | - $this->_default_description = __( 'After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.', 'event_espresso' ); |
|
27 | - $this->_default_button_url = $this->file_url() . 'lib' . DS . 'paypal-express-checkout-logo.png'; |
|
24 | + $this->_pretty_name = __('PayPal Express', 'event_espresso'); |
|
25 | + $this->_template_path = $this->file_folder().'templates'.DS; |
|
26 | + $this->_default_description = __('After clicking \'Finalize Registration\', you will be forwarded to PayPal website to Login and make your payment.', 'event_espresso'); |
|
27 | + $this->_default_button_url = $this->file_url().'lib'.DS.'paypal-express-checkout-logo.png'; |
|
28 | 28 | |
29 | - parent::__construct( $pm_instance ); |
|
29 | + parent::__construct($pm_instance); |
|
30 | 30 | } |
31 | 31 | |
32 | 32 | |
@@ -58,26 +58,26 @@ discard block |
||
58 | 58 | 'extra_meta_inputs' => array( |
59 | 59 | 'api_username' => new EE_Text_Input( |
60 | 60 | array( |
61 | - 'html_label_text'=> sprintf( __( 'API Username %s', 'event_espresso' ), $this->get_help_tab_link() ), |
|
61 | + 'html_label_text'=> sprintf(__('API Username %s', 'event_espresso'), $this->get_help_tab_link()), |
|
62 | 62 | 'required' => true, |
63 | 63 | ) |
64 | 64 | ), |
65 | 65 | 'api_password' => new EE_Text_Input( |
66 | 66 | array( |
67 | - 'html_label_text' => sprintf( __( 'API Password %s', 'event_espresso' ), $this->get_help_tab_link() ), |
|
67 | + 'html_label_text' => sprintf(__('API Password %s', 'event_espresso'), $this->get_help_tab_link()), |
|
68 | 68 | 'required' => true |
69 | 69 | ) |
70 | 70 | ), |
71 | 71 | 'api_signature' => new EE_Text_Input( |
72 | 72 | array( |
73 | - 'html_label_text' => sprintf( __( 'API Signature %s', 'event_espresso' ), $this->get_help_tab_link() ), |
|
73 | + 'html_label_text' => sprintf(__('API Signature %s', 'event_espresso'), $this->get_help_tab_link()), |
|
74 | 74 | 'required' => true |
75 | 75 | ) |
76 | 76 | ), |
77 | 77 | 'image_url' => new EE_Admin_File_Uploader_Input( |
78 | 78 | array( |
79 | - 'html_label_text' => sprintf( __( 'Image URL %s', 'event_espresso' ), $this->get_help_tab_link() ), |
|
80 | - 'html_help_text' => __( 'Used for your business/personal logo on the PayPal page', 'event_espresso' ), |
|
79 | + 'html_label_text' => sprintf(__('Image URL %s', 'event_espresso'), $this->get_help_tab_link()), |
|
80 | + 'html_help_text' => __('Used for your business/personal logo on the PayPal page', 'event_espresso'), |
|
81 | 81 | 'required' => false |
82 | 82 | ) |
83 | 83 | ), |
@@ -94,8 +94,8 @@ discard block |
||
94 | 94 | * @param \EE_Transaction $transaction |
95 | 95 | * @return \EE_Billing_Info_Form |
96 | 96 | */ |
97 | - public function generate_new_billing_form( EE_Transaction $transaction = null ) { |
|
98 | - if ( $this->_pm_instance->debug_mode() ) { |
|
97 | + public function generate_new_billing_form(EE_Transaction $transaction = null) { |
|
98 | + if ($this->_pm_instance->debug_mode()) { |
|
99 | 99 | $form = new EE_Billing_Info_Form( |
100 | 100 | $this->_pm_instance, |
101 | 101 | array( |
@@ -105,8 +105,8 @@ discard block |
||
105 | 105 | array( |
106 | 106 | 'layout_strategy' => new EE_Template_Layout( |
107 | 107 | array( |
108 | - 'layout_template_file' => $this->_template_path . 'paypal_express_debug_info.template.php', |
|
109 | - 'template_args' => array( 'debug_mode' => $this->_pm_instance->debug_mode() ) |
|
108 | + 'layout_template_file' => $this->_template_path.'paypal_express_debug_info.template.php', |
|
109 | + 'template_args' => array('debug_mode' => $this->_pm_instance->debug_mode()) |
|
110 | 110 | ) |
111 | 111 | ) |
112 | 112 | ) |
@@ -1,5 +1,5 @@ discard block |
||
1 | 1 | <?php |
2 | -if (!defined('EVENT_ESPRESSO_VERSION') ) |
|
2 | +if ( ! defined('EVENT_ESPRESSO_VERSION')) |
|
3 | 3 | exit('NO direct script access allowed'); |
4 | 4 | |
5 | 5 | /** |
@@ -35,18 +35,18 @@ discard block |
||
35 | 35 | */ |
36 | 36 | public function __construct() { |
37 | 37 | //define some page related constants |
38 | - define( 'EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings' ); |
|
39 | - define( 'EE_PAYMENTS_ADMIN_URL', admin_url( 'admin.php?page=' . EE_PAYMENTS_PG_SLUG )); |
|
40 | - define( 'EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES . 'payments' . DS ); |
|
41 | - define( 'EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN . 'templates' . DS ); |
|
42 | - define( 'EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL . 'payments/assets/' ); |
|
38 | + define('EE_PAYMENTS_PG_SLUG', 'espresso_payment_settings'); |
|
39 | + define('EE_PAYMENTS_ADMIN_URL', admin_url('admin.php?page='.EE_PAYMENTS_PG_SLUG)); |
|
40 | + define('EE_PAYMENTS_ADMIN', EE_ADMIN_PAGES.'payments'.DS); |
|
41 | + define('EE_PAYMENTS_TEMPLATE_PATH', EE_PAYMENTS_ADMIN.'templates'.DS); |
|
42 | + define('EE_PAYMENTS_ASSETS_URL', EE_ADMIN_PAGES_URL.'payments/assets/'); |
|
43 | 43 | |
44 | 44 | //check that there are active gateways on all admin page loads. but dont do it just yet |
45 | 45 | // echo "constructing payments admin page";die; |
46 | - add_action('admin_notices',array($this,'check_payment_gateway_setup')); |
|
46 | + add_action('admin_notices', array($this, 'check_payment_gateway_setup')); |
|
47 | 47 | |
48 | 48 | // Show/hide PP Standard along side PP Express. |
49 | - add_filter( 'FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', array( $this, 'unset_pp_standard' ) ); |
|
49 | + add_filter('FHEE__Payments_Admin_Page___payment_methods_list__payment_methods', array($this, 'unset_pp_standard')); |
|
50 | 50 | |
51 | 51 | parent::__construct(); |
52 | 52 | } |
@@ -56,7 +56,7 @@ discard block |
||
56 | 56 | } |
57 | 57 | |
58 | 58 | protected function _set_menu_map() { |
59 | - $this->_menu_map = new EE_Admin_Page_Sub_Menu( array( |
|
59 | + $this->_menu_map = new EE_Admin_Page_Sub_Menu(array( |
|
60 | 60 | 'menu_group' => 'settings', |
61 | 61 | 'menu_order' => 30, |
62 | 62 | 'show_on_menu' => EE_Admin_Page_Menu_Map::BLOG_ADMIN_ONLY, |
@@ -72,22 +72,22 @@ discard block |
||
72 | 72 | /** |
73 | 73 | * Checks that there is at least one active gateway. If not, add a notice |
74 | 74 | */ |
75 | - public function check_payment_gateway_setup(){ |
|
75 | + public function check_payment_gateway_setup() { |
|
76 | 76 | //ONLY do this check if models can query |
77 | 77 | //and avoid a bug where when we nuke EE4's data that this causes a fatal error |
78 | 78 | //because the tables are deleted just before this request runs. see https://events.codebasehq.com/projects/event-espresso/tickets/7539 |
79 | - if ( ! EE_Maintenance_Mode::instance()->models_can_query() || ! EEH_Activation::table_exists( EEM_Payment_Method::instance()->table() ) ) { |
|
79 | + if ( ! EE_Maintenance_Mode::instance()->models_can_query() || ! EEH_Activation::table_exists(EEM_Payment_Method::instance()->table())) { |
|
80 | 80 | return; |
81 | 81 | } |
82 | 82 | |
83 | 83 | |
84 | 84 | // ensure Payment_Method model is loaded |
85 | - EE_Registry::instance()->load_model( 'Payment_Method' ); |
|
86 | - $actives = EEM_Payment_Method::instance()->count_active( EEM_Payment_Method::scope_cart ); |
|
87 | - if( $actives < 1 ){ |
|
85 | + EE_Registry::instance()->load_model('Payment_Method'); |
|
86 | + $actives = EEM_Payment_Method::instance()->count_active(EEM_Payment_Method::scope_cart); |
|
87 | + if ($actives < 1) { |
|
88 | 88 | $url = EE_Admin_Page::add_query_args_and_nonce(array(), EE_PAYMENTS_ADMIN_URL); |
89 | 89 | echo '<div class="error"> |
90 | - <p>'. sprintf(__("There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", "event_espresso"),"<a href='$url'>","</a>").'</p> |
|
90 | + <p>'. sprintf(__("There are no Active Payment Methods setup for Event Espresso. Please %s activate at least one.%s", "event_espresso"), "<a href='$url'>", "</a>").'</p> |
|
91 | 91 | </div>'; |
92 | 92 | } |
93 | 93 | } |
@@ -97,20 +97,20 @@ discard block |
||
97 | 97 | /** |
98 | 98 | * Hide PayPal Standard for "new" users. |
99 | 99 | */ |
100 | - public static function unset_pp_standard( $payment_method_types ) { |
|
101 | - $pps = EEM_Payment_Method::instance()->get_one_of_type( 'Paypal_Standard' ); |
|
102 | - $ppstandard_active = ( ! empty($pps) ) ? $pps->active() : false; |
|
100 | + public static function unset_pp_standard($payment_method_types) { |
|
101 | + $pps = EEM_Payment_Method::instance()->get_one_of_type('Paypal_Standard'); |
|
102 | + $ppstandard_active = ( ! empty($pps)) ? $pps->active() : false; |
|
103 | 103 | $ppstandard_active_before = false; |
104 | - if ( $pps ) { |
|
104 | + if ($pps) { |
|
105 | 105 | // PP Standard used before ? |
106 | - $paypal_id = $pps->get_extra_meta( 'paypal_id', TRUE ); |
|
107 | - if ( $paypal_id && ! empty($paypal_id) ) { |
|
106 | + $paypal_id = $pps->get_extra_meta('paypal_id', TRUE); |
|
107 | + if ($paypal_id && ! empty($paypal_id)) { |
|
108 | 108 | $ppstandard_active_before = true; |
109 | 109 | } |
110 | 110 | } |
111 | 111 | |
112 | 112 | // Not using PP Standard? Then display only PayPal Express, no not show PayPal Standard. |
113 | - if ( apply_filters( 'FHEE__EE_PMT_Paypal_Express__register_payment_methods__show_paypal_standard', ! $ppstandard_active && ! $ppstandard_active_before ) ) { |
|
113 | + if (apply_filters('FHEE__EE_PMT_Paypal_Express__register_payment_methods__show_paypal_standard', ! $ppstandard_active && ! $ppstandard_active_before)) { |
|
114 | 114 | unset($payment_method_types['paypal_standard']); |
115 | 115 | } |
116 | 116 | return $payment_method_types; |