2025-06-02 14:39:46 +00:00
|
|
|
|
package payment_provider
|
|
|
|
|
|
|
|
|
|
import (
|
|
|
|
|
"context"
|
|
|
|
|
"gitea.pena/PenaSide/treasurer/internal/errors"
|
|
|
|
|
"gitea.pena/PenaSide/treasurer/internal/models"
|
|
|
|
|
"github.com/labstack/echo/v4"
|
|
|
|
|
)
|
|
|
|
|
|
|
|
|
|
type PaymentProvider interface {
|
|
|
|
|
GetName() string
|
|
|
|
|
Webhooker
|
|
|
|
|
Invocer
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Webhooker interface {
|
|
|
|
|
RegisterWebhookHandlers(router *echo.Group)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type Invocer interface {
|
|
|
|
|
GetSupportedPaymentMethods() []models.PaymentType
|
2025-06-03 09:22:27 +00:00
|
|
|
|
CreateInvoice(ctx context.Context, request *PaymentRequest) (*PaymentResponse, errors.Error)
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
// надо разобраться с дженериками что вообзе за ЬДЬДВЬДыв
|
|
|
|
|
type PaymentRequest struct {
|
|
|
|
|
UserID string `json:"userId"`
|
|
|
|
|
ClientIP string `json:"clientIp"`
|
|
|
|
|
PaymentMethod models.PaymentType `json:"paymentMethod"`
|
|
|
|
|
Amount int64 `json:"amount"`
|
|
|
|
|
Currency string `json:"currency"`
|
|
|
|
|
ReturnURL string `json:"returnUrl"`
|
|
|
|
|
CallbackHostGRPC []string `json:"callbackHostGrpc,omitempty"`
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
type PaymentResponse struct {
|
|
|
|
|
RedirectURL string
|
|
|
|
|
Payment *models.Payment
|
2025-06-02 14:39:46 +00:00
|
|
|
|
}
|