diff --git a/internal/api/payout/payment_handler.go b/internal/api/payout/payout_handler.go similarity index 85% rename from internal/api/payout/payment_handler.go rename to internal/api/payout/payout_handler.go index 66bc268..b9704f3 100644 --- a/internal/api/payout/payment_handler.go +++ b/internal/api/payout/payout_handler.go @@ -1,7 +1,10 @@ package payout import ( + "encoding/json" "errors" + "fmt" + "log/slog" "net/http" "regexp" @@ -15,7 +18,7 @@ import ( ) const ( - BaseRoute = "/payment" + BaseRoute = "/payout" CreateRoute = "/create" CallbackRoute = "/callback" BanksRoute = "/sbp/banks" @@ -87,5 +90,10 @@ func (p *payoutHandler) PayoutCreate(w http.ResponseWriter, r *http.Request) { } // 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)) } diff --git a/internal/service/database/orm/payout.go b/internal/service/database/orm/payout.go index 5800656..9ff38ef 100644 --- a/internal/service/database/orm/payout.go +++ b/internal/service/database/orm/payout.go @@ -1 +1,18 @@ 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 +}