package ports import ( "context" "google.golang.org/grpc" activityv1 "hyapp.local/api/proto/activity/v1" "hyapp/services/wallet-service/internal/domain/ledger" ) // ActivityBadgeClient 是 wallet -> activity 的最小投影接口,避免 wallet 依赖 activity 内部包。 type ActivityBadgeClient interface { ConsumeAchievementEvent(ctx context.Context, req *activityv1.ConsumeAchievementEventRequest, opts ...grpc.CallOption) (*activityv1.ConsumeAchievementEventResponse, error) } // GooglePlayClient 隔离 Google Play Developer API,service 只依赖购买校验和消耗能力。 type GooglePlayClient interface { GetProductPurchase(ctx context.Context, packageName string, purchaseToken string) (ledger.GooglePlayPurchase, error) ConsumeProduct(ctx context.Context, packageName string, productID string, purchaseToken string) error } // MifaPayCreateOrderRequest 是 wallet-service 传给 MiFaPay client 的已校验下单快照。 type MifaPayCreateOrderRequest struct { OrderID string TargetUserID int64 ProductName string CoinAmount int64 AmountMinor int64 CurrencyCode string CountryCode string PayWay string PayType string NotifyURL string ReturnURL string ClientIP string Language string ProviderAmountMinor int64 PayerName string PayerAccount string PayerEmail string } type MifaPayCreateOrderResponse struct { OrderID string ProviderOrderID string PayURL string RawJSON string } type MifaPayQueryOrderRequest struct { OrderID string ProviderOrderID string OrderCreatedAtMS int64 } type MifaPayQueryOrderResponse struct { OrderID string ProviderOrderID string Status string Amount string Currency string PayType string RawJSON string } type MifaPayNotifyData struct { OrderID string ProviderOrderID string OrderStatus string Amount string Currency string PayType string RawJSON string } // V5PayCreateOrderRequest 是 wallet-service 传给 V5Pay client 的已校验下单快照。 type V5PayCreateOrderRequest struct { OrderID string TargetUserID int64 ProductName string CoinAmount int64 AmountMinor int64 CurrencyCode string CountryCode string ProductType string NotifyURL string ReturnURL string Language string ProviderAmountMinor int64 PayerName string PayerAccount string PayerEmail string } type V5PayCreateOrderResponse struct { OrderID string ProviderOrderID string PayURL string RawJSON string } type V5PayQueryOrderRequest struct { OrderID string ProviderOrderID string CountryCode string CurrencyCode string } type V5PayQueryOrderResponse struct { OrderID string ProviderOrderID string Status string Amount string Currency string ProductType string RawJSON string } type V5PayNotifyData struct { OrderID string ProviderOrderID string OrderStatus string Amount string Currency string ProductType string RawJSON string } type V5PayProductTypesRequest struct { CountryCode string CurrencyCode string } type V5PayProductType struct { ProductType string ProductName string Description string Logo string Currency string ProductMode string SupportCashierMode int } type V5PayProductTypesResponse struct { PayinList []V5PayProductType RawJSON string } // MifaPayClient 隔离 MiFaPay RSA 签名、验签和 HTTP 协议细节,service 只处理订单状态。 type MifaPayClient interface { CreateOrder(ctx context.Context, req MifaPayCreateOrderRequest) (MifaPayCreateOrderResponse, error) QueryOrder(ctx context.Context, req MifaPayQueryOrderRequest) (MifaPayQueryOrderResponse, error) ParseNotification(notification ledger.MifaPayNotification) (MifaPayNotifyData, error) } // V5PayClient 隔离 V5Pay MD5 签名、验签和 HTTP 协议细节,service 只处理订单状态。 type V5PayClient interface { CreateOrder(ctx context.Context, req V5PayCreateOrderRequest) (V5PayCreateOrderResponse, error) QueryOrder(ctx context.Context, req V5PayQueryOrderRequest) (V5PayQueryOrderResponse, error) ListProductTypes(ctx context.Context, req V5PayProductTypesRequest) (V5PayProductTypesResponse, error) ParseNotification(notification ledger.V5PayNotification) (V5PayNotifyData, error) } // TronUSDTClient 校验用户提交的 TRC20 tx_hash 是否真实打到平台共享地址。 type TronUSDTClient interface { VerifyUSDTTransfer(ctx context.Context, txHash string, toAddress string, amountMinor int64) (string, error) }