aakb/ereolen — pull request #6 by guddo (2013-04-09 08:39:14+00:00)
Title: Case 2239 - Frontend: [Prices]-button logic and content in popup.

*Opened by Martin Cording 2/12/2013 1:12 PM [Revised 2/12/2013]*

According to the parent case and the attached flow, we need to implement the FE-part of the price comparison functionality.

**Scenario**:
When user loaned to many items (errorCode #120), library used to much money (errorCode #125I) or library loaned to many items (errorCode #126) – and the user press LOAN, one of the below mentioned errors appear.

We should tell the user that the item can’t be loaned, but it can be bought instead. Now the user have the option of pressing 1) close popup, 2) add the item to bookmarks, 3) or open a new window with sales presentation.

The user chooses “lookup prices” and a new overlay appears. Here the user is presented to coverImage, title(, date) and author. A short text explaining the options in the popup.

The distirbuters of the book will be listed with name, logo, “e-mærke” and “trustpilot” and the price.

Distributors is sorted by price on the ebook, with the cheapest at the top.

For each distributor, there should be a BUY-button which links directly to the ebook on the distibutors site.

When clikings BUY, the overlay should close and the link opens in a new window.

**When?**
When one of the following errorCodes is returned, we would like to offer a [Prices]-button to the user - since he is not able to loan.

When error code #120 is returned
`{FaultCodeList.MaxConcurrentLoansPerBorrowerExceeded, "Antallet af samtidige lån er overskredet (#120)."}`
When error code #125 is returned
`{FaultCodeList.MaxAmountPerMonthExceeded, "Biblioteket har nået forbrugsgrænsen i indeværende måned. Kontakt evt. dit lokale bibliotek for yderligere oplysninger (#125)."}`
When error code #126 is returned
`{FaultCodeList.MaxLoansPerMonthExceeded, "Biblioteket har nået grænsen for antal udlån i indeværende måned. Kontakt evt. dit lokale bibliotek for yderligere oplysninger (#126)."}`

**Webservice**
The list of distributors, information and link is provided by a web-service.

This is the endpoint for the service:
`http://purchase.api.pubhub.dk/purchasereference/v1/help/operations/Find`

There is a security key to be sent with when you want to retrieve book data.
This security key must be added to the request header - for example:

```
GET http://purchase.api.pubhub.dk/purchasereference/v1/?isbn=9788770538121
HTTP/1.1
User-Agent: Fiddler
Host: purchase.api.pubhub.dk
x-auth-secret: {KEY}
```

In the data we receive there will be a link to the book - this link will point to:
`http://redirect.pubhub.dk/redir.ashx?r={reseller}&i={isbn}`