|
| 1 | +Read the following document carefully. |
| 2 | +It contains important information about the task itself and how to submit your solution. |
| 3 | + |
| 4 | +## Task overview |
| 5 | + |
| 6 | +Create a implementation of the [IOrderAPI](./MinimalOrderApi/IOrderAPI.cs). |
| 7 | + |
| 8 | +Priorities: |
| 9 | +- The Implementation can be used with any access token (no hardcoded strings etc.) |
| 10 | +- If possible: All fields in the models should be filled by the implementation |
| 11 | +- Calculated prices are correct |
| 12 | +- Tax is correct calculated |
| 13 | +- Discounts (per position) should set to the `OrderItem.Discount` property. |
| 14 | +- The calculated total of the order must equal the `Order.TotalCost` (gross) which comes from the external system. |
| 15 | + |
| 16 | +### `IOrderAPI.GetOrderList` |
| 17 | +This method is used for querying a list of orders which are created or modified after the the `startDate`. |
| 18 | +`vatRateRegular` and `vatRateReduced` are the default vat rates of the client. You can use this for calculating the tax amount |
| 19 | +if the API doesn't provide this information. |
| 20 | +You also need those to specify the `Order.TaxRateRegular`, `Order.TaxRateReduced` and `OrderItem.TaxIndex`. |
| 21 | + |
| 22 | +Possible values for the tax index: |
| 23 | +- 0 = No vat applicable |
| 24 | +- 1 = Regular vat |
| 25 | +- 2 = Reduced vat. |
| 26 | + |
| 27 | +`totalNumberOfOrders` and `totalNumberOfPages`: This parameters are used for pagination. Set them to the corresponding values. |
| 28 | + |
| 29 | +### `IOrderAPI.DeserializeAccessToken` and `IOrderAPI.SerializeAccessToken` |
| 30 | +`IOrderAPI.DeserializeAccessToken` is called by the client before `IOrderAPI.GetOrderList`. |
| 31 | +Use this to setup your implementation for any api related authorization. |
| 32 | + |
| 33 | +`IOrderAPI.SerializeAccessToken` is called by the client for storing the access token in a persistent storage. |
| 34 | + |
| 35 | +## How to start |
| 36 | +1. Download the source of this repository |
| 37 | + ```bash |
| 38 | + $ git clone https://github.com/billbeeio/order-api-implementation-test.git |
| 39 | + $ cd order-api-implementation-test |
| 40 | + $ git remote remove origin |
| 41 | + $ git checkout -b my-implementation |
| 42 | + ``` |
| 43 | +2. Create a implementation class `{NameOfTheImplementation}Api` inside the [`Billbee.MinimalOrderApi.Implementation`](./MinimalOrderApi/Implementation) namespace. |
| 44 | +3. Edit the [Program.cs](./MinimalOrderApi/Program.cs) and set the variables: |
| 45 | + ```C# |
| 46 | + IOrderAPI api = null; // Your implementation |
| 47 | + string accessToken = null; // Your access token |
| 48 | + ``` |
| 49 | +4. Add the logic to your implementation. |
| 50 | +5. Run the console application to test your implementation. |
| 51 | + |
| 52 | +### HTTP Interaction |
| 53 | +To interact with a HTTP service, your implementation can derive from the [RestClientBaseClass](./MinimalOrderApi/RestClientBaseClass.cs). |
| 54 | + |
| 55 | +## Submit your solution |
| 56 | +1. Commit your changes using `git commit` |
| 57 | +2. Create a zip of the changed files using the following command in the git bash: |
| 58 | + ```bash |
| 59 | + $ git archive --format=zip HEAD `git diff master HEAD --name-only` > `git branch --show-current`.zip |
| 60 | + ```` |
| 61 | +3. Send the generated zip file (named as `{BranchName}.zip`) attached to a mail to your contact at Billbee. |
0 commit comments