pull down to refresh

I know about async payment (which are not yet developed completely, I've asked before) and that wasn't my question. I specifically asked about partners that trust each other.
So let's paraphrase this. Immagine you owe somebody some sats and when you are both online, he sends you an invoice and you pay it.

What I am basically asking is how hard is it to do this automatically? And by automatically this probbably (i think) means negotiating payment ammount, recording sending node's id, detecting when sending node is online, communicating in some way thet the previously negltiated invoice can be paid (i am not cure whether this can be done through the lightning network, or directly between the two peers using normal tcp or udp connection), and paying the invoice. That's it.