Skip to content

imforster/recycle

Repository files navigation

Go Account API Server to support managing recycling transactions

Service to support recycling machine

Prerequiste

Overview

The server stub was generated by the [openapi-generator] (https://openapi-generator.tech) project. By using the OpenAPI-Spec from a remote server, you can easily generate a server stub.

To see how to make this your own, look here:

README

  • API version: 1.0.0
  • Build date: 2023-07-02T22:23:09.725236-07:00[America/Vancouver]

Design assumptions

  • Authorization Gateway will add xCubeId to ensure that requests are valid.
  • Added concept of accountId to customer to support a customer having mutiple accounts in future

Running the server

To run the server, follow these simple steps:

go mod download
go build -o app
./app &

Testing requests for the server

Deposit an item example request

curl --location 'http://localhost:8080/customers/0/accounts/0/deposits' \
--header 'xCubeId: 12345' \
--header 'Content-Type: application/json' \
--data '{
  "cubeId": "12345",
  "customerId": "0",
  "itemSize": "small",
  "dateTime": "2023-07-05T17:32:28Z"
}'

Retrieve all deposits by customer and account id

curl --location 'http://localhost:8080/customers/0/accounts/0/deposits' \
--header 'xCubeId: 12345' \
--header 'Accept: application/json'

Retrieve a customer account balance

curl --location 'http://localhost:8080/customers/0/accounts/0/balances' \
--header 'xCubeId: 12345'

Transfer a customer account balance to Paypal or similar service

curl --location 'http://localhost:8080/customers/0/accounts/0/transfers' \
--header 'xCubeId: 12345' \
--header 'Content-Type: application/json' \
--data '{
  "itemSize": "small",
  "dateTime": "<dateTime>"
}'

Known Issue

TBA

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages