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