1<?php 2// (c) Copyright by authors of the Tiki Wiki CMS Groupware Project 3// 4// All Rights Reserved. See copyright.txt for details and a complete list of authors. 5// Licensed under the GNU LESSER GENERAL PUBLIC LICENSE. See license.txt for details. 6// $Id$ 7 8function payment_behavior_cart_gift_certificate_refund( 9 $giftcertId = 0, 10 $giftcertMode = '', 11 $giftcertAmount = 0, 12 $giftcertDiscount = 0 13) { 14 15 $cartlib = TikiLib::lib('cart'); 16 global $prefs; 17 18 if ($giftcertMode == "Percentage" || $giftcertMode == "Coupon Percentage") { 19 $cartlib->set_tracker_value_custom( 20 $prefs['payment_cart_giftcert_tracker_name'], 21 "Current Balance or Percentage", 22 $giftcertId, 23 $giftcertAmount 24 ); 25 } else { 26 $currentBalance = $cartlib->get_tracker_value_custom( 27 $prefs['payment_cart_giftcert_tracker_name'], 28 "Current Balance or Percentage", 29 $giftcertId 30 ); 31 $cartlib->set_tracker_value_custom( 32 $prefs['payment_cart_giftcert_tracker_name'], 33 "Current Balance or Percentage", 34 $giftcertId, 35 $currentBalance + $giftcertDiscount 36 ); 37 } 38 return true; 39} 40