treasurer/internal/payment_provider/provider.go

40 lines
1.1 KiB
Go
Raw Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

package payment_provider
import (
"context"
"gitea.pena/PenaSide/treasurer/internal/errors"
"gitea.pena/PenaSide/treasurer/internal/models"
"github.com/gofiber/fiber/v2"
)
type PaymentProvider interface {
GetName() string
Webhooker
Invocer
}
type Webhooker interface {
RegisterWebhookHandlers(router fiber.Router)
}
type Invocer interface {
GetSupportedPaymentMethods() []models.PaymentType
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
}