(20250225) fml

This commit is contained in:
2025-02-25 16:59:00 +05:30
parent e8cb43247b
commit b70b40c4b2
3 changed files with 28 additions and 2 deletions
+26 -2
View File
@@ -35,6 +35,9 @@ import sys
sys.path.append(".")
sys.path.append("..")
# For Quart:
from quart import current_app
# My async utils:
from utils_v2.string import json
from utils_v2.date_time import date_time
@@ -365,7 +368,7 @@ class PaymentsController(CoreAuthTokenController, ABC):
) -> bool:
"""
???
??? Fuck it. Not worth breaking your head over.
:param sql_conn: The database connection to use to perform this activity.
:param mongo_data_conn: The database connection to use to perform this activity.
:param payment: The record of the payment whose details need to be added as a receipt.
@@ -373,7 +376,28 @@ class PaymentsController(CoreAuthTokenController, ABC):
:return: True is the receipt was added, else False.
"""
pass
# If this is not an against-sale kind of transaction:
if not payment.metadata.reference.strip().lower().find("against sale"):
return True
# If this is against some sale:
api_response = await current_app.http_client.post(
url = "https://api.thecaoffice.com/account/sales/transaction/add",
headers = {"X-Session-Token": session_token},
json = {
"transactionDate": date_time.get_current_date_time().strftime("%Y-%m-%d"),
"clientId": payment.metadata.idClient,
"clientName": payment.metadata.,
"clientAddress": None,
"deliveryAddress": None,
"total": payment.amount,
"documentUrl": None,
"invoiceNo": None,
"deliveryBoyId": None,
"deliveryBoyName": None,
"lineItems": payment.metadata.againstReference
}
)
async def add_event_by_payment_id(
self,