Documentation
¶
Overview ¶
Package dto is the billing module's contract: the commands, queries and results of its facade and HTTP handlers, and the billing-owned read-only snapshots of other domains' data it returns. The package keeps the name dto so the Swagger schema names (dto.*) stay as they were.
Index ¶
- type BatchDeleteCouponRequest
- type BillingBalanceLogSnapshot
- type BillingCommissionLogSnapshot
- type BillingNodeIDList
- type BillingSubscribeDiscount
- type BillingSubscribeSnapshot
- type CheckoutOrderRequest
- type CheckoutOrderResponse
- type CloseOrderRequest
- type CommissionWithdrawRequest
- type Coupon
- type CreateCouponRequest
- type CreateOrderRequest
- type CreatePaymentMethodRequest
- type DeleteCouponRequest
- type DeletePaymentMethodRequest
- type EPayNotifyRequest
- type GetAvailablePaymentMethodsResponse
- type GetCouponListRequest
- type GetCouponListResponse
- type GetOrderListRequest
- type GetOrderListResponse
- type GetPaymentMethodListRequest
- type GetPaymentMethodListResponse
- type GetSubscriptionRequest
- type GetSubscriptionResponse
- type GetWithdrawalListRequest
- type GetWithdrawalListResponse
- type Order
- type OrderDetail
- type PaymentConfig
- type PaymentMethod
- type PaymentMethodDetail
- type PaymentPlatformInfoSnapshot
- type PaymentPlatformResponse
- type PortalPurchaseRequest
- type PortalPurchaseResponse
- type PreOrderResponse
- type PrePurchaseOrderRequest
- type PrePurchaseOrderResponse
- type PurchaseOrderRequest
- type PurchaseOrderResponse
- type QueryOrderDetailRequest
- type QueryOrderListRequest
- type QueryOrderListResponse
- type QueryPurchaseOrderRequest
- type QueryPurchaseOrderResponse
- type QueryUserAffiliateCountResponse
- type QueryUserAffiliateListRequest
- type QueryUserAffiliateListResponse
- type QueryUserBalanceLogListResponse
- type QueryUserCommissionLogListRequest
- type QueryUserCommissionLogListResponse
- type QueryWithdrawalLogListRequest
- type QueryWithdrawalLogListResponse
- type RechargeOrderRequest
- type RechargeOrderResponse
- type RenewalOrderRequest
- type RenewalOrderResponse
- type ResetTrafficOrderRequest
- type ResetTrafficOrderResponse
- type ReviewWithdrawalRequest
- type StripePayment
- type UpdateCouponRequest
- type UpdateOrderStatusRequest
- type UpdatePaymentMethodRequest
- type UserAffiliate
- type V2CheckoutOrderRequest
- type V2CreateOrderRequest
- type V2EventTicketRequest
- type V2EventTicketResponse
- type V2GuestOrderRequest
- type V2OrderEvents
- type V2OrderPayment
- type V2OrderResponse
- type V2OrderSessionRequest
- type V2OrderSessionResponse
- type V2OrderSnapshot
- type WithdrawalLog
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type BatchDeleteCouponRequest ¶
type BatchDeleteCouponRequest struct {
Ids []int64 `json:"ids" validate:"required"`
}
type BillingBalanceLogSnapshot ¶
type BillingBalanceLogSnapshot struct {
Type uint16 `json:"type"`
UserId int64 `json:"user_id"`
Amount int64 `json:"amount"`
OrderNo string `json:"order_no,omitempty"`
Balance int64 `json:"balance"`
Timestamp int64 `json:"timestamp"`
ClientIP string `json:"client_ip,omitempty"`
UserAgent string `json:"user_agent,omitempty"`
ActorID int64 `json:"actor_id,omitempty"`
IPCountryCode string `json:"ip_country_code,omitempty"`
IPCountry string `json:"ip_country,omitempty"`
IPRegion string `json:"ip_region,omitempty"`
IPCity string `json:"ip_city,omitempty"`
IPASN uint `json:"ip_asn,omitempty"`
IPASOrganization string `json:"ip_as_organization,omitempty"`
} // @name dto.BalanceLog
type BillingCommissionLogSnapshot ¶
type BillingCommissionLogSnapshot struct {
Type uint16 `json:"type"`
UserId int64 `json:"user_id"`
Amount int64 `json:"amount"`
OrderNo string `json:"order_no"`
Timestamp int64 `json:"timestamp"`
ClientIP string `json:"client_ip,omitempty"`
UserAgent string `json:"user_agent,omitempty"`
ActorID int64 `json:"actor_id,omitempty"`
IPCountryCode string `json:"ip_country_code,omitempty"`
IPCountry string `json:"ip_country,omitempty"`
IPRegion string `json:"ip_region,omitempty"`
IPCity string `json:"ip_city,omitempty"`
IPASN uint `json:"ip_asn,omitempty"`
IPASOrganization string `json:"ip_as_organization,omitempty"`
} // @name dto.CommissionLog
type BillingNodeIDList ¶
type BillingNodeIDList []int64 // @name dto.StringInt64Slice
func (BillingNodeIDList) Int64s ¶
func (s BillingNodeIDList) Int64s() []int64
func (BillingNodeIDList) MarshalJSON ¶
func (s BillingNodeIDList) MarshalJSON() ([]byte, error)
func (*BillingNodeIDList) UnmarshalJSON ¶
func (s *BillingNodeIDList) UnmarshalJSON(data []byte) error
type BillingSubscribeSnapshot ¶
type BillingSubscribeSnapshot struct {
Id int64 `json:"id"`
Name string `json:"name"`
Language string `json:"language"`
Description string `json:"description"`
UnitPrice int64 `json:"unit_price"`
UnitTime string `json:"unit_time"`
Discount []BillingSubscribeDiscount `json:"discount"`
Replacement int64 `json:"replacement"`
Inventory int64 `json:"inventory"`
Traffic int64 `json:"traffic"`
SpeedLimit int64 `json:"speed_limit"`
DeviceLimit int64 `json:"device_limit"`
Quota int64 `json:"quota"`
Nodes BillingNodeIDList `json:"nodes"`
NodeTags []string `json:"node_tags"`
Show bool `json:"show"`
Sell bool `json:"sell"`
Sort int64 `json:"sort"`
DeductionRatio int64 `json:"deduction_ratio"`
AllowDeduction bool `json:"allow_deduction"`
ResetCycle int64 `json:"reset_cycle"`
RenewalReset bool `json:"renewal_reset"`
ShowOriginalPrice bool `json:"show_original_price"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
} // @name dto.Subscribe
type CheckoutOrderRequest ¶
type CheckoutOrderResponse ¶
type CheckoutOrderResponse struct {
// Type is url, qr, stripe, or balance.
Type string `json:"type" enums:"url,qr,stripe,balance" example:"url"`
CheckoutUrl string `json:"checkout_url,omitempty"`
Stripe *StripePayment `json:"stripe,omitempty"`
}
type CloseOrderRequest ¶
type CloseOrderRequest struct {
OrderNo string `json:"orderNo" validate:"required"`
}
type Coupon ¶
type Coupon struct {
Id int64 `json:"id"`
Name string `json:"name"`
Code string `json:"code"`
Count int64 `json:"count"`
Type uint8 `json:"type"`
Discount int64 `json:"discount"`
StartTime int64 `json:"start_time"`
ExpireTime int64 `json:"expire_time"`
UserLimit int64 `json:"user_limit"`
Subscribe []int64 `json:"subscribe"`
UsedCount int64 `json:"used_count"`
Enable bool `json:"enable"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type CreateCouponRequest ¶
type CreateCouponRequest struct {
Name string `json:"name" validate:"required"`
Code string `json:"code,omitempty"`
Count int64 `json:"count,omitempty"`
Type uint8 `json:"type" validate:"required"`
Discount int64 `json:"discount" validate:"required"`
StartTime int64 `json:"start_time" validate:"required"`
ExpireTime int64 `json:"expire_time" validate:"required"`
UserLimit int64 `json:"user_limit,omitempty"`
Subscribe []int64 `json:"subscribe,omitempty"`
UsedCount int64 `json:"used_count,omitempty"`
Enable *bool `json:"enable,omitempty"`
}
type CreateOrderRequest ¶
type CreateOrderRequest struct {
UserId int64 `json:"user_id" validate:"required"`
Type uint8 `json:"type" validate:"required,oneof=1 2 3 4"`
Quantity int64 `json:"quantity,omitempty" validate:"omitempty,gte=1,lte=1000"`
Price int64 `json:"price" validate:"required,gte=0,lte=2000000000"`
Amount int64 `json:"amount" validate:"required,gte=0,lte=2147483647"`
Discount int64 `json:"discount,omitempty" validate:"omitempty,gte=0,lte=2000000000"`
Coupon string `json:"coupon,omitempty"`
CouponDiscount int64 `json:"coupon_discount,omitempty" validate:"omitempty,gte=0,lte=2000000000"`
Commission int64 `json:"commission" validate:"gte=0,lte=2000000000"`
FeeAmount int64 `json:"fee_amount" validate:"required,gte=0,lte=2000000000"`
PaymentId int64 `json:"payment_id" validate:"required"`
// TradeNo is refused when set: the gateway assigns it when the order is
// paid, and Stripe and Cryptomus read it as their own payment identifier.
TradeNo string `json:"trade_no,omitempty" validate:"omitempty,len=0"`
Status uint8 `json:"status,omitempty"`
SubscribeId int64 `json:"subscribe_id,omitempty"`
// UserSubscribeId is the user subscription a renewal (type 2) or traffic
// reset (type 3) order applies to; required for those types.
UserSubscribeId int64 `json:"user_subscribe_id,omitempty" validate:"omitempty,gt=0"`
}
CreateOrderRequest is an administrator's order. Type is 1 (subscribe), 2 (renewal), 3 (reset traffic) or 4 (recharge); Quantity defaults to one unit. A renewal or traffic reset names the user subscription it applies to in UserSubscribeId. TradeNo is assigned by the gateway that collects the payment and is not accepted here.
type CreatePaymentMethodRequest ¶
type CreatePaymentMethodRequest struct {
Name string `json:"name" validate:"required"`
Platform string `json:"platform" validate:"required"`
Description string `json:"description"`
Icon string `json:"icon,omitempty"`
Domain string `json:"domain,omitempty"`
Config any `json:"config" validate:"required"`
FeeMode uint `json:"fee_mode"`
FeePercent int64 `json:"fee_percent,omitempty"`
FeeAmount int64 `json:"fee_amount,omitempty"`
Sort int64 `json:"sort,omitempty"`
Enable *bool `json:"enable" validate:"required"`
}
type DeleteCouponRequest ¶
type DeleteCouponRequest struct {
Id int64 `json:"id" validate:"required"`
}
type DeletePaymentMethodRequest ¶
type DeletePaymentMethodRequest struct {
Id int64 `json:"id" validate:"required"`
}
type EPayNotifyRequest ¶
type EPayNotifyRequest struct {
Pid string `json:"pid" form:"pid"`
TradeNo string `json:"trade_no" form:"trade_no"`
OutTradeNo string `json:"out_trade_no" form:"out_trade_no"`
Type string `json:"type" form:"type"`
Name string `json:"name" form:"name"`
Money string `json:"money" form:"money"`
TradeStatus string `json:"trade_status" form:"trade_status"`
Param string `json:"param" form:"param"`
Sign string `json:"sign" form:"sign"`
SignType string `json:"sign_type" form:"sign_type"`
}
type GetAvailablePaymentMethodsResponse ¶
type GetAvailablePaymentMethodsResponse struct {
List []PaymentMethod `json:"list"`
}
type GetCouponListRequest ¶
type GetCouponListResponse ¶
type GetOrderListRequest ¶
type GetOrderListRequest struct {
Page int64 `form:"page" validate:"required,gt=0"`
Size int64 `form:"size" validate:"required,gt=0,lte=100"`
UserId int64 `form:"user_id,omitempty"`
Status uint8 `form:"status,omitempty"`
SubscribeId int64 `form:"subscribe_id,omitempty"`
Search string `form:"search,omitempty"`
}
type GetOrderListResponse ¶
type GetPaymentMethodListResponse ¶
type GetPaymentMethodListResponse struct {
Total int64 `json:"total"`
List []PaymentMethodDetail `json:"list"`
}
type GetSubscriptionRequest ¶
type GetSubscriptionRequest struct {
Language string `form:"language"`
}
type GetSubscriptionResponse ¶
type GetSubscriptionResponse struct {
List []BillingSubscribeSnapshot `json:"list"`
}
type GetWithdrawalListResponse ¶
type GetWithdrawalListResponse struct {
List []WithdrawalLog `json:"list"`
Total int64 `json:"total"`
}
type Order ¶
type Order struct {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
OrderNo string `json:"order_no"`
Type uint8 `json:"type"`
Quantity int64 `json:"quantity"`
Price int64 `json:"price"`
Amount int64 `json:"amount"`
GiftAmount int64 `json:"gift_amount"`
Discount int64 `json:"discount"`
Coupon string `json:"coupon"`
CouponDiscount int64 `json:"coupon_discount"`
Commission int64 `json:"commission,omitempty"`
Payment PaymentMethod `json:"payment"`
FeeAmount int64 `json:"fee_amount"`
TradeNo string `json:"trade_no"`
Status uint8 `json:"status"`
SubscribeId int64 `json:"subscribe_id"`
// UserSubscribeId is the user subscription a renewal or traffic reset
// order applies to; zero for other orders and for orders created before
// it was recorded.
UserSubscribeId int64 `json:"user_subscribe_id"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type OrderDetail ¶
type OrderDetail struct {
Id int64 `json:"id"`
UserId int64 `json:"user_id"`
OrderNo string `json:"order_no"`
Type uint8 `json:"type"`
Quantity int64 `json:"quantity"`
Price int64 `json:"price"`
Amount int64 `json:"amount"`
GiftAmount int64 `json:"gift_amount"`
Discount int64 `json:"discount"`
Coupon string `json:"coupon"`
CouponDiscount int64 `json:"coupon_discount"`
Commission int64 `json:"commission,omitempty"`
Payment PaymentMethod `json:"payment"`
Method string `json:"method"`
FeeAmount int64 `json:"fee_amount"`
TradeNo string `json:"trade_no"`
Status uint8 `json:"status"`
SubscribeId int64 `json:"subscribe_id"`
// UserSubscribeId is the user subscription a renewal or traffic reset
// order applies to; zero for other orders and for orders created before
// it was recorded.
UserSubscribeId int64 `json:"user_subscribe_id"`
Subscribe BillingSubscribeSnapshot `json:"subscribe"`
CreatedAt int64 `json:"created_at"`
UpdatedAt int64 `json:"updated_at"`
}
type PaymentConfig ¶
type PaymentConfig struct {
Id int64 `json:"id" validate:"required"`
Name string `json:"name" validate:"required"`
Platform string `json:"platform" validate:"required"`
Description string `json:"description"`
Icon string `json:"icon,omitempty"`
Domain string `json:"domain,omitempty"`
Config any `json:"config" validate:"required"`
FeeMode uint `json:"fee_mode"`
FeePercent int64 `json:"fee_percent,omitempty"`
FeeAmount int64 `json:"fee_amount,omitempty"`
Sort int64 `json:"sort,omitempty"`
Enable *bool `json:"enable" validate:"required"`
}
type PaymentMethod ¶
type PaymentMethod struct {
Id int64 `json:"id"`
Name string `json:"name"`
Platform string `json:"platform"`
Description string `json:"description"`
Icon string `json:"icon"`
FeeMode uint `json:"fee_mode"`
FeePercent int64 `json:"fee_percent"`
FeeAmount int64 `json:"fee_amount"`
Sort int64 `json:"sort"`
}
type PaymentMethodDetail ¶
type PaymentMethodDetail struct {
Id int64 `json:"id"`
Name string `json:"name"`
Platform string `json:"platform"`
Description string `json:"description"`
Icon string `json:"icon"`
Domain string `json:"domain"`
Config any `json:"config"`
FeeMode uint `json:"fee_mode"`
FeePercent int64 `json:"fee_percent"`
FeeAmount int64 `json:"fee_amount"`
Sort int64 `json:"sort"`
Enable bool `json:"enable"`
NotifyURL string `json:"notify_url"`
}
type PaymentPlatformInfoSnapshot ¶
type PaymentPlatformInfoSnapshot = integration.Info // @name dto.PlatformInfo
PlatformInfo is kept as a DTO alias for API compatibility. Provider metadata belongs to the infrastructure-neutral platform package.
type PaymentPlatformResponse ¶
type PaymentPlatformResponse struct {
List []PaymentPlatformInfoSnapshot `json:"list"`
} // @name dto.PlatformResponse
type PortalPurchaseRequest ¶
type PortalPurchaseRequest struct {
AuthType string `json:"auth_type" validate:"required" enums:"email,mobile"`
Identifier string `json:"identifier" validate:"required"`
Password string `json:"password" validate:"required,min=8,max=128"`
Payment int64 `json:"payment" validate:"required,gt=0"`
SubscribeId int64 `json:"subscribe_id" validate:"required,gt=0"`
Quantity int64 `json:"quantity" validate:"required,gt=0,lte=1000"`
Coupon string `json:"coupon,omitempty"`
InviteCode string `json:"invite_code,omitempty"`
TurnstileToken string `json:"turnstile_token,omitempty"`
}
PortalPurchaseRequest creates a guest order. AuthType is email or mobile; a mobile identifier includes its country calling code.
type PortalPurchaseResponse ¶
type PreOrderResponse ¶
type PrePurchaseOrderRequest ¶
type PurchaseOrderRequest ¶
type PurchaseOrderResponse ¶
type PurchaseOrderResponse struct {
OrderNo string `json:"order_no"`
}
type QueryOrderDetailRequest ¶
type QueryOrderDetailRequest struct {
OrderNo string `form:"order_no" validate:"required"`
}
type QueryOrderListRequest ¶
type QueryOrderListResponse ¶
type QueryOrderListResponse struct {
Total int64 `json:"total"`
List []OrderDetail `json:"list"`
}
type QueryPurchaseOrderResponse ¶
type QueryPurchaseOrderResponse struct {
OrderNo string `json:"order_no"`
Subscribe BillingSubscribeSnapshot `json:"subscribe"`
Quantity int64 `json:"quantity"`
Price int64 `json:"price"`
Amount int64 `json:"amount"`
Discount int64 `json:"discount"`
Coupon string `json:"coupon"`
CouponDiscount int64 `json:"coupon_discount"`
FeeAmount int64 `json:"fee_amount"`
Payment PaymentMethod `json:"payment"`
Status uint8 `json:"status"`
CreatedAt int64 `json:"created_at"`
Token string `json:"token,omitempty"`
}
type QueryUserAffiliateListResponse ¶
type QueryUserAffiliateListResponse struct {
List []UserAffiliate `json:"list"`
Total int64 `json:"total"`
}
type QueryUserBalanceLogListResponse ¶
type QueryUserBalanceLogListResponse struct {
List []BillingBalanceLogSnapshot `json:"list"`
Total int64 `json:"total"`
}
type QueryUserCommissionLogListResponse ¶
type QueryUserCommissionLogListResponse struct {
List []BillingCommissionLogSnapshot `json:"list"`
Total int64 `json:"total"`
}
type QueryWithdrawalLogListResponse ¶
type QueryWithdrawalLogListResponse struct {
List []WithdrawalLog `json:"list"`
Total int64 `json:"total"`
}
type RechargeOrderRequest ¶
type RechargeOrderResponse ¶
type RechargeOrderResponse struct {
OrderNo string `json:"order_no"`
}
type RenewalOrderRequest ¶
type RenewalOrderResponse ¶
type RenewalOrderResponse struct {
OrderNo string `json:"order_no"`
}
type ResetTrafficOrderResponse ¶
type ResetTrafficOrderResponse struct {
OrderNo string `json:"order_no"`
}
type ReviewWithdrawalRequest ¶
type StripePayment ¶
type UpdateCouponRequest ¶
type UpdateCouponRequest struct {
Id int64 `json:"id" validate:"required"`
Name string `json:"name" validate:"required"`
Code string `json:"code,omitempty"`
Count int64 `json:"count,omitempty"`
Type uint8 `json:"type" validate:"required"`
Discount int64 `json:"discount" validate:"required"`
StartTime int64 `json:"start_time" validate:"required"`
ExpireTime int64 `json:"expire_time" validate:"required"`
UserLimit int64 `json:"user_limit,omitempty"`
Subscribe []int64 `json:"subscribe,omitempty"`
UsedCount int64 `json:"used_count,omitempty"`
Enable *bool `json:"enable,omitempty"`
}
type UpdatePaymentMethodRequest ¶
type UpdatePaymentMethodRequest struct {
Id int64 `json:"id" validate:"required"`
Name string `json:"name" validate:"required"`
Platform string `json:"platform" validate:"required"`
Description string `json:"description"`
Icon string `json:"icon,omitempty"`
Domain string `json:"domain,omitempty"`
Config any `json:"config" validate:"required"`
FeeMode uint `json:"fee_mode"`
FeePercent int64 `json:"fee_percent,omitempty"`
FeeAmount int64 `json:"fee_amount,omitempty"`
Sort int64 `json:"sort,omitempty"`
Enable *bool `json:"enable" validate:"required"`
}
type UserAffiliate ¶
type V2CheckoutOrderRequest ¶
type V2CreateOrderRequest ¶
type V2CreateOrderRequest struct {
Type string `json:"type"`
PaymentID int64 `json:"payment_id"`
SubscribeID int64 `json:"subscribe_id,omitempty"`
UserSubscribeID int64 `json:"user_subscribe_id,omitempty"`
Quantity int64 `json:"quantity,omitempty"`
Coupon string `json:"coupon,omitempty"`
Amount int64 `json:"amount,omitempty"`
ReturnURL string `json:"return_url,omitempty"`
Guest *V2GuestOrderRequest `json:"guest,omitempty"`
}
type V2EventTicketRequest ¶
type V2EventTicketRequest struct {
CheckoutToken string `json:"checkout_token,omitempty"`
}
type V2EventTicketResponse ¶
type V2GuestOrderRequest ¶
type V2GuestOrderRequest struct {
AuthType string `json:"auth_type" enums:"email,mobile"`
Identifier string `json:"identifier"`
Password string `json:"password"`
InviteCode string `json:"invite_code,omitempty"`
TurnstileToken string `json:"turnstile_token,omitempty"`
}
V2GuestOrderRequest contains the account information held until a guest purchase is activated. It is only accepted for anonymous purchase orders. AuthType is email or mobile; a mobile identifier includes its country calling code. TurnstileToken is required when registration verification is enabled and is not part of the idempotent request identity.
type V2OrderEvents ¶
type V2OrderPayment ¶
type V2OrderPayment struct {
// Type is url, qr, stripe, or balance.
Type string `json:"type" enums:"url,qr,stripe,balance" example:"url"`
CheckoutURL string `json:"checkout_url,omitempty"`
Stripe *StripePayment `json:"stripe,omitempty"`
PaymentStatus string `json:"payment_status"`
}
type V2OrderResponse ¶
type V2OrderResponse struct {
Order V2OrderSnapshot `json:"order"`
Payment *V2OrderPayment `json:"payment,omitempty"`
Events V2OrderEvents `json:"events"`
CheckoutToken string `json:"checkout_token,omitempty"`
}
type V2OrderSessionRequest ¶
type V2OrderSessionRequest struct {
CheckoutToken string `json:"checkout_token,omitempty"`
}
V2OrderSessionRequest exchanges a guest checkout capability for a normal user session after the corresponding purchase has created its account. It deliberately reuses the capability rather than putting a bearer token in an SSE URL or event payload.
type V2OrderSessionResponse ¶
type V2OrderSessionResponse struct {
AccessToken string `json:"access_token"`
}
type V2OrderSnapshot ¶
type V2OrderSnapshot struct {
OrderNo string `json:"order_no"`
Status string `json:"status"`
PaymentStatus string `json:"payment_status"`
FulfillmentStatus string `json:"fulfillment_status"`
StateVersion int64 `json:"state_version"`
Amount int64 `json:"amount"`
Currency string `json:"currency"`
ExpiresAt int64 `json:"expires_at"`
}