added new mongo field crypto amount - float64
This commit is contained in:
parent
4a4048d381
commit
570b1c0d2e
@ -29,7 +29,7 @@ type AlchemyAddressActivityWebhook struct {
|
||||
} `json:"rawContract"`
|
||||
ToAddress string `json:"toAddress"`
|
||||
//TypeTraceAddress interface{} `json:"typeTraceAddress"`
|
||||
Value int64 `json:"value"`
|
||||
Value float64 `json:"value"`
|
||||
} `json:"activity"`
|
||||
Network string `json:"network"`
|
||||
} `json:"event"`
|
||||
|
@ -30,7 +30,8 @@ type Payment struct {
|
||||
*/
|
||||
CallbackHostGRPC []string `json:"callbackHostGrpc" bson:"callbackHostGrpc"`
|
||||
|
||||
WalletAddress string // for crypto
|
||||
WalletAddress string `json:"walletAddress" bson:"walletAddress"` // for crypto
|
||||
CryptoAmount float64 `json:"cryptoAmount" bson:"cryptoAmount"` // for crypto
|
||||
}
|
||||
|
||||
func (p *Payment) Sanitize() *Payment {
|
||||
|
@ -33,6 +33,7 @@ var PaymentFields = struct {
|
||||
CallbackHostGRPC string
|
||||
|
||||
WalletAddress string // for crypto
|
||||
CryptoAmount string // for crypto
|
||||
}{
|
||||
ID: "_id",
|
||||
UserID: "userId",
|
||||
@ -52,6 +53,7 @@ var PaymentFields = struct {
|
||||
CallbackHostGRPC: "callbackHostGrpc",
|
||||
|
||||
WalletAddress: "walletAddress",
|
||||
CryptoAmount: "cryptoAmount",
|
||||
}
|
||||
|
||||
type PaymentRepositoryDeps struct {
|
||||
@ -161,18 +163,18 @@ func (r *PaymentRepository) SetPaymentStatus(ctx context.Context, paymentID stri
|
||||
return &payment, nil
|
||||
}
|
||||
|
||||
func (r *PaymentRepository) FindByWalletAddressAndAmount(ctx context.Context, walletAddress string, amount int64) (*models.Payment, errors.Error) {
|
||||
func (r *PaymentRepository) FindByWalletAddressAndAmount(ctx context.Context, walletAddress string, cryptoAmount float64) (*models.Payment, errors.Error) {
|
||||
payment := models.Payment{}
|
||||
filter := bson.M{
|
||||
PaymentFields.WalletAddress: walletAddress,
|
||||
PaymentFields.Amount: amount,
|
||||
PaymentFields.CryptoAmount: cryptoAmount,
|
||||
PaymentFields.Completed: false, //не завершённые
|
||||
}
|
||||
if err := r.collection.FindOne(ctx, filter).Decode(&payment); err != nil {
|
||||
r.logger.Error("failed to find payment by walletAddress and amount on <FindByWalletAddressAndAmount> of <PaymentRepository>",
|
||||
zap.Error(err),
|
||||
zap.String("walletAddress", walletAddress),
|
||||
zap.Int64("amount", amount),
|
||||
zap.Float64("amount", cryptoAmount),
|
||||
)
|
||||
|
||||
findErr := errors.NewWithError(
|
||||
|
Loading…
Reference in New Issue
Block a user