Update fiat amount handling in models and transaction processor: Modified models to store fiat amounts in centavos for precision. Adjusted transaction processing logic to calculate and display fiat values in centavos, ensuring consistency across the application. Enhanced comments for clarity on the new storage format.

This commit is contained in:
padreug 2025-07-05 14:58:38 +02:00
parent 7af0e47d48
commit e222922a6a
2 changed files with 17 additions and 14 deletions

View file

@ -62,7 +62,7 @@ class UpdateDepositStatusData(BaseModel):
class CreateDcaPaymentData(BaseModel):
client_id: str
amount_sats: int
amount_fiat: int
amount_fiat: int # Stored in centavos (GTQ * 100) for precision
exchange_rate: float
transaction_type: str # 'flow', 'fixed', 'manual', 'commission'
lamassu_transaction_id: Optional[str] = None
@ -74,7 +74,7 @@ class DcaPayment(BaseModel):
id: str
client_id: str
amount_sats: int
amount_fiat: int
amount_fiat: int # Stored in centavos (GTQ * 100) for precision
exchange_rate: float
transaction_type: str
lamassu_transaction_id: Optional[str]
@ -96,7 +96,7 @@ class ClientBalanceSummary(BaseModel):
# Transaction Processing Models
class LamassuTransaction(BaseModel):
transaction_id: str
amount_fiat: int
amount_fiat: int # Stored in centavos (GTQ * 100) for precision
amount_crypto: int
exchange_rate: float
transaction_type: str # 'cash_in' or 'cash_out'
@ -107,7 +107,7 @@ class LamassuTransaction(BaseModel):
# Lamassu Transaction Storage Models
class CreateLamassuTransactionData(BaseModel):
lamassu_transaction_id: str
fiat_amount: int
fiat_amount: int # Stored in centavos (GTQ * 100) for precision
crypto_amount: int
commission_percentage: float
discount: float = 0.0