package hostorg import walletv1 "hyapp.local/api/proto/wallet/v1" type coinSellerStockCreditResponse struct { TransactionID string `json:"transactionId"` SellerUserID int64 `json:"sellerUserId,string"` StockType string `json:"stockType"` CoinAmount int64 `json:"coinAmount"` PaidCurrencyCode string `json:"paidCurrencyCode"` PaidAmountMicro int64 `json:"paidAmountMicro"` CountsAsSellerRecharge bool `json:"countsAsSellerRecharge"` BalanceAfter int64 `json:"balanceAfter"` CreatedAtMS int64 `json:"createdAtMs"` } type coinSellerStockDebitResponse struct { TransactionID string `json:"transactionId"` SellerUserID int64 `json:"sellerUserId,string"` CoinAmount int64 `json:"coinAmount"` AvailableDelta int64 `json:"availableDelta"` BalanceAfter int64 `json:"balanceAfter"` } func coinSellerStockCreditFromProto(item *walletv1.AdminCreditCoinSellerStockResponse) coinSellerStockCreditResponse { if item == nil { return coinSellerStockCreditResponse{} } return coinSellerStockCreditResponse{ TransactionID: item.GetTransactionId(), SellerUserID: item.GetSellerUserId(), StockType: item.GetStockType(), CoinAmount: item.GetCoinAmount(), PaidCurrencyCode: item.GetPaidCurrencyCode(), PaidAmountMicro: item.GetPaidAmountMicro(), CountsAsSellerRecharge: item.GetCountsAsSellerRecharge(), BalanceAfter: item.GetBalanceAfter(), CreatedAtMS: item.GetCreatedAtMs(), } } func coinSellerStockDebitFromProto(sellerUserID int64, coinAmount int64, item *walletv1.AdminCreditAssetResponse) coinSellerStockDebitResponse { if item == nil { return coinSellerStockDebitResponse{SellerUserID: sellerUserID, CoinAmount: coinAmount, AvailableDelta: -coinAmount} } balanceAfter := int64(0) if item.GetBalance() != nil { balanceAfter = item.GetBalance().GetAvailableAmount() } return coinSellerStockDebitResponse{ TransactionID: item.GetTransactionId(), SellerUserID: sellerUserID, CoinAmount: coinAmount, AvailableDelta: -coinAmount, BalanceAfter: balanceAfter, } }