Coder Social home page Coder Social logo

scheduled-payment's Introduction

scheduled-payment

Descrição

A empresa X é especializada em soluções digitais de pagamento. Sabendo disso, o desafio consiste em implementar um serviço de pagamento agendando.

Regras de negócios

  • Quando um agendamento é enviado deve ser registrado como pending e retornado o id;
  • O usuário deve conseguir consultar o status do agendamento pending | paid;
  • Se o pagamento ainda não foi realizado o usuário poderá:
    • Excluir o agendamento;
    • Atualizar a data/hora do agendamento ou status;

Estrutura do agendamento:

{
  "id": "27a61386-ae2e-40d2-b4f9-d7c58d9fc6e7",
  "amount": 1000,
  "payment_date": "2021-10-10T10:00:00",
  "status": "pending",
  "created_at": "2024-02-26T00:51:36.401Z",
  "updated_at": "2024-02-26T00:51:36.401Z"
}

o id deve ser um UUID v4, o amount é o valor do pagamento, em centavos, o payment_date é a data e hora do agendamento e o status pode ser pending ou paid, por padrão o status é pending.

Rotas e Responses

a documentação pode ser acessada em http://localhost:3333/docs

/payment/schedule - POST

{
  "amount": 1000,
  "payment_date": "2021-10-10T10:00:00"
}
{
  "id": "27a61386-ae2e-40d2-b4f9-d7c58d9fc6e7"
}

/payment/schedule/:id - GET

{
  "id": "27a61386-ae2e-40d2-b4f9-d7c58d9fc6e7",
  "amount": 1000,
  "payment_date": "2021-10-10T10:00:00",
  "status": "pending",
  "created_at": "2024-02-26T00:51:36.401Z",
  "updated_at": "2024-02-26T00:51:36.401Z"
}

/payment/schedule/:id - DELETE

{
  "message": "Agendamento excluído com sucesso",
  "id": "27a61386-ae2e-40d2-b4f9-d7c58d9fc6e7"
}

/payment/schedule/:id - PATCH

{
  "payment_date": "2021-10-10T10:00:00"
}
{
  "message": "Agendamento atualizado com sucesso",
  "id": "27a61386-ae2e-40d2-b4f9-d7c58d9fc6e7"
}

scheduled-payment's People

Contributors

meiazero 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.