35
© Copyright 2020, LS Retail ehf. All rights reserved. All trademarks belong to their respective holders LS Omni 4.x Unified Commerce Interface Developers Guide

LS Omni 4.x Unified Commerce Interface - LS Retail

  • Upload
    others

  • View
    5

  • Download
    0

Embed Size (px)

Citation preview

Page 1: LS Omni 4.x Unified Commerce Interface - LS Retail

© Copyright 2020, LS Retail ehf. All rights reserved. All trademarks belong to their respective holders

LS Omni 4.x

Unified Commerce Interface

Developers Guide

Page 2: LS Omni 4.x Unified Commerce Interface - LS Retail

LS Retail ehf. Hagasmari 3, 201 Kopavogur, Iceland

Phone +354 414 5700

Contents

1 Introduction ................................................................................................................................ 3

2 Replication .................................................................................................................................. 4

2.1 Replication Code Sample .......................................................................................................... 6

2.2 Hierarchy Setup ............................................................................................................................ 7

3 Member Contact......................................................................................................................... 9

3.1 Create Member Contact .......................................................................................................... 10

3.2 Profiles .......................................................................................................................................... 12

3.3 Login............................................................................................................................................... 12

3.4 Password Change and Reset ................................................................................................ 13

4 Product Setup .......................................................................................................................... 14

4.1 Hierarchy...................................................................................................................................... 14

4.2 Price and discount .................................................................................................................... 16

4.3 Stock Status ................................................................................................................................. 18

5 Order, Basket & Wishlist ..................................................................................................... 19

5.1 Basket ............................................................................................................................................ 19

5.2 Wish List ....................................................................................................................................... 20

5.3 Calculate ....................................................................................................................................... 21

5.4 Calculate Hospitality Basket ................................................................................................. 22

5.5 Order Create ............................................................................................................................... 24

5.6 Order Lines .................................................................................................................................. 26

5.7 Payments ...................................................................................................................................... 27

5.8 Sales History ............................................................................................................................... 28

5.9 Orders in LS Central ................................................................................................................. 28

5.9.1 Sales Order 29

5.9.2 Click And Collect Order 30

5.10 eCommerce communication .............................................................................................. 32

6 Other Code Samples .............................................................................................................. 35

6.1 Get Image for Item .................................................................................................................... 35

6.2 Get Image Stream for Item .................................................................................................... 35

Page 3: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 1 - Introduction 3

1 Introduction

The purpose of this document is to give an overview of how to start implementing Omni against eCommerce solution. Most samples are shown with SOAP requests, but replication sample uses ASP.NET code to demonstrate how to set up the loop to pull all the data and use of LastKey value.

Install LS Omni Server and configure it to connect to LS Central (14.xx). For installation of the LS Omni server, see “LS Omni Server install and configuration guide”

After Installing the LS Omni server, some data needs to be prepared in LS Central for LS Omni, see “LS Central Configuration for LS Omni 4.x” for more information.

To test connection to LS Omni and check if everything is working and LS Omni can talk to LS Central, open a browser and type in this URL (Pointing to the host where LS Omni is running on)

http://localhost/lsomniservice/ucjson.svc/ping

if all is ok, you should get reply like this:

"PONG OK> Successfully connected to [LSOmni DB] & [LSCentral DB] & [LSCentral WS] LS:14.02.00.936 [32615] OMNI:4.2.0"

To secure eCommerce communication, use the Basic Authentication settings in IIS Server and send the Login Authentication with every request.

Online help for the LS Omni eCommerce Interface can be found here:

http://mobiledemo.lsretail.com/lsomnihelp

There you can see some samples for SOAP & JSON requests, LS Central WS request data and how LS Omni object maps to the LS Central WS XML.

Page 4: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 2 - Replication 4

2 Replication

LS Omni has interface to replicate data from LS Central via Omni over to eCommerce.

More detailed information on what data it replicates can be found online for each function. The functions are:

Product Setup

ReplEcommItems

ReplEcommUnitOfMeasures

ReplEcommItemUnitOfMeasures

ReplEcommItemVariantRegistrations

ReplEcommExtendedVariants

ReplEcommAttribute

ReplEcommAttributeOptionValue

ReplEcommAttributeValue

ReplEcommBarcodes

ReplEcommBasePrices

ReplEcommPrices

ReplEcommDiscounts

ReplEcommMixAndMatch

ReplEcommDiscountValidations

ReplEcommFullItem

ReplEcommImageLinks

ReplEcommImages

ReplEcommItemCategories

ReplEcommProductGroups

ReplEcommInventoryStatus

ReplEcommHierarchy

ReplEcommHierarchyLeaf

ReplEcommHierarchyNode

ReplEcommHierarchyHospDeal

ReplEcommHierarchyHospDealLine

ReplEcommHierarchyHospModifier

ReplEcommHierarchyHospRecipe

Basic Data

ReplEcommCountryCode

ReplEcommCurrency

ReplEcommCurrencyRate

ReplEcommDataTranslation

ReplEcommDataTranslationLangCode

ReplEcommMember

ReplEcommShippingAgent

ReplEcommStores

ReplEcommStoreTenderTypes

ReplEcommTaxSetup

ReplEcommVendor

ReplEcommVendorItemMapping

All functions take in a ReplRequest object that tells what data to get and return a Response object with list of records and other information about the status of the replication.

A Full Replication takes all the data from the source table. Full Replication should be done when new store has been set up or data for a store needs to be recovered or restored again. When doing Update Replication, then LS Central PreActions are used to get all affected records since last Replication and lastKey will point to last PreAction counter which should be sent in every time an Update Replication is performed. If lastKey and maxKey are set to 0, then all affected records with PreAction in LS Central will be replicated.

Page 5: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 2 - Replication 5

For deleted data, Update Replication will include that record with key data and property IsDeleted set to true.

Some of the functions support Store distribution. Set the StoreId in replication request to replicate only data relevant to that store.

Full Replication replicates all the data from LS Central and will return latest PreAction counter when done as LastKey except Price and Discount replication will store last PreAction count in MaxKey value as LastKey is used for table timestamp. Update Replication will look for any changes made from LastKey and MaxKey since last Full or Update Replication was made. LastKey and MaxKey for each Replication function should be stored locally.

This sample for replication is written in Asp.net C# and will demonstrate how to set up a loop code that will pull all data from replication and how to store LastKey and MaxKey and then use it again for update replication.

You will get data back when doing Full Replication but after Full Replication, Update Replication will be empty as LastKey will point to the last record in LS Central. To get some data, either do some changes to the data in LS Central and then run Update Replication again or run Update Replication first after starting up the web sample. Adding this line of code before the while loop will reset the LastKey value so Update Replication will always return all available data from PreActions.

Session["ItemLKey"] = "0";

ReplEcommFullItem function returns Item with list of Variants, Unit of Measures, Attributes and Prices.

ReplEcommImages will return Image in base64 string format. This data can be used directly on a web page by adding the string to WebControl Image control

Image1.ImageUrl = "data:image/jpeg;base64," + replImage.Image64;

ReplEcommInventoryStatus gets current Inventory status.

To set up what products are included in the replication, run the POS Inventory Lookup command in Product Groups page in LS Central to generate the Lookup Lines for the Stores and Products that should be replicated.

The data is stored in “Inventory Lookup Table” in nav.

Run Scheduler Job OMNI_INVENTORY (10012871) to update the Inventory status. This needs to run regularly to keep inventory up to date.

Replication is only picking up the value in the last column, Net Inventory, that gets calculated by the scheduler job.

All UCService.ReplXxxxResponse Objects include a list Object with the data record that is being replicated. LastKey and MaxKey have the last point in time or last PreAction Id during and after replication. MaxKey in most functions shows the highest PreAction Id that is expected after replication is done, but in some it used to store delta value. RecordsRemaining shows how many records are left to pull and when it reaches 0 then all records have been delivered.

NOTE: In some cases, replication will always return all records, as these are tables that don’t have any PreAction setup and usually include small amount of data that does not get updated frequently.

Page 6: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 2 - Replication 6

2.1 Replication Code Sample

Add following code to Default.aspx.cs

public partial class _Default : Page

{

private UCService.ReplRequest request; // Replication Request object

private UCService.IUCServiceClient serviceClient;

protected void Page_Load(object sender, EventArgs e)

{

serviceClient = new UCService.IUCServiceClient();

request = new UCService.ReplRequest();

request.BatchSize = 100; // Number of records to get in each Replication call

request.LastKey = "0"; // Current record point during replication

request.MaxKey = "0"; // Highest record point expected after replication

request.StoreId = "S0001"; // Store to replicate data for

}

protected void Button1_Click(object sender, EventArgs e)

{

// Full replication is needed first time Store is activated

request.FullReplication = true;

while (true)

{

request.LastKey = Session["ItemLKey"] as string; // Set LastKey from previous call

request.MaxKey = Session["ItemMKey"] as string; // Set MaxKey from previous call

UCService.ReplItemResponse result = serviceClient.ReplEcommItems(request);

Session["ItemLKey"] = result.LastKey; // Store LastKey

Session["ItemMKey"] = result.MaxKey; // Store MaxKey

if (result.RecordsRemaining <= 0)

break; // Replication is done, no more data

foreach (UCService.ReplItem item in result.Items)

{

// iterate through the list of returned items

}

}

}

protected void Button2_Click(object sender, EventArgs e)

{

// After Full replication, only Update replication is needed from LastKey record point

request.FullReplication = false;

while (true)

{

request.LastKey = Session["ItemLKey"] as string; // Set LastKey from previous call

request.MaxKey = Session["ItemMKey"] as string; // Set MaxKey from previous call

UCService.ReplItemResponse result = serviceClient.ReplEcommItems(request);

Session["ItemLKey"] = result.LastKey; // Store LastKey

Session["ItemMKey"] = result.MaxKey; // Store MaxKey

if (result.RecordsRemaining <= 0)

break; // Replication is done, no more data

foreach (UCService.ReplItem item in result.Items)

{

// iterate through the list of returned items

}

}

}

}

Page 7: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 2 - Replication 7

2.2 Hierarchy Setup

Hierarchy is built up by Nodes and Leaves. Leaf can be of type Item or Deal. Deal can have Item or Deal Lines. In Hospitality hierarchy Leaf Items can have Modifier and/or Recipe.

Hierarchy

Id: FINEDINING

Node

HierarchyCode: FINEDINING (Hiearchy Id)

Id: SETMENU

Leaf (Deal)

HierarchyCode: FINEDINING (Hiearchy Id)

NodeId: SETMENU (Node Id)

Id: S10011

Type: Deal

Deal

HierarchyCode: FINEDINING (Hiearchy Id)

ParentNode: SETMENU (Node Id)

DealNo: S10011 (Leaf Id)

No: COFFEE

DealLine

HierarchyCode: FINEDINING (Hiearchy Id)

ParentNode: SETMENU (Node Id)

DealNo: S10011 (Leaf Id)

DealLineCode: COFFEE (Deal No)

DealLineNo: 10000

ItemNo: 30086

Page 8: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 2 - Replication 8

Hierarchy

Id: FINEDINING

Node

HierarchyCode: FINEDINING (Hiearchy Id)

Id: MAINS

Leaf (Item)

HierarchyCode: FINEDINING (Hiearchy Id)

NodeId: MAINS (Node Id)

Id: R0001

Type: Item

Item Modifier

HierarchyCode: FINEDINING (Hiearchy Id)

ParentNode: MAINS (Node Id)

ParentItem: R0001 (Leaf Id)

Code: POT+RICE

SubCode: 04

ItemNo: 33030

Type: Item

Recipe

HierarchyCode: FINEDINING (Hiearchy Id)

ParentNode: MAINS (Node Id)

RecipeNo: R0001 (Leaf Id)

ItemNo: 34003

Page 9: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 3 - Member Contact 9

3 Member Contact

Member Contact is a customer that can log into the eCommerce site and look at his shopping history, check offers and do some shopping.

Each Member Contact is assigned to a Member Account. Account can have more than one member if it is not set as Private. Member Account can be in Member Club and Club has Scheme levels.

Member Contact gets a Member Card and can have many Member Cards. Most functions in LS Central / Omni work on Member Card as it is a unique identifier for the Contact. When sending in an Order, only Member Card Id is needed and from there Contact and Account can be looked up.

Member Contact Functions are:

ContactCreate ContactUpdate ContactGetByCardId ContactSearch ContactAddCard CardGetPointBalance LoginChange ChangePassword ForgotPassword ResetPassword PasswordChange PasswordReset

Login LoginWeb NotificationGetById NotificationsGetByCardId NotificationsUpdateStatus ProfilesGetAll ProfilesGetByCardId PublishedOffersGetByCardId SchemesGetAll

Page 10: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 3 - Member Contact 10

3.1 Create Member Contact

The function will create a new Member Contact and return MemberContact data that includes all information assigned to the new Member Contact in LS Central. It will include Member Contact Id, new Member Account, new Member Card. The Account will be assigned to default Member Scheme Clubs.

<soapenv:Body>

<ser:ContactCreate>

<ser:contact>

<ns1:Addresses>

<ns:Address>

<ns:Address1>Boulevard</ns:Address1>

<ns:City>Hollywood</ns:City>

<ns:Country>US</ns:Country>

<ns:PostCode>1001</ns:PostCode>

<ns:StateProvinceRegion>CA</ns:StateProvinceRegion>

<ns:Type>Residential</ns:Type>

</ns:Address>

</ns1:Addresses>

<ns1:Email>[email protected]</ns1:Email>

<ns1:FirstName>John</ns1:FirstName>

<ns1:Gender>Male</ns1:Gender>

<ns1:Initials>Mr</ns1:Initials>

<ns1:LastName>Doh</ns1:LastName>

<ns1:MiddleName></ns1:MiddleName>

<ns1:MobilePhone>555-5551</ns1:MobilePhone>

<ns1:Password>myPwd</ns1:Password>

<ns1:UserName>john</ns1:UserName>

</ser:contact>

</ser:ContactCreate>

</soapenv:Body>

To Assign the new Member Account to certain Member Club, add <ns1:Account>

<ns:Id></ns:Id>

<ns1:Scheme>

<ns:Id></ns:Id>

<ns1:Club>

<ns:Id>CRONUSHOSP</ns:Id>

</ns1:Club>

</ns1:Scheme>

</ns1:Account>

To add Contact to existing Member Account, add

<ns1:Account>

<ns:Id>MA000003</ns:Id>

</ns1:Account>

Page 11: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 3 - Member Contact 11

Member Management in LS Central can be found under

->Departments/LS Retail/Member Management/Member Management

Your new contact can be found under Member Contacts

Page 12: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 3 - Member Contact 12

3.2 Profiles

Profile is a Member Attribute in LS Central that can be assigned to the Member Contact.

ProfilesGetAll – Gets all Attributes that are assigned to the Default Club Set in Member Management Setup, and are Type Boolean and have Lookup Type set as None. ProfilesGetByContactId – Gets all attributes that have been assigned to the Contact. The Attribute Value has to be ‘Yes’ or ‘No’ as it used to detement if the Attirbute is selected or not.

3.3 Login

Login function will check if the Member Contact exists in LS Central and gets all the details about the Member Contact and gets all offers, coupon and profiles that are available for the Member Contact.

Double click on the Login button that was added in previous chapter and add following code

<soapenv:Body>

<ser:Login>

<ser:userName>john</ser:userName>

<ser:password>myPwd</ser:password>

<ser:deviceId></ser:deviceId>

</ser:Login>

</soapenv:Body>

MemberContact object be returned which includes all information assigned to the Member Contact in LS Central.

Difference between Login and LoginWeb is that Login provides more detailed information about the

Member Contact, and includes Profiles, Publish Offers and Notifications, while LoginWeb has just

basic Information.

MemberContact also includes list of OneList objects. These are the Baskets and Wish lists that a

Contact has. There can only be one Basket but one or more Wish lists. Wish lists can be shared

between Contacts.

Page 13: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 3 - Member Contact 13

3.4 Password Change and Reset

Omni version 4.10 and LS Central 16.0 have new function to handle Password. PasswordChange and PasswordReset.

To reset Password or create new Password for existing Contact, call PasswordReset first. For Reset password call the function with username. The function returns Token that should be used to send Email to Contact and used in PasswordChange for next step.

To change password for existing contact:

Call PasswordChange with userName, newPassword, oldPassword

To reset password for existing contact:

Call PasswordReset with userName to get a token.

Call PasswordChange with userName, token, newPassword

To register new login and password for new contact:

Call PasswordReset with email address to get a token.

Call PasswordChange with new userName, token, newPassword

Page 14: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 4 - Product Setup 14

4 Product Setup

4.1 Hierarchy

Products can be organized in two different ways for display on Web Site. The usual method before was to use Item Categories and Product Groups. This only gives two levels to group products together.

The new method is to use Hierarchy, which was added into later versions of LS Nav 2017.

In the LS Central Demo data, hierarchy FASHION is set to Store S0013

Open the Store Card and at the bottom there is section to select hierarchy and it has a starting date when it becomes active so there can be more than one hierarchy set to a store.

Page 15: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 4 - Product Setup 15

To get the hierarchy setup, there are two ways of doing it. One is to replicate the whole setup in three separate calls ReplEcommHierarchyXXX and pass in the store Id (S0013). This will give you the Hierarchy setup as Root, Node and Leaves.

NOTE: When replicating Hierarchies there is no hint on when a hierarchy changes at store level, like when its replaced or new added. The way to do this is to replicate ReplEcommHierarchy always with Full replication and monitor if the data there has changed or not. If so, then replication for Nodes and Leaf should be set to Full replication again for one run.

The other way is to get the hierarchy set up in one Hierarchy object, by calling HierarchyGet with store ID.

Page 16: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 4 - Product Setup 16

4.2 Price and discount

Before prices and discount can be replicated, OMNI_xxxx Scheduler Job in LS Central has to be executed.

OMNI_INIT generates Best Price and gets Discounts and other information for current day for all Items.

OMNI_UPDATE updates this data for items that have been updated since last OMNI_UPDATE was scheduled.

OMNI_UPDATE should be scheduled to run frequently but OMNI_INIT is just needed for first time and if new store has been added or if whole data needs to be processed again for all stores.

OMNI_INVENTORY updates current inventory status for all itmes assigned to a Store that has the Web Store checked.

Prices are replicated with either of these two functions:

ReplEcommPrices

These are the “best prices” for today, based on the price engine that LS Central has in place. The data for this function comes from WI Prices table in LS Central.

NOTE: Only Price with VAT is included in this data.

ReplEcommBasePrices

Gets data direct from Sales Price Table in LS Central. These prices can be found in the Item page under the Pricing Section in LS Central.

Main difference between these two functions is that Best price has to be generated by running the OMNI_xxxx Job in LS Central and the data has to be replicated daily to get the best price for today. There is no start or end date to those prices.

Sales Price is taken “as is” from LS Central so it can be set up for the item in the Retail Item card under Pricing section with start and end date. These prices do not take into account any price modification that could be in place in LS Central.

Page 17: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 4 - Product Setup 17

Only Periodic Offers are available for replication in LS Omni. It can be found here in LS Central.

Discounts are replicated with these two functions:

ReplEcommDiscounts

Gets Periodic Discount Offers and Multibuy Discounts, including the discount Percent and minimum quantity for Multibuy Discounts. Use this to calculate discount from the Price from Price replication functions.

ReplEcommMixAndMatch

Gets Mix & Match Offers information, no setup for the Mix & Match is delivered, only what items are involved and descriptions of the Offer. Use this only to display that a item is part of some offer. To be able to get the discounted value, the basket has to be sent in for calculation and LS Central will then return the price for the basket based on the Mix & Match Offer.

Both these functions return Offers with start and end date so its possible to see the validation dates for the Offers. A Priority value is also included which tells which offer would be taken prior if an item is part of more than one Offer. In both cases the Basket Caluclation will always return the real price and discount based on the LS Central Price and Discount engine, and should always be displayed prior to user confirming the final order.

Page 18: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 4 - Product Setup 18

DiscountsGet can be used to send in list of items to get all available Offers for those Items, based on Loyalty Scheme code if its sent in with the request. This function can be used on Item list page, by send in all the items codes for that page or when displaying the Shopping Basket.

The data retuned is the Offer Code and description of the offer which can be used to display information about what Offers are availeble for the items. No discount values or precents are delivered.

ItemsGetByPublishedOfferId is a function that returns list of all items that belong to a Published Offer.

4.3 Stock Status

ItemsInStockGet will return stock status for an item.

ItemsInStoreGet will return stock status for a list of items.

If store Id is passed in, only status for that store will be retuned otherwise status from all available stores that have been marked with Loyalty or Mobile checked in LS Central Store Setup (Omni Section) will be returned.

StoresGetbyItemInStock will get list of Click and Collect Stores within some distance from a location point, that item is available in.

Page 19: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 19

5 Order, Basket & Wishlist

LS Omni stores user Basket and Wishlist under OneList object which is only stored in local LS Omni Database and is not sent to LS Central. The data can be found in tables named OneListXxxxx. When user is ready to complete order, a Calculation request for OneList needs to be sent in to get all latest prices and discounts from LS Central. These requests return either Order or OrderHosp object depending on which Calculation function is called that has been updated with the result from the Calculation data. These objects should be updated with Shipping details, Payments and other details if needed and then sent in with either OrderCreate or OrderHospCreate request to create the Order.

Functions to handle Basket, Wishlist and Orders are:

OrderCreate OrderHospCreate OrderCheckAvailability OrderStatusCheck OrderCancel SalesEntriesGetByCardId SalesEntryGet RecommendedActive RecommendedItemsGet GetPointRate

ItemsInStockGet ItemsInStoreGet OneListSave OneListDeleteById OneListGetByCardId OneListGetById OneListCalculate OneListHospCalculate OneListItemModify OneListLinking

5.1 Basket

<soapenv:Body>

<ser:OneListSave>

<ser:oneList>

<ns1:CardId>10023</ns1:CardId>

<ns1:Items>

<ns1:OneListItem>

<ns1:ItemDescription>Skirt Linda Professional Wear</ns1:ItemDescription>

<ns1:ItemId>40020</ns1:ItemId>

<ns1:Quantity>2</ns1:Quantity>

<ns1:VariantDescription>YELLOW/38</ns1:VariantDescription>

<ns1:VariantId>002</ns1:VariantId>

</ns1:OneListItem>

</ns1:Items>

<ns1:ListType>Basket</ns1:ListType>

<ns1:StoreId>S0001</ns1:StoreId>

</ser:oneList>

<ser:calculate>true</ser:calculate>

</ser:OneListSave>

</soapenv:Body>

Set CardId for the Member Contact. To create a basket for Anonymous user, leave CardId blank. In that case you need to store the OneList Id that will be returned or create one yourself to be able to get the Basket back.

When storing Basket, a Calculate Request can be added. If Calculate is set to true, then StoreId needs to be added to the OneList object so LS Central knows which store it should apply prices and discount from.

Omni will send Calculate Request to LS Central and update the Basket with correct Prices and Discounts. Updated Basket (OneList) will then be returned after the call is completed.

Page 20: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 20

5.2 Wish List

<soapenv:Body>

<ser:OneListSave>

<ser:oneList>

<ns1:CardId>10023</ns1:CardId>

<ns1:Items>

<ns1:OneListItem>

<ns1:ItemDescription>Skirt Linda Professional Wear</ns1:ItemDescription>

<ns1:ItemId>40020</ns1:ItemId>

<ns1:Quantity>2</ns1:Quantity>

<ns1:VariantDescription>YELLOW/38</ns1:VariantDescription>

<ns1:VariantId>002</ns1:VariantId>

</ns1:OneListItem>

</ns1:Items>

<ns1:ListType>Wish</ns1:ListType>

</ser:oneList>

<ser:calculate>false</ser:calculate>

</ser:OneListSave>

</soapenv:Body>

Wish List works in similar way as Basket, just put ListType to Wish.

Calculate Request will not be performed, even if Calculate is set to True. Only Items will be stored with the OneList object, no discounts will be saved.

Member Contact can have more than one Wish list. List of Member Contact Cards that are assigned to a Wish list can be found in CardLinks list. There is one Card that is Owner and is the one that created the Wish list. Each card has a status that tells if the link is in Requesting stage for approval, active blocked or in Remove state to be delinked. Use the function OneListLinking to link a new card or remove card from Wish list.

When contact adds an Item to Wish list, all other contacts will be able to see the new item. Either use OneListSave to update a Wish list or OneListItemModify can be used to only modify an item in the list without sending the whole OneList object.

After creating a Basket and/or Wishlist you can find the data for it in LS Omni Database in OneList

tables.

Page 21: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 21

5.3 Calculate

Before an Order can be created, the basket must be calculated so all prices and discounts will be applied according to LS Central calculation engine.

<soapenv:Body>

<ser:OneListSave>

<ser:oneList>

<ns1:CardId>10023</ns1:CardId>

<ns1:Items>

<ns1:OneListItem>

<ns1:ItemDescription>Skirt Linda Professional Wear</ns1:ItemDescription>

<ns1:ItemId>40020</ns1:ItemId>

<ns1:Quantity>2</ns1:Quantity>

<ns1:VariantDescription>YELLOW/38</ns1:VariantDescription>

<ns1:VariantId>002</ns1:VariantId>

</ns1:OneListItem>

</ns1:Items>

<ns1:ListType>Basket</ns1:ListType>

<ns1:StoreId>S0001</ns1:StoreId>

</ser:oneList>

<ser:calculate>true</ser:calculate>

</ser:OneListSave>

</soapenv:Body>

To add optional Coupon to the basket, add this to the request

<ns1:PublishedOffers>

<ns1:OneListPublishedOffer>

<ns:Id>XMAS2018</ns:Id>

<ns1:Type>Coupon</ns1:Type>

</ns1:OneListPublishedOffer>

</ns1:PublishedOffers>

Modify Price of an Item

<ns1:OneListItem>

<ns1:ItemDescription>Shipping</ns1:ItemDescription>

<ns1:ItemId>66010</ns1:ItemId>

<ns1:Quantity>1</ns1:Quantity>

<ns1:Price>1.00</ns1:Price>

<ns1:PriceModified>true</ns1:PriceModified>

</ns1:OneListItem>

OneListCalculate returns Order Object with order lines with prices and calculated amount and discount information if any. This Order object can then be used to finalize the order. Add Contact information, Address for shipping and payment information and then it is ready to be sent in “as is” with OrderCreate.

Page 22: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 22

5.4 Calculate Hospitality Basket

Before a Hospitality Order can be created, the basket must be calculated so all prices and discounts will be applied according to LS Central calculation engine

Hospitality Basket has extra SubLines that holds Modifiers and Recipe changes to an Item or Deal in the basket.

OneListHospCalculate returns OrderHosp Object with order lines and sub lines with prices and calculated amount and discount information if any. This OrderHosp object can then be used to finalize the order. Add Contact information and payment information and then it is ready to be sent in “as is” with OrderHospCreate.

Basket with Chicken Meal Item [R0001]. Remove Brown sauce [R0002] (Recipe item). Add SubCode Item Line [01] from Item Modifier [POT+RICE].

<ser:oneList>

<ns1:CardId>10021</ns1:CardId>

<ns1:IsHospitality>true</ns1:IsHospitality>

<ns1:Items>

<ns1:OneListItem>

<!-- Chicken -->

<ns1:IsADeal>false</ns1:IsADeal>

<ns1:ItemId>R0001</ns1:ItemId>

<ns1:OnelistSubLines>

<ns1:OneListItemSubLine>

<!-- Remove Recipe Item -->

<ns1:ItemId>R0002</ns1:ItemId>

<ns1:Quantity>0</ns1:Quantity>

<ns1:Type>Modifier</ns1:Type>

</ns1:OneListItemSubLine>

<ns1:OneListItemSubLine>

<!-- Add Modifier -->

<ns1:ModifierGroupCode>POT+RICE</ns1:ModifierGroupCode>

<ns1:ModifierSubCode>01</ns1:ModifierSubCode>

<ns1:Quantity>1</ns1:Quantity>

<ns1:Type>Modifier</ns1:Type>

</ns1:OneListItemSubLine>

</ns1:OnelistSubLines>

<ns1:Quantity>1</ns1:Quantity>

<ns1:UnitOfMeasureId></ns1:UnitOfMeasureId>

</ns1:OneListItem>

</ns1:Items>

<ns1:ListType>Basket</ns1:ListType>

<ns1:StoreId>S0005</ns1:StoreId>

</ser:oneList>

Page 23: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 23

Basket with Deal [S10024]. Select Deal Item Line 1 (Bacon Burger). Remove Bacon [34420] from

Deal Item Line 1 that is in OneList SubLine list as line 1. Select Modifier Item Line 2 from Deal

Modifier Line 2 (Garlic Bread Sticks). Select Modifier Item Line 2 from Deal Modifier Line 3 (Cherry

Soda).

<ser:oneList>

<ns1:CardId>10021</ns1:CardId>

<ns1:IsHospitality>true</ns1:IsHospitality>

<ns1:Items>

<ns1:OneListItem>

<!-- Burger Deal SetMenu -->

<ns1:IsADeal>true</ns1:IsADeal>

<ns1:ItemId>S10024</ns1:ItemId>

<ns1:LineNumber>1</ns1:LineNumber>

<ns1:OnelistSubLines>

<ns1:OneListItemSubLine>

<!-- Burger -->

<ns1:DealLineId>1</ns1:DealLineId>

<ns1:LineNumber>1</ns1:LineNumber>

<ns1:Quantity>1</ns1:Quantity>

<ns1:Type>Deal</ns1:Type>

</ns1:OneListItemSubLine>

<ns1:OneListItemSubLine>

<!-- Remove Bacon -->

<ns1:DealLineId>1</ns1:DealLineId>

<ns1:ItemId>34420</ns1:ItemId>

<ns1:LineNumber>2</ns1:LineNumber>

<ns1:ParentSubLineId>1</ns1:ParentSubLineId>

<ns1:Quantity>0</ns1:Quantity>

<ns1:Type>Modifier</ns1:Type>

</ns1:OneListItemSubLine>

<ns1:OneListItemSubLine>

<!-- Garlic Bread Sticks -->

<ns1:DealLineId>2</ns1:DealLineId>

<ns1:DealModLineId>2</ns1:DealModLineId>

<ns1:Quantity>1</ns1:Quantity>

<ns1:Type>Deal</ns1:Type>

<ns1:Uom>LAR</ns1:Uom>

</ns1:OneListItemSubLine>

<ns1:OneListItemSubLine>

<!-- Cherry Soda -->

<ns1:DealLineId>3</ns1:DealLineId>

<ns1:DealModLineId>2</ns1:DealModLineId>

<ns1:Quantity>1</ns1:Quantity>

<ns1:Type>Deal</ns1:Type>

<ns1:Uom>LAR</ns1:Uom>

</ns1:OneListItemSubLine>

</ns1:OnelistSubLines>

<ns1:Quantity>1</ns1:Quantity>

<ns1:UnitOfMeasureId></ns1:UnitOfMeasureId>

</ns1:OneListItem>

</ns1:Items>

<ns1:ListType>Basket</ns1:ListType>

<ns1:StoreId>S0005</ns1:StoreId>

</ser:oneList>

Page 24: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 24

5.5 Order Create

After Basket has been calculated and the extra info like Contact data, Shipping and Payment have been added, it can be sent in for Creation.

<soapenv:Body>

<ser:OrderCreate>

<ser:request>

<ns:Id>MyNo12345</ns:Id>

<ns1:CardId>10023</ns1:CardId>

<ns1:LineItemCount>1</ns1:LineItemCount>

<ns1:OrderDiscountLines/>

<ns1:OrderLines>

<ns1:OrderLine>

<ns1:Amount>160.00</ns1:Amount>

<ns1:DiscountAmount>0</ns1:DiscountAmount>

<ns1:DiscountPercent>0</ns1:DiscountPercent>

<ns1:ItemId>40020</ns1:ItemId>

<ns1:LineNumber>1</ns1:LineNumber>

<ns1:LineType>Item</ns1:LineType>

<ns1:NetAmount>128.00</ns1:NetAmount>

<ns1:NetPrice>64.00</ns1:NetPrice>

<ns1:Price>80.00</ns1:Price>

<ns1:Quantity>2.00</ns1:Quantity>

<ns1:TaxAmount>32.00</ns1:TaxAmount>

<ns1:UomId/>

<ns1:VariantId>002</ns1:VariantId>

</ns1:OrderLine>

</ns1:OrderLines>

<ns1:OrderPayments>

<ns1:OrderPayment>

<ns1:Amount>160.00</ns1:Amount>

<ns1:AuthorisationCode>123456</ns1:AuthorisationCode>

<ns1:CardNumber>45XX..5555</ns1:CardNumber>

<ns1:CardType>VISA</ns1:CardType>

<ns1:CurrencyCode></ns1:CurrencyCode>

<ns1:CurrencyFactor>1</ns1:CurrencyFactor>

<ns1:ExternalReference>My123456</ns1:ExternalReference>

<ns1:LineNumber>1</ns1:LineNumber>

<ns1:PaymentType>PreAuthorization</ns1:PaymentType>

<ns1:PreApprovedValidDate>2030-01-01</ns1:PreApprovedValidDate>

<ns1:TenderType>1</ns1:TenderType>

<ns1:TokenNumber>123456</ns1:TokenNumber>

</ns1:OrderPayment>

</ns1:OrderPayments>

<ns1:OrderType>Sale</ns1: OrderType> <ns1:PaymentStatus>PreApproved</ns1:PaymentStatus>

<ns1:ShipToAddress>

<ns:Address1>Boulevard</ns:Address1>

<ns:City>Hollywood</ns:City>

<ns:Country>US</ns:Country>

<ns:PostCode>1001</ns:PostCode>

<ns:StateProvinceRegion>CA</ns:StateProvinceRegion>

<ns:Type>Residential</ns:Type>

</ns1:ShipToAddress>

<ns1:ShippingStatus>NotYetShipped</ns1:ShippingStatus>

<ns1:ShipToEmail>[email protected]</ns1:ShipToEmail>

<ns1:ShipToName>John Doh</ns1:ShipToName>

<ns1:ShipToPhoneNumber>555-5551</ns1:ShipToPhoneNumber>

<ns1:SourceType>eCommerce</ns1:SourceType>

<ns1:StoreId>S0013</ns1:StoreId>

<ns1:TotalAmount>160.00</ns1:TotalAmount>

<ns1:TotalDiscount>0</ns1:TotalDiscount>

<ns1:TotalNetAmount>128.00</ns1:TotalNetAmount>

</ser:request>

</ser:OrderCreate>

</soapenv:Body>

Page 25: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 25

For Anonymous Orders, leave the CardId empty, instead add Contact Name and other details about the Contact. If a CardId is provided, the order will be linked to the card.

<ns1:ContactAddress>

<ns:Address1>Boulevard</ns:Address1>

<ns:City>Hollywood</ns:City>

<ns:Country>US</ns:Country>

<ns:PostCode>1001</ns:PostCode>

<ns:StateProvinceRegion>CA</ns:StateProvinceRegion>

<ns:Type>Residential</ns:Type>

</ns1:ContactAddress>

<ns1:ContactName>John Doh</ns1:ContactName>

<ns1:Email>[email protected]</ns1:Email>

<ns1:MobileNumber>555-5551</ns1:MobileNumber>

If the order is Click and Collect, set OrderType to ClickAndCollect and set CollectLocation to the store where order is gone be collected at.

No ShipTo info is needed unless the Click and Collect orders is to be shipped, then add ShipTo info and set ShippingStatus to NotYetShipped otherwise set it to ShippigNotRequired.

<ns1:CollectLocation>S0001</ns1:CollectLocation>

<ns1:OrderType>ClickAndCollect</ns1: OrderType> <ns1:ShippingStatus>NotYetShipped</ns1:ShippingStatus>

Page 26: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 26

5.6 Order Lines

A valid Order line needs to have ItemId, Quantity, Price and Amounts. Order Line without discount: <ns1:OrderLines>

<ns1:OrderLine>

<ns1:Amount>160.00</ns1:Amount>

<ns1:DiscountAmount>0</ns1:DiscountAmount>

<ns1:DiscountPercent>0</ns1:DiscountPercent>

<ns1:ItemId>40020</ns1:ItemId>

<ns1:LineNumber>1</ns1:LineNumber>

<ns1:LineType>Item</ns1:LineType>

<ns1:NetAmount>128.00</ns1:NetAmount>

<ns1:NetPrice>64.00</ns1:NetPrice>

<ns1:Price>80.00</ns1:Price>

<ns1:Quantity>2.00</ns1:Quantity>

<ns1:TaxAmount>32.00</ns1:TaxAmount>

<ns1:UomId/>

<ns1:VariantId>002</ns1:VariantId>

</ns1:OrderLine>

</ns1:OrderLines>

When adding a manual discount, a Discount Line needs to be added to the order. Both discount % and amount should be set. If the discount is applied from LS Central when Basket was sent in for calculation, then discount lines are already available in the return object from Calculation function. Order Line with 10% discount: <ns1:OrderLines>

<ns1:OrderLine>

<ns1:Amount>144.00</ns1:Amount>

<ns1:DiscountAmount>16.00</ns1:DiscountAmount>

<ns1:DiscountPercent>10.00</ns1:DiscountPercent>

<ns1:ItemId>40020</ns1:ItemId>

<ns1:LineNumber>1</ns1:LineNumber>

<ns1:LineType>Item</ns1:LineType>

<ns1:NetAmount>115.20</ns1:NetAmount>

<ns1:NetPrice>64.00</ns1:NetPrice>

<ns1:Price>80.00</ns1:Price>

<ns1:Quantity>2.00</ns1:Quantity>

<ns1:TaxAmount>28.80</ns1:TaxAmount>

<ns1:UomId/>

<ns1:VariantId>002</ns1:VariantId>

</ns1:OrderLine>

</ns1:OrderLines>

<ns1:OrderDiscountLines>

<ns1:OrderDiscountLine>

<ns1:DiscountAmount>16.00</ns1:DiscountAmount>

<ns1:DiscountPercent>10.00</ns1:DiscountPercent>

<ns1:DiscountType>LineDiscount</ns1:DiscountType>

<ns1:LineNumber>1</ns1:LineNumber>

</ns1:OrderDiscountLine>

</ns1:OrderDiscountLines>

Page 27: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 27

5.7 Payments

Omni has its own Tender Type codes.

Default are: 0=Cash, 1=Card, 2=Coupon, 3=Loyalty Points, 4=Gift Card

Omni Tender Types are then mapped over to LS Central Tender Type code, and the mapping is configured in LS Omni Database – Appsettings table – Record with Key: TenderType_Mapping.

Credit Card: Send in OrderPayment of Tender Type Card (1). Set the Amount to the value that should be authorized for the Order and PaymentType to PreAuthorization. Fill in AuthorisationCode and TokenNumber that payment provider sends. There is option of adding ExternalReference that was used when payment was requested. All this information will be returned when final payment is requested at time when order is ready to be shipped.

<ns1:OrderPayments>

<ns1:OrderPayment>

<ns1:Amount>160.00</ns1:Amount>

<ns1:AuthorisationCode>123456</ns1:AuthorisationCode>

<ns1:CardNumber>45XX..5555</ns1:CardNumber>

<ns1:CardType>VISA</ns1:CardType>

<ns1:CurrencyCode>GBP</ns1:CurrencyCode>

<ns1:CurrencyFactor>1</ns1:CurrencyFactor>

<ns1:ExternalReference>My123456</ns1:ExternalReference>

<ns1:LineNumber>1</ns1:LineNumber>

<ns1:PaymentType>PreAuthorization</ns1:PaymentType>

<ns1:PreApprovedValidDate>2030-01-01</ns1:PreApprovedValidDate>

<ns1:TenderType>1</ns1:TenderType>

<ns1:TokenNumber>123456</ns1:TokenNumber>

</ns1:OrderPayment>

</ns1:OrderPayments>

Loyalty Points: Send in OrderPayment of Tender Type Cash (0) and Currency Code “LOY”. LS Central treats Loyalty points as Currency and has special Currency record with Currency Rate to handle Point payment. The Rate tells how much value each point has in cash value and can be fetched by calling GetPointRate.

<ns1:OrderPayments>

<ns1:OrderPayment>

<ns1:Amount>100.00</ns1:Amount>

<ns1:CardNumber>10023</ns1:CardNumber>

<ns1:CurrencyCode>LOY</ns1:CurrencyCode>

<ns1:CurrencyFactor>0.1</ns1:CurrencyFactor>

<ns1:LineNumber>1</ns1:LineNumber>

<ns1:TenderType>0</ns1:TenderType>

</ns1:OrderPayment>

</ns1:OrderPayments>

Gift Card: Send in OrderPayment of Tender Type Gift Card (4) and Gift Card number in CardNumber and Gift card amount to be used in Amount.

<ns1:OrderPayments>

<ns1:OrderPayment>

<ns1:Amount>100.00</ns1:Amount>

<ns1:CardNumber>123456</ns1:CardNumber>

<ns1:CurrencyCode>GBP</ns1:CurrencyCode>

<ns1:CurrencyFactor>1</ns1:CurrencyFactor>

<ns1:LineNumber>1</ns1:LineNumber>

<ns1:TenderType>4</ns1:TenderType>

</ns1:OrderPayment>

</ns1:OrderPayments>

Page 28: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 28

5.8 Sales History

To get history overview of all Orders and Sales Transactions for a Member Contact, use the function SalesEntriesGetByCardId.

To get detailed data for the SalesEntry, use SalesEntryGetById with the Id and IdType from the SalesEntriesGetByCardId method.

IdType.Receipt is a regular POS transaction.

IdType.Order is a LS Central provided order id.

IdType.External is a custom order id provided by you in order creation.

For anonymous users that don’t have account, they must provide the Id (for example: order id) of the SalesEntry to be used with SalesEntryGetById.

5.9 Orders in LS Central

Orders can be found in LS Central under ->Departments/LS Retail/Customer Order/Customer Order

If order is to be shipped it should have been assigned automatically a Sales Order No.

Page 29: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 29

5.9.1 Sales Order

When an order has been created, it can be found under

->Departments/Sales & Marketing/Order Processing/Sales Orders

There it can be processed for invoicing and shipping. To do that, select the order in the Sales Orders

list and press the “Post” button.

To complete the process, select an option and press “Ok”.

Page 30: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 30

5.9.2 Click And Collect Order

To process Click and Collect orders, Open the Retail POS in LS Central

->Departments/LS Retail/Point Of Sale/POS ->Run Client

Click Logon Button, and Click 101 Flynn button to log in.

If there is a CAC order ready, a message will be waiting in Retail Message

Click on Retail Message Button.

Select the order and Click Process Message Button.

This will show the order and there you can mark item that are being collected or do other work on the order, and then Confirm it as being ready for pickup.

When customer comes to pick up the order, click on Operations button in the main POS Screen, and then click Customer Orders.

Page 31: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 31

This shows all orders ready to be picked up. Pick an order and press To Collect and it will then show up in the POS as normal sale, process the sale to complete the process.

To process Sales from POS so loyalty points will be calculated, and the transaction will show up in Sales Entry history, run Update Member Information in LS Central.

In BC 15 this can be found under: Member Process Order Entry -> Update Member Information

Page 32: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 32

5.10 eCommerce communication

If eCommerce will be used to send Emails or monitor status updates and handle payment processes, a Web Hook must be implemented so Omni can send messages and requests from LS Central over to the eCommerce platform.

Set the URL to the Web Hook in Appsetting.config file

<add key="ECom.Url" value="" />

If “Demo” is set as URL Omni will always reply to LS Central with OK without trying to communicate with eCommerce platform.

LS Central can send Order status updates when Customer Order status changes.

To activate communication from LS Central to Omni, Go to Customer Order section.

In CO Setup, Check Send Omni Messages, and Select correct Omni Func. Profile ID that includes the URL to Omni Service.

Functionality profile should include the URL to OMNI

Page 33: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 33

In Customer Order Processing Status Setup, check all Send Messages for status you want to be broadcasted back to eCommerce

Page 34: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 5 - Order, Basket & Wishlist 34

For Order status messages, Omni will contact the web hook with orderstatus and json data that looks like this:

{

"OrderId": "CO000111",

"CardId": "",

"HeaderStatus": "RECEIVED",

"MsgSubject": "your order 001",

"MsgDetail": "is ready for delivery",

"Lines": [{

"LineNo": "1",

"PrevStatus": "NEW",

"NewStatus": "PICKING"

}

]

}

Statues will include the Status Code used in LS Central.

MsgSubject and MsgDetail will have data if the Email data to be sent is formatted by LS Central.

At time of Posting a Sales Order, a Finalized Payment request will be sent, if a Pre-Authorized payment token was taken at time of Order creation, to get Final payment confirmation from the payment provider.

Omni will contact this web hook path orderpayment command and json data that looks like this: {

"document_id": "CO00001",

"status": 1,

"token": "1234",

"amount": 100,

"authcode": "1234",

"reference": "1234"

}

Status:

0: Customer order is unchanged, same amount and all items delivered

1: Customer order is changed since web order

2: Customer order was cancelled

Response string should be OK if everything is ok, otherwise error message from payment provider.

Page 35: LS Omni 4.x Unified Commerce Interface - LS Retail

Unified Commerce Interface Developers Guide

Chapter 6 - Other Code Samples 35

6 Other Code Samples

6.1 Get Image for Item

UCService.ImageView img = serviceClient.ImageGetById("10020",

new UCService.ImageSize() { Width = 4096, Height = 4096 });

Image1.ImageUrl = "data:image/jpeg;base64," + img.Image;

System.Drawing.Image im = System.Drawing.Image.FromStream(

new MemoryStream(Convert.FromBase64String(img.Image)));

im.Save(@"c:\temp\img999.bmp");

6.2 Get Image Stream for Item

Stream str = serviceClient.ImageStreamGetById("10020", 4096, 4096);

int data;

List<byte> imgbyte = new List<byte>(4096 * 4096);

while ((data = str.ReadByte()) != -1)

{

imgbyte.Add((byte)data);

}

Byte[] bitmapData = imgbyte.ToArray();

string imgstr = Convert.ToBase64String(bitmapData, 0, bitmapData.Length);

Image1.ImageUrl = "data:image/jpeg;base64," + imgstr;

System.Drawing.Image im = System.Drawing.Image.FromStream(new MemoryStream(bitmapData));

im.Save(@"c:\temp\img998.bmp");