endpoints

package
v0.0.0-...-77c56fa Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2024 License: Apache-2.0 Imports: 14 Imported by: 0

Documentation

Index

Constants

View Source
const (
	DefaultDescription = "From ImperatorOfDwelling for renting an apartment."
)

Variables

This section is empty.

Functions

This section is empty.

Types

type Amount

type Amount struct {
	Value    string `json:"value"`
	Currency string `json:"currency"`
}

type Confirmation

type Confirmation struct {
	Type string `json:"type"`
}

type ConfirmationResponse

type ConfirmationResponse struct {
	Type              string `json:"type"`
	ConfirmationToken string `json:"confirmation_token"`
}

type Create

type Create struct {
	UserId string `json:"user_id,omitempty"`
	Amount Amount `json:"amount,omitempty"`
}

func NewCreate

func NewCreate(userId string, val string, currency string) *Create

type CreatePaymentRequest

type CreatePaymentRequest struct {
	Amount       Amount       `json:"amount"`
	Confirmation Confirmation `json:"confirmation"`
	Capture      bool         `json:"capture"`
	Description  string       `json:"description"`
}

type ErrorResponse

type ErrorResponse struct {
	Error string `json:"error"`
}

func NewErrorResponse

func NewErrorResponse(message string) *ErrorResponse

type PayloadAnswer

type PayloadAnswer struct {
	TransactionId uuid.UUID             `json:"transaction_id"`
	Status        metrics.Status        `json:"status"`
	YouKassaModel *YooKassaPayloadModel `json:"you_kassa_payload_model"`
}

PayloadAnswer AnswerToFrontend

func NewPayloadAnswer

func NewPayloadAnswer(youKassaModel *YooKassaPayloadModel) *PayloadAnswer

type PayloadHandler

type PayloadHandler struct {
	// contains filtered or unexported fields
}

func NewPayloadHandler

func NewPayloadHandler(log *slog.Logger, logWriter postgres.LogRepository) *PayloadHandler

func (*PayloadHandler) Payload

func (h *PayloadHandler) Payload(w http.ResponseWriter, r *http.Request)

type PayloadRequestKassa

type PayloadRequestKassa struct {
	Amount      Amount `json:"amount"`
	CardSynonym string `json:"card_synonym"`
	Description string `json:"description"`
}

PayloadRequestKassa provided json paraments of payout request https://yookassa.ru/developers/payouts/making-payouts/bank-card/using-payout-widget/making-payouts-with-synonym

type PaymentAnswer

type PaymentAnswer struct {
	TransactionId uuid.UUID        `json:"transaction_id"`
	Status        metrics.Status   `json:"status"`
	YouKassaModel *PaymentResponse `json:"you_kassa_model"`
}

PaymentAnswer response (answer) to frontend

func NewPaymentAnswer

func NewPaymentAnswer(youKassaModel *PaymentResponse) *PaymentAnswer

type PaymentHandler

type PaymentHandler struct {
	// contains filtered or unexported fields
}

func NewPaymentHandler

func NewPaymentHandler(log *slog.Logger, db postgres.LogRepository) *PaymentHandler

func (*PaymentHandler) Payment

func (h *PaymentHandler) Payment(w http.ResponseWriter, r *http.Request)

type PaymentResponse

type PaymentResponse struct {
	ID           string               `json:"id"`
	Status       metrics.Status       `json:"status"`
	Paid         bool                 `json:"paid"`
	Amount       Amount               `json:"amount"`
	Confirmation ConfirmationResponse `json:"confirmation"`
	CreatedAt    string               `json:"created_at"`
	Description  string               `json:"description"`
	Metadata     interface{}          `json:"metadata"`
	Recipient    Recipient            `json:"recipient"`
	Refundable   bool                 `json:"refundable"`
	Test         bool                 `json:"test"`
}

PaymentResponse response from youkassa

type PayoutRequestEndpoint

type PayoutRequestEndpoint struct {
	ToUserId string `json:"user_id"`
	Amount   Amount `json:"amount"`
}

PayoutRequestEndpoint endpoint parameters

type Recipient

type Recipient struct {
	AccountID string `json:"account_id"`
	GatewayID string `json:"gateway_id"`
}

type SaveCard

type SaveCard struct {
	UserId   string `json:"user_id"`
	Synonym  string `json:"synonym"`
	FirstSix string `json:"first_six"`
	LastFour string `json:"last_four"`
}

SaveCard accepted structure from frontend

type SaveCardHandler

type SaveCardHandler struct {
	// contains filtered or unexported fields
}

func NewSaveCardHandler

func NewSaveCardHandler(log *slog.Logger, db postgres.LogRepository) *SaveCardHandler

func (SaveCardHandler) SaveCard

func (h SaveCardHandler) SaveCard(w http.ResponseWriter, r *http.Request)

type SaveCardResponse

type SaveCardResponse struct {
	Status metrics.Status `json:"status"`
	Error  string         `json:"error"`
}

SaveCardResponse response to frontend

type YooKassaPayloadModel

type YooKassaPayloadModel struct {
	ID          string         `json:"id"`
	Amount      Amount         `json:"amount"`
	Status      metrics.Status `json:"status"`
	Description string         `json:"description"`
	CreatedAt   time.Time      `json:"created_at"`
	Test        bool           `json:"test"`
}

YooKassaPayloadModel YooKassa payload model

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL