mirror of
https://github.com/getAlby/lndhub.go.git
synced 2026-01-04 05:25:35 +01:00
refactor balance check
This commit is contained in:
@@ -97,7 +97,7 @@ func (controller *PayInvoiceController) PayInvoice(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{
|
||||
@@ -108,7 +108,7 @@ func (controller *PayInvoiceController) PayInvoice(c echo.Context) error {
|
||||
)
|
||||
return c.JSON(http.StatusBadRequest, responses.GeneralServerError)
|
||||
}
|
||||
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