From 6f3dac2e971f4715aca5cbd627918e87b3b9d92c Mon Sep 17 00:00:00 2001 From: Daniel Egger Date: Mon, 9 Sep 2024 16:54:36 +0200 Subject: [PATCH] Only upload customer xml file again, when `CheckoutInformation`-instance changed --- .../integration_tests/abacus_sftp/test_abacus_sftp.py | 11 +++-------- server/vbv_lernwelt/shop/invoice/abacus.py | 8 +++++--- 2 files changed, 8 insertions(+), 11 deletions(-) diff --git a/server/integration_tests/abacus_sftp/test_abacus_sftp.py b/server/integration_tests/abacus_sftp/test_abacus_sftp.py index 77178ef0..1a173b5f 100644 --- a/server/integration_tests/abacus_sftp/test_abacus_sftp.py +++ b/server/integration_tests/abacus_sftp/test_abacus_sftp.py @@ -171,11 +171,6 @@ def test_upload_abacus_xml(setup_abacus_env): order_filepath = os.path.join( tmppath, "order/myVBV_orde_20240215083312_60000012_6000000124.xml" ) - assert os.path.exists(order_filepath) - with open(order_filepath) as order_file: - order_content = order_file.read() - assert ( - "24021508331287484" - in order_content - ) - assert "60000012" in order_content + + # it should not upload the order file again + assert not os.path.exists(order_filepath) diff --git a/server/vbv_lernwelt/shop/invoice/abacus.py b/server/vbv_lernwelt/shop/invoice/abacus.py index 6aaed41e..a60b0dd2 100644 --- a/server/vbv_lernwelt/shop/invoice/abacus.py +++ b/server/vbv_lernwelt/shop/invoice/abacus.py @@ -52,9 +52,11 @@ def abacus_ssh_upload(checkout_information: CheckoutInformation): abacus_ssh_upload_invoice( customer_xml_filename, customer_xml_content, folder="debitor" ) - abacus_ssh_upload_invoice( - invoice_xml_filename, invoice_xml_content, folder="order" - ) + + 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 = timezone.now()