| @@ 57-72 (lines=16) @@ | ||
| 54 | // Record the pending payment |
|
| 55 | $payment = give_insert_payment( $payment_data ); |
|
| 56 | ||
| 57 | if ( $payment ) { |
|
| 58 | give_update_payment_status( $payment, 'publish' ); |
|
| 59 | give_send_to_success_page(); |
|
| 60 | } else { |
|
| 61 | give_record_gateway_error( |
|
| 62 | esc_html__( 'Payment Error', 'give' ), |
|
| 63 | sprintf( |
|
| 64 | /* translators: %s: payment data */ |
|
| 65 | esc_html__( 'The payment creation failed while processing a manual (free or test) donation. Payment data: %s', 'give' ), |
|
| 66 | json_encode( $payment_data ) |
|
| 67 | ), |
|
| 68 | $payment |
|
| 69 | ); |
|
| 70 | // If errors are present, send the user back to the donation page so they can be corrected |
|
| 71 | give_send_back_to_checkout( '?payment-mode=' . $purchase_data['post_data']['give-gateway'] ); |
|
| 72 | } |
|
| 73 | } |
|
| 74 | ||
| 75 | add_action( 'give_gateway_manual', 'give_manual_payment' ); |
|
| @@ 296-304 (lines=9) @@ | ||
| 293 | } |
|
| 294 | ||
| 295 | // Verify payment currency. |
|
| 296 | if ( $currency_code !== strtolower( $payment_meta['currency'] ) ) { |
|
| 297 | ||
| 298 | give_record_gateway_error( __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */ |
|
| 299 | __( 'Invalid currency in IPN response. IPN data: %s', 'give' ), json_encode( $data ) ), $payment_id ); |
|
| 300 | give_update_payment_status( $payment_id, 'failed' ); |
|
| 301 | give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) ); |
|
| 302 | ||
| 303 | return; |
|
| 304 | } |
|
| 305 | ||
| 306 | // Process refunds & reversed. |
|
| 307 | if ( 'refunded' === $payment_status || 'reversed' === $payment_status ) { |
|