Coder Social home page Coder Social logo

origin-payment-svc's Introduction

Origin Payment Service

Provides functionality to save payment

Request

The following is a sample JSON request:

{
    "referenceNumber": <<reference number>>,
    "bsb": <<bsb>>,
    "accountNumber": <<account number>>,
    "amount": <<amount>>
}

Response

Status : 201 Created

{
    "message": "success"
}

Error

Error object representing error response sent to the API call

{
    "code": <<error code>>,
    "message": <<error message>>,
    "timestamp": <<timestamp>>
}
400 Bad Request: Invalid BSB
{
    "code": "102",
    "message": "BSB number is invalid! ",
    "timestamp": "2022-02-07T14:33:30.110527"
}
400 Bad Request: Invalid reference number
{
    "code": "102",
    "message": "Reference number format is invalid!",
    "timestamp": "2022-02-07T14:39:07.894066"
}
400 Bad Request: Invalid account number
{
    "code": "102",
    "message": "Account number is invalid!",
    "timestamp": "2022-02-07T14:39:40.086030"
}
400 Bad Request: amount < $00.01
{
    "code": "102",
    "message": "Amount value cannot be less than $0.01! ",
    "timestamp": "2022-02-07T14:40:31.634341"
}
400 Bad Request: amount > $2000.00
{
    "code": "102",
    "message": "Amount cannot be more than $2000.00!",
    "timestamp": "2022-02-07T14:41:11.862112"
}
403 Forbidden: accessing outside of allowed time
{
    "code": "104",
    "message": "Payments are only allowed between 09:00 and 17:00, Monday to Thursday, or between 08:00 and 18:00 on Fridays.",
    "timestamp": "2022-02-07T14:44:46.298106"
}
500 Internal Server Error: any other exception
{
    "code": "103",
    "message": null,
    "timestamp": "2022-02-07T15:12:29.841901"
}

Prerequisite

  • maven
  • Java 11

Installation

Run the following command:

mvn clean install

Usage

Run the following command to start the application

mvn spring-boot:run

Using Postman and access the application using the url http://localhost:8080/payment.
Select the method as POST
Select body as raw and JSON
Following is a valid request:

{
    "referenceNumber": "12345",
    "bsb": 123457,
    "accountNumber": 123456,
    "amount": "1900.01"
}

Author

๐Ÿ‘ค Peppa Pig

License

This project is MIT licensed.

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.