| @@ 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' ); |
|
| @@ 315-323 (lines=9) @@ | ||
| 312 | } |
|
| 313 | ||
| 314 | // Verify payment currency. |
|
| 315 | if ( $currency_code !== strtolower( $payment_meta['currency'] ) ) { |
|
| 316 | ||
| 317 | give_record_gateway_error( |
|
| 318 | __( 'IPN Error', 'give' ), sprintf( /* translators: %s: Paypal IPN response */ |
|
| 319 | __( 'Invalid currency in IPN response. IPN data: %s', 'give' ), json_encode( $data ) |
|
| 320 | ), $payment_id |
|
| 321 | ); |
|
| 322 | give_update_payment_status( $payment_id, 'failed' ); |
|
| 323 | give_insert_payment_note( $payment_id, __( 'Payment failed due to invalid currency in PayPal IPN.', 'give' ) ); |
|
| 324 | ||
| 325 | return; |
|
| 326 | } |
|