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

#337 feat(orders): add order expiration time to list orders response #412

Merged

Conversation

LuloDev
Copy link
Contributor

@LuloDev LuloDev commented Aug 1, 2023

#337
The getTimeToExpirationOrder function works as follows:

  • It takes the creation date of the order from the order object and calculates the expiration time by adding the specified ORDER_PUBLISHED_EXPIRATION_WINDOW value to the creation date.
  • It then calculates the difference between the current date and the expiration date to find the total remaining seconds.
  • Using this total remaining time, it calculates the number of hours and minutes remaining and constructs a string in the desired format.
  • The function takes an order object and i18n context as inputs and returns a string representing the remaining time in the format "X hours Y minute

Example result:

Id      : 64c583074669a3af45b783d0
Status  : PENDING
Time rem: 0 horas 0 minutos
Sats amt: 10000
Fiat amt: 1000
Fiat    : COP
Channel : @test_channel_4534534
_________________________________

Id      : 64c8fcd945aff3bb8395eaa6
Status  : PENDING
Time rem: 0 horas 2 minutos
Sats amt: 0
Fiat amt: 20000
Fiat    : COP
Channel : @test_channel_4534534
_________________________________
Id      : 64c905112631c9039d53eb1d
Status  : PENDING
Time rem: 22 horas 58 minutos
Sats amt: 0
Fiat amt: 321321
Fiat    : COP
Channel : @test_channel_4534534
_________________________________

Id      : 64c9053c2631c9039d53eb2c
Status  : PENDING
Time rem: 22 horas 59 minutos
Sats amt: 0
Fiat amt: 100
Fiat    : USD
Channel : @test_channel_4534534
_________________________________

@LuloDev LuloDev force-pushed the issue_337-order-remaining-time-listorders branch 3 times, most recently from 523c4bb to 1b2486d Compare August 1, 2023 14:39
Signed-off-by: Juan Diego Molina <[email protected]>
Signed-off-by: Juan Diego Molina <[email protected]>
Signed-off-by: Juan Diego Molina <[email protected]>
Signed-off-by: Juan Diego Molina <[email protected]>
@LuloDev LuloDev force-pushed the issue_337-order-remaining-time-listorders branch from 1b2486d to 2af9699 Compare August 1, 2023 14:44
@LuloDev LuloDev changed the title feat(orders): add order expiration time to list orders response #337 feat(orders): add order expiration time to list orders response Aug 1, 2023
Copy link
Member

@grunch grunch left a comment

Choose a reason for hiding this comment

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

LGTM! thanks for this contribution 🚀

@grunch grunch merged commit 40498c5 into lnp2pBot:main Aug 7, 2023
3 checks passed
dolchi21 pushed a commit to dolchi21/p2plnbot that referenced this pull request Sep 3, 2023
…esponse (lnp2pBot#412)

* feat(orders): add order expiration time to list orders response
* feat(util): add getTimeToExpirationOrder function
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