Skip to content

Commit

Permalink
fix
Browse files Browse the repository at this point in the history
  • Loading branch information
KranjQ committed Dec 16, 2024
1 parent 489fd89 commit 189b787
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 3 deletions.
2 changes: 1 addition & 1 deletion internal/pkg/auth/delivery/http/signup/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ func (h *Handler) Handle(w http.ResponseWriter, r *http.Request) {
createBalancesRequest := &generatedPayments.CreateBalancesRequest{
UserID: id.UserId,
MoneyAmount: 0,
DailyAmount: 10,
DailyAmount: consts.DailyLikeLimit,
PurchasedAmount: 5,
}
_, err = h.paymentsClient.CreateBalances(ctx, createBalancesRequest)
Expand Down
6 changes: 4 additions & 2 deletions internal/pkg/payments/delivery/http/acceptpayment/handler.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,23 @@ func (h *Handler) Handle(w http.ResponseWriter, r *http.Request) {
http.Error(w, "decode json error", http.StatusBadRequest)
return
}
h.logger.Info("handle request", zap.Any("jsonData", jsonData))
amount := jsonData["amount"].(map[string]interface{})

h.logger.Info("amount", zap.Any("amount", amount))
price, err := strconv.Atoi(amount["value"].(string))
if err != nil {
h.logger.Error("parse json price", zap.Error(err))
http.Error(w, "parse json error", http.StatusBadRequest)
return
}
h.logger.Info("price", zap.Any("price", price))
payerID, err := strconv.Atoi(jsonData["description"].(string))
if err != nil {
h.logger.Error("parse json payer id", zap.Error(err))
http.Error(w, "parse json error", http.StatusBadRequest)
return
}

h.logger.Info("payer", zap.Any("payerID", payerID))
changeBalanceReq := generatedPayments.ChangeBalanceRequest{
UserID: int32(payerID),
Amount: int32(price),
Expand Down

0 comments on commit 189b787

Please sign in to comment.