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

feat: add created_at to create invoice response #413

Merged
merged 1 commit into from
Sep 5, 2023

Conversation

rolznz
Copy link
Contributor

@rolznz rolznz commented Sep 5, 2023

untested

@rolznz rolznz requested a review from kiwiidb September 5, 2023 12:26
@codecov
Copy link

codecov bot commented Sep 5, 2023

Codecov Report

Merging #413 (3725090) into main (018a1b3) will increase coverage by 0.09%.
The diff coverage is 100.00%.

@@            Coverage Diff             @@
##             main     #413      +/-   ##
==========================================
+ Coverage   59.12%   59.21%   +0.09%     
==========================================
  Files          51       51              
  Lines        3481     3482       +1     
==========================================
+ Hits         2058     2062       +4     
+ Misses       1202     1200       -2     
+ Partials      221      220       -1     
Files Changed Coverage Δ
controllers_v2/invoice.ctrl.go 14.78% <100.00%> (+0.74%) ⬆️

... and 1 file with indirect coverage changes

@kiwiidb kiwiidb merged commit 05824f5 into main Sep 5, 2023
5 checks passed
@kiwiidb kiwiidb deleted the feat/add-created-at-to-create-invoice-response branch September 5, 2023 12:31
@@ -134,6 +134,7 @@ type AddInvoiceResponseBody struct {
PaymentHash string `json:"payment_hash"`
PaymentRequest string `json:"payment_request"`
ExpiresAt time.Time `json:"expires_at"`
CreatedAt time.Time `json:"created_at"`
Copy link
Contributor

Choose a reason for hiding this comment

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

can we return this as timestamp? otherwise we have to deal with timezones?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We cannot change expires_at - it needs to be backward compatible. I think created_at should be consistent here.

We could add 2 new fields for timestamp format. What do you think? @bumi @kiwiidb

Copy link
Contributor Author

Choose a reason for hiding this comment

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

@@ -174,6 +175,7 @@ func (controller *InvoiceController) AddInvoice(c echo.Context) error {
PaymentHash: invoice.RHash,
PaymentRequest: invoice.PaymentRequest,
ExpiresAt: invoice.ExpiresAt.Time,
CreatedAt: invoice.CreatedAt,
Copy link
Contributor

Choose a reason for hiding this comment

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

why is it CreatedAt here but ExpiresAt.Time above?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

expiresAt is nullable, you can create an invoice that does not expire

kiwiidb added a commit that referenced this pull request Sep 7, 2023
…voice-response

feat: add created_at to create invoice response
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.

3 participants