Change text for abacus invoice

This commit is contained in:
Daniel Egger 2024-06-04 14:20:02 +02:00
parent 6de5660f31
commit 2f8d5312eb
2 changed files with 16 additions and 13 deletions

View File

@ -17,6 +17,8 @@ def abacus_ssh_upload(checkout_information: CheckoutInformation):
return True
try:
if not checkout_information.abacus_ssh_upload_done:
# only upload data for not yet uploaded invoices
invoice_xml_filename, invoice_xml_content = create_invoice_xml(
checkout_information
)
@ -27,11 +29,10 @@ def abacus_ssh_upload(checkout_information: CheckoutInformation):
abacus_ssh_upload_invoice(
customer_xml_filename, customer_xml_content, folder="debitor"
)
if not checkout_information.abacus_ssh_upload_done:
abacus_ssh_upload_invoice(
invoice_xml_filename, invoice_xml_content, folder="order"
)
checkout_information.abacus_ssh_upload_done = True
checkout_information.invoice_transmitted_at = datetime.datetime.now()
checkout_information.save()
@ -42,6 +43,7 @@ def abacus_ssh_upload(checkout_information: CheckoutInformation):
"Error uploading invoice to Abacus SFTP",
checkout_information_id=checkout_information.id,
exception=str(e),
exc_info=True,
)
return False
@ -56,8 +58,7 @@ def create_invoice_xml(checkout_information: CheckoutInformation):
abacus_order_id=checkout_information.abacus_order_id,
datatrans_transaction_id=checkout_information.transaction_id,
order_date=checkout_information.created_at.date(),
# TODO was ist der korrekte text für die item_description?
item_description=f"{checkout_information.product_name} - {checkout_information.created_at.date().isoformat()} - {checkout_information.user.last_name} {checkout_information.user.first_name}",
item_description=f"{checkout_information.product_name}, {checkout_information.created_at.date().isoformat()}, {checkout_information.user.last_name} {checkout_information.user.first_name}",
)
# YYYYMMDDhhmmss

View File

@ -11,6 +11,8 @@ def _create_abacus_sftp_client():
port=settings.ABACUS_EXPORT_SFTP_PORT,
username=settings.ABACUS_EXPORT_SFTP_USERNAME,
password=settings.ABACUS_EXPORT_SFTP_PASSWORD,
look_for_keys=False,
allow_agent=False,
)
return ssh_client.open_sftp(), ssh_client