Files
online-backend/internal/payment/visamasterpay/dto.go
GuwandykA b8455625b5
Some checks failed
CI/CD / Vet, test, build (push) Has been cancelled
CI/CD / Docker image (push) Has been cancelled
CI/CD / Deploy binary to server (push) Has been cancelled
add payment settting
2026-09-19 02:12:59 +05:00

58 lines
2.6 KiB
Go

package visamasterpay
import (
"time"
"online-back/internal/shared"
)
// PaymentQuoteDTO is what the "Töleg" modal loads before the operator picks
// an amount. Which fields are populated depends on the order's type:
// Visa/Master orders use BankFeeTmt + GbusFeeTmt against the USD rate;
// Sber orders have no GBÜS fee but add a USD-denominated TVEB fee (shown
// both as-is and converted to TMT) and also show the RUB rate for
// reference, using their own SberBankFeeTmt instead of BankFeeTmt.
type PaymentQuoteDTO struct {
Type string `json:"type"`
ExchangeRateUsd float64 `json:"exchangeRateUsd"`
ExchangeRateRub *float64 `json:"exchangeRateRub,omitempty"`
BankFeeTmt float64 `json:"bankFeeTmt"`
GbusFeeTmt *float64 `json:"gbusFeeTmt,omitempty"`
TvebFeeUsd *float64 `json:"tvebFeeUsd,omitempty"`
TvebFeeTmt *float64 `json:"tvebFeeTmt,omitempty"`
MaxAmountTmt float64 `json:"maxAmountTmt"`
}
// PayOrderDTO submits a payout for a visa/master/sber order. AmountTmt is
// optional: if omitted, the full requested amount (amount_usd * rate) is
// paid; if provided (the modal's amount field is editable, capped at the
// max), it's validated against that max instead. PaymentPeriod is
// optional too - only the Visa/Master modal shows a payment-month picker;
// Sber orders default to the current month when omitted.
type PayOrderDTO struct {
PaymentPeriod *shared.FlexibleTime `json:"paymentPeriod" swaggertype:"string" format:"date"`
AmountTmt *float64 `json:"amountTmt"`
}
// PaymentResultDTO is a flat, payment-focused view of the order's payout
// state — deliberately not the full order+branch+user DTO owned by
// cards/visamaster (fetch that separately via GET /visa-master-payment-orders/:id).
type PaymentResultDTO struct {
OrderId int64 `json:"orderId"`
Type string `json:"type"`
Paid bool `json:"paid"`
AmountUsd float64 `json:"amountUsd"`
ExchangeRateUsd float64 `json:"exchangeRateUsd"`
ExchangeRateRub *float64 `json:"exchangeRateRub,omitempty"`
AmountTmt float64 `json:"amountTmt"`
BankFeeTmt float64 `json:"bankFeeTmt"`
GbusFeeTmt *float64 `json:"gbusFeeTmt,omitempty"`
TvebFeeUsd *float64 `json:"tvebFeeUsd,omitempty"`
TvebFeeTmt *float64 `json:"tvebFeeTmt,omitempty"`
TotalAmountTmt float64 `json:"totalAmountTmt"`
PaymentPeriod *time.Time `json:"paymentPeriod,omitempty"`
GatewayStatus string `json:"gatewayStatus"`
GatewayReference *string `json:"gatewayReference,omitempty"`
PaidAt *time.Time `json:"paidAt,omitempty"`
}