Implement a service to provide customer inquiry and return result, which contains customer detail and its recent payment history. Use best practices and design patterns, skills in design/architecture, ability to build testable and maintainable software.
- Customer ID (Numeric, max 10 digits)
- Email (Valid email format, max 25 digits)
- Customer ID (Numeric, 10 digits)
- Customer Name (Character max 30 chars)
- Contact Email (Max 25 digits)
- Mobile No (Numeric 10 digits)
- List of recent transaction (Up to 5 records)
- Transaction ID (Numeric)
- Transaction Date/Time (DD/MM/YY HH:MM e.g. 31/02/2018 21:34)
- Amount (2 decimal points e.g. 100.00, 1234.56 or 1.99)
- Currency Code (e.g. USD, JPY, THB or SGD)
- Status (Success, Failed or Canceled)
- At least 1 of the inquiry criteria must be provided. Unless return Bad Request with one of the following error message: a. No inquiry criteria b. Invalid Customer ID c. Invalid Email
- If inquiry criteria doesn’t match any record on the database, return result as “Not found”
- The rest of the case is Bad Request with no error message.
- Assume Customer ID and Email are unique to a particular customer.
{
"customerID": 123456
}
{
"email": "user @domain.com"
}
{
"customerID": 123456,
"email": "user @domain.com"
}
{
"customerID": 123456,
"name": "Firstname Lastname",
"email": "user @domain.com",
"mobile": "0123456789",
"transactions": []
}
{
"customerID": 123456,
"name": "Firstname Lastname",
"email": "user @domain.com",
"mobile": "0123456789",
"transactions": [{
"id": 1,
"date": "31/02/2018 21:34",
"amount": "1234.56",
"currency": "USD",
"status": "Success"
}]
}
{
"customerID": 123456,
"name": "Firstname Lastname",
"email": "user @domain.com",
"mobile": "0123456789",
"transactions": [
{
"id": 1,
"date": "31/02/2018 21:34",
"amount": "1234.56",
"currency": "USD",
"status": "Success"
},
{
"id": 2,
"date": "01/11/2018 08:34",
"amount": "0.56",
"currency": "THB",
"status": "Failed"
}]
}
- Web API
- MS SQL Server, please create 2 tables: 1. Customers 2. Transactions
- Entity Framework to retrieve data
24 hours.