[wiaflos-devel] COMMIT - r216 - trunk/soap/Plugins

svn at linuxrulz.org svn at linuxrulz.org
Sun Aug 10 16:02:07 GMT 2008


Author: nkukard
Date: 2008-08-10 16:02:07 +0000 (Sun, 10 Aug 2008)
New Revision: 216

Modified:
   trunk/soap/Plugins/Receipting.pm
Log:
* Added support to create a transaction receipt allocation


Modified: trunk/soap/Plugins/Receipting.pm
===================================================================
--- trunk/soap/Plugins/Receipting.pm	2008-08-10 16:00:20 UTC (rev 215)
+++ trunk/soap/Plugins/Receipting.pm	2008-08-10 16:02:07 UTC (rev 216)
@@ -262,11 +262,16 @@
 }
 
 
-# Create allocation
-# Parameters:
-#		ReceiptNumber	- Receipt number
-#		InvoiceNumber	- Invoice number
-#		Amount		- Amount
+# @fn createReceiptAllocation($data)
+# Create a receipt allocation
+#
+# @param data Hash ref with the below elements
+# @li ReceiptNumber - Receipt number to create allocation for
+# @li InvoiceNumber - Invoice number to allocate to
+# @li TransactionNumber - Transaction number to allocate to
+# @li Amount - Amount to allocate
+#
+# @return Receipt allocation ID on success < 1 on error
 sub createReceiptAllocation {
 	my (undef,$data) = @_;
 
@@ -276,8 +281,14 @@
 		return SOAPResponse(RES_ERROR,ERR_S_PARAM,"Parameter 'ReceiptNumber' invalid");
 	}
 
-	if (!defined($data->{'InvoiceNumber'}) || $data->{'InvoiceNumber'} eq "") {
-		return SOAPResponse(RES_ERROR,ERR_S_PARAM,"Parameter 'InvoiceNumber' invalid");
+	if (defined($data->{'InvoiceNumber'})) {
+		if ($data->{'InvoiceNumber'} eq "") {
+			return SOAPResponse(RES_ERROR,ERR_S_PARAM,"Parameter 'InvoiceNumber' invalid");
+		}
+	} elsif (defined($data->{'TransactionNumber'})) {
+		if ($data->{'TransactionNumber'} eq "") {
+			return SOAPResponse(RES_ERROR,ERR_S_PARAM,"Parameter 'TransactionNumber' invalid");
+		}
 	}
 
 	if (!defined($data->{'Amount'}) || $data->{'Amount'} eq "") {
@@ -290,6 +301,7 @@
 	my $detail;
 	$detail->{'ReceiptNumber'} = $data->{'ReceiptNumber'};
 	$detail->{'InvoiceNumber'} = $data->{'InvoiceNumber'};
+	$detail->{'TransactionNumber'} = $data->{'TransactionNumber'};
 	$detail->{'Amount'} = $data->{'Amount'};
 	my $res = wiaflos::server::Receipting::createReceiptAllocation($detail);
 	if ($res < 1) {



More information about the wiaflos-devel mailing list