diff --git a/receipts.go b/receipts.go index 9236bf8..9035de7 100644 --- a/receipts.go +++ b/receipts.go @@ -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, @@ -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, } diff --git a/utils.go b/utils.go index aaa1c1f..bf60c98 100644 --- a/utils.go +++ b/utils.go @@ -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 +}