-
-
Save Pebblo/2d0b7dbf5917e3b1ba8050d47db67a9d to your computer and use it in GitHub Desktop.
If we have a 'pending' payment for Mollie within a transaction, use that payment to run the process_ipn function and confirm with Millie if the payment is complete. If that payment is complete it will update and trigger any messages normally sent.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php //Please do not include the opening PHP tag if you already have one | |
add_action( | |
'AHEE__Transactions_Admin_Page__transaction_details__start', | |
'tw_ee_check_for_mollie_payment_update_on_transaction', | |
10, | |
1 | |
); | |
function tw_ee_check_for_mollie_payment_update_on_transaction($transaction) | |
{ | |
if ($transaction instanceof EE_Transaction) { | |
// are there pending Mijireh payments on this transaction? | |
$a_mollie_payment = EEM_Payment::instance()->get_one( | |
array( | |
array( | |
'TXN_ID' => $transaction->ID(), | |
'STS_ID' => EEM_Payment::status_id_pending, | |
'Payment_Method.PMD_type' => 'Ideal_Mollie', | |
), | |
) | |
); | |
if ($a_mollie_payment instanceof EE_Payment) { | |
add_action( | |
'AHEE__EE_Registration_Processor__trigger_registration_update_notifications', | |
'tw_ee_send_notifications_after_mollie_ipn', | |
5, | |
2 | |
); | |
EE_Payment_Processor::instance()->process_ipn( | |
array('id' => $a_mollie_payment->txn_id_chq_nmbr()), | |
$transaction, | |
$a_mollie_payment->payment_method() | |
); | |
} | |
} | |
} | |
function tw_ee_send_notifications_after_mollie_ipn($registration, $additional_details) | |
{ | |
$last_payment = isset($additional_details['last_payment']) ? $additional_details['last_payment'] : null; | |
if (! $last_payment instanceof EE_Payment || $last_payment->status() != EEM_Payment::status_id_approved) { | |
add_filter('FHEE__EED_Messages___maybe_registration__deliver_notifications', '__return_false', 15); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment