generated from PenaSide/GolangTemplate
Update cart.go
This commit is contained in:
parent
c1e0926d2c
commit
f4b39119f1
@ -148,16 +148,16 @@ 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
|
||||||
}
|
}
|
||||||
reciever.logger.Debug("account for buy cart", zap.Any(account))
|
reciever.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
|
||||||
}
|
}
|
||||||
reciever.logger.Debug("tariffs for buy cart", zap.Any(tariffs))
|
reciever.logger.Debug("tariffs for buy cart", zap.Any("trtr",tariffs))
|
||||||
|
|
||||||
tariffsAmount := utils.CalculateCartPurchasesAmount(tariffs)
|
tariffsAmount := utils.CalculateCartPurchasesAmount(tariffs)
|
||||||
reciever.logger.Debug("tariffsAmount for buy cart", zap.Any(tariffsAmount))
|
reciever.logger.Debug("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{
|
||||||
@ -173,7 +173,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
|
||||||
}
|
}
|
||||||
reciever.logger.Debug("applyed discounts for buy cart", zap.Any(response))
|
reciever.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) {
|
||||||
receiver.logger.Error("insufficient funds on <Pay> of <CartService>")
|
receiver.logger.Error("insufficient funds on <Pay> of <CartService>")
|
||||||
|
Loading…
Reference in New Issue
Block a user