Release 2012 D

compared with
Current by Martin Breest
on Sep 07, 2012 16:49.

Key
This line was removed.
This word was removed. This word was added.
This line was added.

Changes (2)

View Page History
{toc}

h1. Basket Modifications (TODO)

h2. Allow to create basket with basket items on POST on /api/v1/baskets

h2. Add appearanceLink, appearanceLabel and sizeLabel to basket item

{code}
<basket ...>

<basketItem ...>
<shop id="205909" xlink:href="http://api.spreadshirt.net/v1/shops/205909">
<description>Basket Item description</description>
<quantity>2</quantity>
<element id="123" type="sprd:product" xlink:href="http://api.spreadshirt.net/v1/shops/205909/products/123">
<properties>
<property key="appearance">15</property>
<property key="size">12</property>

<!-- new -->
<property key="appearance>Label">Red</property>
<property key="sizeLabel">M</property>
<property key="appearanceLink">http://image.spreadshirt.net/image-server/v1/appearances/15</property>
<!-- new -->

</properties>
</element>
<links>
<link type="edit" xlink:href="http://www.yourdomain.de/product/123/edit"/>
<link type="continueShopping" xlink:href="http://www.yourdomain.de"/>
</links>
<price>
<currency id="1" xlink:href="http://api.spreadshirt.net/v1/currencies/1"/>
<vatIncluded>10.0</vatIncluded>
<vatExcluded>9.8</vatExcluded>
<vat>0.2</vat>
</price>
...
</basketItem>
...
</basket>
{code}

h2. Add sourceArticleId as supported input parameter for products as basket item elements

{code}
<basket ...>

<basketItem ...>
<shop id="205909" xlink:href="http://api.spreadshirt.net/v1/shops/205909">
<description>Basket Item description</description>
<quantity>2</quantity>
<element id="123" type="sprd:product" xlink:href="http://api.spreadshirt.net/v1/shops/205909/products/123">
<properties>
<property key="appearance">15</property>
<property key="size">12</property>
...
<!-- new -->
<property key="sourceArticleId">456</property>
<!-- new -->

</properties>
</element>
<links>
<link type="edit" xlink:href="http://www.yourdomain.de/product/123/edit"/>
<link type="continueShopping" xlink:href="http://www.yourdomain.de"/>
</links>
<price>
<currency id="1" xlink:href="http://api.spreadshirt.net/v1/currencies/1"/>
<vatIncluded>10.0</vatIncluded>
<vatExcluded>9.8</vatExcluded>
<vat>0.2</vat>
</price>
</basketItem>
...
</basket>
{code}

h2. Add image resource to basket item

* provide one defaultImage resource that contains a link to the default image
* provide 0..n itemImage resource links that contain images for all product views

{code}
<basket ...>

<basketItem ...>
<shop id="205909" xlink:href="http://api.spreadshirt.net/v1/shops/205909">
<description>Basket Item description</description>
<quantity>2</quantity>
<element id="123" type="sprd:product" xlink:href="http://api.spreadshirt.net/v1/shops/205909/products/123">
<properties>
<property key="appearance">15</property>
<property key="size">12</property>
</properties>
</element>
<links>
<link type="edit" xlink:href="http://www.yourdomain.de/product/123/edit"/>
<link type="continueShopping" xlink:href="http://www.yourdomain.de"/>
</links>
<price>
<currency id="1" xlink:href="http://api.spreadshirt.net/v1/currencies/1"/>
<vatIncluded>10.0</vatIncluded>
<vatExcluded>9.8</vatExcluded>
<vat>0.2</vat>
</price>

<!-- new -->
<resources>
<resource xlink:href="http://image.spreadshirt.net/image-server/v1/products/123/views/1?appearance=...&width=200&height=200" type="defaultImage" mediaType="png"/>
<resource xlink:href="http://image.spreadshirt.net/image-server/v1/products/123/views/1?appearance=...&width=200&height=200" type="itemImage" mediaType="png"/>
<resource xlink:href="http://image.spreadshirt.net/image-server/v1/products/123/views/2?appearance=...&width=200&height=200" type="itemImage" mediaType="png"/>
<resource xlink:href="http://image.spreadshirt.net/image-server/v1/products/123/views/3?appearance=...&width=200&height=200" type="itemImage" mediaType="png"/>
<resource xlink:href="http://image.spreadshirt.net/image-server/v1/products/123/views/4?appearance=...&width=200&height=200" type="itemImage" mediaType="png"/>
<resource xlink:href="http://image.spreadshirt.net/image-server/v1/products/123/views/5?appearance=...&width=200&height=200" type="itemImage" mediaType="png"/>
<resource xlink:href="http://image.spreadshirt.net/image-server/v1/products/123/views/6?appearance=...&width=200&height=200" type="itemImage" mediaType="png"/>
...

</resources>
<!-- new -->

</basketItem>
...
</basket>
{code}

h2. Add shipping costs to basket

{code}
<basket ...>

<basketItem ...>
<shop id="205909" xlink:href="http://api.spreadshirt.net/v1/shops/205909">
<description>Basket Item description</description>
<quantity>2</quantity>
<element id="123" type="sprd:product" xlink:href="http://api.spreadshirt.net/v1/shops/205909/products/123">
<properties>
<property key="appearance">15</property>
<property key="size">12</property>
</properties>
</element>
<links>
<link type="edit" xlink:href="http://www.yourdomain.de/product/123/edit"/>
<link type="continueShopping" xlink:href="http://www.yourdomain.de"/>
</links>
<price>
<currency id="1" xlink:href="http://api.spreadshirt.net/v1/currencies/1"/>
<vatIncluded>10.0</vatIncluded>
<vatExcluded>9.8</vatExcluded>
<vat>0.2</vat>
</price>
</basketItem>

<!-- new -->
<shipping>
<shippingType id="1"/>
<shippingCountry id="1"/>
<price>
<currency id="1" xlink:href="http://api.spreadshirt.net/v1/currencies/1"/>
<vatIncluded>10.0</vatIncluded>
<vatExcluded>9.8</vatExcluded>
<vat>0.2</vat>
</price>
</shipping>
<!-- new -->
...
</basket>
{code}

h1. Discounts (TODO)

h2. Resources

h3. Retrieve Shop Discount Scales List

|| Url | .../v1/shops/\{shopId\}/discountScales ||
|| Sample | [http://api.spreadshirt.net/api/v1/shops/40000/discountScales|http://api.spreadshirt.net/api/v1/shops/40000/discountScales] ||
|| Type | LIST ||
|| Method | GET ||
|| Special Status Codes | ||
*Response Representation:*
\\
\\ {noformat}
<discountScales ...>
...
</discountScales>
{noformat}

h3. Retrieve Shop Discount Scale Entity

|| Url | .../v1/shops/\{shopId\}/discountScales/\{discountScaleId\} ||
|| Sample | [http://api.spreadshirt.net/api/v1/shops/40000/discountScales/1|http://api.spreadshirt.net/api/v1/shops/40000/discountScales/1] ||
|| Type | ENTITY ||
|| Method | GET ||
|| Special Status Codes | ||

*Response Representation:*

{noformat}
<discountScale ...>
...
</discountScale>
{noformat}

h2. Representations

h3. Discount

* discount value ranges should work for quantities and prices
** quantity example 0..4, 5..11, 12..24 ...
** price for currency € example 0..10, 11..20, 21..30 ....
* discount credits should work as percentage and fixed price
** percentage example 0, 10, 15, 20, 25
** price example 10, 20, 30, 40, 50 ....

{code}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<discountScale id="1" xlink:href="http://api.spreadshirt.net/api/v1/shops/205909/discountScales/1">
<name>Default discount scale</name>
<discounts>
<discount id="10">
 <valueRange>
<from>0</from>
<to>4</to>
<unit type="sprd:quantity"/>
<!-- could also be <unit type="sprd:price" xlink:href="http://api.spreadshirt.net/api/v1/currencies/1"/> -->
</valueRange>
 <credit>
<value>0</value>
<unit type="sprd:percentage"/>
<!-- could also be <unit type="sprd:price" xlink:href="http://api.spreadshirt.net/api/v1/currencies/1"/> -->
</credit>
<discount>
<discount id="11">
 <valueRange>
<from>5</from>
<to>11</to>
<unit type="sprd:quantity"/>
</valueRange>
 <credit>
<value>10</value>
<unit type="sprd:percentage"/>
</credit>
<discount>
<discount id="12">
 <valueRange>
<from>12</from>
<to>24</to>
<unit type="sprd:quantity"/>
</valueRange>
 <credit>
<value>15</value>
<unit type="sprd:percentage"/>
</credit>
<discount>
<discount id="13">
 <valueRange>
<from>25</from>
<to>49</to>
<unit type="sprd:quantity"/>
</valueRange>
 <credit>
<value>20</value>
<unit type="sprd:percentage"/>
</credit>
<discount>
<discount id="14">
 <valueRange>
<from>50</from>
<to>99</to>
<unit type="sprd:quantity"/>
</valueRange>
 <credit>
<value>25</value>
<unit type="sprd:percentage"/>
</credit>
<discount>
<discount id="15">
 <valueRange>
<from>100</from>
<unit type="sprd:quantity"/>
</valueRange>
 <credit>
<value>30</value>
<unit type="sprd:percentage"/>
</credit>
<discount>
</discounts>
</discount>
{code}

h2. Discount info on basket and basket items

* add discounts block to basket item
* add priceItem block to basket item - price of single basket item without discounts, applied coupons
* modify basket item price - price of single basket item with discounts and coupons applied
* add discounts block to basket - cumulated discounts from basket items
* add priceItems block to basket - price of all basket items (quantity * priceItem) without discounts, applied coupons
* add priceTotal block to basket &nbsp;\- price of all basket items (quantity * priceItem) with discounts, coupons applied

{code}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?><basket id="0cd283f7-5b24-407a-9a9c-a081455e1030"
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://api.spreadshirt.net"
xlink:href="http://api.spreadshirt.net/api/v1/baskets/0cd283f7-5b24-407a-9a9c-a081455e1030">
<token>xy</token>
<user id="42" xlink:href="http://api.spreadshirt.net/v1/users/42"/>
<shop id="42" xlink:href="http://api.spreadshirt.net/v1/shops/42"/>
<basketItems>
<basketItem
xmlns:xlink="http://www.w3.org/1999/xlink"
xmlns="http://api.spreadshirt.net"
xlink:href="http://api.spreadshirt.net/api/v1/baskets/0cd283f7-5b24-407a-9a9c-a081455e1030/items/a561dcbb-9065-4e45-ad20-aba2bd8a6afa"
id="a561dcbb-9065-4e45-ad20-aba2bd8a6afa">
<!-- optional for mixed mode -->
<shop id="40000" xlink:href="http://api.spreadshirt.net/v1/shops/42">
<description>Basket Item description</description>
<quantity>2</quantity>
<element id="456" type="sprd:article" xlink:href="http://api.spreadshirt.net/v1/shops/42/articles/456">
<properties>
<property key="appearance">15</property>
<property key="size">12</property>
</properties>
</element>
<links>
<link type="edit" xlink:href="http://www.yourdomain.de/article/123/edit"/>
<link type="continueShopping" xlink:href="http://www.yourdomain.de"/>
</links>
 
<!-- for demo only -->
<coupons>
...
</coupons>  
<!-- for demo only -->

<!-- new -->
<discounts>
<discount>
<currentDiscountScale id="1" xlink:href="http://api.spreadshirt.net/api/v1/shops/205909/discountScale/1"/>
<currentDiscount id="10"/>
<nextDiscount id="11"/>
<price>
<currency id="1" xlink:href="http://api.spreadshirt.net/v1/currencies/1"/>
<vatIncluded>-3.0</vatIncluded>
<vatExcluded>-2.43</vatExcluded>
<vat>19.0</vat>
</price>
</discount>
</discounts>
<priceItem>
<currency id="1" xlink:href="http://api.spreadshirt.net/v1/currencies/1"/>
<vatIncluded>10.0</vatIncluded>
<vatExcluded>8.1</vatExcluded>
<vat>19.00</vat>
<priceItem>
 <price>
<currency id="1" xlink:href="http://api.spreadshirt.net/v1/currencies/1"/>
<vatIncluded>7.0</vatIncluded>
<vatExcluded>5.67</vatExcluded>
<vat>19.0</vat>
</price>
<!-- new --> 

</basketItem>
...
</basketItems>


<!-- for demo only -->
<coupons>
<coupon>
...  
<price>  
<currency id="1" xlink:href="http://api.spreadshirt.net/v1/currencies/1"/>
<vatIncluded>-5.0</vatIncluded>
<vatExcluded>-0.95</vatExcluded>
<vat>19.00</vat>  
<price>  
</coupon>
</coupons>
<!-- for demo only -->

<shipping>
...
<price>  
<currency id="1" xlink:href="http://api.spreadshirt.net/v1/currencies/1"/>
<vatIncluded>5.0</vatIncluded>
<vatExcluded>0.95</vatExcluded>
<vat>19.00</vat>  
<price>  
</shipping>

<!-- new -->
<discounts>  
<discount>  
<currentDiscountScale id="1" xlink:href="http://api.spreadshirt.net/api/v1/shops/205909/discountScales/1"/>
<currentDiscount id="10"/>
<nextDiscount id="11"/>
<price>  
<currency id="1" xlink:href="http://api.spreadshirt.net/v1/currencies/1"/>  
<vatIncluded>-6.0</vatIncluded>
<vatExcluded>-4.86</vatExcluded>
<vat>19.0</vat>  
</price>  
</discount>  
</discounts>   
<priceItems>  
<currency id="1" xlink:href="http://api.spreadshirt.net/v1/currencies/1"/>
<vatIncluded>20.0</vatIncluded>
<vatExcluded>16.2</vatExcluded>
<vat>19.00</vat>  
<priceItems>  
<priceTotal>
<currency id="1" xlink:href="http://api.spreadshirt.net/v1/currencies/1"/>
<vatIncluded>14.0</vatIncluded>
<vatExcluded>11.34</vatExcluded>
<vat>19.0</vat>
</priceTotal>
<!-- new -->

</basket>
{code}

h2. Add discountable flag to ProductType payload

{code}
<?xml version="1.0" encoding="UTF-8" standalone="yes"?>
<productType ...>
...
<shippingFactory>1.0</shippingFactor>

<!-- new -->
<discountable>true</discountable>
<!-- new -->
...
</productType>
{code}
* discounts
* basket prices