| @@ -399,8 +399,9 @@ | ||
| 399 | 399 | function give_import_donations_options() { |
| 400 | 400 | /** |
| 401 | 401 | * Filter to modify donations option in the import dropdown |
| 402 | 402 | * |
| 403 | + * @since 4.5.0 Add gateway transaction id option | |
| 403 | 404 | * @since 1.8.13 |
| 404 | 405 | * |
| 405 | 406 | * @return array |
| 406 | 407 | */ |
| @@ -484,8 +485,13 @@ | ||
| 484 | 485 | __( 'Method', 'give' ), |
| 485 | 486 | __( 'Payment Gateway', 'give' ), |
| 486 | 487 | __( 'Gateway', 'give' ), |
| 487 | 488 | ], |
| 489 | + 'gateway_transaction_id' => [ | |
| 490 | + __( 'Transaction ID', 'give' ), | |
| 491 | + __( 'Gateway Transaction ID', 'give' ), | |
| 492 | + __( 'Transaction Identifier', 'give' ), | |
| 493 | + ], | |
| 488 | 494 | 'notes' => __( 'Notes', 'give' ), |
| 489 | 495 | 'mode' => [ |
| 490 | 496 | __( 'Payment Mode', 'give' ), |
| 491 | 497 | __( 'Mode', 'give' ), |
| @@ -817,8 +823,9 @@ | ||
| 817 | 823 | |
| 818 | 824 | /** |
| 819 | 825 | * Filter to modify payment Data before getting imported. |
| 820 | 826 | * |
| 827 | + * @since 4.5.0 Add gateway transaction id to payment data | |
| 821 | 828 | * @since 2.1.0 |
| 822 | 829 | * |
| 823 | 830 | * @param array $payment_data payment data |
| 824 | 831 | * @param array $payment_data donation data |
| @@ -845,9 +852,9 @@ | ||
| 845 | 852 | add_filter( 'give_update_donor_information', 'give_donation_import_update_donor_information', 11, 3 ); |
| 846 | 853 | add_action( 'give_insert_payment', 'give_import_donation_insert_payment', 11, 2 ); |
| 847 | 854 | add_filter( 'give_is_stop_email_notification', '__return_true' ); |
| 848 | 855 | |
| 849 | - // if it status is other then pending then first change the donation status to pending and after adding the payment meta update the donation status. | |
| 856 | + // If status is other than pending then first change the donation status to pending and after adding the payment meta update the donation status. | |
| 850 | 857 | if ( 'pending' !== $status ) { |
| 851 | 858 | unset( $payment_data['status'] ); |
| 852 | 859 | } |
| 853 | 860 | |
| @@ -880,8 +887,13 @@ | ||
| 880 | 887 | if ( ! empty( $data['donor_ip'] ) ) { |
| 881 | 888 | $payment->update_meta( '_give_payment_donor_ip', $data['donor_ip'] ); |
| 882 | 889 | } |
| 883 | 890 | |
| 891 | + // Insert Transaction ID. | |
| 892 | + if ( ! empty( $data['gateway_transaction_id'] ) ) { | |
| 893 | + give_set_payment_transaction_id( $payment_id, $data['gateway_transaction_id'] ); | |
| 894 | + } | |
| 895 | + | |
| 884 | 896 | // Insert Notes. |
| 885 | 897 | if ( ! empty( $data['notes'] ) ) { |
| 886 | 898 | $payment->add_note( $data['notes'] ); |
| 887 | 899 | } |
| @@ -908,15 +920,15 @@ | ||
| 908 | 920 | * Fire after payment is imported and payment meta is also being imported. |
| 909 | 921 | * |
| 910 | 922 | * @since 2.1.0 |
| 911 | 923 | * |
| 912 | - * @param int $payment payment id | |
| 924 | + * @param int $payment_id payment id | |
| 913 | 925 | * @param array $payment_data payment data |
| 914 | 926 | * @param array $payment_data donation data |
| 915 | 927 | * @param array $donor_data donor data |
| 916 | 928 | * @param object $donor_data form object |
| 917 | 929 | */ |
| 918 | - do_action( 'give_import_after_import_payment', $payment, $payment_data, $data, $donor_data, $form ); | |
| 930 | + do_action( 'give_import_after_import_payment', $payment_id, $payment_data, $data, $donor_data, $form ); | |
| 919 | 931 | } else { |
| 920 | 932 | $report['create_donation'] = ( ! empty( $report['create_donation'] ) ? ( absint( $report['create_donation'] ) + 1 ) : 1 ); |
| 921 | 933 | $payment_id = true; |
| 922 | 934 | } |