update formatting

This commit is contained in:
Peter Rounce 2023-02-19 17:19:28 +00:00
parent 54f1274fa6
commit 0170019fee

View file

@ -9,24 +9,24 @@ import (
decodepay "github.com/fiatjaf/ln-decodepay" decodepay "github.com/fiatjaf/ln-decodepay"
log "github.com/sirupsen/logrus" log "github.com/sirupsen/logrus"
"io" "io"
"strings"
"net/http" "net/http"
"strconv" "strconv"
"strings"
) )
type LndhubAuthRequest struct { type LndhubAuthRequest struct {
Login string `json:"login"` Login string `json:"login"`
Password string `json:"password"` Password string `json:"password"`
} }
type LndhubAuthResponse struct { type LndhubAuthResponse struct {
RefreshToken string `json:"refresh_token"` RefreshToken string `json:"refresh_token"`
AccessToken string `json:"access_token"` AccessToken string `json:"access_token"`
} }
type LndhubPayInvoiceRequest struct { type LndhubPayInvoiceRequest struct {
Invoice string `json:"invoice"` Invoice string `json:"invoice"`
FreeAmount string `json:"freeamount"` FreeAmount string `json:"freeamount"`
} }
func lndhub_payment(w http.ResponseWriter, p *db.Payment, bolt11 decodepay.Bolt11, param_pr string) { func lndhub_payment(w http.ResponseWriter, p *db.Payment, bolt11 decodepay.Bolt11, param_pr string) {
@ -124,7 +124,7 @@ func lndhub_payment(w http.ResponseWriter, p *db.Payment, bolt11 decodepay.Bolt1
req.Header.Add("Access-Control-Allow-Origin", "*") req.Header.Add("Access-Control-Allow-Origin", "*")
req.Header.Add("Content-Type", "application/json") req.Header.Add("Content-Type", "application/json")
req.Header.Add("Authorization", "Bearer " + auth_keys.AccessToken) req.Header.Add("Authorization", "Bearer "+auth_keys.AccessToken)
res2, err := client.Do(req) res2, err := client.Do(req)
if err != nil { if err != nil {
@ -144,14 +144,14 @@ func lndhub_payment(w http.ResponseWriter, p *db.Payment, bolt11 decodepay.Bolt1
log.Info(string(b2)) log.Info(string(b2))
// var auth_keys LndhubAuthResponse // var auth_keys LndhubAuthResponse
// err = json.Unmarshal([]byte(b), &auth_keys) // err = json.Unmarshal([]byte(b), &auth_keys)
// if err != nil { // if err != nil {
// log.WithFields(log.Fields{"card_payment_id": p.Card_payment_id}).Warn(err) // log.WithFields(log.Fields{"card_payment_id": p.Card_payment_id}).Warn(err)
// resp_err.Write(w) // resp_err.Write(w)
// return // return
// } // }
} }