I made a state diagram for the Purchase object (parent) and for the Item object (child), as you can see below. One of my doubts is how to represent the integration between parent/child objects in the state diagram.
The system flow is the following: Purchase object has an ArrayList to keep Item objects. Purchase is created first, then Item is created and added into the ItemArrayList as much as needed. F4 is pressed in order to open the Payment screen; the same happens to the Finisher object: it is added to the FinisherArrayList till [amountPayable = 0] guard returns True. while guard is False, I can close the Payment screen and return to the Purchase screen in order to add/remove items. After Purchase beeing saved in the table, it will loop ItemArrayList and save Item by Item in the table. If, for some reason, one of the Items fail to save in the table, the whole Purchase will be deleted.
Just to explain that this POS system will not have refund option for this moment.
state diagram for Purchase object:
state diagram for Item object:
Thanks in advance.