Navigation
Lead / Send Request Scenario
General
Design
APIs
Lead / Send Request Scenario
General
Design
APIs
One important use case for pCon.ui is the integration into shop systems, but often the shops don’t want to use the product prices available in the OFML data. For example, there are no prices available for different currencies or promotion discounts of the shops cannot be applied. Therefore, a functionality is needed that allows the shop to overwrite the prices coming from the OFML data in pCon.ui.
The URL of the webservice has to be sent to us so it can be set as parameter in the corresponding GatekeeperID configuration on the server.
CORS Header (Cross-Origin)
Since pCon.ui will get information from a different origin than its own, the same origin policy is violated. Therefore, CORS header needs to be set to allow loading of those information in pCon.ui as follows:
Access-Control-Allow-Headers: Content-Type Access-Control-Allow-Method: POST Access-Control-Allow-Origin: https://ui.pcon-solutions.com
When users insert a product or configure it, a POST request with a JSON including a link to an OBX file is sent to a webservice of the shop. The OBX file contains all pieces of information on the product (manufacturer, article code, configuration, …). The webservice of the shop downloads and parses this XML file and gets the required information to determine the price. The new price, currency and the article ID are sent back to pCon.ui as JSON file. pCon.ui reads this file and displays the new price to the users. The url to priceservice script has to be send to us to make it work.
The POST request sent by pCon.ui looks as follows:
{ "obxUrl": "<url>" "customFields": "" }
The URL leads to an OBX file. This file contains the information on the inserted products. Note that the link expires after 24 hours. If you desire to persist the OBX file, please store it on your own server. If customFields parameter was set in pCon.ui URL, the JSON contains this as well.
An OBX file can contain several products, since the configuration allows adding so called child products. For example, a worktop can have a CPU holder and a screen. In that case, the OBX contains the information for 3 articles.
If required, a detailed OBX specification can be found here. The elements important for the price service are:
| Element | Attribute | Description |
|---|---|---|
bskArticle | The bskArticle element contains all pieces of information about the product like manufacturer, article code, variant code, description and price. | |
basketId | Contains the unique ID for the basket article. The ID is important when sending back the price information to pCon.ui. | |
itemType | BasketArticle – Products of this type have to be used for price evaluation in the shop system. BasketAggregate – Products of this type have to be used for price evaluation in the shop system. BasketPartialPlanning – those elements can be ignored. |
|
manufacturer | This element contains information about the manufacturer including the name of the manufacturer in different languages. | |
id | ID of the manufacturer | |
series | The series element contains information about the product line like the name in different languages. | |
id | ID of the product line | |
artNr | This element contains the information about the article code. | |
type | base - Base article number final - Final article number varcode - Configuration of the article |
|
description | Description of the article | |
type | short – short description of the article in different languages long – long description of the article in different languages feature – describes the configuration of the article in different languages. |
|
itemPrice | This element contains the price information of the article. For a web shop, use the element with type='sale' and pd='1'. This is always the net price from the OFML-data. |
|
type | purchase – purchase price of the article sale – sales price of the article |
|
currency | Currency of the price | |
value | Price | |
taxInfo | Contains special tax information, e.g. for the French ECO contribution. This does not include any information regarding a VAT. |
|
typeId | e.g. ECO_FR | |
categoryId | Type of French ECO contribution, e.g. workplace_wood |
<bskArticle basketId='c45f23d5-8e3f-43a5-b542-f5bddcb14194' itemType='BasketArticle'> <manufacturer id='EGR'> <name lang=' '>EasternGraphics GmbH</name> </manufacturer> <series id='SE'> <name lang=' '>Series Name</name> </series> <artNr type='base'> NU3456 </artNr> <artNr type='final' default='1'> NU3456-TE </artNr> <artNr type='varcode'>CLASS1.PROP1=01;CLASS1.PROP2=06;CLASS2.PROP1=ABC</artNr> <description type='short' default='0'> <text lang='de'>Example Product</text> </description> <itemPrice type='purchase' currency='EUR' value='103.0' /> <itemPrice type='sale' pd='1' currency='EUR' value='103.0' /> <taxInfos> <taxInfo typeId='ECO_FR' categoryId='workplace_wood' /> </taxInfos> </bskArticle>
<bskArticle basketId='main_article_ID' itemType=' BasketAggregate'> … (see example above) <bskArticle basketId='child1_ID' itemType='BasketAggregate' subItem='1'> … (see example above) </bskArticle> </bskArticle>
Prices can be manipulated in many different ways:
| Manipulation Type | Description | Things to consider |
|---|---|---|
| change price | manipulate price given by manufacturer ac-cording to your needs (eg. give discount) | Take given price, do calculations with it, send new price back with mandatory fields (see this section). |
| visualize discount | manipulate price given by manufacturer eg. with given discount percentage or set new price | Take given price, set discount, send default and new price back with optional fields (see this section). |
| gross price | show gross price of articles in pCon.ui | Given price is net price by default so you will have to do the correct calculation of gross price on your side considering the vat tax for your country and send new price back with mandatory fields (see this section). |
| change currency | change the currency given by manufacturer | Default currency given by the manufacturers is mostly EUR. If you want to display a different currency, you have to do the conversion from the default currency to the desired one by yourself and send the new price and currency back with mandatory fields (see this section). |
After the price service system determined the price, it has to send the information back to pCon.ui as JSON. The JSON file needs to contain the following elements:
| Element | Required / Optional | Description |
|---|---|---|
currency | required | currency of the price(s) |
taxCode | optional | code for tax country |
articles | required | list that contains information and prices for all articles |
articles.basketId | required | ID of the product as defined in the OBX file. |
articles.salesPrice | required | New sales price of the article. Should include the French eco contribution, if applicable. |
articles.vat | optional | VAT for this article |
articles.eco | optional | French contribution fee for this article (absolute value) |
articles.eco_info | optional | additional information for French eco contribution |
originalPrice | optional | original Price |
discount | optional | given discount (as decimal number) percentage towards the original price |
compositePrice | optional | if set, it is displayed unchanged in footer and no calculations are made anymore |
If the OBX file contained more than one product, the JSON response has to provide the new price information for all articles.
{ "currency": "EUR", "taxCode": "DE", "articles": [ { "basketId": "f7d06042-5cda-49b7-a2f1-47a4901e3fa9", "salesPrice": "1.0", "vat": "0.19", "eco": "0.1", "eco_info": "eco info text" } ] }
{ "currency": "EUR", "taxCode": "DE", "articles": [ { "basketId": "main_article_id", "salesPrice": "2.0", "vat": "0.4", "eco": "0.2", "eco_info": "eco info text" }, { "basketId": "child_article_id", "salesPrice": "1.0", "vat": "0.19", "eco": "0.1", "eco_info": "eco info text" } ] }
{ "currency": "EUR", "taxCode": "DE", "articles": [ { "basketId": "f7d06042-5cda-49b7-a2f1-47a4901e3fa9", "salesPrice": "1995.0", "vat": "0.19", "eco": "1.26", "eco_info": "eco info text" } ], "originalPrice": "1995.0", "discount": "25", "compositePrice": "1496.25" }
leads to:
{ "currency": "EUR", "taxCode": "DE", "articles": [ { "basketId": "f7d06042-5cda-49b7-a2f1-47a4901e3fa9", "salesPrice": "1496.25", "vat": "0.19" } ], "discount": "25", "compositePrice": "1496.25" }
leads to: