Skip to content

Instantly share code, notes, and snippets.

@cyriux
Created May 24, 2012 15:40
Show Gist options
  • Save cyriux/2782287 to your computer and use it in GitHub Desktop.
Save cyriux/2782287 to your computer and use it in GitHub Desktop.
Shipping cost TDD kata

E-commerce shipping company

On an e-commerce shop, during the checkout process you need to calculate the shipping costs, based on various information.

You work for a shipping company.

You receive a big message with plenty of data for one order from the online shop, and you must return the calculated shipping cost.

We gonna focus on the domain module that does the calculation.

We'll develop the code using modern software development techniques, e.g. TDD.

Shipping costs terms & conditions

Domestic

  • Fast: EUR 1.99 per shipment; Free from EUR 15

  • Priority: 7.99 EUR per shipment (only for books, CD, DVD, Blue-Rays)

  • 1 day delivery: 7.99 EUR per shipment (This option is not available for the following postcodes: 17111; 17123; 17410; 17580; 17590; 17630 ; 17670 ; 17740; 17880; 17940; 29242; 29252; 29259; 29240; 50116; 56360; 56590; 56170; 56780; 56840; 83140; 83150; 83400; 85350)

  • "Free shipping" special offer: free shipping for every item eligible for "Free shipping"

  • Large items (any dimension over 30cm): 19.90 EUR

  • Kitchen, House, High-Tech, Computer & Office : 39.90 EUR

  • Games & Toys : 14,90 EUR

  • Sports & Leisure : 19.90 EUR

Rest of the world

  • Fast: EUR 9.00 EUR 1.90 / item
  • Ultrafast: EUR 20.00 EUR 4.00 per kg

Video games

  • Fast: EUR 3.90 + EUR 1.50 per kg Video games
  • Ultrafast: EUR 9.90 + EUR 3.90 per kg

Luxury watches and jewellery

Always separate shipping

  • Shipping address must be in France Métropolitaine / Monaco, excluded the following postcodes (17111; 17123; 17410; 17580; 17590; 17630 ; 17670 ; 17740; 17880; 17940; 29242; 29252; 29259; 29240; 50116; 56360; 56590; 56170; 56780; 56840; 83140; 83150; 83400; 85350) and post boxes
  • Regular shipping cost

Some hints

Vocabulary

Shipping Method, Cost Per Shipment, Cost Per Item, Cost Per kg

Sample acceptance scenario

Given an order with a book at 13.90 EUR and a dvd at 9.90 EUR
when I select the fast shipping method
then the shipping cost is 3.98
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment