GithubHelp home page GithubHelp logo

rewardservice's Introduction

Rewards Program API

This API provides endpoints to manage transactions and calculate reward points for customers in a rewards program.

Base URL

http://localhost:8080

Endpoints

Create Transaction

  • Endpoint: /transactions
  • Method: POST
  • Description: Create a new transaction.
  • Request Body:

{ "customerId": "123456", "amount": 120.0 }

  • Response:

{ "id": "abc123", "customerId": "123456", "amount": 120.0, "timestamp": "2023-05-17T10:30:00Z" }

Get Monthly Rewards

  • Endpoint: /rewards/monthly/{customerId}

  • Method: GET

  • Description: Get the reward points earned by a customer for each month.

  • Path Parameters:

    • customerId: The ID of the customer.
  • Response:

{ "customerId": "123456", "rewards": [ { "month": "2023-05", "points": 90 }, { "month": "2023-04", "points": 150 } ] }

Get Total Rewards

  • Endpoint: /rewards/total/{customerId}

  • Method: GET

  • Description: Get the total reward points earned by a customer.

  • Path Parameters:

    • customerId: The ID of the customer.
  • Response:

{ "customerId": "123456", "totalPoints": 240 }

Error Handling

In case of errors, the API will return an appropriate HTTP status code along with an error message in the response body.

Example Error Response:

{ "status": 400, "message": "Invalid request. Customer ID is required." }

Conclusion

This API allows you to create transactions, retrieve monthly rewards, and calculate total rewards for customers in the rewards program. Use the provided endpoints to interact with the API and manage reward points for customers.

Please refer to the individual endpoint descriptions for more information on the request and response formats.

Note: Replace the base URL (http://localhost:8080) with the appropriate URL of your deployed application.

rewardservice's People

Contributors

ceble avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.