From bbcb28cfc738a28a8364722c94bb695f7bbc13f4 Mon Sep 17 00:00:00 2001 From: Nathan Coad Date: Tue, 6 May 2014 16:09:33 +1000 Subject: [PATCH] Tweak refund process --- booking.helper.inc | 46 ++++++++++++++++++++++++---------------------- 1 file changed, 24 insertions(+), 22 deletions(-) diff --git a/booking.helper.inc b/booking.helper.inc index df9cb2d..9fb5894 100644 --- a/booking.helper.inc +++ b/booking.helper.inc @@ -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;