reverseTransaction()

TransactionDetail reverseTransaction(string usn, ReverseTransactionRequest reverseTransactionRequest)

This method raises a new transaction that reverses the a specified transaction.

Parameters

usn
Format: string
Purpose: Specifies the USN of the account for which the reversal is requested.
reverseTransactionRequest
Format: ReverseTransactionRequest XML
Purpose: Defines a ReverseTransactionRequest XML document that specifies the transaction number to be reversed.

Example: A ReverseTransactionRequest XML document

This example shows a ReverseTransactionRequest XML document for transaction number 21431481.

A ReverseTransactionRequest XML document contains the following elements:
<Number>
Specifies the transaction number to reverse.
<SalesReportCategory>
Specifies the sales report item code to apply to the reversal transaction.
<ReversalDate>
Specifies the date of the reversal transaction.
<Comment>
(Optional) Specifies comments or notes about the reversal.
<ReverseTransactionRequest xmlns="http://xml.inomial.com/smile/2.xsd">
  <Number>21431481</Number>
  <SalesReportCategory>rinvoice</SalesReportCategory>
  <ReversalDate>2015-01-13+10:00</ReversalDate>
  <Comment>Test Reverse Invoice</Comment>
</ReverseTransactionRequest>

Results

This method returns a TransactionDetail XML document that contains information about the transaction reversal.

Smile emits a TransactionClosed message for the reversal and a TransactionReversed message for the original transaction.

Example: A returned TransactionDetail XML document

This example shows a TransactionDetail XML document that contains information about the transaction reversal.

<TransactionDetail xmlns="http://xml.inomial.com/smile/2.xsd" xmlns="http://ws.inomial.com/smile.2">
  <version>2.0</version>
  <transactionType>InvoiceReversal</transactionType>
  <company>1</company>
  <usn>2142422787</usn>
  <transactionNumber>21431523</transactionNumber>
  <currency>AUD</currency>
  <amount>-100.00</amount>
  <accountType>1</accountType>
  <gstAmount>-9.09</gstAmount>
  <entryTimestamp>2015-01-13T11:47:02.749+11:00</entryTimestamp>
  <salesReportCategory>rinvoice</salesReportCategory>
  <formattedAmount currency="AUD" formatted="$(100.00)">-100.00</formattedAmount>
  <formattedGstAmount currency="AUD" formatted="$(9.09)">-9.09</formattedGstAmount>            
  <unallocatedAmount>0.00</unallocatedAmount>
  <enteredByUsn>2142420815</enteredByUsn>
  <logTimestamp>2015-01-13T11:47:02.749+11:00</logTimestamp>
  <referencedNumber>21431481</referencedNumber>
  <description>Test Reverse Invoice</description>
  <formattedUnallocatedAmount currency="AUD" formatted="$0.00">0.00</formattedUnallocatedAmount>
</TransactionDetail>

Faults

NoSuchItemException

This fault is returned when the provided transaction number does not exist.

InvalidRequestException

This fault is returned when the account number is not provided.

Java client syntax

java -cp build/smilewsv2-client.jar [options]
 com.inomial.smile.client.v2.examples.ReverseTransactionRequest usn filename
usn
Purpose: Specifies the USN of the account for which the reversal is requested.
filename
Purpose: Defines the filename of the ReverseTransactionRequest XML document.
Note: For more information about the Java client and the options it accepts, see Java client syntax.