mirror of
https://github.com/getAlby/lndhub.go.git
synced 2025-12-24 08:05:02 +01:00
refactor balance check
This commit is contained in:
@@ -82,7 +82,7 @@ func (controller *KeySendController) KeySend(c echo.Context) error {
|
||||
})
|
||||
}
|
||||
|
||||
ok, err := controller.svc.BalanceCheck(c.Request().Context(), lnPayReq, userID)
|
||||
resp, err := controller.svc.CheckPaymentAllowed(c.Request().Context(), lnPayReq, userID)
|
||||
if err != nil {
|
||||
c.Logger().Errorj(
|
||||
log.JSON{
|
||||
@@ -93,7 +93,7 @@ func (controller *KeySendController) KeySend(c echo.Context) error {
|
||||
)
|
||||
return c.JSON(http.StatusBadRequest, responses.BadArgumentsError)
|
||||
}
|
||||
if !ok {
|
||||
if resp != nil {
|
||||
c.Logger().Errorf("User does not have enough balance user_id:%v amount:%v", userID, lnPayReq.PayReq.NumSatoshis)
|
||||
return c.JSON(http.StatusBadRequest, responses.NotEnoughBalanceError)
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user