Only upload customer xml file again, when `CheckoutInformation`-instance changed

This commit is contained in:
Daniel Egger 2024-09-09 16:54:36 +02:00
parent 7a1c2c3863
commit 6f3dac2e97
2 changed files with 8 additions and 11 deletions

View File

@ -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 (
"<ReferencePurchaseOrder>24021508331287484</ReferencePurchaseOrder>"
in order_content
)
assert "<CustomerNumber>60000012</CustomerNumber>" in order_content
# it should not upload the order file again
assert not os.path.exists(order_filepath)

View File

@ -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()