Skip to content

Instantly share code, notes, and snippets.

@joshfeck
Forked from sidharrell/gist:8652848
Last active August 29, 2015 14:06
Show Gist options
  • Save joshfeck/201142511a36d51b152f to your computer and use it in GitHub Desktop.
Save joshfeck/201142511a36d51b152f to your computer and use it in GitHub Desktop.
// 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; // comment out this block if extra emails are fired
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