fix err amount - int64
This commit is contained in:
parent
92d90b8ab9
commit
4a4048d381
@ -29,7 +29,7 @@ type AlchemyAddressActivityWebhook struct {
|
||||
} `json:"rawContract"`
|
||||
ToAddress string `json:"toAddress"`
|
||||
//TypeTraceAddress interface{} `json:"typeTraceAddress"`
|
||||
Value float64 `json:"value"`
|
||||
Value int64 `json:"value"`
|
||||
} `json:"activity"`
|
||||
Network string `json:"network"`
|
||||
} `json:"event"`
|
||||
|
@ -24,7 +24,7 @@ type Provider struct {
|
||||
}
|
||||
|
||||
type Deps struct {
|
||||
Repository *repository.PaymentMethodRepository
|
||||
Repository *repository.PaymentRepository
|
||||
Logger *zap.Logger
|
||||
Config *Config
|
||||
}
|
||||
@ -63,8 +63,7 @@ func (p *Provider) handleWebhook(ctx *fiber.Ctx) error {
|
||||
if act.ToAddress != p.config.WalletAddress {
|
||||
continue
|
||||
}
|
||||
amountStr := fmt.Sprintf("%v", act.Value)
|
||||
payment, err := p.repository.FindByWalletAddressAndAmount(ctx.Context(), act.FromAddress, amountStr)
|
||||
payment, err := p.repository.FindByWalletAddressAndAmount(ctx.Context(), act.FromAddress, act.Value)
|
||||
if err != nil {
|
||||
if err.Type() == errors.ErrNotFound {
|
||||
return ctx.Status(fiber.StatusNotFound).SendString(fmt.Sprintf("payment not found: %s", err.Error()))
|
||||
|
@ -161,7 +161,7 @@ func (r *PaymentRepository) SetPaymentStatus(ctx context.Context, paymentID stri
|
||||
return &payment, nil
|
||||
}
|
||||
|
||||
func (r *PaymentRepository) FindByWalletAddressAndAmount(ctx context.Context, walletAddress string, amount string) (*models.Payment, errors.Error) {
|
||||
func (r *PaymentRepository) FindByWalletAddressAndAmount(ctx context.Context, walletAddress string, amount int64) (*models.Payment, errors.Error) {
|
||||
payment := models.Payment{}
|
||||
filter := bson.M{
|
||||
PaymentFields.WalletAddress: walletAddress,
|
||||
@ -172,7 +172,7 @@ func (r *PaymentRepository) FindByWalletAddressAndAmount(ctx context.Context, wa
|
||||
r.logger.Error("failed to find payment by walletAddress and amount on <FindByWalletAddressAndAmount> of <PaymentRepository>",
|
||||
zap.Error(err),
|
||||
zap.String("walletAddress", walletAddress),
|
||||
zap.String("amount", amount),
|
||||
zap.Int64("amount", amount),
|
||||
)
|
||||
|
||||
findErr := errors.NewWithError(
|
||||
|
Loading…
Reference in New Issue
Block a user