data/exchange_rates. This rate is used throughout the platform for multi-currency order amounts, transaction records, and billing calculations.
Rate document structure
Thedata/exchange_rates Firestore document contains:
data/exchange_rates/history.
exchange_rates (automatic)
Scrapes the current USD and EUR exchange rates from the BCV website (http://www.bcv.org.ve) and stores them in Firestore.
Endpoint
Request
What it does
- Fetches and parses the BCV website HTML
- Extracts USD and EUR rates from the page content
- Sets
bs: 1as the bolivar baseline - Writes to
data/exchange_rates(overwrites current rate) - Appends a history entry to
data/exchange_rates/historywithlast_update_type: "automatico"
Response
This function uses
@extractus/article-extractor to parse the BCV site and disables TLS certificate validation (NODE_TLS_REJECT_UNAUTHORIZED=0) for compatibility with the BCV server. Schedule this function via Cloud Scheduler to run daily.exchange_rates_manual
Manually sets the USD and EUR exchange rates in Firestore. Use this when the BCV site is unavailable or rates need to be overridden.
Endpoint
Request
This function reads from
req.body.params (not req.body.data) — the request body uses a params key at the top level.USD to bolivar exchange rate (bolivares per 1 USD).
EUR to bolivar exchange rate (bolivares per 1 EUR).
What it does
- Sets
bs: 1, and uses the providedusdandeurvalues - Writes to
data/exchange_rateswithlast_update_type: "manual" - Appends a history entry to
data/exchange_rates/history
Response
Usage in the platform
All order transactions reference the current exchange rate at the time of purchase:data/exchange_rates to calculate IVA and IGTF taxes in bolivar-equivalent amounts.