From 2f8d5312eb8145c84b09b1f48d37d34db4598350 Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Tue, 4 Jun 2024 14:20:02 +0200 Subject: [PATCH] Change text for abacus invoice --- server/vbv_lernwelt/shop/invoice/abacus.py | 27 ++++++++++--------- .../shop/invoice/abacus_sftp_client.py | 2 ++ 2 files changed, 16 insertions(+), 13 deletions(-) diff --git a/server/vbv_lernwelt/shop/invoice/abacus.py b/server/vbv_lernwelt/shop/invoice/abacus.py index a7c8bc31..1bc7cd2d 100644 --- a/server/vbv_lernwelt/shop/invoice/abacus.py +++ b/server/vbv_lernwelt/shop/invoice/abacus.py @@ -17,21 +17,22 @@ def abacus_ssh_upload(checkout_information: CheckoutInformation): return True try: - invoice_xml_filename, invoice_xml_content = create_invoice_xml( - checkout_information - ) - customer_xml_filename, customer_xml_content = create_customer_xml( - checkout_information - ) - - abacus_ssh_upload_invoice( - customer_xml_filename, customer_xml_content, folder="debitor" - ) - 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 + ) + customer_xml_filename, customer_xml_content = create_customer_xml( + checkout_information + ) + + abacus_ssh_upload_invoice( + customer_xml_filename, customer_xml_content, folder="debitor" + ) 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 diff --git a/server/vbv_lernwelt/shop/invoice/abacus_sftp_client.py b/server/vbv_lernwelt/shop/invoice/abacus_sftp_client.py index e58f2443..524fee06 100644 --- a/server/vbv_lernwelt/shop/invoice/abacus_sftp_client.py +++ b/server/vbv_lernwelt/shop/invoice/abacus_sftp_client.py @@ -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