Merge pull request #189 from getAlby/fix/amt-validations

Fix/amt-validations
This commit is contained in:
kiwiidb
2022-06-10 10:23:07 +02:00
committed by GitHub
2 changed files with 2 additions and 2 deletions

View File

@@ -61,7 +61,7 @@ func AddInvoice(c echo.Context, svc *service.LndhubService, userID int64) error
}
amount, err := svc.ParseInt(body.Amount)
if err != nil {
if err != nil || amount < 0 {
return c.JSON(http.StatusBadRequest, responses.BadArgumentsError)
}
c.Logger().Infof("Adding invoice: user_id:%v memo:%s value:%v description_hash:%s", userID, body.Memo, amount, body.DescriptionHash)

View File

@@ -24,7 +24,7 @@ func NewKeySendController(svc *service.LndhubService) *KeySendController {
}
type KeySendRequestBody struct {
Amount int64 `json:"amount" validate:"required"`
Amount int64 `json:"amount" validate:"required,gt=0"`
Destination string `json:"destination" validate:"required"`
Memo string `json:"memo" validate:"omitempty"`
CustomRecords map[string]string `json:"customRecords" validate:"omitempty"`