billing-company-product
Description
This bucket is used to store temporarily CSV files imported by the Admin at ActiveAdmin’s Billings > Global Billing Company Products page. This file is later on processed by a service, which will parse and import the products contained in the CSV files.
File lifecycles
-
uala-admin/app/admin/billing_company_product.rbThis ActiveAdmin class is responsible for uploading the CSV file to S3 buckets and triggering the ImportBillingCompanyProductsJob. This job is tasked with downloading the CSV from S3 and processing it by parsing the file. -
uala-main/app/main_jobs/import_billing_company_products_job.rbThis job triggers the import service (BillingCompanyProducts::ImportService). It also monitors for any potential errors and handles the enqueueing of notification emails, which are sent just after the import service completes. -
uala-main/app/services/billing_company_products/import_service.rbThis service manages the download of the file, reads and parses it, and stores the parsed products (BillingProduct) in the database. -
uala-main/app/services/notifications/email_service.rbThis is a generic class responsible for processing notification emails.
listing-registry
Description
The bucket exists for the purpose of storing products and product images to be imported through ActiveAdmin UI.
File lifecycles
-
uala-admin/app/admin/warehouse/product.rbuses it to store CSVs uploaded by ActiveAdmin users in order to import warehouse products images, enqueuing aWarehouse::CsvImageImportJobjob that callsWarehouse::CsvImageImportService, which downloads the CSV file usingWarehouse::FileLoaderService, that is a basically a simple HTTP URL downloader, it isn't related to S3. -
uala-admin/app/admin/warehouse/manufacturer.rbuses it to store CSVs uploaded by ActiveAdmin users in order to import products by manufacturer, enqueuing aImportProductsJob, which callsListingImporterwhich downloads the file straight away usingFile.open(Uri.parse(@csv_file_path)). After that,ImportProductsJobsends the link of the file uploaded via S3 to the ActiveAdmin user who started the product import as summary.
order-recaps
Description
This bucket is used for holding Order Recap Excel file (.xlsx) while sending Order Recap email
Names in different environments
- Production:
order-recaps - development:
be-devenvs-order-recaps
Usage
uala-main/app/jobs/notify_order_job.rb
uala-main/app/jobs/notify_order_job.rb
-
triggered in
uala-main/app/controllers/api/v1/orders_controller.rbcreateupdate
-
both trigger
uala-main/app/jobs/notify_order_job -
uala-main/app/jobs/notify_order_job.rbOrders::GenerateRecapSpreadsheetServiceto generate a spreadsheet#_upload_to_aws, to upload it to AWS S3- saves the file url in table
Order.recap_spreadsheet Notifications::EmailService#anonymous_notify_order_recapto send an email to
-
Notifications::EmailService#anonymous_notify_order_recap- email is sent to both
VenueandSupplier
- email is sent to both
admin-alert-files
Description
This bucket is used for holding AA import report (success) or alert (failure) TXT files
Names in different environments
- Production:
admin-alert-files - development:
be-devenvs-admin-alert-files
Usage
uala-main/app/jobs/import_customers_job.rbuala-main/app/jobs/import_products_job.rb
uala-main/app/jobs/import_customers_job.rb
- triggered in
uala-admin/app/admin/customer.rb#import_customers
- calls
uala-main/app/jobs/import_customers_job.rb - in
uala-main/app/jobs/import_customers_job.rb
- calls
Customers::ImportCustomersService.runto import customers- success: email to AA user with no files
- failure: it generates a TXT file contains all errors occur during importing
- calls
#_upload_to_awsto upload the TXT file to AWS S3
- calls
- calls
Notifications::EmailService#admin_alertto send email to AA user
uala-main/app/jobs/import_products_job.rb
- triggered in
uala-admin/app/admin/warehouse/manufacturer.rb
#import_products
- calls
uala-main/app/jobs/import_products_job.rb - in
uala-main/app/jobs/import_products_job.rb- calls
ListingImporter.importto import products- it calls
#_bucket_file_linkto upload that TXT file to AWS S3, the TXT file content is different based on:- success: TXT file contains import results
- failure: TXT file contains import errors
- it calls
- calls
- calls
Notifications::EmailService#admin_alertto send email to AA user
Notes and comments
- seems generating these TXT files is a bit redundant
- we can just send out emails with all info we needed, unless:
- we need to keep it somewhere for record (Datadog Logs might be a better place?)
- sharing it with others
- we can just send out emails with all info we needed, unless:
invoice.uala.it
Description
The bucket exists for the purpose of storing different types of PDF documents. Such as:
- receipts for checkouts
- URL stores in
Checkout#pdf_path - generation flow
- folder name
s
- URL stores in
- appointments daily recaps
- generates by
Api::V1::AppointmentsController#daily_recap - folder name
appointments_daily_recaps
- generates by
- billing company invoices internal docs
- URL stores in
BillingCompanyInvoice#pdf_path - generates by
BillingCompanyInvoice#generate_pdf - folder name
companys
- URL stores in
- billing company invoices external docs
- URL stores in
BillingCompanyInvoice#external_doc - generates by
BillingCompanyInvoice#generate_pdf - folder name
companys
- URL stores in
- billing company transfers
- URL stores in
BillingCompanyTransfer#pdf_path - generates by
BillingCompanyTransfer#dispose! - folder name
companys
- URL stores in
- marketing promotions documents with promotion codes
- URL stores in
MarketingPromotion#pdf_path - generates by
MarketingPromotion#generate_missing_pdf! - folder name
promotions
- URL stores in
- treatments presents
- URL stores in
TreatmentPresent#pdf_path) - generates by
TreatmentsPresent#generate_missing_pdf! - folder name
presents
- URL stores in
- venue acceptance forms
- URL stores in
VenueAcceptanceForm#pdf_path - generates by
VenueAcceptanceForm#generate_pdf - folder name
acceptances
- URL stores in
- billing company payment summaries
- URL stores in
BillingCompanyPaymentSummary#pdf_path - generates by
Billing::GenerateBillingCompanyPaymentSummaryJob - folder name
companys
- URL stores in
Checkout receipts flow
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
labels-registry
Description
It shows up in only 1 file: uala-admin/app/admin/treatment.rb#import_labels
It uploads a CSV file provided by Admin users to S3, naming starts with labels-importing,
then involves ImportLabelsJob (uala-main/app/jobs/import_labels_job.rb) > Treatments::ImportTreatmentsService
(uala-main/app/services/treatments/import_treatments_service.rb) to import labels
fiscal-archives
Description
Used by:
-
Venues::PtPos::StoreFiscalArchiveInteractorto storeSAF-Treports for Portuguese venues, the URL of the file is stored in the table fiscal_archives. The URL is sent to FE to download the file directly (Custom exportandFiscal exportin Profile). -
Cash::FiscalTransactionsExportJob, the file is generated only for German venues by the buttonFISCAL TRANSACTION EXPORT(inside theCompany Report / Sales Proceedsof the SaaS), the uploaded CSV file is sent by mail to the venue. -
Fiskaly::DSFinVK::ExportDownloadInteractorandFiskaly::KassenSichV::TSSExportFileRetrieveInteractorfor German venues reports. The file URL is stored in the table fiscal_archives. The file can be downloaded directly from its URL from theFiscal archivesActive Admin page (uala-admin/app/admin/fiscal_archive.rb). The URL is sent to FE to download the file directly (Custom exportin Profile). -
Venues::Nf525::GenerateMonthlyFiscalArchiveInteractorandVenues::Nf525::GenerateYearlyFiscalArchiveInteractorto store French fiscal reports. The file can be downloaded directly from its URL from theFiscal archivesActive Admin page (uala-admin/app/admin/fiscal_archive.rb). The URL is sent to FE to download the file directly (Custom exportin Profile).
Bucket name in different environments
development-be-devenvs-fiscal-archivesproduction-fiscal-archives