generated from PenaSide/GolangTemplate
Update cart.go
This commit is contained in:
parent
476f54c2f2
commit
f39e5a66f0
@ -148,12 +148,15 @@ func (receiver *Service) Pay(ctx context.Context, accessToken string, userID str
|
|||||||
receiver.logger.Error("failed to find account on <Pay> of <CartService>", zap.String("userID", userID), zap.Error(err))
|
receiver.logger.Error("failed to find account on <Pay> of <CartService>", zap.String("userID", userID), zap.Error(err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
receiver.logger.Debug("account for buy cart", zap.Any("trtr", account))
|
receiver.logger.Debug("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 {
|
||||||
receiver.logger.Error("failed to get tarrifs on <Pay> of <CartService>", zap.Strings("cart", account.Cart), zap.Error(err))
|
receiver.logger.Error("failed to get tarrifs on <Pay> of <CartService>", zap.Strings("cart", account.Cart), zap.Error(err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
receiver.logger.Debug("tariffs for buy cart", zap.Any("trtr",tariffs))
|
receiver.logger.Debug("tariffs for buy cart", zap.Any("trtr",tariffs))
|
||||||
|
|
||||||
tariffsAmount := utils.CalculateCartPurchasesAmount(tariffs)
|
tariffsAmount := utils.CalculateCartPurchasesAmount(tariffs)
|
||||||
@ -173,6 +176,7 @@ func (receiver *Service) Pay(ctx context.Context, accessToken string, userID str
|
|||||||
receiver.logger.Error("failed to discount on <Pay> of <CartService>", zap.Error(err))
|
receiver.logger.Error("failed to discount on <Pay> of <CartService>", zap.Error(err))
|
||||||
return err
|
return err
|
||||||
}
|
}
|
||||||
|
|
||||||
receiver.logger.Debug("applyed discounts for buy cart", zap.Any("trtr",response))
|
receiver.logger.Debug("applyed discounts for buy cart", zap.Any("trtr",response))
|
||||||
|
|
||||||
if account.Wallet.Money < int64(response.Price) {
|
if account.Wallet.Money < int64(response.Price) {
|
||||||
|
Loading…
Reference in New Issue
Block a user