The pharma-ecommerce-backend requires the configuration of some environment variables alongside the configuration of some support CRUD collections in the Mia-Platform Console.
The pharma-ecommerce-backend microservice can be configured using the following environment variables. Please note that such configuration applies to all current supported and possible supported providers.
|Comma separated values containing the pharma e-commerce supported providers, such as
|The name of the microservice dedicated to CRUDs operations
|The name of the header containing the logged user id used to identify different users. It enables to perform operations on their resources such as adding or deleting items to their shopping carts
|The CRUD endpoint that stores the users' personal data required for processing the pharma e-commerce purchases
|The CRUD endpoint that stores the pharma e-commerce orders made by registered users
|Max number of iterations allowed for the creation of a random order
customOrderId saved alongside other order information in the MIA_ORDERS_CRUD_ENDPOINT CRUD
|The name of your project microservice that will be used to handle drug prescriptions
|The endpoint of your prescription-manager-service that allows the download of a PDF of a prescription
|The endpoint of your prescription-manager-service that allows the retrieval of a previously stored prescription that will be used to create a new shopping cart with the same items
Currently, the Pharma Ecommerce Backend supports only
pharmaPrime as providers and thus must be included in the ACTIVE_PROVIDERS environment variable.
More details about the prescription-manager required interface are detailed in the following section. This microservice is completely optional and required only if the
GET /cart endpoint is called with the
prescriptionId query parameter and the
POST /cart/products body contains the
Further environment variables are required for specific providers.
|Base path of the
pharmaPrime provider APIs
|The partner token released from Pharma Prime required for authenticated API calls to the provider endpoints
|The language code used by the pharma e-commerce provider to fetch items or single items in a specific language
|The user default location latitude that is used to retrieve available products from the e-commerce
|The user default location longitude that is used to retrieve available products from the e-commerce
To obtain a PHARMAPRIME_PARTNER_TOKEN and a PHARMAPRIME_BASE_PATH you can contact Pharma Prime support.
The DEFAULT_LATITUDE and DEFAULT_LONGITUDE points to Piazza della Repubblica, Rome.
The microservice requires the following CRUD collections to store user's information and placed order to a specific provider.
Users CRUD collection
The Pharma Ecommerce Backend requires a CRUD containing the users. The collection can have any name you want, as long as you specify
the correct endpoint name in the
MIA_USERS_CRUD_ENDPOINT environment variable.
The users' collection needs the following service-specific fields:
- email (required) -
string: the user's email;
- authUserId -
string: the auth service user id associated to a specific user;
- firstName (required) -
string: the user's first name;
- lastName (required) -
string: the user's last name;
- phoneNumber (required) -
string: the user's phone number;
- fiscalCode (required) -
string: the user's fiscal code.
The minimum required properties of this CRUD can be imported downloading this example json file.
Orders CRUD collection
The Pharma Ecommerce Backend requires a CRUD for storing the user's orders made to different providers. This collection can have any name you want, as long as you specify
the correct endpoint name in the
MIA_ORDERS_CRUD_ENDPOINT environment variable.
The orders' collection stores the information of an order placed to a pharma e-commerce provider and needs the following service-specific fields:
- userId (required) -
object id: the user id that is performing the order, it's the
_idfrom the users' CRUD collection;
- provider (required) -
string: the order's provider identifier;
- subtotal -
number: the order cost (without shipping costs);
- shippingCosts -
number: the order's shipping costs;
- status (required) -
string: the order current status;
- customOrderId (required) -
string: an order that is different from the order id given by a pharma e-commerce provider during the creation of an order;
- orderId (required) -
string: this property stores the specific provider order id.
The required properties of this CRUD can be imported downloading this example json file.
Currently, the only supported
An order total cost is computed adding the
subtotal to the
The Prescription Manager is an optional service that works alongside the Pharma Ecommerce Backend and allows the storage and management of medicine prescriptions. In particular, this service allows:
- to re-create a user's shopping cart with the same items of a previously stored prescription;
- to create an order for medicines that require a prescription using an already saved prescription PDF file.
This microservice should have the endpoints specified in the DOWNLOAD_PRESCRIPTION_PDF_ENDPOINT and PRESCRIPTION_ENDPOINT environment variables. We assume the previous default endpoints are used to describe the required endpoints of a prescription manager microservice.
This endpoint should return the PDF file of the prescription, specified by id, as a stream.
This endpoint should return a prescription by id as an array of prescription items ids.
Any other endpoint you need to implement in the prescription-manager for managing the prescriptions creation and other functionalities, such as prescriptions storage and retrieval, is up to you.