Creating External Pricing Services

PRESSERO > *Integration information & Supported Services

Creating External Pricing Services

Starting with version 5.2.9, Pressero can integrate with any external pricing service that is exposed on the web. In order to explain how it works, we will create a scenario where an MIS partner wants to expose their pricing service to Pressero.

FIGURE 1 - PRICING ENGINE

The product “Test" will need to display a pricing engine like the one shown in Figure 1. Since each product may have different set of options like stock, color, coating, etc. Pressero needs to retrieve the correct information from the MIS. For this example we will assume that the MIS Partner will use C# to create the web service that will provide the pricing information to Pressero.

The first step is to create the classes that will expose the different options and its values to the end user. Let’s call them Pricing Parameters. The code displayed below describes the pricing parameter structure. It is important to mention that each parameter may have a set of options.

 

 
  1. [Serializable]
  2. public class PricingParameter {
  3.     public string ID { get; set; }
  4.     public string Label { get; set; }
  5.     public List<PricingParameterOption> Options { get; set; }
  6.  
  7.     public PricingParameter() {
  8.         this.Options = new List<PricingParameterOption>();
  9.     }
  10.  
  11.     public PricingParameter(string label, string id)
  12.         : this() {
  13.         this.ID = id;
  14.         this.Label = label;
  15.     }
  16.  
  17.     public void AddOptionValue(string text, string value) {
  18.         this.Options.Add(new PricingParameterOption(text, value));
  19.     }
  20. }
  21.  
  22. [Serializable]
  23. public class PricingParameterOption {
  24.     public string Key { get; set; }
  25.     public string Value { get; set; }
  26.  
  27.     public PricingParameterOption() {
  28.  
  29.     }
  30.  
  31.     public PricingParameterOption(string key, string value)
  32.         : this() {
  33.         this.Key = key; 
  34.         this.Value = value;
  35.     }
  36. }
 

These objects will be used when Pressero asks the web service for a set of options for a certain product.

 

 
  1. [WebMethod]
  2. public List GetOptionsForProduct(string user, string accessToken, string productID) {
  3.  
  4. PricingParameter colorOptions = new PricingParameter("Paper Color", "color");
  5. colorOptions.AddOptionValue("Black", "b");
  6. colorOptions.AddOptionValue("Red", "r");
  7. colorOptions.AddOptionValue("White", "w");
  8. colorOptions.AddOptionValue("Yellow", "y");
  9.  
  10. PricingParameter paperOptions = new PricingParameter("Paper Type", "paper");
  11. paperOptions.AddOptionValue("Glossy", "g");
  12. paperOptions.AddOptionValue("Matte", "m");
  13.  
  14. List options = new List();
  15. options.Add(colorOptions);
  16. options.Add(paperOptions);
  17. return options;
  18. }
 
The code above shows that Pressero can also send product and authentication information so the correct options are returned based on the product. When this information gets displayed to the end user it will fire the call for the pricing. It will then activate another method in the MIS webservice, so the price can be calculated based on the selected options for each parameter.

 

 
  1. [WebMethod]
  2. public decimal GetPriceForProduct(string user, string accessToken, string productId, int quantity, List options) {
  3. return 10 * quantity;
  4. }
 

By analyzing the code above, it is possible to see that Pressero also sends the quantity information as well as the options selected for each parameter. With all this information, it is possible to calculate the correct price for a certain product based on the options.

Plug-and-Play Pricing Provider Service

We also have a separate DLL that can be used by .Net developers in order to create Plug-and-Play pricing providers. By using a web service that implements the IPricingService interface, integratation developers will be able to test the pricing engine at any time. Click here to download the sample project that contains the DLL.
 

Technical Support

Please note that we are unable to provide free technical support to you for this capability.  Any requests for assistance will be treated a paid professional service.
 

Related Documentation