Contact me!
Eric Håård
+46 (0) 73 375 86 06

Order integration

When an order is created in Storm, it can be configured to call an external service to perform an order integration into an ERP-system. Storm will send an XML-request that contains all information needed to create a normal order.

If we receive an error, Storm will retry send the same XML-request for every 10 minutes for six hours or until we receive an ok.

At the moment you need to contact Storm to configure the receiving endpoint. You can view your configuration in the Client settings page under the ERP integration header.

Order request

This is the order request contract that will be sent. You can read more about the OrderRequest contract in the Storm Connect API reference documentation. You need credentials to access this documentation.

<OrderRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="Enferno.Services.StormConnect.Contracts.Order">
	<SellTo>
		<Company />
		<Person>
			<CustomerCode>XXXXXXXXXXXXXXXX</CustomerCode>
			<CompanyCode i:nil="true" />
			<FirstName>Magnus</FirstName>
			<LastName>Blombergsson</LastName>
			<JobTitle i:nil="true" />
			<PrivatePhone>070111111</PrivatePhone>
			<CellPhone>070111111</CellPhone>
			<WorkPhone i:nil="true" />
			<Email>someone@hotmail</Email>
			<SSN />
			<Address>
				<Type i:nil="true" />
				<Line1>Sell here</Line1>
				<Line2 i:nil="true" />
				<Box />
				<ZipCode>11111</ZipCode>
				<City>Stockholm</City>
				<Region i:nil="true" />
				<Country>SE</Country>
				<CareOf i:nil="true" />
			</Address>
			<AdditionalInfo />
			<IsActive i:nil="true" />
		</Person>
	</SellTo>
	<BillTo>
		<Company />
		<Person>
			<CustomerCode>2000032</CustomerCode>
			<CompanyCode i:nil="true" />
			<FirstName>Magnus</FirstName>
			<LastName>Blombergsson</LastName>
			<JobTitle i:nil="true" />
			<PrivatePhone>070111111</PrivatePhone>
			<CellPhone>070111111</CellPhone>
			<WorkPhone i:nil="true" />
			<Email>someone@hotmail</Email>
			<SSN />
			<Address>
				<Type i:nil="true" />
				<Line1>Bill here</Line1>
				<Line2 i:nil="true" />
				<Box />
				<ZipCode>11111</ZipCode>
				<City>Stockholm</City>
				<Region i:nil="true" />
				<Country>SE</Country>
				<CareOf i:nil="true" />
			</Address>
			<AdditionalInfo />
			<IsActive i:nil="true" />
		</Person>
	</BillTo>
	<ShipTo>
		<Company />
		<Person>
			<CustomerCode>2000032</CustomerCode>
			<CompanyCode i:nil="true" />
			<FirstName>Magnus</FirstName>
			<LastName>Blombergsson</LastName>
			<JobTitle i:nil="true" />
			<PrivatePhone>070111111</PrivatePhone>
			<CellPhone>070111111</CellPhone>
			<WorkPhone i:nil="true" />
			<Email>someone@hotmail</Email>
			<SSN />
			<Address>
				<Type i:nil="true" />
				<Line1>Deliver here</Line1>
				<Line2 i:nil="true" />
				<Box />
				<ZipCode>11111</ZipCode>
				<City>Stockholm</City>
				<Region i:nil="true" />
				<Country>SE</Country>
				<CareOf i:nil="true" />
			</Address>
			<AdditionalInfo />
			<IsActive i:nil="true" />
		</Person>
	</ShipTo>
	<SalesContactCode i:nil="true" />
	<SalesContactDivision />
	<DoHold>false</DoHold>
	<ClientOrderRef>5670588</ClientOrderRef>
	<ErpOrderNo />
	<CustomerOrderRef />
	<CustomerOrderComment />
	<SubmitDate>2017-02-23T08:56:59.424326+01:00</SubmitDate>
	<CurrencyCode>SEK</CurrencyCode>
	<ReferId i:nil="true" />
	<Payments>
		<Payment>
			<PaymentCode>14221</PaymentCode>
			<PaymentMethodCode>Klarna</PaymentMethodCode>
			<PaymentRef>XXXXXXXXXXXXXXXX</PaymentRef>
			<Amount>572.50</Amount>
			<CurrencyCode>SEK</CurrencyCode>
			<AdditionalInfo />
		</Payment>
	</Payments>
	<Discounts />
	<ShippingAdvice>
		<DeliveryMethodCode>DHL</DeliveryMethodCode>
		<DoSMSNotify>true</DoSMSNotify>
		<PickupStore>
			<Code>XXX</Code>
			<Name>Hemköp Järfälla</Name>
			<IsDropPoint>true</IsDropPoint>
			<Address />
		</PickupStore>
		<IsFeeChargedOnce>true</IsFeeChargedOnce>
		<IsComplete>true</IsComplete>
		<ShipAdvisorOrderCode i:nil="true" />
	</ShippingAdvice>
	<Items>
		<OrderItem>
			<LineNo>1</LineNo>
			<ParentLineNo i:nil="true" />
			<Type>ErpStandard</Type>
			<TypeGroup>Physical</TypeGroup>
			<PartNo>ABC123</PartNo>
			<ErpPartNo>ABC123</ErpPartNo>
			<InternalProductId>28928524</InternalProductId>
			<Description>Exempel på artikel: Färg med kulör</Description>
			<Quantity>1</Quantity>
			<UnitOfMeasure i:nil="true" />
			<UnitPrice>458.00</UnitPrice>
			<UnitPriceOriginal>458.00</UnitPriceOriginal>
			<Discount>0.00</Discount>
			<UnitVat>114.5000</UnitVat>
			<PriceListNo>1</PriceListNo>
			<VatRate>25.00</VatRate>
			<Comment i:nil="true" />
			<PriceLists />
			<Promotions />
			<AdditionalInfo>
				<Value>
					<Id>65</Id>
					<Code>EAN</Code>
					<Value>XXXXXXXXXXXXXXXX</Value>
				</Value>
				<Value>
					<Id>66</Id>
					<Code>Sample</Code>
					<Value>false</Value>
				</Value>
				<Value>
					<Id>67</Id>
					<Code>NCS</Code>
					<Value>S 1050-R90B</Value>
				</Value>
				<Value>
					<Id>68</Id>
					<Code>SampleOfPartNo</Code>
					<Value i:nil="true"/>
				</Value>
			</AdditionalInfo>
		</OrderItem>
		<OrderItem>
			<LineNo>2</LineNo>
			<ParentLineNo i:nil="true" />
			<Type>ErpStandard</Type>
			<TypeGroup>Physical</TypeGroup>
			<PartNo>ABC124</PartNo>
			<ErpPartNo>ABC124</ErpPartNo>
			<InternalProductId>28928525</InternalProductId>
			<Description>Exempel på artikel: Tillbehör</Description>
			<Quantity>1</Quantity>
			<UnitOfMeasure i:nil="true" />
			<UnitPrice>458.00</UnitPrice>
			<UnitPriceOriginal>458.00</UnitPriceOriginal>
			<Discount>0.00</Discount>
			<UnitVat>114.5000</UnitVat>
			<PriceListNo>1</PriceListNo>
			<VatRate>25.00</VatRate>
			<Comment i:nil="true" />
			<PriceLists />
			<Promotions />
			<AdditionalInfo>
				<Value>
					<Id>65</Id>
					<Code>EAN</Code>
					<Value>XXXXXXXXXXXXXXXX</Value>
				</Value>
				<Value>
					<Id>66</Id>
					<Code>Sample</Code>
					<Value>false</Value>
				</Value>
				<Value>
					<Id>67</Id>
					<Code>NCS</Code>
					<Value i:nil="true"/>
				</Value>
				<Value>
					<Id>68</Id>
					<Code>SampleOfPartNo</Code>
					<Value i:nil="true"/>
				</Value>
			</AdditionalInfo>
		</OrderItem>
		<OrderItem>
			<LineNo>3</LineNo>
			<ParentLineNo i:nil="true" />
			<Type>ErpStandard</Type>
			<TypeGroup>Physical</TypeGroup>
			<PartNo>ABC125</PartNo>
			<ErpPartNo>ABC125</ErpPartNo>
			<InternalProductId>28928525</InternalProductId>
			<Description>Exempel på artikel: Tapetprov</Description>
			<Quantity>1</Quantity>
			<UnitOfMeasure i:nil="true" />
			<UnitPrice>458.00</UnitPrice>
			<UnitPriceOriginal>458.00</UnitPriceOriginal>
			<Discount>0.00</Discount>
			<UnitVat>114.5000</UnitVat>
			<PriceListNo>1</PriceListNo>
			<VatRate>25.00</VatRate>
			<Comment i:nil="true" />
			<PriceLists />
			<Promotions />
			<AdditionalInfo>
				<Value>
					<Id>65</Id>
					<Code>EAN</Code>
					<Value>XXXXXXXXXXXXXXXX</Value>
				</Value>
				<Value>
					<Id>66</Id>
					<Code>Sample</Code>
					<Value>true</Value>
				</Value>
				<Value>
					<Id>67</Id>
					<Code>NCS</Code>
					<Value i:nil="true"/>
				</Value>
				<Value>
					<Id>68</Id>
					<Code>SampleOfPartNo</Code>
					<Value>ABC130</Value>
				</Value>
			</AdditionalInfo>
		</OrderItem>
		<OrderItem>
			<LineNo>4</LineNo>
			<ParentLineNo i:nil="true" />
			<Type>Extended</Type>
			<TypeGroup>Physical</TypeGroup>
			<PartNo>ABC130</PartNo>
			<ErpPartNo>ABC130</ErpPartNo>
			<InternalProductId>28928525</InternalProductId>
			<Description>Exempel på artikel: Tapet (not in store, ordered from supplier)</Description>
			<Quantity>1</Quantity>
			<UnitOfMeasure i:nil="true" />
			<UnitPrice>458.00</UnitPrice>
			<UnitPriceOriginal>458.00</UnitPriceOriginal>
			<Discount>0.00</Discount>
			<UnitVat>114.5000</UnitVat>
			<PriceListNo>1</PriceListNo>
			<VatRate>25.00</VatRate>
			<Comment i:nil="true" />
			<PriceLists />
			<Promotions />
			<AdditionalInfo>
				<Value>
					<Id>65</Id>
					<Code>EAN</Code>
					<Value>XXXXXXXXXXXXXXXX</Value>
				</Value>
				<Value>
					<Id>66</Id>
					<Code>Sample</Code>
					<Value>false</Value>
				</Value>
				<Value>
					<Id>67</Id>
					<Code>NCS</Code>
					<Value i:nil="true"/>
				</Value>
				<Value>
					<Id>68</Id>
					<Code>SampleOfPartNo</Code>
					<Value i:nil="true"/>
				</Value>
			</AdditionalInfo>
		</OrderItem>
		<OrderItem>
			<LineNo>5</LineNo>
			<ParentLineNo i:nil="true" />
			<Type>Freight</Type>
			<TypeGroup>Service</TypeGroup>
			<PartNo>ABC127</PartNo>
			<ErpPartNo>ABC127</ErpPartNo>
			<InternalProductId>28928527</InternalProductId>
			<Description>Exempel på artikel: Freight</Description>
			<Quantity>1</Quantity>
			<UnitOfMeasure i:nil="true" />
			<UnitPrice>100.00</UnitPrice>
			<UnitPriceOriginal>100.00</UnitPriceOriginal>
			<Discount>0.00</Discount>
			<UnitVat>25.0000</UnitVat>
			<PriceListNo>1</PriceListNo>
			<VatRate>25.00</VatRate>
			<Comment i:nil="true" />
			<PriceLists />
			<Promotions />
			<AdditionalInfo>
				<Value>
					<Id>65</Id>
					<Code>EAN</Code>
					<Value i:nil="true"/>
				</Value>
				<Value>
					<Id>66</Id>
					<Code>Sample</Code>
					<Value>false</Value>
				</Value>
				<Value>
					<Id>67</Id>
					<Code>NCS</Code>
					<Value i:nil="true"/>
				</Value>
				<Value>
					<Id>68</Id>
					<Code>SampleOfPartNo</Code>
					<Value i:nil="true"/>
				</Value>
			</AdditionalInfo>
		</OrderItem>
	</Items>
	<Fees />
	<AdditionalInfo>
		<Value>
			<Id>69</Id>
			<Code>StoreCode</Code>
			<Value>Central</Value>
		</Value>
	</AdditionalInfo>
	<Header>
		<ApplicationKey>xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxx</ApplicationKey>
	</Header>
	<OrderType>Order</OrderType>
</OrderRequest>

Order response

This is the response that Storm will expect if all goes well:

<OrderResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="Enferno.Services.StormConnect.Contracts.Order">
	<StatusCode>OK</StatusCode>
	<Description>More info when an error occured</Description>
	<HasErpOrderNo>true</HasErpOrderNo>
	<ErpOrderNo>123123123</ErpOrderNo>
</OrderResponse>

Example of simple order endpoint

This is an example of how to receive the order request and create an order response that is returned to Storm. It uses a public Storm Connect contract.

public class CustomerOrderController : ApiController
    {
       
        /// <summary>
        /// Storm calls this service with an orderrequest message. And expects an OrderResponse message back. 
        /// Timeouts or 500 errors will result in retries. If a reponse with statuscode "OK" or "Failed" is returned no more retries is sent.
        /// Use "Failed" to tell Storm that the order is not created, but no more retries is needed anyway. The fault handling is done from this system.
	/// Storm supports SSL, SOAP or REST, XML or JSON and Basic authentication (recommended).
        /// </summary>

        /// <returns>OrderResponse</returns>
        // POST: api/CustomerOrder
        public XElement Post([FromBody]XElement value)
        {
            XNamespace nsEnfernoOrder = "Enferno.Services.StormConnect.Contracts.Order";
            
            var xd = new XDocument(value);
            xd.Save($"C:\\temp\\orderRequest_{Guid.NewGuid()}.txt");

            //1. Order is received and is set to accepted in Storm
            var response  =new XElement(nsEnfernoOrder + "OrderResponse", 
                new XElement(nsEnfernoOrder + "StatusCode", "OK"),
                new XElement(nsEnfernoOrder + "Description", "Order is received and being processed"),
                new XElement(nsEnfernoOrder + "HasErpOrderNo", false),
                new XElement(nsEnfernoOrder + "ErpOrderNo", null)
                );

            /*
            //2. Order is received and is set to confirmed in Storm orderno is updated
            var response  =new XElement(nsEnfernoOrder + "OrderResponse", 
                new XElement(nsEnfernoOrder + "StatusCode", "OK"),
                new XElement(nsEnfernoOrder + "Description", "Order is received and is confirmed"),
                new XElement(nsEnfernoOrder + "HasErpOrderNo", true)
                new XElement(nsEnfernoOrder + "ErpOrderNo", Guid.NewGuid().ToString()) //Should be created in ERP, must be unique
                );
                
            //3. Known error in order process
            var response  =new XElement(nsEnfernoOrder + "OrderResponse", 
                new XElement(nsEnfernoOrder + "StatusCode", "Failed"), 
                new XElement(nsEnfernoOrder + "Description", "Order is received but has a known issue, error handling i done here, no retry needed"),
                new XElement(nsEnfernoOrder + "HasErpOrderNo", false),
                new XElement(nsEnfernoOrder + "ErpOrderNo", null)
                ); 
            
             */

            return response;
        }
        
    }