Skip to content

Commit

Permalink
Added FromTiyinToSoum and FromSoumToTiyin
Browse files Browse the repository at this point in the history
  • Loading branch information
Muhammadali-Akbarov committed Sep 14, 2023
1 parent 079d0c3 commit 18395a0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 2 deletions.
4 changes: 2 additions & 2 deletions receipts.go
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ func (c *SubscribeAPI) createCheck(ctx context.Context, data PaymentDetails) (cr
requestID := fmt.Sprintf("ReceiptsCreate:MerchantTransaction:%s", data.Client.OrderID)

receiptParams := map[string]interface{}{
"amount": data.Amount,
"amount": FromSoumToTiyin(data.Amount),
"account": Account{
OrderID: data.Client.OrderID,
CardID: data.Client.CardData.ID,
Expand Down Expand Up @@ -112,7 +112,7 @@ func (c *SubscribeAPI) createCheckP2P(ctx context.Context, data PaymentDetails)
description := fmt.Sprintf("P2PTransaction for order %s", data.Client.OrderID)

receiptParams := map[string]interface{}{
"amount": data.Amount,
"amount": FromSoumToTiyin(data.Amount),
"token": data.Driver.CardData.Token,
"description": description,
}
Expand Down
8 changes: 8 additions & 0 deletions utils.go
Original file line number Diff line number Diff line change
Expand Up @@ -32,3 +32,11 @@ func handleErrorResponse(responseJson PaymeResponse) (PaymeResponse, error) {

return responseJson, paymeError
}

func FromSoumToTiyin(amount int) int {
return amount * 100
}

func FromTiyinToSoum(amount int) int {
return amount / 100
}

0 comments on commit 18395a0

Please sign in to comment.