Test yookassa callback
This commit is contained in:
@@ -1,7 +1,10 @@
|
|||||||
package payout
|
package payout
|
||||||
|
|
||||||
import (
|
import (
|
||||||
|
"encoding/json"
|
||||||
"errors"
|
"errors"
|
||||||
|
"fmt"
|
||||||
|
"log/slog"
|
||||||
"net/http"
|
"net/http"
|
||||||
"regexp"
|
"regexp"
|
||||||
|
|
||||||
@@ -15,7 +18,7 @@ import (
|
|||||||
)
|
)
|
||||||
|
|
||||||
const (
|
const (
|
||||||
BaseRoute = "/payment"
|
BaseRoute = "/payout"
|
||||||
CreateRoute = "/create"
|
CreateRoute = "/create"
|
||||||
CallbackRoute = "/callback"
|
CallbackRoute = "/callback"
|
||||||
BanksRoute = "/sbp/banks"
|
BanksRoute = "/sbp/banks"
|
||||||
@@ -87,5 +90,10 @@ func (p *payoutHandler) PayoutCreate(w http.ResponseWriter, r *http.Request) {
|
|||||||
}
|
}
|
||||||
|
|
||||||
// PaymentCallback implements [Handler].
|
// PaymentCallback implements [Handler].
|
||||||
func (p *payoutHandler) PayoutCallback(http.ResponseWriter, *http.Request) {
|
func (p *payoutHandler) PayoutCallback(w http.ResponseWriter, r *http.Request) {
|
||||||
|
inData := map[string]any{}
|
||||||
|
decoder := json.NewDecoder(r.Body)
|
||||||
|
decoder.Decode(&inData)
|
||||||
|
|
||||||
|
slog.Info(fmt.Sprintf("Received callback from %s with object %v with headers %v", r.RemoteAddr, inData, r.Header))
|
||||||
}
|
}
|
||||||
@@ -1 +1,18 @@
|
|||||||
package orm
|
package orm
|
||||||
|
|
||||||
|
import "gorm.io/gorm"
|
||||||
|
|
||||||
|
type Payout struct {
|
||||||
|
gorm.Model
|
||||||
|
|
||||||
|
User User
|
||||||
|
|
||||||
|
Description string
|
||||||
|
PayoutID string
|
||||||
|
Type string
|
||||||
|
AccountNumber string
|
||||||
|
Amount float32
|
||||||
|
Currency string
|
||||||
|
Status string
|
||||||
|
Test bool
|
||||||
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user