Skip to content

Instantly share code, notes, and snippets.

@Pebblo Pebblo/example.php Secret
Created Jun 29, 2018

Embed
What would you like to do?
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.
<?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
You can’t perform that action at this time.