computeSurcharge()
SurchargeCalculation computeSurcharge(string usn, string
paymentTypeCode, CurrencyValue amount, date timestamp)
This method calculates the surcharge payable on a payment of the given amount for a specified payment type at a specified time.
Parameters
- usn
- Format: string
- paymentTypeCode
- Format: string
- amount
- Format: CurrencyValue
- timestamp
- Format: date
Results
This method returns a SurchargeCalculation XML document that list information about the surcharge and the itemised charges used to calculate the total amount charged.
There are no messages defined by this method.
Example: A returned SurchargeCalculation XML document
This example shows a SurchargeCalculation XML document that calculates the surcharge on an amount of $0.90.
<SurchargeCalculation xmlns:="http://xml.inomial.com/smile/2.xsd" xmlns:="http://ws.inomial.com/smile.2">
<Surcharge>
<Percentage>1</Percentage>
<Fixed formatted="$0.50" currency="AUD">0.5</Fixed>
<Minimum formatted="$1.00" currency="AUD">1</Minimum>
</Surcharge>
<TotalAmount formatted="$2.00" currency="AUD">2.00</TotalAmount>
<SurchargeTotal formatted="$1.10" currency="AUD">1.10</SurchargeTotal>
<SurchargeTax formatted="$0.10" currency="AUD">0.10</SurchargeTax>
<SurchargeExTax formatted="$1.00" currency="AUD">1.00</SurchargeExTax>
<OriginalAmount formatted="$0.90" currency="AUD">0.90</OriginalAmount>
</SurchargeCalculation>
Faults
NoSuchItemExceptionThis fault is returned when the objects represented by usn or paymentTypeCode cannot be found.
InvalidRequestExceptionThis fault is returned when a required parameter is not provided, currency is provided and does not match the expected currency, or the amount is invalid, for example, zero or negative.
Java client syntax
java -cp build/smilewsv2-client.jar [options] com.inomial.smile.client.v2.examples.ComputeSurcharge usn paymentTypeCode amount [timestamp]
- usn
- Purpose: Specifies the USN of the account against which the surcharge calculation should be made.
- paymentTypeCode
- Purpose: Specifies the code of the intended payment type.
- amount
- Purpose: Specifies the amount to be paid. If the currency attribute is specified it will be checked against the expected currency.
- timestamp
- Purpose: (Optional) Specifies the time at which the payment is made. If not specified the current time is used.