orderSubscription()

OrderDetails orderSubscription(string usn, Order order)

This method orders a package that contains one or more subscriptions. The package specifies the configuration information for the subscriptions and also specifies if the order requires approval.

Before you call this method, call getOrderForm() to get the package order form. You must create an account before you can order a subscription against the account.

Parameters

usn
Format: string
Purpose: Specifies the USN of the account to raise the subscription against. This USN must match the USN in the Order XML document.
order
Format: Order XML
Purpose: Defines an Order XML document that specifies the package to order and contains the completed package order form. If the package contains plans, this document also specifies the plan to order.

Example: Order a subscription

This example orders package 192 with plan 812 against account 1204921324. The order form for the package has five fields (username, given name, family name, number of phone lines and secondary contact). Secondary contact is a compound custom field type, with sub-fields of secondary contact name and secondary contact number.

<Order xmlns="http://xml.inomial.com/smile/2.xsd">
  <Package>192</Package>
  <RequiresApproval>true</RequiresApproval>
  <AccountUSN>1204921324</AccountUSN>
  <PackagePlan>812</PackagePlan>
  <OrderForm>
    <Object>
      <String name="username">+61355501256</String>
      <String name="contactGiven">Joe</String>
      <String name="contactFamily">Smith</String>
      <Integer name="phoneLines">12</Integer>
      <Object name="secondaryContact">
        <String name="secondaryContactName">John Smith</String>
        <String name="secondaryContactNo">+61395505665</String>
      </Object>
    </Object>
  </OrderForm>
</Order>  

Results

This method returns an OrderDetails XML document that contains the status of the order, the order number and information about the ordered subscriptions.

Smile emits the OrderEntered message after the order is entered.

Example: A returned OrderDetails XML document

This example shows an OrderDetails XML document for two subscriptions. The document contains the order number (O12492318), specifies that the order has been approved (RequiresApproval is false) and contains the USN, SID and status information for the subscriptions.

<OrderDetails xmlns="http://xml.inomial.com/smile/2.xsd">
  <OrderNumber>O12492318</OrderNumber>
  <Order>
    <Package>192</Package>
    <RequiresApproval>false</RequiresApproval>
    <AccountUSN>1204921324</AccountUSN>
    <PackagePlan>812</PackagePlan>
    <OrderForm>
      <Object>
        <String name="username">+61355501256</String>
        <String name="contactGiven">Joe</String>
        <String name="contactFamily">Smith</String>
        <Integer name="phoneLines">12</Integer>
        <Object name="secondaryContact">
          <String name="secondaryContactName">John Smith</String>
          <String name="secondaryContactNo">+61395505665</String>
        </Object>
      </Object>
    </OrderForm>
  </Order>
  <OrderedComponents>
    <Subscription>
      <USN>120398123</USN>
      <ProvisionStatus>Provisioned</ProvisionStatus>
      <ActivateStatus>Activated</ActivateStatus>
      <EnableStatus>Enabled</EnableStatus>
      <SID>15</SID>
    </Subscription>
    <Subscription>
      <USN>120398131</USN>
      <ProvisionStatus>Provisioned</ProvisionStatus>
      <ActivateStatus>Activated</ActivateStatus>
      <EnableStatus>Enabled</EnableStatus>
      <SID>1</SID>
    </Subscription>
  </OrderedComponents>
</OrderDetails>

Faults

OrderException

This fault is returned when Smile cannot process the order, or the <Order> element is not specified or is in the wrong namespace.

Java client syntax

java -cp build/smilewsv2-client.jar [options] com.inomial.smile.client.v2.examples.OrderSubscription usn filename
usn
Purpose: Specifies the USN of the account to raise the subscription against. This USN must match the USN in the Order XML document.
filename
Purpose: Defines the filename of the Order XML document.
Note: For more information about the Java client and the options it accepts, see Java client syntax.