Charge

This function allows you to add a charge to an invoice.

Tags: Charge, InvoiceCharge, InvoiceIdentification, ChargeInvoiceArticle, ChargeOrderContext, ChargeInOrderContext, ChargeResponse, InvoiceChargeResult

Request XML

POST /xxx/Automation.asmx HTTP/1.1
Host: api.ongoingsystems.se
Content-Type: text/xml; charset=utf-8
Content-Length: length
SOAPAction: "http://ongoingsystems.se/Automation/Charge"

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <Charge xmlns="http://ongoingsystems.se/Automation">
      <UserName>string</UserName>
      <Password>string</Password>
      <InvoiceCharge>
        <Invoice>
          <Identification>InvoiceId or ActiveInvoice or ExistingOrNewInvoice</Identification>
          <InvoiceId>int</InvoiceId>
          <GoodsOwnerId>int</GoodsOwnerId>
        </Invoice>
        <InvoiceArticle>
          <InvoiceArticleIdentification>InvoiceArticleId</InvoiceArticleIdentification>
          <InvoiceArticleId>int</InvoiceArticleId>
        </InvoiceArticle>
        <OrderContext>
          <OrderId>int</OrderId>
        </OrderContext>
        <InOrderContext>
          <InOrderId>int</InOrderId>
        </InOrderContext>
        <NumberOfItems>decimal</NumberOfItems>
        <Price>decimal</Price>
        <Comment>string</Comment>
        <ActionDate>dateTime</ActionDate>
      </InvoiceCharge>
    </Charge>
  </soap:Body>
</soap:Envelope>

Request specification

Charge
UserName string(50) Req. Your username
Password string(50) Req. Your password
InvoiceCharge InvoiceCharge Req. An InvoiceCharge object
InvoiceCharge
Invoice InvoiceIdentification Req. An element of InvoiceIdentification. Defines which invoice you wish to add the charge to.
InvoiceArticle ChargeInvoiceArticle Req. An element of ChargeInvoiceArticle. Defines which invoice article you wish charge. You can use GetPriceListByQuery to get a list of all invoice articles which have been set up for a goods owner.
OrderContext ChargeOrderContext An element of ChargeOrderContext. Use this if you wish the charge to be connected to a particular order.
InOrderContext ChargeInOrderContext An element of ChargeInOrderContext. Use this if you wish the charge to be connected to a particular inorder.
NumberOfItems decimal Req. The number of charges you wish to add to the invoice.
Price decimal Req. The total price of the charges.
Comment string(1000) A comment for the charge.
ActionDate dateTime The time when the charge was made
InvoiceIdentification
Identification enum Req. Defines what you want to identify the invoice by:
 - InvoiceId
 - ActiveInvoice
 - ExistingOrNewInvoice
If ActiveInvoice is used, the system will apply the charge to the currently active invoice for the goods owner. If there is no active invoice, an error message is returned.
If ExistingOrNewInvoice is used, the system will apply the charge to an existing invoice where the invoice period matches the provided ActionDate (today's date if none provided). If no matching invoice exists, a new invoice will be automatically created.
InvoiceId int The system id of the invoice which you want to apply the charge to. Required if Identification = InvoiceId.
GoodsOwnerId int Req. The system id of the goods owner.
ChargeInvoiceArticle
InvoiceArticleIdentification enum Req. Defines what you want to identify the invoice article by:
 - InvoiceArticleId (currently this is the only choice available)
InvoiceArticleId int Req. The system id of the invoice article of the charge you wish to add.
ChargeOrderContext
OrderId int Req. The internal system id of the order which you wish the charge to be connected to
ChargeInOrderContext
InOrderId int Req. The internal system id of the inorder which you wish the charge to be connected to

Response XML

<?xml version="1.0" encoding="utf-8" ?>
<soap:Envelope xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns:xsd="http://www.w3.org/2001/XMLSchema" xmlns:soap="http://schemas.xmlsoap.org/soap/envelope/">
  <soap:Body>
    <ChargeResponse xmlns="http://ongoingsystems.se/Automation">
      <ChargeResult>
        <Success>boolean</Success>
        <Message>string</Message>
        <ChargeId>int</ChargeId>
        <InvoiceId>int</InvoiceId>
      </ChargeResult>
    </ChargeResponse>
  </soap:Body>
</soap:Envelope>

Response specification

ChargeResponse
ChargeResult InvoiceChargeResult
InvoiceChargeResult
Success boolean True if successful, false otherwise
Message string Error message, if the call was unsuccessful
ChargeId int The id of the charge which was added
InvoiceId int The id of invoice to which the charge was added