Skip to content

Instantly share code, notes, and snippets.

@sidharrell
Created January 27, 2014 17:10
Show Gist options
  • Save sidharrell/8652848 to your computer and use it in GitHub Desktop.
Save sidharrell/8652848 to your computer and use it in GitHub Desktop.
email confirmations when invoice finalize link is clicked
// Add this section to the end of gateways/invoice/init.php
// This is for the thank you page
if (!empty($_REQUEST['type']) && $_REQUEST['type'] == 'invoice') {
event_espresso_require_gateway("invoice/invoice_ipn.php");
add_filter('filter_hook_espresso_transactions_get_attendee_id', 'espresso_transactions_invoice_get_attendee_id');
add_filter('filter_hook_espresso_thank_you_get_payment_data', 'espresso_process_invoice');
}
// Then create a new file, gateways/invoice/invoice_ipn.php and add this to it.
// Don't forget to add a <?php to the top of the file before adding all this to it.
function espresso_transactions_invoice_get_attendee_id($attendee_id) {
if (isset($_REQUEST['id']))
$attendee_id = $_REQUEST['id'];
return $attendee_id;
}
function espresso_process_invoice($payment_data) {
static $sent = false;
if (!$sent) {
event_espresso_email_confirmations(array('session_id' => $payment_data['attendee_session'], 'send_admin_email' => 'true', 'send_attendee_email' => 'true'));
$sent = true;
}
$payment_data['payment_status'] = 'Pending';
$payment_data['txn_type'] = 'Invoice';
$payment_data['txn_id'] = $payment_data['attendee_session'];
$payment_data['txn_details'] = "paying by invoice";
return $payment_data;
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment