wallet amount fix

This commit is contained in:
Yared Yemane 2025-06-30 19:32:36 +03:00
parent abbcf90feb
commit 95499cea7a
3 changed files with 5 additions and 5 deletions

View File

@ -31,7 +31,7 @@ func NewClient(baseURL, secretKey string) *Client {
func (c *Client) InitializePayment(ctx context.Context, req domain.ChapaDepositRequest) (domain.ChapaDepositResponse, error) { func (c *Client) InitializePayment(ctx context.Context, req domain.ChapaDepositRequest) (domain.ChapaDepositResponse, error) {
payload := map[string]interface{}{ payload := map[string]interface{}{
"amount": fmt.Sprintf("%.2f", float64(req.Amount)/100), "amount": fmt.Sprintf("%.2f", float64(req.Amount)),
"currency": req.Currency, "currency": req.Currency,
// "email": req.Email, // "email": req.Email,
"first_name": req.FirstName, "first_name": req.FirstName,

View File

@ -346,12 +346,12 @@ func (s *service) ProcessWin(ctx context.Context, req *domain.PopOKWinRequest) (
return nil, fmt.Errorf("transaction recording failed") 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{ return &domain.PopOKWinResponse{
TransactionID: req.TransactionID, TransactionID: req.TransactionID,
ExternalTrxID: fmt.Sprintf("%v", tx.ID), ExternalTrxID: fmt.Sprintf("%v", tx.ID),
Balance: float64(userWallets[0].Balance) / 100, Balance: float64(userWallets[0].Balance),
}, nil }, nil
} }

View File

@ -209,7 +209,7 @@ func buildNotificationMessage(thresholdPercent int, currentBalance, initialDepos
return fmt.Sprintf( return fmt.Sprintf(
"Company wallet balance has reached %d%% of initial deposit. Current balance: %.2f, Initial deposit: %.2f", "Company wallet balance has reached %d%% of initial deposit. Current balance: %.2f, Initial deposit: %.2f",
thresholdPercent, thresholdPercent,
float64(currentBalance)/100, // Assuming currency is in cents float64(currentBalance), // Assuming currency is in cents
float64(initialDeposit)/100, float64(initialDeposit),
) )
} }