Invoices
Description
The bucket exists for the purpose of storing receipts for checkouts that are contain the same information that we show after the checkout to a partners.
Upload
The process of uploading the receipts contains two steps:
- After FE call the endpoint
POST /api/v1/venues/5/checkouts.jsonthat is responsible for creation of new checkout (Api::V1::CheckoutsController#create) we callCash::Checkouts::CreateInteractorthat calls::Checkouts::CreateService. In this service we have a method#_set_pdf_paththat is calling aftercheckoutcreation. The method is responsible for creation of the unique PDF file name that will be used for further operations. The file name is a full public url or the future file in the S3 bucket and looks likehttps://<bucket name>.s3.eu-central-1.amazonaws.com/s/checkout-<id of checkout>-<date of creation>-<unique hash>.pdf. The file name is saved in the columnpdf_pathof the checkout. - After the checkout is created FE calls
PUT /api/v1/venues/<venue id>/checkouts/<checkout id>/preview.json(Api::V1::CheckoutsController#update_preview) we callCheckoutReceiptPdf.generate_and_attach!for the checkout. It generates the same file name that we already have in the checkout and uploads the file that BE generates by parameters that received from FE. These parameters are saved in the checkout's columnpreview
Download
To download the receipt you need to call the endpoint GET /api/v1/venues/<venue id>/checkouts/<checkout id>/preview_pdf_download
(Api::V1::CheckoutsController#preview_pdf_download) that returns the JSON object with the link to
the file. In this case we returning the full public url of the file
Bucket name in different environments
development-be-devenvs-billing-registryproduction-invoices.uala.it- for all countries