Merged in feature/vbv-703-abacus-export (pull request #349)

VBV-703: abacus filename: timestamp comes first

Approved-by: Christian Cueni
This commit is contained in:
Daniel Egger 2024-07-09 11:57:06 +00:00 committed by Christian Cueni
commit 37d571ab54
3 changed files with 16 additions and 13 deletions

View File

@ -102,7 +102,7 @@ def test_upload_abacus_xml(setup_abacus_env):
assert "<Email>andreas.feuz@eiger-versicherungen.ch</Email>" in debi_content
order_filepath = os.path.join(
tmppath, "order/myVBV_orde_60000012_20240215083312_6000000124.xml"
tmppath, "order/myVBV_orde_20240215083312_60000012_6000000124.xml"
)
assert os.path.exists(order_filepath)
with open(order_filepath) as order_file:

View File

@ -63,7 +63,7 @@ def create_invoice_xml(checkout_information: CheckoutInformation):
# YYYYMMDDhhmmss
filename_datetime = checkout_information.created_at.strftime("%Y%m%d%H%M%S")
invoice_xml_filename = f"myVBV_orde_{customer.abacus_debitor_number}_{filename_datetime}_{checkout_information.abacus_order_id}.xml"
invoice_xml_filename = f"myVBV_orde_{filename_datetime}_{customer.abacus_debitor_number}_{checkout_information.abacus_order_id}.xml"
return invoice_xml_filename, invoice_xml_content
@ -207,17 +207,20 @@ def render_customer_xml(
address_data = SubElement(customer_element, "AddressData", mode="SAVE")
SubElement(address_data, "AddressNumber").text = str(abacus_debitor_number)
SubElement(address_data, "Name").text = last_name
SubElement(address_data, "FirstName").text = first_name
SubElement(address_data, "Name").text = last_name[:100]
SubElement(address_data, "FirstName").text = first_name[:50]
if company_name:
SubElement(address_data, "Text").text = company_name
SubElement(address_data, "Street").text = street
SubElement(address_data, "HouseNumber").text = house_number
SubElement(address_data, "ZIP").text = zip_code
SubElement(address_data, "City").text = city
SubElement(address_data, "Country").text = country
SubElement(address_data, "Language").text = language
SubElement(address_data, "Email").text = email
SubElement(address_data, "Text").text = company_name[:80]
SubElement(address_data, "Street").text = street[:50]
SubElement(address_data, "HouseNumber").text = house_number[:9]
# only take the numbers from zip_code
SubElement(address_data, "ZIP").text = "".join(
filter(lambda ch: str.isdigit(ch), zip_code)
)[:15]
SubElement(address_data, "City").text = city[:50]
SubElement(address_data, "Country").text = country[:4]
SubElement(address_data, "Language").text = language[:6]
SubElement(address_data, "Email").text = email[:65]
return create_xml_string(container)

View File

@ -43,7 +43,7 @@ class AbacusInvoiceTestCase(TestCase):
)
self.assertEqual(
invoice_xml_filename, "myVBV_orde_60000012_20240215083312_6000000124.xml"
invoice_xml_filename, "myVBV_orde_20240215083312_60000012_6000000124.xml"
)
print(invoice_xml_content)