bugfix #4
This commit is contained in:
@@ -257,6 +257,13 @@ class LknpdClient:
|
|||||||
qty_decimal = Decimal(str(quantity))
|
qty_decimal = Decimal(str(quantity))
|
||||||
total = amount_decimal * qty_decimal
|
total = amount_decimal * qty_decimal
|
||||||
|
|
||||||
|
# API expects quantity as integer when it's a whole number
|
||||||
|
qty_value: int | str
|
||||||
|
if qty_decimal == qty_decimal.to_integral_value():
|
||||||
|
qty_value = int(qty_decimal)
|
||||||
|
else:
|
||||||
|
qty_value = str(qty_decimal)
|
||||||
|
|
||||||
# Build request
|
# Build request
|
||||||
request_data = {
|
request_data = {
|
||||||
"operationTime": _format_datetime(op_time),
|
"operationTime": _format_datetime(op_time),
|
||||||
@@ -265,7 +272,7 @@ class LknpdClient:
|
|||||||
{
|
{
|
||||||
"name": name,
|
"name": name,
|
||||||
"amount": str(amount_decimal),
|
"amount": str(amount_decimal),
|
||||||
"quantity": str(qty_decimal),
|
"quantity": qty_value,
|
||||||
}
|
}
|
||||||
],
|
],
|
||||||
"totalAmount": str(total),
|
"totalAmount": str(total),
|
||||||
|
|||||||
Reference in New Issue
Block a user