AlanT
18th April 2006, 10:03 PM
No merchant likes refunds, but if you offer them, eventually someone will take you up on the offer.
Up until now, there was no way to properly record a refund transaction in PAP. Your only option was to decline the original transaction and then do some manual bookkeeping to adjust the affiliate's payout.
For me, this was simply unacceptable. I had asked for this feature, but the next version of PAP that's supposed to include it has not yet been released. I couldn't wait any longer, as I have affiliate to pay and 4 refunds to process.
After studying the code and trying a few things, I found that there are only 2 changes that need to be made to allow for the creation of negative transactions in PAP.
Change 1: include/Affiliate/Merchant/Views/TransactionManager.class.php
in function processCreateTransaction () around line 259, you'll see this line of code:
$totalcost = preg_replace('/[^0-9\.]/', '', $_POST['totalcost']);
The preg_replace is removing the negation sign from the entered number. I have no idea how to adjust it right, but for my purposes, I simply removed all that and replaced that line with:
$totalcost = $_POST['totalcost'];
Change 2: include/Affiliate/Scripts/Bl/SaleRegistrator.class.php
in function registerSale () around line 186, you'll see this line of code:
if(!is_numeric($original_totalCost) || $original_totalCost < 0)
The < 0 comparison is disallowing negative transactions. Simply remove that comparision to fix, leaving
if(!is_numeric($original_totalCost))
That's all there is to it. Now you can enter negative transactions to account for refunds, and the next time you process payments, PAP handles all the accounting so you pay your affiliates the correct amount.
Up until now, there was no way to properly record a refund transaction in PAP. Your only option was to decline the original transaction and then do some manual bookkeeping to adjust the affiliate's payout.
For me, this was simply unacceptable. I had asked for this feature, but the next version of PAP that's supposed to include it has not yet been released. I couldn't wait any longer, as I have affiliate to pay and 4 refunds to process.
After studying the code and trying a few things, I found that there are only 2 changes that need to be made to allow for the creation of negative transactions in PAP.
Change 1: include/Affiliate/Merchant/Views/TransactionManager.class.php
in function processCreateTransaction () around line 259, you'll see this line of code:
$totalcost = preg_replace('/[^0-9\.]/', '', $_POST['totalcost']);
The preg_replace is removing the negation sign from the entered number. I have no idea how to adjust it right, but for my purposes, I simply removed all that and replaced that line with:
$totalcost = $_POST['totalcost'];
Change 2: include/Affiliate/Scripts/Bl/SaleRegistrator.class.php
in function registerSale () around line 186, you'll see this line of code:
if(!is_numeric($original_totalCost) || $original_totalCost < 0)
The < 0 comparison is disallowing negative transactions. Simply remove that comparision to fix, leaving
if(!is_numeric($original_totalCost))
That's all there is to it. Now you can enter negative transactions to account for refunds, and the next time you process payments, PAP handles all the accounting so you pay your affiliates the correct amount.