Update cart.go

This commit is contained in:
Mikhail 2023-08-19 14:31:49 +00:00
parent c38b20ffc0
commit a9a4cb57d1

@ -149,7 +149,7 @@ func (receiver *Service) Pay(ctx context.Context, accessToken string, userID str
return err return err
} }
receiver.logger.Debug("account for buy cart", zap.Any("trtr", account)) receiver.logger.Info("account for buy cart", zap.Any("trtr", account))
tariffs, err := receiver.hubadminClient.GetTariffs(ctx, accessToken, account.Cart) tariffs, err := receiver.hubadminClient.GetTariffs(ctx, accessToken, account.Cart)
if err != nil { if err != nil {
@ -157,10 +157,10 @@ func (receiver *Service) Pay(ctx context.Context, accessToken string, userID str
return err return err
} }
receiver.logger.Debug("tariffs for buy cart", zap.Any("trtr", tariffs)) receiver.logger.Info("tariffs for buy cart", zap.Any("trtr", tariffs))
tariffsAmount := utils.CalculateCartPurchasesAmount(tariffs) tariffsAmount := utils.CalculateCartPurchasesAmount(tariffs)
receiver.logger.Debug("tariffsAmount for buy cart", zap.Any("trtr", tariffsAmount)) receiver.logger.Info("tariffsAmount for buy cart", zap.Any("trtr", tariffsAmount))
response, err := receiver.discountClient.Apply(ctx, &discount.ApplyDiscountRequest{ response, err := receiver.discountClient.Apply(ctx, &discount.ApplyDiscountRequest{
UserInformation: &discount.UserInformation{ UserInformation: &discount.UserInformation{
@ -177,7 +177,7 @@ func (receiver *Service) Pay(ctx context.Context, accessToken string, userID str
return err return err
} }
receiver.logger.Debug("applyed discounts for buy cart", zap.Any("trtr", response)) receiver.logger.Info("applyed discounts for buy cart", zap.Any("trtr", response))
if account.Wallet.Money < int64(response.Price) { if account.Wallet.Money < int64(response.Price) {
receiver.logger.Error("insufficient funds on <Pay> of <CartService>") receiver.logger.Error("insufficient funds on <Pay> of <CartService>")