This is a sample API a bank might use for tracking that status of invoices used for factoring
ruby 3.2.2 rails 7.0.4.3 sqlite3 3.39.5
Installation instructions may be found here: https://guides.rubyonrails.org/getting_started.html#creating-a-new-rails-project-installing-rails
rake db:migrate
bin/rails test
bin/rails server
curl --request GET
--url http://localhost:3000/invoices
--header 'Content-Type: application/json'
Should return []
curl --request POST
--url http://localhost:3000/borrowers
--header 'Content-Type: application/json'
--data '{"borrower": { "name": "ACME Bank" }}'
curl --request POST
--url http://localhost:3000/fees
--header 'Content-Type: application/json'
--data '{"fee": { "percentage": 0.02 }}'
curl --request POST
--url http://localhost:3000/invoices
--header 'Content-Type: application/json'
--data '{
"borrower_id": 1,
"fee_id": 1,
"invoice_number": "ABC123",
"amount": 200.0,
"due_date": "2023-04-28 12:41:12",
"status": "created",
"scan": "iVBORw0KGgoAAAANSUhEUgAAAAUAAAAFCAYAAACNbyblAAAAHElEQVQI12P4//8/w38GIAXDIBKE0DHxgljNBAAO9TXL0Y4OHwAAAABJRU5ErkJggg=="
}'
curl --request PUT
--url http://localhost:3000/invoices/1
--header 'Content-Type: application/json'
--data '{ "id": 1, "status": "approved" }'
curl --request PUT
--url http://localhost:3000/invoices/1
--header 'Content-Type: application/json'
--data '{ "id": 1, "status": "purchased" }'
curl --request PUT
--url http://localhost:3000/invoices/1
--header 'Content-Type: application/json'
--data '{ "id": 1, "status": "closed" }'
curl --request GET
--url http://localhost:3000/invoices
--header 'Content-Type: application/json'