Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Changed status of orders after hold invoice expires #617

Open
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

Anthonyushie
Copy link

Implemented logic to change order status when a hold invoice expires, ensuring automatic updates in order management systems post-expiry.

Let me know if there's any issue :)

Copy link
Member

@Catrya Catrya left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Hi @Anthonyushie , I've already tested it, have you also tested it locally?
It doesn't work. Here are some clarifications that may be useful:

The hold invoice expires if it is not paid before HOLD_INVOICE_CLTV_DELTA. When an order is in status WAITING-PAYMENT the bot ln node generates a hold invoice ("state": "OPEN") that the seller must pay ("state": "ACCEPTED") but the payment is not executed and sats are not charged until the seller confirms that the fiat has arrived, when it does the bot collects the sats from the seller and the hold invoice changes to "state": "SETTLED". The order changes to status PAID_HOLD_INVOICE and the bot ln node tries to pay the buyer's invoice (it is not a hold invoice). However, if the order is cancelled, or the HOLD_INVOICE_CLTV_DELTA time is reached without the bot node having collected the Sats, then the hold invoice will be cancelled ("state": "CANCELED"). In short: when the order has status PAID_HOLD_INVOICE the invoice will not expire because it has already been paid. It could expire in status ACTIVE, or FIAT_SENT.

);

if (order) {
OrderEvents.orderUpdated(order);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

An event should not be published in Nostr with the new order status HOLD_INVOICE_EXPIRED

@Anthonyushie
Copy link
Author

@Catrya
Alright Noted, On it
Would let you know if i have an Issues

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants