Digital Invoice Fragment
When you use the Component API the DigitalInvoiceFragment
displays the line items extracted from an invoice document and their total price. The user can deselect line items which should not be paid for and also edit the quantity, price or description of each line item. The total price is always updated to include only the selected line items.
The returned extractions in the DigitalInvoiceFragmentListener.onPayInvoice() are updated to include the user's midifications:
"amountToPay" is updated to contain the sum of the selected line items' prices,
the line items are updated according to the user's modifications.
Before showing the DigitalInvoiceFragment
you should validate the compound extractions using the LineItemsValidator. These extractions are returned in the AnalysisFragmentListener.onExtractionsAvailable() listener method.
Include the DigitalInvoiceFragment
into your layout by using the DigitalInvoiceFragment.createInstance() factory method to create an instance and display it using the androidx.fragment.app.FragmentManager.
A DigitalInvoiceFragmentListener instance must be available before the DigitalInvoiceFragment
is attached to an Activity. Failing to do so will throw an exception. The listener instance can be provided either implicitly by making the hosting Activity implement the DigitalInvoiceFragmentListener interface or explicitly by setting the listener using DigitalInvoiceFragment.listener.
Your Activity is automatically set as the listener in DigitalInvoiceFragment.onCreate().
Customizing the Digital Invoice Screen
See the DigitalInvoiceActivity for details.