75 lines
3.8 KiB
Go
75 lines
3.8 KiB
Go
package yandex
|
|
|
|
import "time"
|
|
|
|
// Payment description https://yookassa.ru/developers/api#payment_object
|
|
type Payment struct {
|
|
ID string `json:"id" bson:"id"`
|
|
Status PaymentStatus `json:"status" bson:"status"`
|
|
Amount Amount `json:"amount" bson:"amount"`
|
|
Confirmation *ConfirmationRedirect `json:"confirmation" bson:"confirmation"`
|
|
IncomeAmount *Amount `json:"income_amount,omitempty" bson:"income_amount,omitempty"`
|
|
Description string `json:"description,omitempty" bson:"description,omitempty"`
|
|
PaymentMethod *PaymentMethod `json:"payment_method,omitempty" bson:"payment_method,omitempty"`
|
|
Recipient Recipient `json:"recipient" bson:"recipient"`
|
|
CapturedAt string `json:"captured_at,omitempty" bson:"captured_at,omitempty"`
|
|
ExpiresAt string `json:"expires_at,omitempty" bson:"expires_at,omitempty"`
|
|
CreatedAt string `json:"created_at" bson:"created_at"`
|
|
IsTest bool `json:"test" bson:"test"`
|
|
RefundedAmount *Amount `json:"refunded_amount,omitempty" bson:"refunded_amount,omitempty"`
|
|
IsPaid bool `json:"paid" bson:"paid"`
|
|
IsRefundable bool `json:"refundable" bson:"refundable"`
|
|
ReceiptRegistration string `json:"receipt_registration,omitempty" bson:"receipt_registration,omitempty"`
|
|
Metadata any `json:"metadata,omitempty" bson:"metadata,omitempty"`
|
|
CancellationDetails any `json:"cancellation_details,omitempty" bson:"cancellation_details,omitempty"`
|
|
AuthorizationDetails any `json:"authorization_details,omitempty" bson:"authorization_details,omitempty"`
|
|
Transfers []any `json:"transfers,omitempty" bson:"transfers,omitempty"`
|
|
Deal any `json:"deal,omitempty" bson:"deal,omitempty"`
|
|
MerchantCustomerID string `json:"merchant_customer_id,omitempty" bson:"merchant_customer_id,omitempty"`
|
|
}
|
|
|
|
type Recipient struct {
|
|
AccountID string `json:"account_id" bson:"account_id"`
|
|
GatewayID string `json:"gateway_id" bson:"gateway_id"`
|
|
}
|
|
|
|
type Confirmation struct {
|
|
}
|
|
|
|
type PaymentStatus string
|
|
|
|
const (
|
|
PaymentStatusPending PaymentStatus = "pending"
|
|
PaymentStatusWaiting PaymentStatus = "waiting_for_capture"
|
|
PaymentStatusSuccessfully PaymentStatus = "succeeded"
|
|
PaymentStatusCanceled PaymentStatus = "canceled"
|
|
)
|
|
|
|
type PaymentMethod struct {
|
|
ID string `json:"_id" bson:"_id,omitempty"`
|
|
UserID string `json:"userId" bson:"userId"`
|
|
Type string `json:"type" bson:"type"`
|
|
MethodID string `json:"id" bson:"id"`
|
|
Saved bool `json:"saved" bson:"saved"`
|
|
Card *Card `json:"card,omitempty" bson:"card,omitempty"`
|
|
Title string `json:"title" bson:"title"`
|
|
CreatedAt time.Time `json:"createdAt" bson:"createdAt"`
|
|
UpdatedAt time.Time `json:"updatedAt" bson:"updatedAt"`
|
|
}
|
|
|
|
type Card struct {
|
|
First6 string `json:"first6" bson:"first6"`
|
|
Last4 string `json:"last4" bson:"last4"`
|
|
ExpiryMonth string `json:"expiry_month" bson:"expiry_month"`
|
|
ExpiryYear string `json:"expiry_year" bson:"expiry_year"`
|
|
CardType string `json:"card_type" bson:"card_type"`
|
|
CardProduct *CardProduct `json:"card_product,omitempty" bson:"card_product,omitempty"`
|
|
IssuerCountry string `json:"issuer_country" bson:"issuer_country"`
|
|
IssuerName string `json:"issuer_name" bson:"issuer_name"`
|
|
}
|
|
|
|
type CardProduct struct {
|
|
Code string `json:"code" bson:"code"`
|
|
Name string `json:"name" bson:"name"`
|
|
}
|