Tweak refund process

This commit is contained in:
2014-05-06 16:09:33 +10:00
parent 5e8e1bd22d
commit bbcb28cfc7

View File

@@ -728,7 +728,7 @@ function _booking_process_refund($person)
$refund_due = $person->booking_amount_paid - $refund;
if ($refund_due == 0)
{
//mark the refund as processed since no action is required
//mark the refund as processed since no action is required and don't add an entry into the manual payments table
db_update('booking_person')
->fields(array(
'booking_refund_due' => 0,
@@ -746,29 +746,31 @@ function _booking_process_refund($person)
))
->condition('nid', $person->nid)
->execute();
//add manual payment entry for refund
$result = db_insert('booking_payment')
->fields(array(
'booking_person_nid' => $person->nid,
'booking_eventid' => $event->eid,
'booking_mc_gross' => $refund * -1,
'booking_mc_currency' => 'AUD',
'booking_mc_fee' => '0.00',
'booking_quantity' => 1,
'booking_invoice' => 'Refund',
'booking_payer_id' => '',
'booking_payment_date' => REQUEST_TIME,
'booking_payment_status' => '',
'booking_first_name' => $person->booking_firstname,
'booking_last_name' => $person->booking_lastname,
'booking_buyer_email' => '',
'booking_payer_status' => '',
'booking_item_name' => 'Refund',
'booking_ipn_track_id' => '',
))
->execute();
}
//add manual payment entry for refund
$result = db_insert('booking_payment')
->fields(array(
'booking_person_nid' => $person->nid,
'booking_eventid' => $event->eid,
'booking_mc_gross' => $refund * -1,
'booking_mc_currency' => 'AUD',
'booking_mc_fee' => '0.00',
'booking_quantity' => 1,
'booking_invoice' => 'Refund',
'booking_payer_id' => '',
'booking_payment_date' => REQUEST_TIME,
'booking_payment_status' => '',
'booking_first_name' => $person->booking_firstname,
'booking_last_name' => $person->booking_lastname,
'booking_buyer_email' => '',
'booking_payer_status' => '',
'booking_item_name' => 'Refund',
'booking_ipn_track_id' => '',
))
->execute();
//return the amount to refund this person
return $refund;