From 95499cea7a7debf0166e762828adf7604216bd43 Mon Sep 17 00:00:00 2001 From: Yared Yemane Date: Mon, 30 Jun 2025 19:32:36 +0300 Subject: [PATCH] wallet amount fix --- internal/services/chapa/client.go | 2 +- internal/services/virtualGame/service.go | 4 ++-- internal/services/wallet/monitor/service.go | 4 ++-- 3 files changed, 5 insertions(+), 5 deletions(-) diff --git a/internal/services/chapa/client.go b/internal/services/chapa/client.go index baac2fd..3beed5b 100644 --- a/internal/services/chapa/client.go +++ b/internal/services/chapa/client.go @@ -31,7 +31,7 @@ func NewClient(baseURL, secretKey string) *Client { func (c *Client) InitializePayment(ctx context.Context, req domain.ChapaDepositRequest) (domain.ChapaDepositResponse, error) { payload := map[string]interface{}{ - "amount": fmt.Sprintf("%.2f", float64(req.Amount)/100), + "amount": fmt.Sprintf("%.2f", float64(req.Amount)), "currency": req.Currency, // "email": req.Email, "first_name": req.FirstName, diff --git a/internal/services/virtualGame/service.go b/internal/services/virtualGame/service.go index cd69636..2bc4f9e 100644 --- a/internal/services/virtualGame/service.go +++ b/internal/services/virtualGame/service.go @@ -346,12 +346,12 @@ func (s *service) ProcessWin(ctx context.Context, req *domain.PopOKWinRequest) ( return nil, fmt.Errorf("transaction recording failed") } - fmt.Printf("\n\n Win balance is:%v\n\n", float64(userWallets[0].Balance)/100) + fmt.Printf("\n\n Win balance is:%v\n\n", float64(userWallets[0].Balance)) return &domain.PopOKWinResponse{ TransactionID: req.TransactionID, ExternalTrxID: fmt.Sprintf("%v", tx.ID), - Balance: float64(userWallets[0].Balance) / 100, + Balance: float64(userWallets[0].Balance), }, nil } diff --git a/internal/services/wallet/monitor/service.go b/internal/services/wallet/monitor/service.go index 4f48115..e3f7bc5 100644 --- a/internal/services/wallet/monitor/service.go +++ b/internal/services/wallet/monitor/service.go @@ -209,7 +209,7 @@ func buildNotificationMessage(thresholdPercent int, currentBalance, initialDepos return fmt.Sprintf( "Company wallet balance has reached %d%% of initial deposit. Current balance: %.2f, Initial deposit: %.2f", thresholdPercent, - float64(currentBalance)/100, // Assuming currency is in cents - float64(initialDeposit)/100, + float64(currentBalance), // Assuming currency is in cents + float64(initialDeposit), ) }