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
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions controllers_v2/invoice.ctrl.go
Original file line number Diff line number Diff line change
Expand Up @@ -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.

}

// AddInvoice godoc
Expand Down Expand Up @@ -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

}

return c.JSON(http.StatusOK, &responseBody)
Expand Down
Loading