Merge pull request #52 from boltcard/lndhub-check-limit
Lndhub check limit
This commit is contained in:
commit
e249324e64
1 changed files with 20 additions and 0 deletions
|
|
@ -38,6 +38,18 @@ func lndhub_payment(w http.ResponseWriter, p *db.Payment, bolt11 decodepay.Bolt1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// check amount limits
|
||||||
|
invoice_sats := int(bolt11.MSatoshi / 1000)
|
||||||
|
|
||||||
|
//check the tx limit
|
||||||
|
if invoice_sats > c.Tx_limit_sats {
|
||||||
|
log.WithFields(log.Fields{"card_payment_id": p.Card_payment_id}).Info("invoice_sats: ", invoice_sats)
|
||||||
|
log.WithFields(log.Fields{"card_payment_id": p.Card_payment_id}).Info("tx_limit_sats: ", c.Tx_limit_sats)
|
||||||
|
log.WithFields(log.Fields{"card_payment_id": p.Card_payment_id}).Info("over tx_limit_sats!")
|
||||||
|
resp_err.Write(w)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
//lndhub.auth API call
|
//lndhub.auth API call
|
||||||
//the login JSON is held in the Card_name field
|
//the login JSON is held in the Card_name field
|
||||||
// as "login:password"
|
// as "login:password"
|
||||||
|
|
@ -98,6 +110,14 @@ func lndhub_payment(w http.ResponseWriter, p *db.Payment, bolt11 decodepay.Bolt1
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// update paid_flag so we only attempt payment once
|
||||||
|
err = db.Update_payment_paid(p.Card_payment_id)
|
||||||
|
if err != nil {
|
||||||
|
log.WithFields(log.Fields{"card_payment_id": p.Card_payment_id}).Warn(err)
|
||||||
|
resp_err.Write(w)
|
||||||
|
return
|
||||||
|
}
|
||||||
|
|
||||||
// https://github.com/fiatjaf/lnurl-rfc/blob/luds/03.md
|
// https://github.com/fiatjaf/lnurl-rfc/blob/luds/03.md
|
||||||
//
|
//
|
||||||
// LN SERVICE sends a {"status": "OK"} or
|
// LN SERVICE sends a {"status": "OK"} or
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue