Skip to content

devnetomartins/delivery-center-integration

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

37 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

delivery-center-integration

Visão Geral

O objetivo desse projeto é fazer uma integração com a api da delivery-center, fazendo o conversão dos dados que chegam na requisição para poder atender os requisitos impostos na api da delivery-center.

Stack do projeto

  • ruby 2.7.1
  • roda 3.40.0
  • docker
  • mongodb
    Foi utilizado o framework roda(https://roda.jeremyevans.net/) para implementar o protocolo http.
    A principal funcionalidade desse framework é contruir as rotas usando estrutura de dados árvore.

Modelagem dos dados

Segue abaixo a modelagem do banco de dados:

Subindo o Servidor

  • Para inciar o servidor basta executar o comando abaixo:
  docker-compose build
  docker-compose up

Executando Testes

  • Para executar os testes do projeto:
  docker-compose run --rm api bundle exec rspec .

Testando a api

  • Para testar a api basta rodar esse seguinte comando:
  curl --location --request POST 'http://localhost:9292/api/v1/orders/parse_order' \
--header 'Content-Type: application/json' \
--data-raw '{
"id": 9987071,
"store_id": 282,
"date_created": "2019-06-24T16:45:32.000-04:00",
"date_closed": "2019-06-24T16:45:35.000-04:00",
"last_updated": "2019-06-25T13:26:49.000-04:00",
"total_amount": 49.9,
"total_shipping": 5.14,
"total_amount_with_shipping": 55.04,
"paid_amount": 55.04,
"expiration_date": "2019-07-22T16:45:35.000-04:00",
"order_items": [
  {
    "item": {
      "id": "IT4801901403",
      "title": "Produto de Testes"
    },
    "quantity": 1,
    "unit_price": 49.9,
    "full_unit_price": 49.9
  }
],
"payments": [
  {
    "id": 12312313,
    "order_id": 9987071,
    "payer_id": 414138,
    "installments": 1,
    "payment_type": "credit_card",
    "status": "paid",
    "transaction_amount": 49.9,
    "taxes_amount": 0,
    "shipping_cost": 5.14,
    "total_paid_amount": 55.04,
    "installment_amount": 55.04,
    "date_approved": "2019-06-24T16:45:35.000-04:00",
    "date_created": "2019-06-24T16:45:33.000-04:00"
  }
],
"shipping": {
  "id": 43444211797,
  "shipment_type": "shipping",
  "date_created": "2019-06-24T16:45:33.000-04:00",
  "receiver_address": {
    "id": 1051695306,
    "address_line": "Rua Fake de Testes 3454",
    "street_name": "Rua Fake de Testes",
    "street_number": "3454",
    "comment": "teste",
    "zip_code": "85045020",
    "city": {
      "name": "Cidade de Testes"
    },
    "state": {
      "name": "São Paulo"
    },
    "country": {
      "id": "BR",
      "name": "Brasil"
    },
    "neighborhood": {
      "id": null,
      "name": "Vila de Testes"
    },
    "latitude": -23.629037,
    "longitude": -46.712689,
    "receiver_phone": "41999999999"
  }
},
"status": "paid",
"buyer": {
  "id": 136226073,
  "nickname": "JOHN DOE",
  "email": "[email protected]",
  "phone": {
    "area_code": 41,
    "number": "999999999"
  },
  "first_name": "John",
  "last_name": "Doe",
  "billing_info": {
    "doc_type": "CPF",
    "doc_number": "09487965477"
  }
}
}'

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages