Retail:Developers Guide/Deliver Documents
The functional scope for this project is to be able to send documents in different ways (i.e. email or sms) and being able resend those documents.
Front end infrastructure
Message state handling
A new type of Message will be included called ‘deliver_document’. This new message will have a modelName associated and should include the information required to deliver some documents in different ways (email as of now). The message structure is the following:
Some considerations should be taken into account:
- Print documents are excluded from this message (only for documents that should be sent to BO to handle they delivery)
- Only one message of type ‘deliver_document’ will exists in Messages state
- Each document to be delivered will be added to an existing ‘deliver_document’ message or ,in case it does not exists, it will create a new message of this type
- Each document will have the template of the document (only the reference to the template, not the populated XML with data)
- Params object will include all the required model information for templates to be generated
Once the synchronization buffer is launched, a unique consumer will handle the ‘deliver_document’ message. The message handler will: Generate/populate the template with data in an asynchronous way Send a mobile service request to the backoffice to handle the document delivery
The initial idea is to use the same utility function to print a ticket to generate the ‘deliver_document’ message.
As this utility function could affect several flows of the POS application, it is possible that a new utility function must be created to keep backwards compatibility.
In any case, this utility function will receive additionally in the payload the following information:
- deliverAction: This attribute could have four different values:
- print: A new message to print the document is created
- send: The delivery_document message is created/updated to include this document and the “service” to use to send the document
- printAndSend: Executes the combined actions of “Print” and “Send”
- none: No new message is created
- deliverService: Indicates the delivery document model name. This value will be used in BO to generate the proper import entry
- service: The type of data that will handle the deliver of documents
- to: Destination of the document (email address, mobile phone)
Back office infrastructure
Once a message is processed by deliver document endpoint, a new import entry will be generated in BO application
Example of XML deliver document import entry JSON Info
The processor will generate for each delivery document method a single import entry with the documents to deliver.
Organization, Role, and POS Terminal values for new import entries are same as the original OBMOBC_DeliverDocument import entry.
Each module will then handle the delivery option using the import entries created by the OBMOBC_DeliverDocument data import entry processor.