Remove the day limit and add the 'Update_payment_paid' function to lndhub pay function
This commit is contained in:
parent
576356ced0
commit
cb4edfe259
1 changed files with 9 additions and 18 deletions
|
|
@ -41,14 +41,7 @@ func lndhub_payment(w http.ResponseWriter, p *db.Payment, bolt11 decodepay.Bolt1
|
|||
// check amount limits
|
||||
invoice_sats := int(bolt11.MSatoshi / 1000)
|
||||
|
||||
day_total_sats, err := db.Get_card_totals(p.Card_id)
|
||||
if err != nil {
|
||||
log.WithFields(log.Fields{"card_payment_id": p.Card_payment_id}).Warn(err)
|
||||
resp_err.Write(w)
|
||||
return
|
||||
}
|
||||
|
||||
//check the tx limit
|
||||
//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)
|
||||
|
|
@ -57,16 +50,6 @@ func lndhub_payment(w http.ResponseWriter, p *db.Payment, bolt11 decodepay.Bolt1
|
|||
return
|
||||
}
|
||||
|
||||
//check the daily limit
|
||||
if day_total_sats+invoice_sats > c.Day_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("day_total_sats: ", day_total_sats)
|
||||
log.WithFields(log.Fields{"card_payment_id": p.Card_payment_id}).Info("day_limit_sats: ", c.Day_limit_sats)
|
||||
log.WithFields(log.Fields{"card_payment_id": p.Card_payment_id}).Info("over day_limit_sats!")
|
||||
resp_err.Write(w)
|
||||
return
|
||||
}
|
||||
|
||||
//lndhub.auth API call
|
||||
//the login JSON is held in the Card_name field
|
||||
// as "login:password"
|
||||
|
|
@ -127,6 +110,14 @@ func lndhub_payment(w http.ResponseWriter, p *db.Payment, bolt11 decodepay.Bolt1
|
|||
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
|
||||
//
|
||||
// LN SERVICE sends a {"status": "OK"} or
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue