Skip to content

Commit

Permalink
Merge pull request #2933 from bcgov/fix/daniel-fix-int-rounding-1414
Browse files Browse the repository at this point in the history
fix: Convert Decimal to int
  • Loading branch information
dhaselhan authored Dec 16, 2024
2 parents ce50f52 + 2c0941e commit a623b8e
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions backend/api/services/TransactionMessageService.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
import json
from decimal import Decimal

import pika
from pika.exceptions import AMQPError
from tfrs.settings import AMQP_CONNECTION_PARAMETERS
Expand All @@ -13,8 +15,9 @@ class TransactionDeliveryFailure(Exception):
class TransactionMessageService:
@staticmethod
def send_transaction_message(
tfrs_id: int, organization_id: int, compliance_units_amount: int
tfrs_id: int, organization_id: int, compliance_units_amount: Decimal
):

try:
# Use existing AMQP connection parameters from settings
parameters = AMQP_CONNECTION_PARAMETERS
Expand All @@ -28,7 +31,7 @@ def send_transaction_message(
message = {
"tfrs_id": tfrs_id,
"organization_id": organization_id,
"compliance_units_amount": compliance_units_amount,
"compliance_units_amount": int(compliance_units_amount.to_integral_value()),
}

# Publish the message to the queue
Expand Down

0 comments on commit a623b8e

Please sign in to comment.