- Implement tests for basic and bearer authentication headers in `test_auth.py`. - Create tests for the `EasybillWebhookParser` in `test_webhooks.py`, covering JSON and form-encoded payloads, as well as a generic parse and acknowledgement method.
212 lines
9.9 KiB
Python
212 lines
9.9 KiB
Python
# coding: utf-8
|
|
|
|
"""
|
|
easybill REST API
|
|
|
|
The first version of the easybill REST API. [CHANGELOG](https://api.easybill.de/rest/v1/CHANGELOG.md) ## Authentication You can choose between two available methods: `Basic Auth` or `Bearer Token`. In each HTTP request, one of the following HTTP headers is required: ``` # Basic Auth Authorization: Basic base64_encode('<email>:<api_key>') # Bearer Token Authorization: Bearer <api_key> ``` ## Limitations ### Request Limit * PLUS: 10 requests per minute * BUSINESS: 60 requests per minute If the limit is exceeded, you will receive the HTTP error: `429 Too Many Requests` ### Result Limit All result lists are limited to 100 by default. This limit can be increased by the query parameter `limit` to a maximum of 1000. ## Query filter Many list resources can be filtered. In `/documents` you can filter e.g. by number with `/documents?number=111028654`. If you want to filter multiple numbers, you can either enter them separated by commas `/documents?number=111028654,222006895` or as an array `/documents?number[]=111028654&number[]=222006895`. **Warning**: The maximum size of an HTTP request line in bytes is 4094. If this limit is exceeded, you will receive the HTTP error: `414 Request-URI Too Large` ### Escape commas in query You can escape commans in query `name=Patrick\\, Peter` if you submit the header `X-Easybill-Escape: true` in your request. ## Property login_id This is the login of your admin or employee account. ## Date and Date-Time format Please use the timezone `Europe/Berlin`. * **date** = *Y-m-d* = `2016-12-31` * **date-time** = *Y-m-d H:i:s* = `2016-12-31 03:13:37` Date or datetime can be `null` because the attributes have been added later and the entry is older.
|
|
|
|
The version of the OpenAPI document: 1.96.0
|
|
Generated by OpenAPI Generator (https://openapi-generator.tech)
|
|
|
|
Do not edit the class manually.
|
|
""" # noqa: E501
|
|
|
|
|
|
import unittest
|
|
|
|
from easybill_generated_async.models.document import Document
|
|
|
|
class TestDocument(unittest.TestCase):
|
|
"""Document unit test stubs"""
|
|
|
|
def setUp(self):
|
|
pass
|
|
|
|
def tearDown(self):
|
|
pass
|
|
|
|
def make_instance(self, include_optional) -> Document:
|
|
"""Test Document
|
|
include_optional is a boolean, when False only required
|
|
params are included, when True both required and
|
|
optional params are included """
|
|
# uncomment below to create an instance of `Document`
|
|
"""
|
|
model = Document()
|
|
if include_optional:
|
|
return Document(
|
|
address = easybill_generated_async.models.document_address.DocumentAddress(
|
|
salutation = 56,
|
|
personal = False,
|
|
title = 'Dr.',
|
|
first_name = 'Max',
|
|
last_name = 'Mustermann',
|
|
suffix_1 = 'Abteilung Vertrieb',
|
|
suffix_2 = '3. Etage',
|
|
company_name = 'Musterunternehmen AG',
|
|
street = 'Musterstr.',
|
|
zip_code = '12345',
|
|
city = 'Musterstadt',
|
|
state = 'NRW',
|
|
country = 'DE', ),
|
|
advanced_data_fields = [],
|
|
attachment_ids = [],
|
|
label_address = easybill_generated_async.models.document_address.DocumentAddress(
|
|
salutation = 56,
|
|
personal = False,
|
|
title = 'Dr.',
|
|
first_name = 'Max',
|
|
last_name = 'Mustermann',
|
|
suffix_1 = 'Abteilung Vertrieb',
|
|
suffix_2 = '3. Etage',
|
|
company_name = 'Musterunternehmen AG',
|
|
street = 'Musterstr.',
|
|
zip_code = '12345',
|
|
city = 'Musterstadt',
|
|
state = 'NRW',
|
|
country = 'DE', ),
|
|
amount = 56,
|
|
amount_net = 56,
|
|
anonymize_due_date = 'Thu Feb 07 00:00:00 UTC 2019',
|
|
anonymize_status = 'NOT_ANONYMIZED',
|
|
anonymized_at = '2019-02-07 00:00:00',
|
|
bank_debit_form = 'null',
|
|
billing_country = 'null',
|
|
calc_vat_from = 0,
|
|
cancel_id = 56,
|
|
cash_allowance = 1.337,
|
|
cash_allowance_days = 56,
|
|
cash_allowance_text = 'null',
|
|
contact_id = 56,
|
|
contact_label = '',
|
|
contact_text = '',
|
|
created_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'),
|
|
currency = 'EUR',
|
|
customer_id = 56,
|
|
customer_snapshot = None,
|
|
discount = 'null',
|
|
discount_type = 'PERCENT',
|
|
document_date = 'Thu Feb 07 00:00:00 UTC 2019',
|
|
due_date = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(),
|
|
edited_at = datetime.datetime.strptime('2013-10-20 19:20:30.00', '%Y-%m-%d %H:%M:%S.%f'),
|
|
external_id = 'null',
|
|
replica_url = 'null',
|
|
grace_period = 56,
|
|
due_in_days = 56,
|
|
id = 56,
|
|
is_acceptable_on_public_domain = False,
|
|
is_archive = False,
|
|
is_draft = True,
|
|
is_replica = False,
|
|
is_oss = False,
|
|
item_notes = [
|
|
''
|
|
],
|
|
items = [
|
|
easybill_generated_async.models.document_position.DocumentPosition(
|
|
number = 'null',
|
|
description = 'null',
|
|
document_note = 'Test Note',
|
|
quantity = 1.0,
|
|
quantity_str = '1:30 h',
|
|
unit = 'null',
|
|
type = 'POSITION',
|
|
position = 1,
|
|
single_price_net = 75.0,
|
|
single_price_gross = 1.337,
|
|
vat_percent = 0.0,
|
|
discount = 10.0,
|
|
discount_type = 'PERCENT',
|
|
position_id = 123456,
|
|
total_price_net = 1.337,
|
|
total_price_gross = 1.337,
|
|
total_vat = 1.337,
|
|
serial_number_id = 'SN-2023-001-ID',
|
|
serial_number = 'SN-2023-001',
|
|
booking_account = 'null',
|
|
export_cost_1 = 'null',
|
|
export_cost_2 = 'null',
|
|
cost_price_net = 45.5,
|
|
cost_price_total = 45.5,
|
|
cost_price_charge = 10.0,
|
|
cost_price_charge_type = 'PERCENT',
|
|
item_type = 'UNDEFINED',
|
|
id = 56, )
|
|
],
|
|
last_postbox_id = 56,
|
|
login_id = 56,
|
|
number = 'null',
|
|
order_number = '',
|
|
buyer_reference = '',
|
|
paid_amount = 56,
|
|
paid_at = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(),
|
|
pdf_pages = 56,
|
|
pdf_template = 'null',
|
|
payment_link_enabled = False,
|
|
payment_link_locale = 'de',
|
|
project_id = 56,
|
|
recurring_options = easybill_generated_async.models.document_recurring.DocumentRecurring(
|
|
next_date = 'Sat Feb 01 00:00:00 UTC 2020',
|
|
frequency = 'MONTHLY',
|
|
frequency_special = 'LASTDAYOFMONTH',
|
|
interval = 1,
|
|
end_date_or_count = 'null',
|
|
status = 'WAITING',
|
|
as_draft = True,
|
|
is_notify = True,
|
|
send_as = 'EMAIL',
|
|
is_sign = True,
|
|
is_paid = True,
|
|
paid_date_option = 'created_date',
|
|
is_sepa = True,
|
|
sepa_local_instrument = 'CORE',
|
|
sepa_sequence_type = 'FRST',
|
|
sepa_reference = 'null',
|
|
sepa_remittance_information = 'null',
|
|
target_type = 'INVOICE', ),
|
|
ref_id = 56,
|
|
root_id = 56,
|
|
service_date = easybill_generated_async.models.service_date.ServiceDate(
|
|
type = 'DEFAULT',
|
|
date = 'Fri Feb 01 00:00:00 UTC 2019',
|
|
date_from = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(),
|
|
date_to = datetime.datetime.strptime('1975-12-30', '%Y-%m-%d').date(),
|
|
text = 'null', ),
|
|
shipping_country = 'null',
|
|
status = 'ACCEPT',
|
|
text = 'Vielen Dank für Ihren Auftrag!
|
|
|
|
Bitte begleichen Sie den offenen Betrag bis zum %DOKUMENT.DATUM-FAELLIG%.
|
|
|
|
Mit freundlichen Grüßen
|
|
|
|
%FIRMA.FIRMA%
|
|
',
|
|
text_prefix = '%KUNDE.ANREDE%,
|
|
nachfolgend berechnen wir Ihnen wie vorab besprochen:
|
|
',
|
|
text_tax = 'null',
|
|
title = 'null',
|
|
type = 'INVOICE',
|
|
use_shipping_address = False,
|
|
vat_country = 'null',
|
|
vat_id = '',
|
|
fulfillment_country = 'null',
|
|
vat_option = 'NULL',
|
|
file_format_config = [
|
|
easybill_generated_async.models.file_format_config.FileFormatConfig(
|
|
type = 'default', )
|
|
]
|
|
)
|
|
else:
|
|
return Document(
|
|
)
|
|
"""
|
|
|
|
def testDocument(self):
|
|
"""Test Document"""
|
|
# inst_req_only = self.make_instance(include_optional=False)
|
|
# inst_req_and_optional = self.make_instance(include_optional=True)
|
|
|
|
if __name__ == '__main__':
|
|
unittest.main()
|