White Paper - Simplify E-commerce Application Development with MS Commerce Server.

Commerce Server: An Introduction 
Commerce Server is a good way to create and maintain a sales presence on your Web site. With flexible configuration capabilities to get your site up quickly, complete yet extensible order processing, and tools to help you actively sell and promote, it is a wonderful choice for companies that want to go beyond just publishing online. 

Commerce Server provides a comprehensive solution for many business scenarios, including: 

  • Business-to-consumer (B2C) sales of tangible or digital goods or online service delivery.
  • Business-to-business (B2B) scenarios, such as e-procurement and trading communities.
  • B2X scenarios, combining Business to Consumer (B2C) and Business to Business (B2B).
  • Self service portals using catalogs, profiles, or content targeting for personalized information delivery

The key advantages that Commerce Server offers are: 

  • Creating a compelling and secure buying experience
  • Requiring minimal custom development
  • Providing the ability to conduct dynamic promotions

The Commerce Server 2007 development platform features the following enhancements:

  • Provides a .NET Framework class library that extends and supplements ASP.NET functionality and builds on top of ASP.NET 2.0.
  • Adds a new project type for Commerce Server Web applications to Visual Studio 2005 or Visual Studio 2008.
  • Implements a Service Oriented Architecture (SOA) and provides access to many functions through Web services.
  • Supports easy integration and bidirectional synchronization of catalog, inventory, orders, and profiles data with line-of-business (LOB) systems by using the BizTalk Server adapters provided with Commerce Server.
Subsystems

Commerce Server 2007 provides the tools for customizing each of its six integrated systems:

  • Catalog System
  • Inventory System
  • Marketing System
  • Orders System
  • Profiles System
  • Business Processing Pipeline System
Pipelines

Each System in commerce server integrates with each other is achieved through pipelines. A pipeline is an extensible software framework that defines and links one or more stages of a business process, running them in sequence to complete a specific task. Pipelines base their functionality on pipeline components, pipeline configuration files, and pipeline framework objects. You can develop pipelines as COM components or as .NET components that implement the required pipeline COM interfaces. By default Commerce Server has the following Pipeline files: 1.       Advertising.pcf

2.       Basket.pcf

3.       Chckout.pcf

4.       Discounts.pcf

5.       DMLPipe.pcf

6.       Product.pcf

7.       RecordEvent.pcf

8.       Total.pcf

Pipeline framework consists of COM objects that are linked and stored in pcf file format. You can further categorize pipelines into stages. Pipelines are executed by the Pipeline object and configured by Pipeline Editor. Pipelines can be executed transactional and be pooled for performance. Commerce Server has a dozen or more Pipeline components and several default pcf files containing one or more Pipeline components. You can also create your own Pipeline components.

Commerce Server has three types of Pipelines:

i.            Order Processing

The Order Processing pipelines (OPP) are software infrastructures that link several components and run them in sequence on an OrderForm or Dictionary object. The Order processing Pipeline implement aspects of business-to-consumer and business-to-business checkout transactions such as discounts, Inventory checking, Product Catalog checking etc… 

ii.            Content Selection Framework

The Content Selection Framework (CSF) is a platform-level framework for building targeted content delivery applications on the Internet. The targeted advertising and discount features of Microsoft Commerce Server are built by using the CSF. The framework provides the means for building new types of content delivery applications and makes it easy to customize and extend the advertising and discount delivery systems.

iii.            Direct Mailer

The Direct Mailer pipeline runs components that screen recipients and personalize e-mail, and then sends the personalized e-mail.

You can add third-party or custom components to the Commerce Server pipeline. Those components need implement only the standard pipeline component interfaces. They also, however, need to understand the dictionary keys that components in the pipeline use.

Catalog System

A catalog consists of a group of categories and products. It contains descriptions and    pricing information for products and services. The Catalog System lets you create, manage, import, and export online catalogs by using the Catalog API.

Catalog System Elements: 

  • Catalog Search

  • Schema Items

  • Catalog Items: Product, Category and Product Family 

Note: Use the key public classes in the Microsoft.CommerceServer.Catalog namespace to work with catalog elements

Catalog Context

The CatalogContext object provides the functionality to manage your catalogs. It can be created in one of two modes. It can be in local mode, where the code accesses the Commerce Server objects and the database directly and does not use a Web service.

Alternatively, it can be in agent mode, where calls to the catalog system are made through the Web service with the help of an agent.

Code Snippet:

Create a CatalogContext object in local mode

Create a CatalogSiteAgent object. This object contains the configuration information that is required to connect to the catalog database.

// create a CatalogSiteAgent to connect to the database.

CatalogSiteAgent catalogSiteAgent = new CatalogSiteAgent();

catalogSiteAgent.SiteName = "CustomerXYZ";

 // create the CatalogContext object.

CatalogContext catalogContext = CatalogContext.Create(catalogSiteAgent);

Create a CatalogContext object in agent mode

Create a CatalogServiceAgent object. This object contains the authentication information that is   required to communicate with a Web service.

// create a CatalogServiceAgent to connect to the Web service.

 CatalogServiceAgent serviceAgent = new CatalogServiceAgent(url, new string[] {"ntlm", "kerberos", negotiate"});

// create the CatalogContext object.

 CatalogContext catalogContext = CatalogContext.Create(serviceAgent);

Catalog Search Types

  1. Free-text search

  2. Using Sql where clause

  3. Guided search / Specification Search

Free-text search

You can use the free-text search to search for words and phrases in the values of searchable properties. For example, you can search for all products that have the text "kenmore" in their descriptions. When you add a property definition to your catalog, you can specify whether it is available for free-text search.

Note: To designate a property as free-text searchable, set the IsFreeTextSearchable property to true using catalog & Inventory Manager or through c# code.

Code Snippet:

This code snippet is used to search the products & Product family given the search string in CustomerXYZ Project

CatalogSearch catalogSearch = CatalogContext.GetCatalogSearch();

 catalogSearch.CatalogNames = CatalogName;

 catalogSearch.Recursive = false;

 catalogSearch.UseAdvancedFreeTextSearch = true;

 catalogSearch.Language = CultureInfo.CurrentUICulture.Name;

 //simple search

 catalogSearch.SqlWhereClause = string.Empty;

 if (SearchForText.Contains("*"))

 {

    catalogSearch.AdvancedFreeTextSearchPhrase = string.Empty;

 }

 else

 {

    string cleanUpText = cleanSearchText(SearchForText);

    catalogSearch.AdvancedFreeTextSearchPhrase = cleanUpText;

 }

 CatalogSearchOptions Options = new CatalogSearchOptions();

 Options.StartingRecord = 1;

 Options.RecordsToRetrieve = MaxSearchResults;

 Options.SortDescending = false;

 Options.PropertiesToReturn = "*";// DefaultPropertiesToReturn; // "*"    : return all properties

 Options.SortProperty = "[FreeTextSearch_Rank], [DisplayName]";

 // All types

 Options.ClassTypes = CatalogClassTypes.ProductClass

                      //|CatalogClassTypes.CategoryClass                                         

                        | CatalogClassTypes.ProductFamilyClass;

            //|CatalogClassTypes.ProductVariantClass                                                  catalogSearch.SearchOptions = Options;

 try

 {

    searchResultsDataSet = catalogSearch.Search();

    searchResultsDataSet.Locale = CultureInfo.InvariantCulture;

 }

 catch (SearchException searchEx)

 {

   throw searchEx;

 }

Guided search

To perform a guided search, you search for properties by progressively reducing the number of products that match your search criteria. Guided searches are useful when you do not want to search all of your products for a property, but you need to identify a group of products instead.

Note: To designate a property as Guided searchable, set the IsSearchableproperty to true using catalog & Inventory Manager or through c# code.

Code Snippet:

This type of search is used in CustomerXYZ Project to create dealer catalogs where each catalog contains products belongs to brands selected by the dealer.

 productCatalog =    //product catalog can be base/virtual (ProductCatalog)CatalogContext.GetCatalog(vCatalogName);

SpecificationSearch search = productCatalog.BeginSpecificationSearch(CategoryName);

string strClause = @"[Brand] not in ('"; //exclude all the brands related products not required from catalog

 for (int i = 0; i < brands.Length; i++)

   {

      strClause += brands[i];

      if (i != brands.Length - 1)

          strClause += "', '";

      else

          strClause += "')";

   }

search.AddSearchClause(String.Format(strClause));    CatalogItemsDataSet items = search.Search();

Schema Item

A catalog and inventory schema is a template or "schema" for product catalogs, inventory

catalogs, products, categories, and inventory SKUs in the Catalog and Inventory System.

Schema contains three types of definitions:

  • Property definitions

  • Category definitions

  • Product definitions

Note: Use Catalog & Inventory Schema manager to create/update definitions and metadata. Database will be updated automatically for any changes to the schema.

Property Definitions

Property definitions describe specific properties in the Catalog System. Commerce Server provides a variety of predefined properties, but frequently you will want to create new, custom properties for your schema.

Ex: Following are the custom properties that are added to CustomerXYZ Project

BrandCode, Doc_Src_Url, Doc_Src_file, Features, finance, financelink, Head, IsEchoSource, IsEnergyFriendly, more, PlotLabelXml, Plots, Specifications, Thumbnail, UpdateFlag, Variant_Image_filename

Category Definitions

 

A category can have one or more properties, such as name, description, and image.

Ex: If you want to store information about manufacturers, and then organize products by manufacturer, you can create a Manufacturer category definition that would include different properties, such as Manufacturer Name, Country/Region, Address, and Contact Person

CustomerXYZ Category Defination sample xml

<Definition name="CustomerXYZCatDef" description="Category defination    for CustomerXYZ" DefinitionType="category">

      <DefProperty>Name</DefProperty>

      <DefProperty>Description</DefProperty>

      <DefProperty>IntroductionDate</DefProperty>

      <DefProperty>Image_filename</DefProperty>

      <DefProperty>Brand</DefProperty>

      <DefProperty>Image_height</DefProperty>

      <DefProperty>Image_width</DefProperty>

      <DefProperty>Plots</DefProperty>

      <DefProperty>Thumbnail</DefProperty>

      <DefProperty>finance</DefProperty>

      <DefProperty>financelink</DefProperty>

      <DefProperty>more</DefProperty>

      <DefProperty>Head</DefProperty>

      <DefProperty>PlotLabelXml</DefProperty>

</Definition> 

Product Definitions

The product definition is a collection of properties that uniquely identify a particular product.

CustomerXYZ Product Defination sample xml

<Definition name="CustomerXYZ Product" description="Product Definition for CustomerXYZ" DefinitionType="product">

      <DefProperty>Name</DefProperty>

      <DefVariantProperty>ProductColor</DefVariantProperty>

      <DefProperty>BrandCode</DefProperty>

      <DefVariantProperty>ProductSize</DefVariantProperty>

      <DefProperty>Brand</DefProperty>

      <DefVariantProperty>VariantCode</DefVariantProperty>

      <DefProperty>Description</DefProperty>

      <DefVariantProperty>Variant_Image_filename</DefVariantProperty>

      <DefProperty>Specifications</DefProperty>

      <DefProperty>Image_filename</DefProperty>

      <DefProperty>Brand_Image</DefProperty>

      <DefProperty>DOC_SRC_FILE</DefProperty>

      <DefProperty>Doc_Src_Url</DefProperty>

      <DefProperty>IsEchoSource</DefProperty>

      <DefProperty>IsEnergyFriendly</DefProperty>

      <DefProperty>OnSale</DefProperty>

      <DefProperty>available</DefProperty>

      <DefProperty>Features</DefProperty>

      <DefProperty>ProductCode</DefProperty>

      <DefProperty>IntroductionDate</DefProperty>

      <DefProperty>UpdateFlag</DefProperty>

</Definition>

Using Catalog Manager

Using commerce server catalog manager business user application you can perform the following tasks 

  • Create Base Catalog

  • Create/Update/Delete Products & Categories

  • Provide the association between Categories & Products

  • Assign Variants, Related Products to the existing Product.

  • Import/Export Catalogs

  • Create Virtual Catalog(Dealer Catalogs)

  • Create Catalog Sets by combining existing catalogs

  • Create Inventory Catalog and assign it to the existing catalogs

  • Update the properties of Inventory like stock, status, quantity, stock thresholds etc

Inventory System

  • You can retrieve inventory information by using the catalog and inventory methods and properties. Any method that returns information about products or variants includes inventory information.

  • The Inventory System provides inventory information for products, including current quantities on hand, an out-of-stock threshold, and whether the item can be back-ordered and to what quantity.

  • The Inventory System provides pipeline components to check and update inventory during purchases.

  • You create an inventory catalog and populate it with inventory information for all products from your product catalogs. When a product catalog is contained in an inventory catalog, it is said to be mapped to the inventory catalog. Each inventory catalog can contain multiple product catalogs, but each product catalog can map to only one inventory catalog.

Note: Use Commerce server Catalog Manager to manage Inventory Catalogs

InventoryContext

The InventoryContext object cannot be created directly. Instead, create a CatalogContext object and get the InventoryContext object from the InventoryContext property of the CatalogContext object.

Code Snippet:

 Create the CatalogContext object mentioned above in the document then use below

 Code to get InventoryContext. Use this object to create, update or delete stock-keeping unit (SKUS)

// Get the InventoryContext property.

    InventoryContext inventoryContext = catalogContext.InventoryContext;

Marketing System

Marketing System provides the following benefits: 

  • Create campaigns, which are marketing programs that use many communication vehicles to accomplish a specific result, such as increasing market share, introducing new products, or retaining customers.

  • Create and publish promotional prices on products or product groups to users that meet certain specified conditions. Discount interactions, order-level discounts, and targeting expressions are supported.

  • Host expression-based, targeted advertisements on your site for your products, or for the products of other companies. You can charge your advertising customers based upon the page where their ads appear and the number of ad requests (clicks) they want.

  • You can generate reports to measure your key sales and activity metrics.

Snapshot of Marketing Manager: 


 

Marketing System Elements

Customers: A customer is the parent of one or more campaigns.

Campaigns: Each campaign is associated with a parent customer. A campaign may contain one or more advertisement, discount, and direct mail items.

Advertisements:An advertisement is part of a campaign. Campaigns can contain one or more advertisements. An advertisement cannot exist without a parent campaign.

Discounts and Promotion codes:Discounts are a specific type of marketing promotion in which you invite shoppers to save money on specific products or product groups. Discounts are part of a campaign. Campaigns may contain one or more discounts. A discount cannot exist without a parent campaign. Run time discounts are computed in the Basket, Checkout, and Total Pipeline components. Following are the fixed set of discount types available 

  1. Sample Discount: Buy a product at a reduced price.

Example: Buy two backpacks and get 25% off the price of each 

  1. Minimum Purchase Discount: Buy a minimum quantity of a product, get a reduced price.

Example: Buy at least three CDs and get $1 off the price of each 

  1. Buy N, Get 1 More Free: Buy a minimum number of an item; get one more of the same item free.

Example:  Buy 5 ties, get the 6th one free


Note:The tie is not automatically added to the basket. The customer must add the sixth tie to the basket in order to receive the 100 percent discount for the 6th tie.
 

  1. Paired Discount: Buy one product and get a price reduction on another product.

Example: Buy a bicycle, get a helmet at 15% off 

  1. Paired Set Discount: Buy a specified quantity of a product, get a price reduction on another product.

Example: Buy 6 bottles of wine, get a wine rack at $10 off 

  1. Order Discount: Buy a specified total amount; get a price reduction on the order total or on the shipping cost.

Example:  Buy at least $500 worth of services, and get 20% off

Expressions

  • An expression is a condition that Commerce Server evaluates against profiles to determine whether to deliver content, or perform another action.

  • An Expression can be local or global. A local expression is a discount-specific Expression since it is created or destroyed within the context of a discount.

  • Global Expressions are shared expressions since they can be used by any discount in the system.

You can use the Commerce Server Marketing Manager to create two types of expressions:

Catalog Expressions 

  • Specify the products in a catalog to which you can apply a discount. Catalog expressions define the products or categories of products to which you want to apply a discount.

  • You can only associate catalog expressions with discounts that have the "buy" or "get" condition.

  • After you create the catalog expression, you can target your discounts to those products that match your catalog expression criteria.

Target Expressions 

  • Identify where, when, and to whom to display content.

  • You create target expressions to specify the customers to which you want to target advertisements and discounts

  • Target expressions can also target request context like Web site from which the customer is visiting, the current page group, the time of day, or an HTTP cookie.

  • Use the Expression Builder to select the language to which you want to target your advertisements or discounts.

Snapshot to create an Expression: 


Target an Expression to a Discount: 


Order System

The following list describes the key scenarios for using the orders system: 

  • Adding items to a shopping basket.

  • Adding items to a wish list, recurring basket, or gift registry.

  • Viewing a basket on the Web site.

  • Checking out and purchasing a basket.

  • Finding, modifying, and deleting baskets.

  • Finding, modifying, and deleting purchase orders.

  • Processing punch-outs to accept baskets via a Web service.

Order System Elements: 

  • OrderManagementContext

  • BasketManager : User/Anonymous Carts

  • PurchaseManager : Purchase Orders

  • ShippingMethodManager: Shipping Methods

  • PaymentMethodManager: Payment Methods

Note: Use the key public classes in the Microsoft.CommerceServer.Orders namespace to work with Order Elements

Life Cycle of an Order 

  1. Add the first item to the shopping cart

  2. Add another item to the shopping cart.

  3. If the user is anonymous then we have to convert anonymous cart to registered cart.

  4. Checkout Process:

    1. Gather shipment information, payment information and discount information from the customer
    2. Run pipelines in the order and also mention this info in web.config file of the site

     Basket Pipeline

     Total Pipeline

     Checkout Pipeline

  1. Convert the basket object to a PurchaseOrder Object.

Working with Order Objects 

Baskets

A Basket represents a shopping cart. A user may have multiple baskets with different names, for example a current basket and a wish list

Code Snippet:

Creating Basket:

//use commerce server reference

using Microsoft.CommerceServer.Runtime.Orders;

//userID: id of the user, basketName = default/wishlist

 Guid userID = Guid.NewGuid();

 String basketName = "default";

// Create a new Basket.

 Basket newBasket = OrderContext.Current.GetBasket(userID, basketName);

Retrieve User Baskets:

// Now get the same Basket back.

 Basket retrievedBasket = OrderContext.Current.GetBasket(userID, "default");

Convert Anonymous Basket to a Users Basket

A basket that belongs to a user who has not signed in is called an anonymous basket. A user might add items to a basket before signing in to your site. Later, the user could sign in either by using an existing account or by creating a new account. At this point, you have to associate the anonymous basket with the registered user's account.

Code Snippet: 

        // For this example, create a new GUID for the user ID

        // of the anonymous basket.

        Guid anonymousUserID = Guid.NewGuid(); 

        // Create a Basket object to represent the anonymous

        // user's basket. Add two items to the basket.

        Basket anonymousBasket = OrderContext.Current.GetBasket(anonymousUserID,    "default");

        OrderForm orderForm = new OrderForm();

        LineItem item1 = new LineItem("clothing", "ABC-123", "", 2);

        LineItem item2 = new LineItem("clothing", "DEF-456", "", 1);

        orderForm.LineItems.Add(item1);

        orderForm.LineItems.Add(item2);

        anonymousBasket.OrderForms.Add(orderForm); 

        // Assume that the user has now signed in. For this

        // example, create a new GUID for the user's ID. If this

        // were part of a full Commerce Server site, you would get

        // the ID of the current user from the CommerceContext

        // object.

        Guid registeredUserID = Guid.NewGuid(); 

        // Create a Basket object to represent the registered

        // user's basket.

        Basket registeredUserBasket = OrderContext.Current.GetBasket(registeredUserID, "default"); 

        // Add the items from the anonymous user's basket to the

        // registered user's basket.

        registeredUserBasket.Add(anonymousBasket); 

        // Create the basket pipeline.

        PipelineInfo pipeline = new PipelineInfo("basket", OrderPipelineType.Basket); 

        // In a full Commerce Server site, you would add the

        // registered user's profile to the PipelineInfo

        // object by uncommenting the following line:

        // pipeline.Profiles.Add("UserObject", CommerceContext.Current.UserProfile); 

        registeredUserBasket.RunPipeline(pipeline); 

        // Save the registered user's basket and delete the

        // anonymous basket.

        registeredUserBasket.Save();

        anonymousBasket.Delete(); 

Purchase Order 

A PurchaseOrder represents a completed order, a shopping cart that has already gone through the checkout process. After you run the Checkout pipeline on a Basket, convert the Basket to a PurchaseOrder by using the SaveAsOrder method.

         // Convert the Basket to a PurchaseOrder, and save the.

        // PurchaseOrder.

        PurchaseOrder myPurchaseOrder = myBasket.SaveAsOrder();

Customer & Order Manager

Use the Customer and Orders Manager screens to manage customer profiles, shipping methods, payment methods, site terms, and search orders.

Profile System

Some common scenarios for developing with the Profiles System are as follows:

  • Authenticate users.

Implements authentication functionality. Authentication is the process of verifying the identity of a user

  • Capture user logon information.

You can obtain all information about a customer from the customer's profile, regardless of where the information is stored.

  • Capture user preference information.

Stores user-related information, such as the following:

  • First name

  • Last name

  • Multiple address information for shipping or billing

  • Credit card or other payment credentials

  • Organization information 

  • Store general business information.

Stores site currency exchange rates, and site status information such as open, closed for maintenance, and general messages, and shipping types such as overnight, 2nd day, and ground service. 

  • Provide a targeted and personalized site experience

Can target a user to provide a personalized shopping experience that show personalized site content, product catalog sets and pricing, and remembers user preferences. 

  • Provide a targeted and personalized marketing experience.

The predefined profile for a customer is integrated with the Commerce Server Marketing System to let you personalize e-mail messages and create marketing campaigns that are targeted to customers who have specific characteristics.  

Commerce Server product contains six predefined profiles. You can use these profiles as they are, you can modify these profiles, and you can define your own profiles.

Predefined Commerce Server profiles:

  • Address Profile Schema

  • BlanketPOs Profile Schema

  • CreditCard Profile Schema

  • Currency Profile Schema

  • Organization Profile Schema

  • UserObject Profile Schema

Code snippet to create user profile:

ProfileContext profileContext = CommerceContext.Current.ProfileSystem;

               //Check if the profile already exits

Profile userProfile = profileContext.GetProfile(BasketID,BsConstants.UserProfile);

if (userProfile == null)

{

   // Create a new UserObject Profile  

   userProfile = profileContext.CreateProfile(BasketID, BsConstants.UserProfile);

}

// Set the required property values       

userProfile.Properties[BsConstants.User_Email].Value = dtUserInfo.Rows[iUserInfo]["Email"].ToString();

userProfile.Properties[BsConstants.User_Password].Value = dtUserInfo.Rows[iUserInfo]["Password"].ToString();

serProfile.Properties[BsConstants.User_UserType].Value = dtUserInfo.Rows[iUserInfo]["UserType"].ToString();

userProfile.Properties[BsConstants.User_LastName].Value = dtUserInfo.Rows[iUserInfo]["LastName"].ToString();

serProfile.Properties[BsConstants.User_FirstName].Value = dtUserInfo.Rows[iUserInfo]["FirstName"].ToString();               userProfile.Properties[BsConstants.User_DefaultLanguage].Value = @"en_US";              

//Update and save the profile       

userProfile.Update();

Payment Processing 

A payment processor is a pipeline component that validates and processes a payment. If you incorporate a custom payment method into your Commerce Server application, you must create a new payment processor. After you create the payment processor, configure a payment method to use the new payment processor. The following procedure describes how to implement the aspects of a pipeline component that are required for a payment processor.

Creating a payment processor 

i.            Define a class that implements the IPipelineComponent interface. If the pipeline component will store configuration information, also implement the IPersistDictionary interface. Configuration information is information about the pipeline component itself instead of information that is only needed during a single execution of the pipeline component.

ii.            Define a constructor for the class.

iii.            Define a method named GetProgID that returns the pipeline component's programmatic identifier (ProgID). The ProgID can be any unique string, although it is usually related to the namespace and class name.

iv.            Define the IPipelineComponent::Execute method. Within the Execute method, do the following:

a.       Cast the arguments to the method to the IDictionary interface.

(IDictionary) context = (IDictionary) contextArgument;
(IDictionary) orderForm = (IDictionary) orderFormArgument;
Where contextArgument and orderFormArgument are the arguments that were passed to the Execute method.

b.      If the pipeline component might generate errors that will be displayed to the customer, get the MessageManagerobject.

messageManager = (IMessageManager)context["MessageManager"];

c.       Obtain the data that you will need in order to process the payment from the order form and the context. In particular, you can get the payments by using the following code:

(IDictionary) payment = (IDictionary)context["payment_to_process"];

d.      Execute whatever business logic is necessary to process the payment.

e.     If there are errors that you want to display to the customer, use the MessageManager object that you created in step b to create an error message and add it to the errors that are associated with the purchase.

Object errorMessage = messageManager.GetMessage (errorName, null); ((ISimpleList)orderForm["_Purchase_Errors"]).Add(ref errorMessage);

Where errorName is a string that contains the identifier of the error, and orderFormArgument is the order argument that you cast to the IDictionary interface in step a.

v.            If the payment processor might generate any new errors to display to the customer, add the error messages to MessageManager. For more information about how to customize error messages.

                Add the pipeline component .pcf file

§         register the assembly for Com interop

§         add this component to the creditcard pipeline and make sure you have added it under payment methods

Sample:Paypal Integration

The goal is to create a pipeline that will process credit card payments using VeriSign or PayPal as it is called now.  We will be using the Payflow Pro SDK which is available for download at https://www.paypal.com/IntegrationCenter/ic_downloads.html#PayflowPro

 You will need to have a PayPal merchant account setup already in order to use the sdk.  

You will need to add some things to your web.config for the PayFlow sdk.

<?xml version="1.0"?>
<configuration>
 <configSections>
  <section name="PayFlowProSettings" type="System.Configuration.NameValueSectionHandler,system,Version=1.0.3300.0,Culture=neutral, PublicKeyToken=b77a5c561934e089,Custom=null"/>
 </configSections>
 <PayFlowProSettings>
  <!-- Payflow Pro Host Name. This is the host name for the PayPal Payment Gateway.
    For test accounts it should be pilot-payflowpro.PayPal.com.
    For live accounts it should be changed to payflowpro.PayPal.com -->
  <add key="PAYFLOW_HOST" value="pilot-payflowpro.verisign.com/transaction"/>
  <add key="PARTNER" value="PartnerName"/>
  <add key="MERCHANT_LOGIN" value="MerchantLogin"/>
  <add key="USER_LOGIN" value="UserLogin"/>
  <add key="USER_PASSWORD" value="UserPassword"/>
 </PayFlowProSettings>
</configuration>
 

Pipeline component code snippet: 

public class PayFlowPipeline: PipelineComponent,IPipelineComponentAdmin

{

#region IPipelineComponent Members

 void IPipelineComponent.EnableDesign(int fEnable) { }

 int IPipelineComponent.Execute(object pdispOrder, object dispContext, int lFlags)

        {

                //override the code for this method to check the credit card details

        }

 #endregion

}

Summary

 

Commerce Server enables you to create full-featured Web business applications and extend your business across networks, while allowing you to integrate e-commerce solutions within your existing infrastructure. It helps you to create e-commerce solutions and Web sites with high-performance, familiar tools that simplify setup, management, and administration tasks.

Each aspect of developing, deploying, managing, maintaining, and monitoring e-commerce sites is designed to help maximize security, minimize total cost of ownership, accelerate time to market, and simplify exchange of data with existing line-of-business (LOB) systems and trading partners. The development platform and service oriented architecture make it easy to extend and repurpose Commerce Server functionality. Also, with multilingual and multicurrency support, supporting international sites is easier than ever.

As is evident from the details explained earlier, Commerce Server will enable enterprises

 

  • Reduce time-to-market: Allows to create more flexible and high-performance sites faster

  • Reduce IT costs for implementation and maintenance: Empowering and enabling administrators and business users to more effectively manage and maintain sites.

  • Achieve sophisticated integration features: Helps to integrate newly developed sites with the existing systems and infrastructure. 

References 

http://msdn.microsoft.com/hi-in/library/ms964382(en-us).aspx