147 lines
6.1 KiB
Go
147 lines
6.1 KiB
Go
package financeorder
|
|
|
|
import "hyapp-admin-server/internal/model"
|
|
|
|
type createCoinSellerRechargeOrderRequest struct {
|
|
AppCode string `json:"appCode"`
|
|
TargetUserID string `json:"targetUserId"`
|
|
USDAmount float64 `json:"usdAmount"`
|
|
CoinAmount int64 `json:"coinAmount"`
|
|
ProviderCode string `json:"providerCode"`
|
|
Chain string `json:"chain"`
|
|
ExternalOrderNo string `json:"externalOrderNo"`
|
|
ProviderCountryCode string `json:"providerCountryCode"`
|
|
ProviderCurrencyCode string `json:"providerCurrencyCode"`
|
|
ProviderAmountMinor int64 `json:"providerAmountMinor"`
|
|
ProviderPayType string `json:"providerPayType"`
|
|
OrderDate string `json:"orderDate"`
|
|
OrderDateMS int64 `json:"orderDateMs"`
|
|
Remark string `json:"remark"`
|
|
}
|
|
|
|
type verifyCoinSellerRechargeReceiptRequest struct {
|
|
AppCode string `json:"appCode"`
|
|
USDAmount float64 `json:"usdAmount"`
|
|
USDMinorAmount int64 `json:"usdMinorAmount"`
|
|
ProviderCode string `json:"providerCode"`
|
|
Chain string `json:"chain"`
|
|
ExternalOrderNo string `json:"externalOrderNo"`
|
|
}
|
|
|
|
type coinSellerRechargeReceiptVerificationDTO struct {
|
|
Verified bool `json:"verified"`
|
|
ProviderCode string `json:"providerCode"`
|
|
ExternalOrderNo string `json:"externalOrderNo"`
|
|
ProviderOrderID string `json:"providerOrderId"`
|
|
Status string `json:"status"`
|
|
CurrencyCode string `json:"currencyCode"`
|
|
ProviderAmountMinor int64 `json:"providerAmountMinor"`
|
|
Chain string `json:"chain"`
|
|
ReceiveAddress string `json:"receiveAddress"`
|
|
VerifiedAtMS int64 `json:"verifiedAtMs"`
|
|
FailureReason string `json:"failureReason"`
|
|
RawJSON string `json:"rawJson"`
|
|
}
|
|
|
|
type coinSellerRechargeOrderDTO struct {
|
|
ID uint `json:"id"`
|
|
AppCode string `json:"appCode"`
|
|
TargetUserID string `json:"targetUserId"`
|
|
TargetDisplayUserID string `json:"targetDisplayUserId"`
|
|
TargetCountryID int64 `json:"targetCountryId"`
|
|
TargetRegionID int64 `json:"targetRegionId"`
|
|
USDAmount string `json:"usdAmount"`
|
|
USDMinorAmount int64 `json:"usdMinorAmount"`
|
|
CoinAmount int64 `json:"coinAmount"`
|
|
|
|
ProviderCode string `json:"providerCode"`
|
|
Chain string `json:"chain"`
|
|
ExternalOrderNo string `json:"externalOrderNo"`
|
|
ProviderOrderID string `json:"providerOrderId"`
|
|
ProviderStatus string `json:"providerStatus"`
|
|
ProviderCountryCode string `json:"providerCountryCode"`
|
|
ProviderCurrencyCode string `json:"providerCurrencyCode"`
|
|
ProviderAmountMinor int64 `json:"providerAmountMinor"`
|
|
ProviderPayType string `json:"providerPayType"`
|
|
ReceiveAddress string `json:"receiveAddress"`
|
|
OrderDateMS int64 `json:"orderDateMs"`
|
|
|
|
Status string `json:"status"`
|
|
VerifyStatus string `json:"verifyStatus"`
|
|
GrantStatus string `json:"grantStatus"`
|
|
Remark string `json:"remark"`
|
|
FailureReason string `json:"failureReason"`
|
|
ProviderPayloadJSON string `json:"providerPayloadJson"`
|
|
|
|
WalletCommandID string `json:"walletCommandId"`
|
|
WalletTransactionID string `json:"walletTransactionId"`
|
|
WalletAssetType string `json:"walletAssetType"`
|
|
WalletAmountDelta int64 `json:"walletAmountDelta"`
|
|
WalletBalanceAfter int64 `json:"walletBalanceAfter"`
|
|
|
|
OperatorUserID uint `json:"operatorUserId"`
|
|
OperatorName string `json:"operatorName"`
|
|
VerifiedByUserID *uint `json:"verifiedByUserId"`
|
|
VerifiedByName string `json:"verifiedByName"`
|
|
GrantedByUserID *uint `json:"grantedByUserId"`
|
|
GrantedByName string `json:"grantedByName"`
|
|
VerifiedAtMS *int64 `json:"verifiedAtMs"`
|
|
GrantedAtMS *int64 `json:"grantedAtMs"`
|
|
CreatedAtMS int64 `json:"createdAtMs"`
|
|
UpdatedAtMS int64 `json:"updatedAtMs"`
|
|
}
|
|
|
|
func coinSellerRechargeOrderDTOFromModel(order model.CoinSellerRechargeOrder) coinSellerRechargeOrderDTO {
|
|
return coinSellerRechargeOrderDTO{
|
|
ID: order.ID,
|
|
AppCode: order.AppCode,
|
|
TargetUserID: formatInt64(order.TargetUserID),
|
|
TargetDisplayUserID: order.TargetDisplayUserID,
|
|
TargetCountryID: order.TargetCountryID,
|
|
TargetRegionID: order.TargetRegionID,
|
|
USDAmount: order.USDAmount,
|
|
USDMinorAmount: order.USDMinorAmount,
|
|
CoinAmount: order.CoinAmount,
|
|
ProviderCode: order.ProviderCode,
|
|
Chain: order.Chain,
|
|
ExternalOrderNo: order.ExternalOrderNo,
|
|
ProviderOrderID: order.ProviderOrderID,
|
|
ProviderStatus: order.ProviderStatus,
|
|
ProviderCountryCode: order.ProviderCountryCode,
|
|
ProviderCurrencyCode: order.ProviderCurrencyCode,
|
|
ProviderAmountMinor: order.ProviderAmountMinor,
|
|
ProviderPayType: order.ProviderPayType,
|
|
ReceiveAddress: order.ReceiveAddress,
|
|
OrderDateMS: order.OrderDateMS,
|
|
Status: order.Status,
|
|
VerifyStatus: order.VerifyStatus,
|
|
GrantStatus: order.GrantStatus,
|
|
Remark: order.Remark,
|
|
FailureReason: order.FailureReason,
|
|
ProviderPayloadJSON: order.ProviderPayloadJSON,
|
|
WalletCommandID: order.WalletCommandID,
|
|
WalletTransactionID: order.WalletTransactionID,
|
|
WalletAssetType: order.WalletAssetType,
|
|
WalletAmountDelta: order.WalletAmountDelta,
|
|
WalletBalanceAfter: order.WalletBalanceAfter,
|
|
OperatorUserID: order.OperatorUserID,
|
|
OperatorName: order.OperatorName,
|
|
VerifiedByUserID: order.VerifiedByUserID,
|
|
VerifiedByName: order.VerifiedByName,
|
|
GrantedByUserID: order.GrantedByUserID,
|
|
GrantedByName: order.GrantedByName,
|
|
VerifiedAtMS: order.VerifiedAtMS,
|
|
GrantedAtMS: order.GrantedAtMS,
|
|
CreatedAtMS: order.CreatedAtMS,
|
|
UpdatedAtMS: order.UpdatedAtMS,
|
|
}
|
|
}
|
|
|
|
func coinSellerRechargeOrderDTOsFromModel(orders []model.CoinSellerRechargeOrder) []coinSellerRechargeOrderDTO {
|
|
out := make([]coinSellerRechargeOrderDTO, 0, len(orders))
|
|
for _, order := range orders {
|
|
out = append(out, coinSellerRechargeOrderDTOFromModel(order))
|
|
}
|
|
return out
|
|
}
|