
Web2Print Cloud Lab
1 Table of Contents
2 Introduction
Affiliate discounts are given upon a number of
Article Groups. Before any profits are calculated, the affiliate gets a discount on a
Article Group. The resulting price will then be used to calculate relative and absolute profits on. So the basic formular is:
EndCustomerPrice = InputPrice - Discount + AbsoluteProfit + RelativeProfit
Thus resulting in the following profit formular:
AffiliateProfit = (InputPrice - Discount) * RelativeProfit + AbsoluteProfit
2.1 Discount models
There are two discount models available, based on a hierarchy. Discounts do not stack, only the highest percentage will used.
2.1.1 Discount level
The affiliate can be assigned to a specific discount level. This level defines discounts on a number of article groups. Every affiliate in this level shares the same discount values. Higher discount levels will result in higher discounts that will be given to the affiliate.
2.1.2 Custom discounts
Every affiliate can have custom discounts, which allow a fine grained administration of discounts on special
Article Groups. This can be used to define exceptions on the discount level the affiliate is currently assigned to.
2.2 General usage
The affiliate gets a discount in percent, defined in the used discount model, on which base he can add a list of profits in percent and/or fixed amount of money utilizing the
ContactingDiscountProfitEntry element. If the affiliate has several
Resale Units he can set up multiple profits on the same
Article Groups by referring to different
Resale Units. This enables the affiliate to sell articles from the same
Article Group on different plattforms or locations i.e.
Resale Units.
3 ContactingDiscountEntry Element
3.1 Endpoints
To get a list of custom discounts for a specific affiliate, the following URI needs to be used.
3.1.1 List existing items
GET https://api.delivergo.com/portal/PortalNamespace/api/Customer/CustomerGuid/Discounts
The sample below illustrates a response from the server, having a custom discount of 10% on Article Group with ID = 3, plus two different profits on two Resale Units.
JSON:
{
"Active":true,
"ContactingDiscountProfitEntry":[
{
"Active":true,
"Created":"\/Date(1299680589917+0100)\/",
"Creator":"1186f976-8aae-4929-b6f2-3ce99553e248",
"Id":1,
"IdContactingDiscountEntry":1,
"IdResaleUnit":1,
"ResaleProfitAmount":5.0000,
"ResaleProfitPercentage":10.00
},
{
"Active":true,
"Created":"\/Date(1299680589917+0100)\/",
"Creator":"1186f976-8aae-4929-b6f2-3ce99553e248",
"Id":2,
"IdContactingDiscountEntry":1,
"IdResaleUnit":2,
"ResaleProfitAmount":2.0000,
"ResaleProfitPercentage":12.00
}
],
"Id":1,
"IdArticleGroup":3,
"Percentage":10.00
}
XML:
<ContactingDiscountEntry xmlns="http://delivergo.net/portal/api">
<Id>1</Id>
<IdArticleGroup>3</IdArticleGroup>
<Percentage>10.00</Percentage>
<ValidFrom xsi:nil="true" />
<ValidTo xsi:nil="true" />
<Creator xsi:nil="true" />
<Created xsi:nil="true" />
<Modifier xsi:nil="true" />
<Modified xsi:nil="true" />
<Active>true</Active>
<ContactingDiscountProfitEntry>
<ContactingDiscountProfitEntry>
<Id>1</Id>
<IdResaleUnit>1</IdResaleUnit>
<IdContactingDiscountEntry>1</IdContactingDiscountEntry>
<ResaleProfitPercentage>10.00</ResaleProfitPercentage>
<ResaleProfitAmount>5.0000</ResaleProfitAmount>
<Creator>1186f976-8aae-4929-b6f2-3ce99553e248</Creator>
<Created>2011-03-09T15:23:09.917</Created>
<Modifier xsi:nil="true" />
<Modified xsi:nil="true" />
<Active>true</Active>
</ContactingDiscountProfitEntry>
<ContactingDiscountProfitEntry>
<Id>2</Id>
<IdResaleUnit>2</IdResaleUnit>
<IdContactingDiscountEntry>1</IdContactingDiscountEntry>
<ResaleProfitPercentage>12.00</ResaleProfitPercentage>
<ResaleProfitAmount>2.0000</ResaleProfitAmount>
<Creator>1186f976-8aae-4929-b6f2-3ce99553e248</Creator>
<Created>2011-03-09T15:23:09.917</Created>
<Modifier xsi:nil="true" />
<Modified xsi:nil="true" />
<Active>true</Active>
</ContactingDiscountProfitEntry>
</ContactingDiscountProfitEntry>
</ContactingDiscountEntry>
3.1.2 Add items
PUT https://api.delivergo.com/portal/PortalNamespace/api/Customer/CustomerGuid/Discount/Profits
The sample adds a new profit item to ContactingDiscountEntry with ID = 1, attaching it to the Resale Unit with ID = 1. Notice that you can add multiple items in one batch, hence the datatype array.
JSON:
[
{
"Active":true,
"IdContactingDiscountEntry":1,
"IdResaleUnit":1,
"ResaleProfitAmount":5.0000,
"ResaleProfitPercentage":10.00
}
]
XML:
<ContactingDiscountProfitEntry xmlns="http://delivergo.net/portal/api">
<ContactingDiscountProfitEntry>
<IdResaleUnit>1</IdResaleUnit>
<IdContactingDiscountEntry>1</IdContactingDiscountEntry>
<ResaleProfitPercentage>10.00</ResaleProfitPercentage>
<ResaleProfitAmount>5.0000</ResaleProfitAmount>
<Active>true</Active>
</ContactingDiscountProfitEntry>
</ContactingDiscountProfitEntry>
3.1.3 Update items
POST https://api.delivergo.com/portal/PortalNamespace/api/Customer/CustomerGuid/Discount/Profits
The sample below updates the profit item with ID = 1. Notice that you can update multiple items in one batch, hence the datatype array.
JSON:
[
{
"Active":true,
"Created":"\/Date(1299680589917+0100)\/",
"Creator":"1186f976-8aae-4929-b6f2-3ce99553e248",
"Id":1,
"IdContactingDiscountEntry":1,
"IdResaleUnit":1,
"ResaleProfitAmount":5.0000,
"ResaleProfitPercentage":10.00
}
]
XML:
<ContactingDiscountProfitEntry xmlns="http://delivergo.net/portal/api">
<ContactingDiscountProfitEntry>
<Id>1</Id>
<IdResaleUnit>1</IdResaleUnit>
<IdContactingDiscountEntry>1</IdContactingDiscountEntry>
<ResaleProfitPercentage>10.00</ResaleProfitPercentage>
<ResaleProfitAmount>5.0000</ResaleProfitAmount>
<Creator>1186f976-8aae-4929-b6f2-3ce99553e248</Creator>
<Created>2011-03-09T15:23:09.917</Created>
<Active>true</Active>
</ContactingDiscountProfitEntry>
</ContactingDiscountProfitEntry>
3.1.4 Delete items
DELETE https://api.delivergo.com/portal/PortalNamespace/api/Customer/CustomerGuid/Discount/Profits
The sample below will delete an existing profit, identified by an ID. Notice that you can delete multiple items in one batch, hence the datatype array.
JSON:
[
{
"Id": 1,
}
]
XML:
<ContactingDiscountProfitEntry xmlns="http://delivergo.net/portal/api">
<ContactingDiscountProfitEntry>
<Id>1</Id>
</ContactingDiscountProfitEntry>
</ContactingDiscountProfitEntry>
3.2 ContactingDiscountEntry Elements
| Name | Type | Datatype | Example | Default | Description |
|---|
| Id
| optional
| int
| 1
| -
| Primary key. Will be created automatically and serves as an identifier for update and delete actions.
|
| IdArticleGroup
| required
| int
| 1
| -
| Foreign key. Identifies the Article Group on which the discount is given.
|
| Percentage
| optional
| float
| 10.0
| -
| Custom discount percentage given on an article group. This is only required, when a percentage in the assigned discount level needs to be overridden.
|
| ValidFrom
| optional
| datetime
| -
| -
| Defines the beginnging of the timeframe in which the discount is valid.
|
| ValidTo
| optional
| datetime
| -
| -
| Defines the end of the timeframe in which the discount is valid.
|
| Created
| returned
| datetime
| -
| -
| Creation date of the item.
|
| Creator
| returned
| guid
| -
| -
| Creator of the item.
|
| Modified
| returned
| datetime
| -
| -
| Last modification date of the item.
|
| Modifier
| returned
| guid
| -
| -
| Modifier of the item.
|
| Active
| required
| bool
| true
| false
| Whether the Resale Unit should be active or not.
|
| ContactingDiscountProfitEntry
| required
| array
| -
| -
| List of profits assigned to this discount. Each entry must refer to a different Resale Unit or contain only one entry, which will act as a global Resale Unit.
|
3.3 ContactingDiscountProfitEntry Elements
| Name | Type | Datatype | Example | Default | Description |
|---|
| Id
| optional
| int
| 1
| -
| Primary key. Will be created automatically and serves as an identifier for update and delete actions.
|
| IdResaleUnit
| required
| int
| 1
| -
| Referring to a specific Resale Unit. Must be different for every single item.
|
| IdContactingDiscountEntry
| required
| int
| 1
| -
| Foreign key, pointing to the ContactingDiscountEntry's Id element, thus descriping what the profit is assigned to.
|
| ResaleProfitPercentage
| optional
| float
| 10.00
| -
| Profit in percent. Will be calculated on the sale sum after the given discount is subtracted. Either ResaleProfitPercentage, ResaleProfitAmount or both can be supplied.
|
| ResaleProfitAmount
| optional
| float
| 10.00
| -
| Fixed amount of profit. Will be added to the sale sum after the given discount is subtracted. Either ResaleProfitPercentage, ResaleProfitAmount or both can be supplied.
|
| Created
| returned
| datetime
| -
| -
| Creation date of the item.
|
| Creator
| returned
| guid
| -
| -
| Creator of the item.
|
| Modified
| returned
| datetime
| -
| -
| Last modification date of the item.
|
| Modifier
| returned
| guid
| -
| -
| Modifier of the item.
|
| Active
| required
| bool
| true
| false
| Whether the Resale Unit should be active or not.
|