Skip to content

This exercise is a common problem in e­commerce and brick-and-mortar retail systems.

License

Notifications You must be signed in to change notification settings

michaelahlers/boldradius-bundle-pricing

Repository files navigation

Bundle Pricing for BoldRadius Solutions CircleCI

Abstract

This exercise is a common problem in e­commerce and brick-and-mortar retail systems.

A customer shops from some form of catalog, selecting items and quantities they wish to purchase. When they are ready, they “check out”, that is, complete their purchase, at which point they are given a total amount of money they owe for the purchase of a specific set of items.

In the bounds of this problem, certain groups of items can be taken together as a “bundle” with a different price. For example, if I buy a single apple in isolation it costs $1.99, if I buy two apples it’s $2.15. More complex combinations are possible. For example, a loaf of bread “A” purchased with two sticks of margarine “B” and the second stick of margarine is free.

The same item may appear in more than one bundle (i.e., any one “cart” of items might be able to be combined in more than one way).

Development

Setup

Apart from requiring Oracle's Java SE Development Kit 8 (JDK 8), this project is “batteries included.” Simply start Typesafe Activator from the project's root to get started (installing SBT is optional). It's recommended to use one of the following resources to obtain Java.

Testing

From an SBT shell, the unit test suite is run with:

test

Specific tests with:

testOnly boldradius.catalog.ItemSpec

Test code coverage reports may be generated with:

;coverage;clean;test;coverageReport

Visit target/scala-2.11/scoverage-report/index.html (from the project's root) in your browser to see results.

Documentation

API documentation is available with copious developer notes is included. From an SBT shell, generate it with:

doc

Visit target/scala-2.11/api/index.html (from the project's root) in your browser to see results.

Resources

Provides a Knapsack problem constraint that's used by a pricer (class that calculates a price of items versus rules).

JSON representations of local models are convenient for both API consumers and developers. Typesafe's library—from the Play Framework—is a convenient and powerful tool for these purposes.

Used occasionally, mostly for testing purposes.

Although its functional programming features are little-used by this project, it offers a few convenient enhancements to Scala's core library.

As with Scalaz, Shapeless's more advanced features are little-used, save for conveniences it provides for working with tuples.

This project deals with costs, and the Squants framework—which deals with quantities and units of measure—provides an outstanding, full-featured API for money.

About

This exercise is a common problem in e­commerce and brick-and-mortar retail systems.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages