Change text for abacus invoice
This commit is contained in:
parent
6de5660f31
commit
2f8d5312eb
|
|
@ -17,21 +17,22 @@ def abacus_ssh_upload(checkout_information: CheckoutInformation):
|
||||||
return True
|
return True
|
||||||
|
|
||||||
try:
|
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:
|
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(
|
abacus_ssh_upload_invoice(
|
||||||
invoice_xml_filename, invoice_xml_content, folder="order"
|
invoice_xml_filename, invoice_xml_content, folder="order"
|
||||||
)
|
)
|
||||||
|
|
||||||
checkout_information.abacus_ssh_upload_done = True
|
checkout_information.abacus_ssh_upload_done = True
|
||||||
checkout_information.invoice_transmitted_at = datetime.datetime.now()
|
checkout_information.invoice_transmitted_at = datetime.datetime.now()
|
||||||
checkout_information.save()
|
checkout_information.save()
|
||||||
|
|
@ -42,6 +43,7 @@ def abacus_ssh_upload(checkout_information: CheckoutInformation):
|
||||||
"Error uploading invoice to Abacus SFTP",
|
"Error uploading invoice to Abacus SFTP",
|
||||||
checkout_information_id=checkout_information.id,
|
checkout_information_id=checkout_information.id,
|
||||||
exception=str(e),
|
exception=str(e),
|
||||||
|
exc_info=True,
|
||||||
)
|
)
|
||||||
return False
|
return False
|
||||||
|
|
||||||
|
|
@ -56,8 +58,7 @@ def create_invoice_xml(checkout_information: CheckoutInformation):
|
||||||
abacus_order_id=checkout_information.abacus_order_id,
|
abacus_order_id=checkout_information.abacus_order_id,
|
||||||
datatrans_transaction_id=checkout_information.transaction_id,
|
datatrans_transaction_id=checkout_information.transaction_id,
|
||||||
order_date=checkout_information.created_at.date(),
|
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
|
# YYYYMMDDhhmmss
|
||||||
|
|
|
||||||
|
|
@ -11,6 +11,8 @@ def _create_abacus_sftp_client():
|
||||||
port=settings.ABACUS_EXPORT_SFTP_PORT,
|
port=settings.ABACUS_EXPORT_SFTP_PORT,
|
||||||
username=settings.ABACUS_EXPORT_SFTP_USERNAME,
|
username=settings.ABACUS_EXPORT_SFTP_USERNAME,
|
||||||
password=settings.ABACUS_EXPORT_SFTP_PASSWORD,
|
password=settings.ABACUS_EXPORT_SFTP_PASSWORD,
|
||||||
|
look_for_keys=False,
|
||||||
|
allow_agent=False,
|
||||||
)
|
)
|
||||||
|
|
||||||
return ssh_client.open_sftp(), ssh_client
|
return ssh_client.open_sftp(), ssh_client
|
||||||
|
|
|
||||||
Loading…
Reference in New Issue