From d68c28a8b823f363e9c739aeabd02dff55acb703 Mon Sep 17 00:00:00 2001 From: Kevin Hellemun Date: Tue, 21 Nov 2017 21:40:04 +0100 Subject: [PATCH] Added are all fieds none method. (bunq/sdk_python#42) --- bunq/sdk/model/core.py | 64 + bunq/sdk/model/generated/endpoint.py | 5220 +++++++++++++++++++------- bunq/sdk/model/generated/object_.py | 1163 +++++- 3 files changed, 5129 insertions(+), 1318 deletions(-) diff --git a/bunq/sdk/model/core.py b/bunq/sdk/model/core.py index f1135b1..f9e76c6 100644 --- a/bunq/sdk/model/core.py +++ b/bunq/sdk/model/core.py @@ -2,6 +2,10 @@ from bunq.sdk.json import converter +class AnchoredObjectInterface: + pass + + class BunqModel(object): # Field constants _FIELD_RESPONSE = 'Response' @@ -12,6 +16,9 @@ class BunqModel(object): # The very first index of an array _INDEX_FIRST = 0 + def are_all_fields_none(self): + raise NotImplementedError + def to_json(self): """ :rtype: str @@ -141,6 +148,13 @@ def id_(self): return self._id_ + def are_all_fields_none(self): + if self.id_ is not None: + return False + + return True + + class Uuid(BunqModel): """ @@ -158,6 +172,11 @@ def uuid(self): return self._uuid + def are_all_fields_none(self): + if self.uuid is not None: + return False + + return True class SessionToken(BunqModel): """ @@ -205,6 +224,21 @@ def token(self): return self._token + def are_all_fields_none(self): + if self.id_ is not None: + return False + + if self.created is not None: + return False + + if self.updated is not None: + return False + + if self.token is not None: + return False + + return True + class PublicKeyServer(BunqModel): """ @@ -222,6 +256,12 @@ def server_public_key(self): return self._server_public_key + def are_all_fields_none(self): + if self.server_public_key is not None: + return False + + return True + class Installation(BunqModel): """ @@ -296,6 +336,17 @@ def generate_request_body_bytes(cls, public_key_string): } ).encode() + def are_all_fields_none(self): + if self.id_ is not None: + return False + + if self.token is not None: + return False + + if self.server_public_key is not None: + return False + + return True class SessionServer(BunqModel): """ @@ -373,4 +424,17 @@ def generate_request_body_bytes(cls, secret): return converter.class_to_json({cls.FIELD_SECRET: secret}).encode() + def are_all_fields_none(self): + if self.id_ is not None: + return False + + if self.token is not None: + return False + + if self.user_person is not None: + return False + + if self.user_company is not None: + return False + return True diff --git a/bunq/sdk/model/generated/endpoint.py b/bunq/sdk/model/generated/endpoint.py index 125dff9..32ba5c4 100644 --- a/bunq/sdk/model/generated/endpoint.py +++ b/bunq/sdk/model/generated/endpoint.py @@ -237,6 +237,61 @@ def vat_number(self): return self._vat_number + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._invoice_date is not None: + return False + + if self._invoice_number is not None: + return False + + if self._status is not None: + return False + + if self._group is not None: + return False + + if self._total_vat_inclusive is not None: + return False + + if self._total_vat_exclusive is not None: + return False + + if self._total_vat is not None: + return False + + if self._alias is not None: + return False + + if self._address is not None: + return False + + if self._counterparty_alias is not None: + return False + + if self._counterparty_address is not None: + return False + + if self._chamber_of_commerce_number is not None: + return False + + if self._vat_number is not None: + return False + + return True + class InvoiceByUser(core.BunqModel): """ @@ -460,8 +515,63 @@ def vat_number(self): return self._vat_number + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._invoice_date is not None: + return False + + if self._invoice_number is not None: + return False + + if self._status is not None: + return False + + if self._group is not None: + return False + + if self._total_vat_inclusive is not None: + return False -class ChatConversation(core.BunqModel): + if self._total_vat_exclusive is not None: + return False + + if self._total_vat is not None: + return False + + if self._alias is not None: + return False + + if self._address is not None: + return False + + if self._counterparty_alias is not None: + return False + + if self._counterparty_address is not None: + return False + + if self._chamber_of_commerce_number is not None: + return False + + if self._vat_number is not None: + return False + + return True + + +class ChatConversation(core.BunqModel, core.AnchoredObjectInterface): """ Manages user's conversations. @@ -559,6 +669,19 @@ def get_referenced_object(self): raise exception.BunqException(self._ERROR_NULL_FIELDS) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._SupportConversationExternal is not None: + return False + + if self._ChatConversationReference is not None: + return False + + return True + class ChatConversationSupportExternal(core.BunqModel): """ @@ -613,8 +736,27 @@ def last_message(self): return self._last_message + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False -class ChatMessage(core.BunqModel): + if self._updated is not None: + return False + + if self._last_message is not None: + return False + + return True + + +class ChatMessage(core.BunqModel, core.AnchoredObjectInterface): """ Endpoint for retrieving the messages that are part of a conversation. @@ -705,6 +847,22 @@ def get_referenced_object(self): raise exception.BunqException(self._ERROR_NULL_FIELDS) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._ChatMessageAnnouncement is not None: + return False + + if self._ChatMessageStatus is not None: + return False + + if self._ChatMessageUser is not None: + return False + + return True + class ChatMessageAnnouncement(core.BunqModel): """ @@ -779,6 +937,31 @@ def content(self): return self._content + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._conversation_id is not None: + return False + + if self._creator is not None: + return False + + if self._content is not None: + return False + + return True + class CardDebit(core.BunqModel): """ @@ -1032,6 +1215,73 @@ def country(self): return self._country + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._public_uuid is not None: + return False + + if self._type_ is not None: + return False + + if self._sub_type is not None: + return False + + if self._second_line is not None: + return False + + if self._name_on_card is not None: + return False + + if self._primary_account_number_four_digit is not None: + return False + + if self._status is not None: + return False + + if self._order_status is not None: + return False + + if self._expiry_date is not None: + return False + + if self._limit is not None: + return False + + if self._country_permission is not None: + return False + + if self._label_monetary_account_ordered is not None: + return False + + if self._label_monetary_account_current is not None: + return False + + if self._alias is not None: + return False + + if self._pin_code_assignment is not None: + return False + + if self._monetary_account_id_fallback is not None: + return False + + if self._country is not None: + return False + + return True + class CardPinChange(core.BunqModel): """ @@ -1157,6 +1407,31 @@ def status(self): return self._status + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._label_card is not None: + return False + + if self._label_monetary_account_current is not None: + return False + + if self._time_request is not None: + return False + + if self._time_accept is not None: + return False + + if self._status is not None: + return False + + return True + class CardResult(core.BunqModel): """ @@ -1382,6 +1657,61 @@ def reservation_expiry_time(self): return self._reservation_expiry_time + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._monetary_account_id is not None: + return False + + if self._card_id is not None: + return False + + if self._amount_original is not None: + return False + + if self._amount_final is not None: + return False + + if self._decision is not None: + return False + + if self._decision_description is not None: + return False + + if self._decision_description_translated is not None: + return False + + if self._description is not None: + return False + + if self._message_type is not None: + return False + + if self._authorisation_type is not None: + return False + + if self._city is not None: + return False + + if self._alias is not None: + return False + + if self._counterparty_alias is not None: + return False + + if self._label_card is not None: + return False + + if self._reservation_status is not None: + return False + + if self._reservation_expiry_time is not None: + return False + + return True + class DraftPayment(core.BunqModel): """ @@ -1593,6 +1923,37 @@ def object_(self): return self._object_ + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._monetary_account_id is not None: + return False + + if self._user_alias_created is not None: + return False + + if self._responses is not None: + return False + + if self._status is not None: + return False + + if self._type_ is not None: + return False + + if self._entries is not None: + return False + + if self._object_ is not None: + return False + + return True + class Payment(core.BunqModel): """ @@ -1934,6 +2295,82 @@ def allow_chat(self): return self._allow_chat + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._monetary_account_id is not None: + return False + + if self._amount is not None: + return False + + if self._alias is not None: + return False + + if self._counterparty_alias is not None: + return False + + if self._description is not None: + return False + + if self._type_ is not None: + return False + + if self._sub_type is not None: + return False + + if self._bunqto_status is not None: + return False + + if self._bunqto_sub_status is not None: + return False + + if self._bunqto_share_url is not None: + return False + + if self._bunqto_expiry is not None: + return False + + if self._bunqto_time_responded is not None: + return False + + if self._attachment is not None: + return False + + if self._merchant_reference is not None: + return False + + if self._batch_id is not None: + return False + + if self._scheduled_id is not None: + return False + + if self._address_shipping is not None: + return False + + if self._address_billing is not None: + return False + + if self._geolocation is not None: + return False + + if self._allow_chat is not None: + return False + + return True + class PaymentBatch(core.BunqModel): """ @@ -2074,6 +2511,16 @@ def payments(self): return self._payments + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._payments is not None: + return False + + return True + class IdealMerchantTransaction(core.BunqModel): """ @@ -2308,6 +2755,55 @@ def allow_chat(self): return self._allow_chat + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._monetary_account_id is not None: + return False + + if self._alias is not None: + return False + + if self._counterparty_alias is not None: + return False + + if self._amount_guaranteed is not None: + return False + + if self._amount_requested is not None: + return False + + if self._expiration is not None: + return False + + if self._issuer is not None: + return False + + if self._issuer_name is not None: + return False + + if self._issuer_authentication_url is not None: + return False + + if self._purchase_identifier is not None: + return False + + if self._status is not None: + return False + + if self._status_timestamp is not None: + return False + + if self._transaction_identifier is not None: + return False + + if self._allow_chat is not None: + return False + + return True + class PromotionDisplay(core.BunqModel): """ @@ -2413,6 +2909,25 @@ def status(self): return self._status + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._counterparty_alias is not None: + return False + + if self._event_description is not None: + return False + + if self._status is not None: + return False + + return True + class RequestInquiryBatch(core.BunqModel): """ @@ -2565,6 +3080,19 @@ def total_amount_inquired(self): return self._total_amount_inquired + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._request_inquiries is not None: + return False + + if self._total_amount_inquired is not None: + return False + + return True + class RequestInquiry(core.BunqModel): """ @@ -2959,6 +3487,88 @@ def allow_chat(self): return self._allow_chat + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._time_responded is not None: + return False + + if self._time_expiry is not None: + return False + + if self._monetary_account_id is not None: + return False + + if self._amount_inquired is not None: + return False + + if self._amount_responded is not None: + return False + + if self._user_alias_created is not None: + return False + + if self._user_alias_revoked is not None: + return False + + if self._counterparty_alias is not None: + return False + + if self._description is not None: + return False + + if self._merchant_reference is not None: + return False + + if self._attachment is not None: + return False + + if self._status is not None: + return False + + if self._batch_id is not None: + return False + + if self._scheduled_id is not None: + return False + + if self._minimum_age is not None: + return False + + if self._require_address is not None: + return False + + if self._bunqme_share_url is not None: + return False + + if self._redirect_url is not None: + return False + + if self._address_shipping is not None: + return False + + if self._address_billing is not None: + return False + + if self._geolocation is not None: + return False + + if self._allow_chat is not None: + return False + + return True + class RequestResponse(core.BunqModel): """ @@ -3316,9 +3926,91 @@ def eligible_whitelist_id(self): return self._eligible_whitelist_id + def are_all_fields_none(self): + """ + :rtype: bool + """ -class SchedulePaymentBatch(core.BunqModel): - """ + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._time_responded is not None: + return False + + if self._time_expiry is not None: + return False + + if self._monetary_account_id is not None: + return False + + if self._amount_inquired is not None: + return False + + if self._amount_responded is not None: + return False + + if self._status is not None: + return False + + if self._description is not None: + return False + + if self._alias is not None: + return False + + if self._counterparty_alias is not None: + return False + + if self._attachment is not None: + return False + + if self._minimum_age is not None: + return False + + if self._require_address is not None: + return False + + if self._geolocation is not None: + return False + + if self._type_ is not None: + return False + + if self._sub_type is not None: + return False + + if self._redirect_url is not None: + return False + + if self._address_billing is not None: + return False + + if self._address_shipping is not None: + return False + + if self._allow_chat is not None: + return False + + if self._credit_scheme_identifier is not None: + return False + + if self._mandate_identifier is not None: + return False + + if self._eligible_whitelist_id is not None: + return False + + return True + + +class SchedulePaymentBatch(core.BunqModel): + """ Endpoint for schedule payment batches. :type _payments: list[object_.SchedulePaymentEntry] @@ -3429,6 +4121,19 @@ def schedule(self): return self._schedule + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._payments is not None: + return False + + if self._schedule is not None: + return False + + return True + class Schedule(core.BunqModel): """ @@ -3568,6 +4273,31 @@ def object_(self): return self._object_ + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._time_start is not None: + return False + + if self._time_end is not None: + return False + + if self._recurrence_unit is not None: + return False + + if self._recurrence_size is not None: + return False + + if self._status is not None: + return False + + if self._object_ is not None: + return False + + return True + class SchedulePayment(core.BunqModel): """ @@ -3732,6 +4462,19 @@ def schedule(self): return self._schedule + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._payment is not None: + return False + + if self._schedule is not None: + return False + + return True + class ScheduleInstance(core.BunqModel): """ @@ -3889,6 +4632,31 @@ def result_object(self): return self._result_object + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._state is not None: + return False + + if self._time_start is not None: + return False + + if self._time_end is not None: + return False + + if self._error_message is not None: + return False + + if self._scheduled_object is not None: + return False + + if self._result_object is not None: + return False + + return True + class ShareInviteBankInquiry(core.BunqModel): """ @@ -4149,6 +4917,49 @@ def id_(self): return self._id_ + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._alias is not None: + return False + + if self._user_alias_created is not None: + return False + + if self._user_alias_revoked is not None: + return False + + if self._counter_user_alias is not None: + return False + + if self._monetary_account_id is not None: + return False + + if self._draft_share_invite_bank_id is not None: + return False + + if self._share_detail is not None: + return False + + if self._status is not None: + return False + + if self._share_type is not None: + return False + + if self._start_date is not None: + return False + + if self._end_date is not None: + return False + + if self._id_ is not None: + return False + + return True + class ShareInviteBankResponse(core.BunqModel): """ @@ -4348,6 +5159,43 @@ def description(self): return self._description + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._counter_alias is not None: + return False + + if self._user_alias_cancelled is not None: + return False + + if self._monetary_account_id is not None: + return False + + if self._draft_share_invite_bank_id is not None: + return False + + if self._share_detail is not None: + return False + + if self._status is not None: + return False + + if self._share_type is not None: + return False + + if self._start_date is not None: + return False + + if self._end_date is not None: + return False + + if self._description is not None: + return False + + return True + class UserCredentialPasswordIp(core.BunqModel): """ @@ -4482,6 +5330,34 @@ def permitted_device(self): return self._permitted_device + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._status is not None: + return False + + if self._expiry_time is not None: + return False + + if self._token_value is not None: + return False + + if self._permitted_device is not None: + return False + + return True + class ChatMessageStatus(core.BunqModel): """ @@ -4556,6 +5432,31 @@ def content(self): return self._content + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._conversation_id is not None: + return False + + if self._creator is not None: + return False + + if self._content is not None: + return False + + return True + class ChatMessageUser(core.BunqModel): """ @@ -4640,6 +5541,34 @@ def content(self): return self._content + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._conversation_id is not None: + return False + + if self._creator is not None: + return False + + if self._displayed_sender is not None: + return False + + if self._content is not None: + return False + + return True + class ChatConversationReference(core.BunqModel): """ @@ -4684,6 +5613,22 @@ def updated(self): return self._updated + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + return True + class ChatMessageAttachment(core.BunqModel): """ @@ -4740,6 +5685,16 @@ def id_(self): return self._id_ + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + return True + class ChatMessageText(core.BunqModel): """ @@ -4795,6 +5750,16 @@ def id_(self): return self._id_ + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + return True + class AttachmentConversationContent(core.BunqModel): """ @@ -4834,6 +5799,14 @@ def list(cls, api_context, user_id, chat_conversation_id, attachment_id, custom_ ) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + return True + + class AttachmentPublicContent(core.BunqModel): """ Fetch the raw content of a public attachment with given ID. The raw content @@ -4870,6 +5843,14 @@ def list(cls, api_context, attachment_public_uuid, custom_headers=None): ) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + return True + + class AttachmentTabContent(core.BunqModel): """ Fetch the raw content of a tab attachment with given ID. The raw content is @@ -4908,6 +5889,14 @@ def list(cls, api_context, user_id, monetary_account_id, attachment_tab_id, cust ) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + return True + + class TabAttachmentTabContent(core.BunqModel): """ Fetch the raw content of a tab attachment with given ID. The raw content is @@ -4945,6 +5934,14 @@ def list(cls, api_context, tab_uuid, attachment_id, custom_headers=None): ) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + return True + + class AttachmentMonetaryAccount(core.BunqModel): """ This call is used to upload an attachment that can be referenced to in @@ -5010,6 +6007,19 @@ def id_(self): return self._id_ + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._attachment is not None: + return False + + if self._id_ is not None: + return False + + return True + class AttachmentPublic(core.BunqModel): """ @@ -5121,6 +6131,25 @@ def attachment(self): return self._attachment + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._uuid is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._attachment is not None: + return False + + return True + class AttachmentTab(core.BunqModel): """ @@ -5235,6 +6264,25 @@ def attachment(self): return self._attachment + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._attachment is not None: + return False + + return True + class TabAttachmentTab(core.BunqModel): """ @@ -5315,6 +6363,25 @@ def attachment(self): return self._attachment + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._attachment is not None: + return False + + return True + class Avatar(core.BunqModel): """ @@ -5402,6 +6469,19 @@ def image(self): return self._image + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._uuid is not None: + return False + + if self._image is not None: + return False + + return True + class BunqMeTab(core.BunqModel): """ @@ -5614,6 +6694,40 @@ def result_inquiries(self): return self._result_inquiries + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._time_expiry is not None: + return False + + if self._monetary_account_id is not None: + return False + + if self._status is not None: + return False + + if self._bunqme_tab_share_url is not None: + return False + + if self._bunqme_tab_entry is not None: + return False + + if self._result_inquiries is not None: + return False + + return True + class BunqMeTabEntry(core.BunqModel): """ @@ -5705,6 +6819,34 @@ def merchant_available(self): return self._merchant_available + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._uuid is not None: + return False + + if self._amount_inquired is not None: + return False + + if self._alias is not None: + return False + + if self._description is not None: + return False + + if self._status is not None: + return False + + if self._redirect_url is not None: + return False + + if self._merchant_available is not None: + return False + + return True + class BunqMeTabResultInquiry(core.BunqModel): """ @@ -5731,6 +6873,16 @@ def payment(self): return self._payment + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._payment is not None: + return False + + return True + class CardGeneratedCvc2(core.BunqModel): """ @@ -5888,11 +7040,36 @@ def expiry_time(self): return self._expiry_time + def are_all_fields_none(self): + """ + :rtype: bool + """ -class CardName(core.BunqModel): - """ - Endpoint for getting all the accepted card names for a user. As bunq do not - allow total freedom in choosing the name that is going to be printed on the + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._cvc2 is not None: + return False + + if self._status is not None: + return False + + if self._expiry_time is not None: + return False + + return True + + +class CardName(core.BunqModel): + """ + Endpoint for getting all the accepted card names for a user. As bunq do not + allow total freedom in choosing the name that is going to be printed on the card, the following formats are accepted: Name Surname, N. Surname, N Surname or Surname. @@ -5943,6 +7120,16 @@ def possible_card_name_array(self): return self._possible_card_name_array + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._possible_card_name_array is not None: + return False + + return True + class CardReplace(core.BunqModel): """ @@ -6004,6 +7191,16 @@ def id_(self): return self._id_ + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + return True + class Card(core.BunqModel): """ @@ -6323,6 +7520,76 @@ def country(self): return self._country + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._public_uuid is not None: + return False + + if self._type_ is not None: + return False + + if self._sub_type is not None: + return False + + if self._second_line is not None: + return False + + if self._status is not None: + return False + + if self._sub_status is not None: + return False + + if self._order_status is not None: + return False + + if self._expiry_date is not None: + return False + + if self._name_on_card is not None: + return False + + if self._primary_account_number_four_digit is not None: + return False + + if self._limit is not None: + return False + + if self._mag_stripe_permission is not None: + return False + + if self._country_permission is not None: + return False + + if self._label_monetary_account_ordered is not None: + return False + + if self._label_monetary_account_current is not None: + return False + + if self._pin_code_assignment is not None: + return False + + if self._monetary_account_id_fallback is not None: + return False + + if self._country is not None: + return False + + return True + class CashRegisterQrCodeContent(core.BunqModel): """ @@ -6363,6 +7630,14 @@ def list(cls, api_context, user_id, monetary_account_id, cash_register_id, qr_co ) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + return True + + class CashRegisterQrCode(core.BunqModel): """ Once your CashRegister has been activated you can create a QR code for it. @@ -6559,6 +7834,31 @@ def tab_object(self): return self._tab_object + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._status is not None: + return False + + if self._cash_register is not None: + return False + + if self._tab_object is not None: + return False + + return True + class CashRegister(core.BunqModel): """ @@ -6794,8 +8094,42 @@ def tab_text_waiting_screen(self): return self._tab_text_waiting_screen + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._name is not None: + return False + + if self._status is not None: + return False + + if self._avatar is not None: + return False + + if self._location is not None: + return False + + if self._notification_filters is not None: + return False + + if self._tab_text_waiting_screen is not None: + return False + + return True -class Tab(core.BunqModel): + +class Tab(core.BunqModel, core.AnchoredObjectInterface): """ Once your CashRegister has been activated you can use it to create Tabs. A Tab is a template for a payment. In contrast to requests a Tab is not @@ -6907,6 +8241,19 @@ def get_referenced_object(self): raise exception.BunqException(self._ERROR_NULL_FIELDS) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._TabUsageSingle is not None: + return False + + if self._TabUsageMultiple is not None: + return False + + return True + class TabUsageSingle(core.BunqModel): """ @@ -7279,6 +8626,70 @@ def tab_attachment(self): return self._tab_attachment + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._uuid is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._merchant_reference is not None: + return False + + if self._description is not None: + return False + + if self._status is not None: + return False + + if self._amount_total is not None: + return False + + if self._amount_paid is not None: + return False + + if self._qr_code_token is not None: + return False + + if self._tab_url is not None: + return False + + if self._visibility is not None: + return False + + if self._minimum_age is not None: + return False + + if self._require_address is not None: + return False + + if self._redirect_url is not None: + return False + + if self._expiration is not None: + return False + + if self._alias is not None: + return False + + if self._cash_register_location is not None: + return False + + if self._tab_item is not None: + return False + + if self._tab_attachment is not None: + return False + + return True + class TabItem(core.BunqModel): """ @@ -7363,6 +8774,34 @@ def amount(self): return self._amount + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._description is not None: + return False + + if self._ean_code is not None: + return False + + if self._avatar_attachment is not None: + return False + + if self._tab_attachment is not None: + return False + + if self._quantity is not None: + return False + + if self._amount is not None: + return False + + return True + class TabUsageMultiple(core.BunqModel): """ @@ -7716,6 +9155,64 @@ def tab_attachment(self): return self._tab_attachment + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._uuid is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._description is not None: + return False + + if self._status is not None: + return False + + if self._amount_total is not None: + return False + + if self._qr_code_token is not None: + return False + + if self._tab_url is not None: + return False + + if self._visibility is not None: + return False + + if self._minimum_age is not None: + return False + + if self._require_address is not None: + return False + + if self._redirect_url is not None: + return False + + if self._expiration is not None: + return False + + if self._alias is not None: + return False + + if self._cash_register_location is not None: + return False + + if self._tab_item is not None: + return False + + if self._tab_attachment is not None: + return False + + return True + class CertificatePinned(core.BunqModel): """ @@ -7859,6 +9356,19 @@ def id_(self): return self._id_ + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._certificate_chain is not None: + return False + + if self._id_ is not None: + return False + + return True + class DeviceServer(core.BunqModel): """ @@ -8023,8 +9533,33 @@ def status(self): return self._status + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False -class Device(core.BunqModel): + if self._updated is not None: + return False + + if self._description is not None: + return False + + if self._ip is not None: + return False + + if self._status is not None: + return False + + return True + + +class Device(core.BunqModel, core.AnchoredObjectInterface): """ Used to get a Device or a listing of Devices. Creating a DeviceServer should happen via /device-server @@ -8113,6 +9648,16 @@ def get_referenced_object(self): raise exception.BunqException(self._ERROR_NULL_FIELDS) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._DeviceServer is not None: + return False + + return True + class DraftShareInviteBankQrCodeContent(core.BunqModel): """ @@ -8154,6 +9699,14 @@ def list(cls, api_context, user_id, draft_share_invite_bank_id, custom_headers=N ) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + return True + + class DraftShareInviteBank(core.BunqModel): """ Used to create a draft share invite for a monetary account with another bunq @@ -8348,6 +9901,34 @@ def id_(self): return self._id_ + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._user_alias_created is not None: + return False + + if self._status is not None: + return False + + if self._expiration is not None: + return False + + if self._share_invite_bank_response_id is not None: + return False + + if self._draft_share_url is not None: + return False + + if self._draft_share_settings is not None: + return False + + if self._id_ is not None: + return False + + return True + class ExportAnnualOverviewContent(core.BunqModel): """ @@ -8387,6 +9968,14 @@ def list(cls, api_context, user_id, export_annual_overview_id, custom_headers=No ) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + return True + + class ExportAnnualOverview(core.BunqModel): """ Used to create new and read existing annual overviews of all the user's @@ -8535,6 +10124,28 @@ def alias_user(self): return self._alias_user + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._year is not None: + return False + + if self._alias_user is not None: + return False + + return True + class CustomerStatementExportContent(core.BunqModel): """ @@ -8574,6 +10185,14 @@ def list(cls, api_context, user_id, monetary_account_id, customer_statement_id, ) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + return True + + class CustomerStatementExport(core.BunqModel): """ Used to create new and read existing statement exports. Statement exports @@ -8794,6 +10413,43 @@ def alias_monetary_account(self): return self._alias_monetary_account + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._date_start is not None: + return False + + if self._date_end is not None: + return False + + if self._status is not None: + return False + + if self._statement_number is not None: + return False + + if self._statement_format is not None: + return False + + if self._regional_format is not None: + return False + + if self._alias_monetary_account is not None: + return False + + return True + class InstallationServerPublicKey(core.BunqModel): """ @@ -8847,6 +10503,16 @@ def server_public_key(self): return self._server_public_key + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._server_public_key is not None: + return False + + return True + class ShareInviteBankAmountUsed(core.BunqModel): """ @@ -8890,6 +10556,14 @@ def delete(cls, api_context, user_id, monetary_account_id, share_invite_bank_inq ) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + return True + + class MonetaryAccountBank(core.BunqModel): """ With MonetaryAccountBank you can create a new bank account, retrieve @@ -9230,22 +10904,89 @@ def setting(self): return self._setting + def are_all_fields_none(self): + """ + :rtype: bool + """ -class MonetaryAccountProfile(core.BunqModel): - """ - Used to update and read up monetary account profiles, to keep the balance - between specific thresholds. - - :type _profile_fill: object_.MonetaryAccountProfileFill - :type _profile_drain: object_.MonetaryAccountProfileDrain - """ + if self._id_ is not None: + return False - # Field constants. - FIELD_PROFILE_FILL = "profile_fill" - FIELD_PROFILE_DRAIN = "profile_drain" + if self._created is not None: + return False - # Object type. - _OBJECT_TYPE = "MonetaryAccountProfile" + if self._updated is not None: + return False + + if self._avatar is not None: + return False + + if self._currency is not None: + return False + + if self._description is not None: + return False + + if self._daily_limit is not None: + return False + + if self._daily_spent is not None: + return False + + if self._overdraft_limit is not None: + return False + + if self._balance is not None: + return False + + if self._alias is not None: + return False + + if self._public_uuid is not None: + return False + + if self._status is not None: + return False + + if self._sub_status is not None: + return False + + if self._reason is not None: + return False + + if self._reason_description is not None: + return False + + if self._user_id is not None: + return False + + if self._monetary_account_profile is not None: + return False + + if self._notification_filters is not None: + return False + + if self._setting is not None: + return False + + return True + + +class MonetaryAccountProfile(core.BunqModel): + """ + Used to update and read up monetary account profiles, to keep the balance + between specific thresholds. + + :type _profile_fill: object_.MonetaryAccountProfileFill + :type _profile_drain: object_.MonetaryAccountProfileDrain + """ + + # Field constants. + FIELD_PROFILE_FILL = "profile_fill" + FIELD_PROFILE_DRAIN = "profile_drain" + + # Object type. + _OBJECT_TYPE = "MonetaryAccountProfile" def __init__(self): self._profile_fill = None @@ -9269,8 +11010,21 @@ def profile_drain(self): return self._profile_drain + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._profile_fill is not None: + return False + + if self._profile_drain is not None: + return False -class MonetaryAccount(core.BunqModel): + return True + + +class MonetaryAccount(core.BunqModel, core.AnchoredObjectInterface): """ Used to show the MonetaryAccounts that you can access. Currently the only MonetaryAccount type is MonetaryAccountBank. See also: @@ -9363,6 +11117,217 @@ def get_referenced_object(self): raise exception.BunqException(self._ERROR_NULL_FIELDS) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._MonetaryAccountBank is not None: + return False + + return True + + +class BunqMeFundraiserResult(core.BunqModel): + """ + bunq.me fundraiser result containing all payments. + + :type _id_: int + :type _created: str + :type _updated: str + :type _bunqme_fundraiser_profile: BunqMeFundraiserProfile + :type _payments: list[Payment] + """ + + # Object type. + _OBJECT_TYPE = "BunqMeFundraiserResult" + + def __init__(self): + self._id_ = None + self._created = None + self._updated = None + self._bunqme_fundraiser_profile = None + self._payments = None + + + + @property + def id_(self): + """ + :rtype: int + """ + + return self._id_ + + @property + def created(self): + """ + :rtype: str + """ + + return self._created + + @property + def updated(self): + """ + :rtype: str + """ + + return self._updated + + @property + def bunqme_fundraiser_profile(self): + """ + :rtype: BunqMeFundraiserProfile + """ + + return self._bunqme_fundraiser_profile + + @property + def payments(self): + """ + :rtype: list[Payment] + """ + + return self._payments + + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._bunqme_fundraiser_profile is not None: + return False + + if self._payments is not None: + return False + + return True + + +class BunqMeFundraiserProfile(core.BunqModel): + """ + bunq.me public profile of the user. + + :type _color: str + :type _alias: object_.MonetaryAccountReference + :type _description: str + :type _attachment: list[object_.AttachmentPublic] + :type _pointer: object_.MonetaryAccountReference + :type _status: str + :type _redirect_url: str + """ + + # Field constants. + FIELD_POINTER = "pointer" + + # Object type. + _OBJECT_TYPE = "BunqMeFundraiserProfileModel" + + def __init__(self): + self._color = None + self._alias = None + self._description = None + self._attachment = None + self._pointer = None + self._status = None + self._redirect_url = None + + + + @property + def color(self): + """ + :rtype: str + """ + + return self._color + + @property + def alias(self): + """ + :rtype: object_.MonetaryAccountReference + """ + + return self._alias + + @property + def description(self): + """ + :rtype: str + """ + + return self._description + + @property + def attachment(self): + """ + :rtype: list[object_.AttachmentPublic] + """ + + return self._attachment + + @property + def pointer(self): + """ + :rtype: object_.MonetaryAccountReference + """ + + return self._pointer + + @property + def status(self): + """ + :rtype: str + """ + + return self._status + + @property + def redirect_url(self): + """ + :rtype: str + """ + + return self._redirect_url + + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._color is not None: + return False + + if self._alias is not None: + return False + + if self._description is not None: + return False + + if self._attachment is not None: + return False + + if self._pointer is not None: + return False + + if self._status is not None: + return False + + if self._redirect_url is not None: + return False + + return True + class BunqMeTabResultResponse(core.BunqModel): """ @@ -9389,6 +11354,16 @@ def payment(self): return self._payment + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._payment is not None: + return False + + return True + class MasterCardAction(core.BunqModel): """ @@ -9684,6 +11659,82 @@ def eligible_whitelist_id(self): return self._eligible_whitelist_id + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._monetary_account_id is not None: + return False + + if self._card_id is not None: + return False + + if self._amount_local is not None: + return False + + if self._amount_billing is not None: + return False + + if self._amount_original_local is not None: + return False + + if self._amount_original_billing is not None: + return False + + if self._amount_fee is not None: + return False + + if self._decision is not None: + return False + + if self._decision_description is not None: + return False + + if self._decision_description_translated is not None: + return False + + if self._description is not None: + return False + + if self._authorisation_status is not None: + return False + + if self._authorisation_type is not None: + return False + + if self._pan_entry_mode_user is not None: + return False + + if self._city is not None: + return False + + if self._alias is not None: + return False + + if self._counterparty_alias is not None: + return False + + if self._label_card is not None: + return False + + if self._token_status is not None: + return False + + if self._reservation_expiry_time is not None: + return False + + if self._applied_limit is not None: + return False + + if self._allow_chat is not None: + return False + + if self._eligible_whitelist_id is not None: + return False + + return True + class TabResultInquiry(core.BunqModel): """ @@ -9779,6 +11830,19 @@ def payment(self): return self._payment + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._tab is not None: + return False + + if self._payment is not None: + return False + + return True + class TabResultResponse(core.BunqModel): """ @@ -9870,15 +11934,156 @@ def payment(self): return self._payment + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._tab is not None: + return False -class UserPerson(core.BunqModel): + if self._payment is not None: + return False + + return True + + +class User(core.BunqModel, core.AnchoredObjectInterface): """ - With UserPerson you can retrieve information regarding the authenticated - UserPerson and update specific fields.

Notification filters can be - set on a UserPerson level to receive callbacks. For more information check - the dedicated callbacks page. + Using this call you can retrieve information of the user you are logged in + as. This includes your user id, which is referred to in endpoints. - :type _id_: int + :type _UserLight: UserLight + :type _UserPerson: UserPerson + :type _UserCompany: UserCompany + """ + + # Error constants. + _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' + + # Endpoint constants. + _ENDPOINT_URL_READ = "user/{}" + _ENDPOINT_URL_LISTING = "user" + + # Object type. + _OBJECT_TYPE = "User" + + def __init__(self): + self._UserLight = None + self._UserPerson = None + self._UserCompany = None + + @classmethod + def get(cls, api_context, user_id, custom_headers=None): + """ + Get a specific user. + + :type api_context: context.ApiContext + :type user_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseUser + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseUser.cast_from_bunq_response( + cls._from_json(response_raw) + ) + + @classmethod + def list(cls, api_context, params=None, custom_headers=None): + """ + Get a collection of all available users. + + :type api_context: context.ApiContext + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseUserList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_LISTING + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseUserList.cast_from_bunq_response( + cls._from_json_list(response_raw) + ) + + @property + def UserLight(self): + """ + :rtype: UserLight + """ + + return self._UserLight + + @property + def UserPerson(self): + """ + :rtype: UserPerson + """ + + return self._UserPerson + + @property + def UserCompany(self): + """ + :rtype: UserCompany + """ + + return self._UserCompany + def get_referenced_object(self): + """ + :rtype: core.BunqModel + :raise: BunqException + """ + + if self._UserLight is not None: + return self._UserLight + + if self._UserPerson is not None: + return self._UserPerson + + if self._UserCompany is not None: + return self._UserCompany + + raise exception.BunqException(self._ERROR_NULL_FIELDS) + + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._UserLight is not None: + return False + + if self._UserPerson is not None: + return False + + if self._UserCompany is not None: + return False + + return True + + +class UserLight(core.BunqModel): + """ + Show the authenticated user, if it is a light user. + + :type _id_: int :type _created: str :type _updated: str :type _public_uuid: str @@ -9889,6 +12094,7 @@ class UserPerson(core.BunqModel): :type _display_name: str :type _public_nick_name: str :type _alias: list[object_.Pointer] + :type _social_security_number: str :type _tax_resident: list[object_.TaxResident] :type _document_type: str :type _document_number: str @@ -9912,17 +12118,18 @@ class UserPerson(core.BunqModel): """ # Endpoint constants. - _ENDPOINT_URL_READ = "user-person/{}" - _ENDPOINT_URL_UPDATE = "user-person/{}" + _ENDPOINT_URL_READ = "user-light/{}" # Field constants. FIELD_FIRST_NAME = "first_name" FIELD_MIDDLE_NAME = "middle_name" FIELD_LAST_NAME = "last_name" FIELD_PUBLIC_NICK_NAME = "public_nick_name" + FIELD_COUNTER_BANK_IBAN = "counter_bank_iban" FIELD_ADDRESS_MAIN = "address_main" FIELD_ADDRESS_POSTAL = "address_postal" FIELD_AVATAR_UUID = "avatar_uuid" + FIELD_SOCIAL_SECURITY_NUMBER = "social_security_number" FIELD_TAX_RESIDENT = "tax_resident" FIELD_DOCUMENT_TYPE = "document_type" FIELD_DOCUMENT_NUMBER = "document_number" @@ -9941,7 +12148,6 @@ class UserPerson(core.BunqModel): FIELD_LEGAL_GUARDIAN_ALIAS = "legal_guardian_alias" FIELD_SESSION_TIMEOUT = "session_timeout" FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN = "daily_limit_without_confirmation_login" - FIELD_COUNTER_BANK_IBAN = "counter_bank_iban" FIELD_NOTIFICATION_FILTERS = "notification_filters" # Object type. @@ -9959,6 +12165,7 @@ def __init__(self): self._display_name = None self._public_nick_name = None self._alias = None + self._social_security_number = None self._tax_resident = None self._document_type = None self._document_number = None @@ -9981,53 +12188,28 @@ def __init__(self): self._notification_filters = None @classmethod - def get(cls, api_context, user_person_id, custom_headers=None): + def get(cls, api_context, user_light_id, custom_headers=None): """ - Get a specific person. + Get a specific bunq light user. :type api_context: context.ApiContext - :type user_person_id: int + :type user_light_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseUserPerson + :rtype: BunqResponseUserLight """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_person_id) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_light_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseUserPerson.cast_from_bunq_response( + return BunqResponseUserLight.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) - @classmethod - def update(cls, api_context, request_map, user_person_id, custom_headers=None): - """ - Modify a specific person object's data. - - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_person_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt - """ - - if custom_headers is None: - custom_headers = {} - - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_person_id) - response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) - @property def id_(self): """ @@ -10116,6 +12298,14 @@ def alias(self): return self._alias + @property + def social_security_number(self): + """ + :rtype: str + """ + + return self._social_security_number + @property def tax_resident(self): """ @@ -10276,132 +12466,250 @@ def notification_filters(self): return self._notification_filters + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False -class UserCompany(core.BunqModel): + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._public_uuid is not None: + return False + + if self._first_name is not None: + return False + + if self._middle_name is not None: + return False + + if self._last_name is not None: + return False + + if self._legal_name is not None: + return False + + if self._display_name is not None: + return False + + if self._public_nick_name is not None: + return False + + if self._alias is not None: + return False + + if self._social_security_number is not None: + return False + + if self._tax_resident is not None: + return False + + if self._document_type is not None: + return False + + if self._document_number is not None: + return False + + if self._document_country_of_issuance is not None: + return False + + if self._address_main is not None: + return False + + if self._address_postal is not None: + return False + + if self._date_of_birth is not None: + return False + + if self._place_of_birth is not None: + return False + + if self._country_of_birth is not None: + return False + + if self._nationality is not None: + return False + + if self._language is not None: + return False + + if self._region is not None: + return False + + if self._gender is not None: + return False + + if self._avatar is not None: + return False + + if self._version_terms_of_service is not None: + return False + + if self._status is not None: + return False + + if self._sub_status is not None: + return False + + if self._session_timeout is not None: + return False + + if self._daily_limit_without_confirmation_login is not None: + return False + + if self._notification_filters is not None: + return False + + return True + + +class UserPerson(core.BunqModel): """ - With UserCompany you can retrieve information regarding the authenticated - UserCompany and update specific fields.

Notification filters can be - set on a UserCompany level to receive callbacks. For more information check + With UserPerson you can retrieve information regarding the authenticated + UserPerson and update specific fields.

Notification filters can be + set on a UserPerson level to receive callbacks. For more information check the dedicated callbacks page. :type _id_: int :type _created: str :type _updated: str :type _public_uuid: str - :type _name: str + :type _first_name: str + :type _middle_name: str + :type _last_name: str + :type _legal_name: str :type _display_name: str :type _public_nick_name: str :type _alias: list[object_.Pointer] - :type _chamber_of_commerce_number: str - :type _type_of_business_entity: str - :type _sector_of_industry: str - :type _counter_bank_iban: str - :type _avatar: object_.Avatar + :type _tax_resident: list[object_.TaxResident] + :type _document_type: str + :type _document_number: str + :type _document_country_of_issuance: str :type _address_main: object_.Address :type _address_postal: object_.Address - :type _version_terms_of_service: str - :type _director_alias: object_.LabelUser + :type _date_of_birth: str + :type _place_of_birth: str + :type _country_of_birth: str + :type _nationality: str :type _language: str - :type _country: str :type _region: str - :type _ubo: list[object_.Ubo] + :type _gender: str + :type _avatar: object_.Avatar + :type _version_terms_of_service: str :type _status: str :type _sub_status: str :type _session_timeout: int :type _daily_limit_without_confirmation_login: object_.Amount :type _notification_filters: list[object_.NotificationFilter] - :type _customer: Customer - :type _customer_limit: CustomerLimit - :type _billing_contract: list[BillingContractSubscription] """ # Endpoint constants. - _ENDPOINT_URL_READ = "user-company/{}" - _ENDPOINT_URL_UPDATE = "user-company/{}" + _ENDPOINT_URL_READ = "user-person/{}" + _ENDPOINT_URL_UPDATE = "user-person/{}" # Field constants. - FIELD_NAME = "name" + FIELD_FIRST_NAME = "first_name" + FIELD_MIDDLE_NAME = "middle_name" + FIELD_LAST_NAME = "last_name" FIELD_PUBLIC_NICK_NAME = "public_nick_name" - FIELD_AVATAR_UUID = "avatar_uuid" FIELD_ADDRESS_MAIN = "address_main" FIELD_ADDRESS_POSTAL = "address_postal" + FIELD_AVATAR_UUID = "avatar_uuid" + FIELD_TAX_RESIDENT = "tax_resident" + FIELD_DOCUMENT_TYPE = "document_type" + FIELD_DOCUMENT_NUMBER = "document_number" + FIELD_DOCUMENT_COUNTRY_OF_ISSUANCE = "document_country_of_issuance" + FIELD_DOCUMENT_FRONT_ATTACHMENT_ID = "document_front_attachment_id" + FIELD_DOCUMENT_BACK_ATTACHMENT_ID = "document_back_attachment_id" + FIELD_DATE_OF_BIRTH = "date_of_birth" + FIELD_PLACE_OF_BIRTH = "place_of_birth" + FIELD_COUNTRY_OF_BIRTH = "country_of_birth" + FIELD_NATIONALITY = "nationality" FIELD_LANGUAGE = "language" FIELD_REGION = "region" - FIELD_COUNTRY = "country" - FIELD_UBO = "ubo" - FIELD_CHAMBER_OF_COMMERCE_NUMBER = "chamber_of_commerce_number" + FIELD_GENDER = "gender" FIELD_STATUS = "status" FIELD_SUB_STATUS = "sub_status" + FIELD_LEGAL_GUARDIAN_ALIAS = "legal_guardian_alias" FIELD_SESSION_TIMEOUT = "session_timeout" FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN = "daily_limit_without_confirmation_login" FIELD_COUNTER_BANK_IBAN = "counter_bank_iban" FIELD_NOTIFICATION_FILTERS = "notification_filters" # Object type. - _OBJECT_TYPE = "UserCompany" + _OBJECT_TYPE = "UserPerson" def __init__(self): self._id_ = None self._created = None self._updated = None self._public_uuid = None - self._name = None + self._first_name = None + self._middle_name = None + self._last_name = None + self._legal_name = None self._display_name = None self._public_nick_name = None self._alias = None - self._chamber_of_commerce_number = None - self._type_of_business_entity = None - self._sector_of_industry = None - self._counter_bank_iban = None - self._avatar = None + self._tax_resident = None + self._document_type = None + self._document_number = None + self._document_country_of_issuance = None self._address_main = None self._address_postal = None - self._version_terms_of_service = None - self._director_alias = None + self._date_of_birth = None + self._place_of_birth = None + self._country_of_birth = None + self._nationality = None self._language = None - self._country = None self._region = None - self._ubo = None + self._gender = None + self._avatar = None + self._version_terms_of_service = None self._status = None self._sub_status = None self._session_timeout = None self._daily_limit_without_confirmation_login = None self._notification_filters = None - self._customer = None - self._customer_limit = None - self._billing_contract = None @classmethod - def get(cls, api_context, user_company_id, custom_headers=None): + def get(cls, api_context, user_person_id, custom_headers=None): """ - Get a specific company. + Get a specific person. :type api_context: context.ApiContext - :type user_company_id: int + :type user_person_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseUserCompany + :rtype: BunqResponseUserPerson """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_company_id) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_person_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseUserCompany.cast_from_bunq_response( + return BunqResponseUserPerson.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod - def update(cls, api_context, request_map, user_company_id, custom_headers=None): + def update(cls, api_context, request_map, user_person_id, custom_headers=None): """ - Modify a specific company's data. + Modify a specific person object's data. :type api_context: context.ApiContext :type request_map: dict[str, object] - :type user_company_id: int + :type user_person_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -10412,7 +12720,7 @@ def update(cls, api_context, request_map, user_company_id, custom_headers=None): api_client = client.ApiClient(api_context) request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_company_id) + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_person_id) response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) return BunqResponseInt.cast_from_bunq_response( @@ -10452,12 +12760,36 @@ def public_uuid(self): return self._public_uuid @property - def name(self): + def first_name(self): """ :rtype: str """ - return self._name + return self._first_name + + @property + def middle_name(self): + """ + :rtype: str + """ + + return self._middle_name + + @property + def last_name(self): + """ + :rtype: str + """ + + return self._last_name + + @property + def legal_name(self): + """ + :rtype: str + """ + + return self._legal_name @property def display_name(self): @@ -10484,44 +12816,36 @@ def alias(self): return self._alias @property - def chamber_of_commerce_number(self): + def tax_resident(self): """ - :rtype: str + :rtype: list[object_.TaxResident] """ - return self._chamber_of_commerce_number + return self._tax_resident @property - def type_of_business_entity(self): + def document_type(self): """ :rtype: str """ - return self._type_of_business_entity + return self._document_type @property - def sector_of_industry(self): + def document_number(self): """ :rtype: str """ - return self._sector_of_industry + return self._document_number @property - def counter_bank_iban(self): + def document_country_of_issuance(self): """ :rtype: str """ - return self._counter_bank_iban - - @property - def avatar(self): - """ - :rtype: object_.Avatar - """ - - return self._avatar + return self._document_country_of_issuance @property def address_main(self): @@ -10540,36 +12864,44 @@ def address_postal(self): return self._address_postal @property - def version_terms_of_service(self): + def date_of_birth(self): """ :rtype: str """ - return self._version_terms_of_service + return self._date_of_birth @property - def director_alias(self): + def place_of_birth(self): """ - :rtype: object_.LabelUser + :rtype: str """ - return self._director_alias + return self._place_of_birth @property - def language(self): + def country_of_birth(self): """ :rtype: str """ - return self._language + return self._country_of_birth @property - def country(self): + def nationality(self): """ :rtype: str """ - return self._country + return self._nationality + + @property + def language(self): + """ + :rtype: str + """ + + return self._language @property def region(self): @@ -10580,12 +12912,28 @@ def region(self): return self._region @property - def ubo(self): + def gender(self): """ - :rtype: list[object_.Ubo] + :rtype: str """ - return self._ubo + return self._gender + + @property + def avatar(self): + """ + :rtype: object_.Avatar + """ + + return self._avatar + + @property + def version_terms_of_service(self): + """ + :rtype: str + """ + + return self._version_terms_of_service @property def status(self): @@ -10627,112 +12975,232 @@ def notification_filters(self): return self._notification_filters - @property - def customer(self): + def are_all_fields_none(self): """ - :rtype: Customer + :rtype: bool """ - return self._customer + if self._id_ is not None: + return False - @property - def customer_limit(self): - """ - :rtype: CustomerLimit - """ + if self._created is not None: + return False - return self._customer_limit + if self._updated is not None: + return False - @property - def billing_contract(self): - """ - :rtype: list[BillingContractSubscription] - """ + if self._public_uuid is not None: + return False - return self._billing_contract + if self._first_name is not None: + return False + if self._middle_name is not None: + return False -class Customer(core.BunqModel): - """ - Used to view a customer. - - :type _id_: int - :type _created: str - :type _updated: str - :type _billing_account_id: str - """ + if self._last_name is not None: + return False - # Endpoint constants. - _ENDPOINT_URL_LISTING = "user/{}/customer" - _ENDPOINT_URL_READ = "user/{}/customer/{}" - _ENDPOINT_URL_UPDATE = "user/{}/customer/{}" + if self._legal_name is not None: + return False - # Field constants. - FIELD_BILLING_ACCOUNT_ID = "billing_account_id" + if self._display_name is not None: + return False - # Object type. - _OBJECT_TYPE = "Customer" + if self._public_nick_name is not None: + return False - def __init__(self): - self._id_ = None - self._created = None - self._updated = None - self._billing_account_id = None + if self._alias is not None: + return False - @classmethod - def list(cls, api_context, user_id, params=None, custom_headers=None): - """ - :type api_context: context.ApiContext - :type user_id: int - :type params: dict[str, str]|None - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseCustomerList - """ + if self._tax_resident is not None: + return False - if params is None: - params = {} + if self._document_type is not None: + return False - if custom_headers is None: - custom_headers = {} + if self._document_number is not None: + return False - api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) - response_raw = api_client.get(endpoint_url, params, custom_headers) + if self._document_country_of_issuance is not None: + return False - return BunqResponseCustomerList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE) - ) + if self._address_main is not None: + return False - @classmethod - def get(cls, api_context, user_id, customer_id, custom_headers=None): - """ - :type api_context: context.ApiContext - :type user_id: int - :type customer_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseCustomer - """ + if self._address_postal is not None: + return False - if custom_headers is None: - custom_headers = {} + if self._date_of_birth is not None: + return False - api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, customer_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + if self._place_of_birth is not None: + return False - return BunqResponseCustomer.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE) - ) + if self._country_of_birth is not None: + return False - @classmethod - def update(cls, api_context, request_map, user_id, customer_id, custom_headers=None): - """ - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type customer_id: int + if self._nationality is not None: + return False + + if self._language is not None: + return False + + if self._region is not None: + return False + + if self._gender is not None: + return False + + if self._avatar is not None: + return False + + if self._version_terms_of_service is not None: + return False + + if self._status is not None: + return False + + if self._sub_status is not None: + return False + + if self._session_timeout is not None: + return False + + if self._daily_limit_without_confirmation_login is not None: + return False + + if self._notification_filters is not None: + return False + + return True + + +class UserCompany(core.BunqModel): + """ + With UserCompany you can retrieve information regarding the authenticated + UserCompany and update specific fields.

Notification filters can be + set on a UserCompany level to receive callbacks. For more information check + the dedicated callbacks page. + + :type _id_: int + :type _created: str + :type _updated: str + :type _public_uuid: str + :type _name: str + :type _display_name: str + :type _public_nick_name: str + :type _alias: list[object_.Pointer] + :type _chamber_of_commerce_number: str + :type _type_of_business_entity: str + :type _sector_of_industry: str + :type _counter_bank_iban: str + :type _avatar: object_.Avatar + :type _address_main: object_.Address + :type _address_postal: object_.Address + :type _version_terms_of_service: str + :type _director_alias: object_.LabelUser + :type _language: str + :type _country: str + :type _region: str + :type _ubo: list[object_.Ubo] + :type _status: str + :type _sub_status: str + :type _session_timeout: int + :type _daily_limit_without_confirmation_login: object_.Amount + :type _notification_filters: list[object_.NotificationFilter] + :type _customer: Customer + :type _customer_limit: CustomerLimit + :type _billing_contract: list[BillingContractSubscription] + """ + + # Endpoint constants. + _ENDPOINT_URL_READ = "user-company/{}" + _ENDPOINT_URL_UPDATE = "user-company/{}" + + # Field constants. + FIELD_NAME = "name" + FIELD_PUBLIC_NICK_NAME = "public_nick_name" + FIELD_AVATAR_UUID = "avatar_uuid" + FIELD_ADDRESS_MAIN = "address_main" + FIELD_ADDRESS_POSTAL = "address_postal" + FIELD_LANGUAGE = "language" + FIELD_REGION = "region" + FIELD_COUNTRY = "country" + FIELD_UBO = "ubo" + FIELD_CHAMBER_OF_COMMERCE_NUMBER = "chamber_of_commerce_number" + FIELD_STATUS = "status" + FIELD_SUB_STATUS = "sub_status" + FIELD_SESSION_TIMEOUT = "session_timeout" + FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN = "daily_limit_without_confirmation_login" + FIELD_COUNTER_BANK_IBAN = "counter_bank_iban" + FIELD_NOTIFICATION_FILTERS = "notification_filters" + + # Object type. + _OBJECT_TYPE = "UserCompany" + + def __init__(self): + self._id_ = None + self._created = None + self._updated = None + self._public_uuid = None + self._name = None + self._display_name = None + self._public_nick_name = None + self._alias = None + self._chamber_of_commerce_number = None + self._type_of_business_entity = None + self._sector_of_industry = None + self._counter_bank_iban = None + self._avatar = None + self._address_main = None + self._address_postal = None + self._version_terms_of_service = None + self._director_alias = None + self._language = None + self._country = None + self._region = None + self._ubo = None + self._status = None + self._sub_status = None + self._session_timeout = None + self._daily_limit_without_confirmation_login = None + self._notification_filters = None + self._customer = None + self._customer_limit = None + self._billing_contract = None + + @classmethod + def get(cls, api_context, user_company_id, custom_headers=None): + """ + Get a specific company. + + :type api_context: context.ApiContext + :type user_company_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseUserCompany + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_company_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseUserCompany.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE) + ) + + @classmethod + def update(cls, api_context, request_map, user_company_id, custom_headers=None): + """ + Modify a specific company's data. + + :type api_context: context.ApiContext + :type request_map: dict[str, object] + :type user_company_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -10743,7 +13211,7 @@ def update(cls, api_context, request_map, user_id, customer_id, custom_headers=N api_client = client.ApiClient(api_context) request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, customer_id) + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_company_id) response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) return BunqResponseInt.cast_from_bunq_response( @@ -10775,354 +13243,404 @@ def updated(self): return self._updated @property - def billing_account_id(self): + def public_uuid(self): """ :rtype: str """ - return self._billing_account_id + return self._public_uuid + @property + def name(self): + """ + :rtype: str + """ -class CustomerLimit(core.BunqModel): - """ - Show the limits for the authenticated user. - - :type _limit_monetary_account: int - :type _limit_card_debit_maestro: int - :type _limit_card_debit_mastercard: int - :type _limit_card_debit_wildcard: int - :type _limit_card_debit_replacement: int - """ + return self._name - # Endpoint constants. - _ENDPOINT_URL_LISTING = "user/{}/limit" + @property + def display_name(self): + """ + :rtype: str + """ - # Object type. - _OBJECT_TYPE = "CustomerLimit" + return self._display_name - def __init__(self): - self._limit_monetary_account = None - self._limit_card_debit_maestro = None - self._limit_card_debit_mastercard = None - self._limit_card_debit_wildcard = None - self._limit_card_debit_replacement = None + @property + def public_nick_name(self): + """ + :rtype: str + """ - @classmethod - def list(cls, api_context, user_id, params=None, custom_headers=None): + return self._public_nick_name + + @property + def alias(self): """ - Get all limits for the authenticated user. - - :type api_context: context.ApiContext - :type user_id: int - :type params: dict[str, str]|None - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseCustomerLimitList + :rtype: list[object_.Pointer] """ - if params is None: - params = {} + return self._alias - if custom_headers is None: - custom_headers = {} + @property + def chamber_of_commerce_number(self): + """ + :rtype: str + """ - api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) - response_raw = api_client.get(endpoint_url, params, custom_headers) + return self._chamber_of_commerce_number - return BunqResponseCustomerLimitList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE) - ) + @property + def type_of_business_entity(self): + """ + :rtype: str + """ + + return self._type_of_business_entity @property - def limit_monetary_account(self): + def sector_of_industry(self): """ - :rtype: int + :rtype: str """ - return self._limit_monetary_account + return self._sector_of_industry @property - def limit_card_debit_maestro(self): + def counter_bank_iban(self): """ - :rtype: int + :rtype: str """ - return self._limit_card_debit_maestro + return self._counter_bank_iban @property - def limit_card_debit_mastercard(self): + def avatar(self): """ - :rtype: int + :rtype: object_.Avatar """ - return self._limit_card_debit_mastercard + return self._avatar @property - def limit_card_debit_wildcard(self): + def address_main(self): """ - :rtype: int + :rtype: object_.Address """ - return self._limit_card_debit_wildcard + return self._address_main @property - def limit_card_debit_replacement(self): + def address_postal(self): """ - :rtype: int + :rtype: object_.Address """ - return self._limit_card_debit_replacement + return self._address_postal + @property + def version_terms_of_service(self): + """ + :rtype: str + """ -class BillingContractSubscription(core.BunqModel): - """ - Show the subscription billing contract for the authenticated user. - - :type _id_: int - :type _created: str - :type _updated: str - :type _contract_date_start: str - :type _contract_date_end: str - :type _contract_version: int - :type _subscription_type: str - """ + return self._version_terms_of_service - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/billing-contract-subscription" - _ENDPOINT_URL_LISTING = "user/{}/billing-contract-subscription" + @property + def director_alias(self): + """ + :rtype: object_.LabelUser + """ - # Field constants. - FIELD_SUBSCRIPTION_TYPE = "subscription_type" + return self._director_alias - # Object type. - _OBJECT_TYPE = "BillingContractSubscription" + @property + def language(self): + """ + :rtype: str + """ - def __init__(self): - self._id_ = None - self._created = None - self._updated = None - self._contract_date_start = None - self._contract_date_end = None - self._contract_version = None - self._subscription_type = None + return self._language - @classmethod - def create(cls, api_context, request_map, user_id, custom_headers=None): + @property + def country(self): """ - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseBillingContractSubscription + :rtype: str """ - if custom_headers is None: - custom_headers = {} + return self._country - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id) - response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) + @property + def region(self): + """ + :rtype: str + """ - return BunqResponseBillingContractSubscription.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE) - ) + return self._region - @classmethod - def list(cls, api_context, user_id, params=None, custom_headers=None): + @property + def ubo(self): """ - Get all subscription billing contract for the authenticated user. - - :type api_context: context.ApiContext - :type user_id: int - :type params: dict[str, str]|None - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseBillingContractSubscriptionList + :rtype: list[object_.Ubo] """ - if params is None: - params = {} + return self._ubo - if custom_headers is None: - custom_headers = {} + @property + def status(self): + """ + :rtype: str + """ - api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) - response_raw = api_client.get(endpoint_url, params, custom_headers) + return self._status - return BunqResponseBillingContractSubscriptionList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE) - ) + @property + def sub_status(self): + """ + :rtype: str + """ + + return self._sub_status @property - def id_(self): + def session_timeout(self): """ :rtype: int """ - return self._id_ + return self._session_timeout @property - def created(self): + def daily_limit_without_confirmation_login(self): """ - :rtype: str + :rtype: object_.Amount """ - return self._created + return self._daily_limit_without_confirmation_login @property - def updated(self): + def notification_filters(self): """ - :rtype: str + :rtype: list[object_.NotificationFilter] """ - return self._updated + return self._notification_filters @property - def contract_date_start(self): + def customer(self): """ - :rtype: str + :rtype: Customer """ - return self._contract_date_start + return self._customer @property - def contract_date_end(self): + def customer_limit(self): """ - :rtype: str + :rtype: CustomerLimit """ - return self._contract_date_end + return self._customer_limit @property - def contract_version(self): + def billing_contract(self): """ - :rtype: int + :rtype: list[BillingContractSubscription] """ - return self._contract_version + return self._billing_contract - @property - def subscription_type(self): + def are_all_fields_none(self): """ - :rtype: str + :rtype: bool """ - return self._subscription_type + if self._id_ is not None: + return False + if self._created is not None: + return False -class PaymentChat(core.BunqModel): + if self._updated is not None: + return False + + if self._public_uuid is not None: + return False + + if self._name is not None: + return False + + if self._display_name is not None: + return False + + if self._public_nick_name is not None: + return False + + if self._alias is not None: + return False + + if self._chamber_of_commerce_number is not None: + return False + + if self._type_of_business_entity is not None: + return False + + if self._sector_of_industry is not None: + return False + + if self._counter_bank_iban is not None: + return False + + if self._avatar is not None: + return False + + if self._address_main is not None: + return False + + if self._address_postal is not None: + return False + + if self._version_terms_of_service is not None: + return False + + if self._director_alias is not None: + return False + + if self._language is not None: + return False + + if self._country is not None: + return False + + if self._region is not None: + return False + + if self._ubo is not None: + return False + + if self._status is not None: + return False + + if self._sub_status is not None: + return False + + if self._session_timeout is not None: + return False + + if self._daily_limit_without_confirmation_login is not None: + return False + + if self._notification_filters is not None: + return False + + if self._customer is not None: + return False + + if self._customer_limit is not None: + return False + + if self._billing_contract is not None: + return False + + return True + + +class Customer(core.BunqModel): """ - Manage the chat connected to a payment. + Used to view a customer. :type _id_: int :type _created: str :type _updated: str - :type _unread_message_count: int + :type _billing_account_id: str """ # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/payment/{}/chat" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/payment/{}/chat/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/payment/{}/chat" + _ENDPOINT_URL_LISTING = "user/{}/customer" + _ENDPOINT_URL_READ = "user/{}/customer/{}" + _ENDPOINT_URL_UPDATE = "user/{}/customer/{}" # Field constants. - FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id" + FIELD_BILLING_ACCOUNT_ID = "billing_account_id" # Object type. - _OBJECT_TYPE = "ChatConversationPayment" + _OBJECT_TYPE = "Customer" def __init__(self): self._id_ = None self._created = None self._updated = None - self._unread_message_count = None + self._billing_account_id = None @classmethod - def create(cls, api_context, request_map, user_id, monetary_account_id, payment_id, custom_headers=None): + def list(cls, api_context, user_id, params=None, custom_headers=None): """ - Create a chat for a specific payment. - :type api_context: context.ApiContext - :type request_map: dict[str, object] :type user_id: int - :type monetary_account_id: int - :type payment_id: int + :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseInt + :rtype: BunqResponseCustomerList """ + if params is None: + params = {} + if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, payment_id) - response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) + return BunqResponseCustomerList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) @classmethod - def update(cls, api_context, request_map, user_id, monetary_account_id, payment_id, payment_chat_id, custom_headers=None): + def get(cls, api_context, user_id, customer_id, custom_headers=None): """ - Update the last read message in the chat of a specific payment. - :type api_context: context.ApiContext - :type request_map: dict[str, object] :type user_id: int - :type monetary_account_id: int - :type payment_id: int - :type payment_chat_id: int + :type customer_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponsePaymentChat + :rtype: BunqResponseCustomer """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, payment_id, payment_chat_id) - response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, customer_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponsePaymentChat.cast_from_bunq_response( + return BunqResponseCustomer.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod - def list(cls, api_context, user_id, monetary_account_id, payment_id, params=None, custom_headers=None): + def update(cls, api_context, request_map, user_id, customer_id, custom_headers=None): """ - Get the chat for a specific payment. - :type api_context: context.ApiContext + :type request_map: dict[str, object] :type user_id: int - :type monetary_account_id: int - :type payment_id: int - :type params: dict[str, str]|None + :type customer_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponsePaymentChatList + :rtype: BunqResponseInt """ - if params is None: - params = {} - if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, payment_id) - response_raw = api_client.get(endpoint_url, params, custom_headers) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, customer_id) + response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - return BunqResponsePaymentChatList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @property @@ -11150,97 +13668,68 @@ def updated(self): return self._updated @property - def unread_message_count(self): + def billing_account_id(self): """ - :rtype: int + :rtype: str """ - return self._unread_message_count + return self._billing_account_id + + def are_all_fields_none(self): + """ + :rtype: bool + """ + if self._id_ is not None: + return False -class PermittedIp(core.BunqModel): + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._billing_account_id is not None: + return False + + return True + + +class CustomerLimit(core.BunqModel): """ - Manage the IPs which may be used for a credential of a user for server - authentication. + Show the limits for the authenticated user. - :type _ip: str - :type _status: str + :type _limit_monetary_account: int + :type _limit_card_debit_maestro: int + :type _limit_card_debit_mastercard: int + :type _limit_card_debit_wildcard: int + :type _limit_card_debit_replacement: int """ # Endpoint constants. - _ENDPOINT_URL_READ = "user/{}/credential-password-ip/{}/ip/{}" - _ENDPOINT_URL_CREATE = "user/{}/credential-password-ip/{}/ip" - _ENDPOINT_URL_LISTING = "user/{}/credential-password-ip/{}/ip" - _ENDPOINT_URL_UPDATE = "user/{}/credential-password-ip/{}/ip/{}" - - # Field constants. - FIELD_IP = "ip" - FIELD_STATUS = "status" + _ENDPOINT_URL_LISTING = "user/{}/limit" # Object type. - _OBJECT_TYPE = "PermittedIp" + _OBJECT_TYPE = "CustomerLimit" def __init__(self): - self._ip = None - self._status = None - - @classmethod - def get(cls, api_context, user_id, credential_password_ip_id, permitted_ip_id, custom_headers=None): - """ - :type api_context: context.ApiContext - :type user_id: int - :type credential_password_ip_id: int - :type permitted_ip_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponsePermittedIp - """ - - if custom_headers is None: - custom_headers = {} - - api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, credential_password_ip_id, permitted_ip_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) - - return BunqResponsePermittedIp.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE) - ) + self._limit_monetary_account = None + self._limit_card_debit_maestro = None + self._limit_card_debit_mastercard = None + self._limit_card_debit_wildcard = None + self._limit_card_debit_replacement = None @classmethod - def create(cls, api_context, request_map, user_id, credential_password_ip_id, custom_headers=None): + def list(cls, api_context, user_id, params=None, custom_headers=None): """ - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type credential_password_ip_id: int - :type custom_headers: dict[str, str]|None + Get all limits for the authenticated user. - :rtype: BunqResponseInt - """ - - if custom_headers is None: - custom_headers = {} - - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, credential_password_ip_id) - response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) - - @classmethod - def list(cls, api_context, user_id, credential_password_ip_id, params=None, custom_headers=None): - """ :type api_context: context.ApiContext :type user_id: int - :type credential_password_ip_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponsePermittedIpList + :rtype: BunqResponseCustomerLimitList """ if params is None: @@ -11250,99 +13739,117 @@ def list(cls, api_context, user_id, credential_password_ip_id, params=None, cust custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, credential_password_ip_id) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponsePermittedIpList.cast_from_bunq_response( + return BunqResponseCustomerLimitList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) - @classmethod - def update(cls, api_context, request_map, user_id, credential_password_ip_id, permitted_ip_id, custom_headers=None): + @property + def limit_monetary_account(self): """ - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type credential_password_ip_id: int - :type permitted_ip_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt + :rtype: int """ - if custom_headers is None: - custom_headers = {} + return self._limit_monetary_account - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, credential_password_ip_id, permitted_ip_id) - response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) + @property + def limit_card_debit_maestro(self): + """ + :rtype: int + """ - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) + return self._limit_card_debit_maestro @property - def ip(self): + def limit_card_debit_mastercard(self): """ - :rtype: str + :rtype: int """ - return self._ip + return self._limit_card_debit_mastercard @property - def status(self): + def limit_card_debit_wildcard(self): """ - :rtype: str + :rtype: int """ - return self._status + return self._limit_card_debit_wildcard + + @property + def limit_card_debit_replacement(self): + """ + :rtype: int + """ + return self._limit_card_debit_replacement -class RequestInquiryChat(core.BunqModel): + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._limit_monetary_account is not None: + return False + + if self._limit_card_debit_maestro is not None: + return False + + if self._limit_card_debit_mastercard is not None: + return False + + if self._limit_card_debit_wildcard is not None: + return False + + if self._limit_card_debit_replacement is not None: + return False + + return True + + +class BillingContractSubscription(core.BunqModel): """ - Manage the chat connected to a request inquiry. In the same way a request - inquiry and a request response are created together, so that each side of - the interaction can work on a different object, also a request inquiry chat - and a request response chat are created at the same time. See - 'request-response-chat' for the chat endpoint for the responding user. + Show the subscription billing contract for the authenticated user. :type _id_: int :type _created: str :type _updated: str - :type _unread_message_count: int + :type _contract_date_start: str + :type _contract_date_end: str + :type _contract_version: int + :type _subscription_type: str """ # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-inquiry/{}/chat" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-inquiry/{}/chat/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-inquiry/{}/chat" + _ENDPOINT_URL_CREATE = "user/{}/billing-contract-subscription" + _ENDPOINT_URL_LISTING = "user/{}/billing-contract-subscription" # Field constants. - FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id" + FIELD_SUBSCRIPTION_TYPE = "subscription_type" # Object type. - _OBJECT_TYPE = "RequestInquiryChat" + _OBJECT_TYPE = "BillingContractSubscription" def __init__(self): self._id_ = None self._created = None self._updated = None - self._unread_message_count = None + self._contract_date_start = None + self._contract_date_end = None + self._contract_version = None + self._subscription_type = None @classmethod - def create(cls, api_context, request_map, user_id, monetary_account_id, request_inquiry_id, custom_headers=None): + def create(cls, api_context, request_map, user_id, custom_headers=None): """ - Create a chat for a specific request inquiry. - :type api_context: context.ApiContext :type request_map: dict[str, object] :type user_id: int - :type monetary_account_id: int - :type request_inquiry_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseInt + :rtype: BunqResponseBillingContractSubscription """ if custom_headers is None: @@ -11350,54 +13857,24 @@ def create(cls, api_context, request_map, user_id, monetary_account_id, request_ api_client = client.ApiClient(api_context) request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, request_inquiry_id) + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) - - @classmethod - def update(cls, api_context, request_map, user_id, monetary_account_id, request_inquiry_id, request_inquiry_chat_id, custom_headers=None): - """ - Update the last read message in the chat of a specific request inquiry. - - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type monetary_account_id: int - :type request_inquiry_id: int - :type request_inquiry_chat_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseRequestInquiryChat - """ - - if custom_headers is None: - custom_headers = {} - - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, request_inquiry_id, request_inquiry_chat_id) - response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - - return BunqResponseRequestInquiryChat.cast_from_bunq_response( + return BunqResponseBillingContractSubscription.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod - def list(cls, api_context, user_id, monetary_account_id, request_inquiry_id, params=None, custom_headers=None): + def list(cls, api_context, user_id, params=None, custom_headers=None): """ - Get the chat for a specific request inquiry. + Get all subscription billing contract for the authenticated user. :type api_context: context.ApiContext :type user_id: int - :type monetary_account_id: int - :type request_inquiry_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestInquiryChatList + :rtype: BunqResponseBillingContractSubscriptionList """ if params is None: @@ -11407,10 +13884,10 @@ def list(cls, api_context, user_id, monetary_account_id, request_inquiry_id, par custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, request_inquiry_id) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseRequestInquiryChatList.cast_from_bunq_response( + return BunqResponseBillingContractSubscriptionList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) @@ -11439,38 +13916,86 @@ def updated(self): return self._updated @property - def unread_message_count(self): + def contract_date_start(self): """ - :rtype: int + :rtype: str """ - return self._unread_message_count + return self._contract_date_start + @property + def contract_date_end(self): + """ + :rtype: str + """ -class RequestResponseChat(core.BunqModel): - """ - Manage the chat connected to a request response. In the same way a request - inquiry and a request response are created together, so that each side of - the interaction can work on a different object, also a request inquiry chat - and a request response chat are created at the same time. See - 'request-inquiry-chat' for the chat endpoint for the inquiring user. - - :type _id_: int + return self._contract_date_end + + @property + def contract_version(self): + """ + :rtype: int + """ + + return self._contract_version + + @property + def subscription_type(self): + """ + :rtype: str + """ + + return self._subscription_type + + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._contract_date_start is not None: + return False + + if self._contract_date_end is not None: + return False + + if self._contract_version is not None: + return False + + if self._subscription_type is not None: + return False + + return True + + +class PaymentChat(core.BunqModel): + """ + Manage the chat connected to a payment. + + :type _id_: int :type _created: str :type _updated: str :type _unread_message_count: int """ # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-response/{}/chat" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-response/{}/chat/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-response/{}/chat" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/payment/{}/chat" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/payment/{}/chat/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/payment/{}/chat" # Field constants. FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id" # Object type. - _OBJECT_TYPE = "RequestResponseChat" + _OBJECT_TYPE = "ChatConversationPayment" def __init__(self): self._id_ = None @@ -11479,15 +14004,15 @@ def __init__(self): self._unread_message_count = None @classmethod - def create(cls, api_context, request_map, user_id, monetary_account_id, request_response_id, custom_headers=None): + def create(cls, api_context, request_map, user_id, monetary_account_id, payment_id, custom_headers=None): """ - Create a chat for a specific request response. + Create a chat for a specific payment. :type api_context: context.ApiContext :type request_map: dict[str, object] :type user_id: int :type monetary_account_id: int - :type request_response_id: int + :type payment_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -11498,7 +14023,7 @@ def create(cls, api_context, request_map, user_id, monetary_account_id, request_ api_client = client.ApiClient(api_context) request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, request_response_id) + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, payment_id) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) return BunqResponseInt.cast_from_bunq_response( @@ -11506,19 +14031,19 @@ def create(cls, api_context, request_map, user_id, monetary_account_id, request_ ) @classmethod - def update(cls, api_context, request_map, user_id, monetary_account_id, request_response_id, request_response_chat_id, custom_headers=None): + def update(cls, api_context, request_map, user_id, monetary_account_id, payment_id, payment_chat_id, custom_headers=None): """ - Update the last read message in the chat of a specific request response. + Update the last read message in the chat of a specific payment. :type api_context: context.ApiContext :type request_map: dict[str, object] :type user_id: int :type monetary_account_id: int - :type request_response_id: int - :type request_response_chat_id: int + :type payment_id: int + :type payment_chat_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestResponseChat + :rtype: BunqResponsePaymentChat """ if custom_headers is None: @@ -11526,26 +14051,26 @@ def update(cls, api_context, request_map, user_id, monetary_account_id, request_ api_client = client.ApiClient(api_context) request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, request_response_id, request_response_chat_id) + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, payment_id, payment_chat_id) response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - return BunqResponseRequestResponseChat.cast_from_bunq_response( + return BunqResponsePaymentChat.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod - def list(cls, api_context, user_id, monetary_account_id, request_response_id, params=None, custom_headers=None): + def list(cls, api_context, user_id, monetary_account_id, payment_id, params=None, custom_headers=None): """ - Get the chat for a specific request response. + Get the chat for a specific payment. :type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int - :type request_response_id: int + :type payment_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestResponseChatList + :rtype: BunqResponsePaymentChatList """ if params is None: @@ -11555,10 +14080,10 @@ def list(cls, api_context, user_id, monetary_account_id, request_response_id, pa custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, request_response_id) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, payment_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseRequestResponseChatList.cast_from_bunq_response( + return BunqResponsePaymentChatList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) @@ -11594,116 +14119,133 @@ def unread_message_count(self): return self._unread_message_count + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False -class ScheduleUser(core.BunqModel): + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._unread_message_count is not None: + return False + + return True + + +class PermittedIp(core.BunqModel): """ - view for reading the scheduled definitions. + Manage the IPs which may be used for a credential of a user for server + authentication. + + :type _ip: str + :type _status: str """ # Endpoint constants. - _ENDPOINT_URL_LISTING = "user/{}/schedule" + _ENDPOINT_URL_READ = "user/{}/credential-password-ip/{}/ip/{}" + _ENDPOINT_URL_CREATE = "user/{}/credential-password-ip/{}/ip" + _ENDPOINT_URL_LISTING = "user/{}/credential-password-ip/{}/ip" + _ENDPOINT_URL_UPDATE = "user/{}/credential-password-ip/{}/ip/{}" + + # Field constants. + FIELD_IP = "ip" + FIELD_STATUS = "status" # Object type. - _OBJECT_TYPE = "ScheduleUser" + _OBJECT_TYPE = "PermittedIp" + + def __init__(self): + self._ip = None + self._status = None @classmethod - def list(cls, api_context, user_id, params=None, custom_headers=None): + def get(cls, api_context, user_id, credential_password_ip_id, permitted_ip_id, custom_headers=None): """ - Get a collection of scheduled definition for all accessible monetary - accounts of the user. You can add the parameter type to filter the - response. When - type={SCHEDULE_DEFINITION_PAYMENT,SCHEDULE_DEFINITION_PAYMENT_BATCH} is - provided only schedule definition object that relate to these - definitions are returned. - :type api_context: context.ApiContext :type user_id: int - :type params: dict[str, str]|None + :type credential_password_ip_id: int + :type permitted_ip_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseScheduleUserList + :rtype: BunqResponsePermittedIp """ - if params is None: - params = {} - if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) - response_raw = api_client.get(endpoint_url, params, custom_headers) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, credential_password_ip_id, permitted_ip_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseScheduleUserList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE) + return BunqResponsePermittedIp.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE) ) - -class Session(core.BunqModel): - """ - Endpoint for operations over the current session. - """ - - # Endpoint constants. - _ENDPOINT_URL_DELETE = "session/{}" - - # Object type. - _OBJECT_TYPE = "Session" - @classmethod - def delete(cls, api_context, session_id, custom_headers=None): + def create(cls, api_context, request_map, user_id, credential_password_ip_id, custom_headers=None): """ - Deletes the current session. No response is returned for this request. - :type api_context: context.ApiContext - :type session_id: int + :type request_map: dict[str, object] + :type user_id: int + :type credential_password_ip_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseNone + :rtype: BunqResponseInt """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_DELETE.format(session_id) - response_raw = api_client.delete(endpoint_url, custom_headers) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, credential_password_ip_id) + response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - return BunqResponseNone.cast_from_bunq_response( - client.BunqResponse(None, response_raw.headers) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) + @classmethod + def list(cls, api_context, user_id, credential_password_ip_id, params=None, custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type credential_password_ip_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponsePermittedIpList + """ -class TabItemShopBatch(core.BunqModel): - """ - Create a batch of tab items. - - :type _tab_items: list[TabItemShop] - """ - - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item-batch" + if params is None: + params = {} - # Field constants. - FIELD_TAB_ITEMS = "tab_items" + if custom_headers is None: + custom_headers = {} - # Object type. - _OBJECT_TYPE = "TabItemShopBatch" + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, credential_password_ip_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) - def __init__(self): - self._tab_items = None + return BunqResponsePermittedIpList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE) + ) @classmethod - def create(cls, api_context, request_map, user_id, monetary_account_id, cash_register_id, tab_uuid, custom_headers=None): + def update(cls, api_context, request_map, user_id, credential_password_ip_id, permitted_ip_id, custom_headers=None): """ - Create tab items as a batch. - :type api_context: context.ApiContext :type request_map: dict[str, object] :type user_id: int - :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str + :type credential_password_ip_id: int + :type permitted_ip_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -11714,79 +14256,84 @@ def create(cls, api_context, request_map, user_id, monetary_account_id, cash_reg api_client = client.ApiClient(api_context) request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, cash_register_id, tab_uuid) - response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, credential_password_ip_id, permitted_ip_id) + response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) return BunqResponseInt.cast_from_bunq_response( cls._process_for_id(response_raw) ) @property - def tab_items(self): + def ip(self): """ - :rtype: list[TabItemShop] + :rtype: str """ - return self._tab_items + return self._ip + + @property + def status(self): + """ + :rtype: str + """ + return self._status -class TabItemShop(core.BunqModel): + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._ip is not None: + return False + + if self._status is not None: + return False + + return True + + +class RequestInquiryChat(core.BunqModel): """ - After you’ve created a Tab using /tab-usage-single or /tab-usage-multiple - you can add items and attachments using tab-item. You can only add or modify - TabItems of a Tab which status is OPEN. The amount of the TabItems will not - influence the total_amount of the corresponding Tab. However, if you've - created any TabItems for a Tab the sum of the amounts of these items must be - equal to the total_amount of the Tab when you change its status to - PAYABLE/WAITING_FOR_PAYMENT. + Manage the chat connected to a request inquiry. In the same way a request + inquiry and a request response are created together, so that each side of + the interaction can work on a different object, also a request inquiry chat + and a request response chat are created at the same time. See + 'request-response-chat' for the chat endpoint for the responding user. :type _id_: int - :type _description: str - :type _ean_code: str - :type _avatar_attachment: object_.AttachmentPublic - :type _tab_attachment: list[object_.AttachmentTab] - :type _quantity: float - :type _amount: object_.Amount + :type _created: str + :type _updated: str + :type _unread_message_count: int """ # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item/{}" - _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item" - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item/{}" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-inquiry/{}/chat" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-inquiry/{}/chat/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-inquiry/{}/chat" # Field constants. - FIELD_DESCRIPTION = "description" - FIELD_EAN_CODE = "ean_code" - FIELD_AVATAR_ATTACHMENT_UUID = "avatar_attachment_uuid" - FIELD_TAB_ATTACHMENT = "tab_attachment" - FIELD_QUANTITY = "quantity" - FIELD_AMOUNT = "amount" + FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id" # Object type. - _OBJECT_TYPE = "TabItem" + _OBJECT_TYPE = "RequestInquiryChat" def __init__(self): self._id_ = None - self._description = None - self._ean_code = None - self._avatar_attachment = None - self._tab_attachment = None - self._quantity = None - self._amount = None + self._created = None + self._updated = None + self._unread_message_count = None @classmethod - def create(cls, api_context, request_map, user_id, monetary_account_id, cash_register_id, tab_uuid, custom_headers=None): + def create(cls, api_context, request_map, user_id, monetary_account_id, request_inquiry_id, custom_headers=None): """ - Create a new TabItem for a given Tab. + Create a chat for a specific request inquiry. :type api_context: context.ApiContext :type request_map: dict[str, object] :type user_id: int :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str + :type request_inquiry_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -11797,7 +14344,7 @@ def create(cls, api_context, request_map, user_id, monetary_account_id, cash_reg api_client = client.ApiClient(api_context) request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, cash_register_id, tab_uuid) + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, request_inquiry_id) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) return BunqResponseInt.cast_from_bunq_response( @@ -11805,20 +14352,19 @@ def create(cls, api_context, request_map, user_id, monetary_account_id, cash_reg ) @classmethod - def update(cls, api_context, request_map, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id, custom_headers=None): + def update(cls, api_context, request_map, user_id, monetary_account_id, request_inquiry_id, request_inquiry_chat_id, custom_headers=None): """ - Modify a TabItem from a given Tab. + Update the last read message in the chat of a specific request inquiry. :type api_context: context.ApiContext :type request_map: dict[str, object] :type user_id: int :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :type tab_item_shop_id: int + :type request_inquiry_id: int + :type request_inquiry_chat_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseInt + :rtype: BunqResponseRequestInquiryChat """ if custom_headers is None: @@ -11826,98 +14372,209 @@ def update(cls, api_context, request_map, user_id, monetary_account_id, cash_reg api_client = client.ApiClient(api_context) request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id) + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, request_inquiry_id, request_inquiry_chat_id) response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) + return BunqResponseRequestInquiryChat.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod - def delete(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id, custom_headers=None): + def list(cls, api_context, user_id, monetary_account_id, request_inquiry_id, params=None, custom_headers=None): """ - Delete a specific TabItem from a Tab. This request returns an empty - response. + Get the chat for a specific request inquiry. :type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :type tab_item_shop_id: int + :type request_inquiry_id: int + :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseNone + :rtype: BunqResponseRequestInquiryChatList """ + if params is None: + params = {} + if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_DELETE.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id) - response_raw = api_client.delete(endpoint_url, custom_headers) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, request_inquiry_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseNone.cast_from_bunq_response( - client.BunqResponse(None, response_raw.headers) + return BunqResponseRequestInquiryChatList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) + @property + def id_(self): + """ + :rtype: int + """ + + return self._id_ + + @property + def created(self): + """ + :rtype: str + """ + + return self._created + + @property + def updated(self): + """ + :rtype: str + """ + + return self._updated + + @property + def unread_message_count(self): + """ + :rtype: int + """ + + return self._unread_message_count + + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._unread_message_count is not None: + return False + + return True + + +class RequestResponseChat(core.BunqModel): + """ + Manage the chat connected to a request response. In the same way a request + inquiry and a request response are created together, so that each side of + the interaction can work on a different object, also a request inquiry chat + and a request response chat are created at the same time. See + 'request-inquiry-chat' for the chat endpoint for the inquiring user. + + :type _id_: int + :type _created: str + :type _updated: str + :type _unread_message_count: int + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-response/{}/chat" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-response/{}/chat/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-response/{}/chat" + + # Field constants. + FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id" + + # Object type. + _OBJECT_TYPE = "RequestResponseChat" + + def __init__(self): + self._id_ = None + self._created = None + self._updated = None + self._unread_message_count = None + @classmethod - def list(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, params=None, custom_headers=None): + def create(cls, api_context, request_map, user_id, monetary_account_id, request_response_id, custom_headers=None): """ - Get a collection of TabItems from a given Tab. + Create a chat for a specific request response. :type api_context: context.ApiContext + :type request_map: dict[str, object] :type user_id: int :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :type params: dict[str, str]|None + :type request_response_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseTabItemShopList + :rtype: BunqResponseInt """ - if params is None: - params = {} - if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, cash_register_id, tab_uuid) - response_raw = api_client.get(endpoint_url, params, custom_headers) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, request_response_id) + response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - return BunqResponseTabItemShopList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @classmethod - def get(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id, custom_headers=None): + def update(cls, api_context, request_map, user_id, monetary_account_id, request_response_id, request_response_chat_id, custom_headers=None): """ - Get a specific TabItem from a given Tab. + Update the last read message in the chat of a specific request response. :type api_context: context.ApiContext + :type request_map: dict[str, object] :type user_id: int :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :type tab_item_shop_id: int + :type request_response_id: int + :type request_response_chat_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseTabItemShop + :rtype: BunqResponseRequestResponseChat """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, request_response_id, request_response_chat_id) + response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - return BunqResponseTabItemShop.cast_from_bunq_response( + return BunqResponseRequestResponseChat.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) + @classmethod + def list(cls, api_context, user_id, monetary_account_id, request_response_id, params=None, custom_headers=None): + """ + Get the chat for a specific request response. + + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type request_response_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseRequestResponseChatList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, request_response_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseRequestResponseChatList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE) + ) + @property def id_(self): """ @@ -11927,845 +14584,846 @@ def id_(self): return self._id_ @property - def description(self): + def created(self): """ :rtype: str """ - return self._description + return self._created @property - def ean_code(self): + def updated(self): """ :rtype: str """ - return self._ean_code + return self._updated @property - def avatar_attachment(self): + def unread_message_count(self): """ - :rtype: object_.AttachmentPublic + :rtype: int """ - return self._avatar_attachment + return self._unread_message_count - @property - def tab_attachment(self): + def are_all_fields_none(self): """ - :rtype: list[object_.AttachmentTab] + :rtype: bool """ - return self._tab_attachment + if self._id_ is not None: + return False - @property - def quantity(self): - """ - :rtype: float - """ + if self._created is not None: + return False - return self._quantity + if self._updated is not None: + return False - @property - def amount(self): - """ - :rtype: object_.Amount - """ + if self._unread_message_count is not None: + return False - return self._amount + return True -class TabQrCodeContent(core.BunqModel): +class ScheduleUser(core.BunqModel): """ - This call returns the raw content of the QR code that links to this Tab. - When a bunq user scans this QR code with the bunq app the Tab will be shown - on his/her device. + view for reading the scheduled definitions. """ # Endpoint constants. - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/qr-code-content" + _ENDPOINT_URL_LISTING = "user/{}/schedule" # Object type. - _OBJECT_TYPE = "TabQrCodeContent" + _OBJECT_TYPE = "ScheduleUser" @classmethod - def list(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, custom_headers=None): + def list(cls, api_context, user_id, params=None, custom_headers=None): """ - Returns the raw content of the QR code that links to this Tab. The raw - content is the binary representation of a file, without any JSON - wrapping. + Get a collection of scheduled definition for all accessible monetary + accounts of the user. You can add the parameter type to filter the + response. When + type={SCHEDULE_DEFINITION_PAYMENT,SCHEDULE_DEFINITION_PAYMENT_BATCH} is + provided only schedule definition object that relate to these + definitions are returned. :type api_context: context.ApiContext :type user_id: int - :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str + :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseBytes + :rtype: BunqResponseScheduleUserList """ + if params is None: + params = {} + if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, cash_register_id, tab_uuid) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseBytes.cast_from_bunq_response( - client.BunqResponse(response_raw.body_bytes, response_raw.headers) + return BunqResponseScheduleUserList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) -class TokenQrRequestIdeal(core.BunqModel): + def are_all_fields_none(self): + """ + :rtype: bool + """ + + return True + + +class Session(core.BunqModel): """ - Using this call you create a request for payment from an external token - provided with an ideal transaction. Make sure your iDEAL payments are - compliant with the iDEAL standards, by following the following manual: https://www.bunq.com/files/media/legal/en/20170315_ideal_standards_en.pdf. - It's very important to keep these points in mind when you are using the - endpoint to make iDEAL payments from your application. - - :type _time_responded: str - :type _time_expiry: str - :type _monetary_account_id: int - :type _amount_inquired: object_.Amount - :type _amount_responded: object_.Amount - :type _alias: object_.MonetaryAccountReference - :type _counterparty_alias: object_.MonetaryAccountReference - :type _description: str - :type _attachment: list[object_.Attachment] - :type _status: str - :type _minimum_age: int - :type _require_address: str - :type _address_shipping: object_.Address - :type _address_billing: object_.Address - :type _geolocation: object_.Geolocation - :type _redirect_url: str - :type _type_: str - :type _sub_type: str - :type _allow_chat: bool - :type _eligible_whitelist_id: int + Endpoint for operations over the current session. """ # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/token-qr-request-ideal" - - # Field constants. - FIELD_TOKEN = "token" + _ENDPOINT_URL_DELETE = "session/{}" # Object type. - _OBJECT_TYPE = "TokenQrRequestIdeal" - - def __init__(self): - self._time_responded = None - self._time_expiry = None - self._monetary_account_id = None - self._amount_inquired = None - self._amount_responded = None - self._alias = None - self._counterparty_alias = None - self._description = None - self._attachment = None - self._status = None - self._minimum_age = None - self._require_address = None - self._address_shipping = None - self._address_billing = None - self._geolocation = None - self._redirect_url = None - self._type_ = None - self._sub_type = None - self._allow_chat = None - self._eligible_whitelist_id = None + _OBJECT_TYPE = "Session" @classmethod - def create(cls, api_context, request_map, user_id, custom_headers=None): + def delete(cls, api_context, session_id, custom_headers=None): """ - Create a request from an ideal transaction. + Deletes the current session. No response is returned for this request. :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int + :type session_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseTokenQrRequestIdeal + :rtype: BunqResponseNone """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id) - response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(session_id) + response_raw = api_client.delete(endpoint_url, custom_headers) - return BunqResponseTokenQrRequestIdeal.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE) + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) ) - @property - def time_responded(self): - """ - :rtype: str - """ - - return self._time_responded - @property - def time_expiry(self): + def are_all_fields_none(self): """ - :rtype: str + :rtype: bool """ - return self._time_expiry + return True - @property - def monetary_account_id(self): - """ - :rtype: int - """ - return self._monetary_account_id +class TabItemShopBatch(core.BunqModel): + """ + Create a batch of tab items. + + :type _tab_items: list[TabItemShop] + """ - @property - def amount_inquired(self): - """ - :rtype: object_.Amount - """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item-batch" - return self._amount_inquired + # Field constants. + FIELD_TAB_ITEMS = "tab_items" - @property - def amount_responded(self): - """ - :rtype: object_.Amount - """ + # Object type. + _OBJECT_TYPE = "TabItemShopBatch" - return self._amount_responded + def __init__(self): + self._tab_items = None - @property - def alias(self): + @classmethod + def create(cls, api_context, request_map, user_id, monetary_account_id, cash_register_id, tab_uuid, custom_headers=None): """ - :rtype: object_.MonetaryAccountReference + Create tab items as a batch. + + :type api_context: context.ApiContext + :type request_map: dict[str, object] + :type user_id: int + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._alias + if custom_headers is None: + custom_headers = {} - @property - def counterparty_alias(self): - """ - :rtype: object_.MonetaryAccountReference - """ + api_client = client.ApiClient(api_context) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, cash_register_id, tab_uuid) + response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - return self._counterparty_alias + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) @property - def description(self): + def tab_items(self): """ - :rtype: str + :rtype: list[TabItemShop] """ - return self._description + return self._tab_items - @property - def attachment(self): + def are_all_fields_none(self): """ - :rtype: list[object_.Attachment] + :rtype: bool """ - return self._attachment + if self._tab_items is not None: + return False - @property - def status(self): - """ - :rtype: str - """ + return True - return self._status - @property - def minimum_age(self): - """ - :rtype: int - """ +class TabItemShop(core.BunqModel): + """ + After you’ve created a Tab using /tab-usage-single or /tab-usage-multiple + you can add items and attachments using tab-item. You can only add or modify + TabItems of a Tab which status is OPEN. The amount of the TabItems will not + influence the total_amount of the corresponding Tab. However, if you've + created any TabItems for a Tab the sum of the amounts of these items must be + equal to the total_amount of the Tab when you change its status to + PAYABLE/WAITING_FOR_PAYMENT. + + :type _id_: int + :type _description: str + :type _ean_code: str + :type _avatar_attachment: object_.AttachmentPublic + :type _tab_attachment: list[object_.AttachmentTab] + :type _quantity: float + :type _amount: object_.Amount + """ - return self._minimum_age + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item/{}" - @property - def require_address(self): - """ - :rtype: str - """ + # Field constants. + FIELD_DESCRIPTION = "description" + FIELD_EAN_CODE = "ean_code" + FIELD_AVATAR_ATTACHMENT_UUID = "avatar_attachment_uuid" + FIELD_TAB_ATTACHMENT = "tab_attachment" + FIELD_QUANTITY = "quantity" + FIELD_AMOUNT = "amount" - return self._require_address + # Object type. + _OBJECT_TYPE = "TabItem" - @property - def address_shipping(self): - """ - :rtype: object_.Address - """ - - return self._address_shipping - - @property - def address_billing(self): - """ - :rtype: object_.Address - """ - - return self._address_billing - - @property - def geolocation(self): - """ - :rtype: object_.Geolocation - """ - - return self._geolocation + def __init__(self): + self._id_ = None + self._description = None + self._ean_code = None + self._avatar_attachment = None + self._tab_attachment = None + self._quantity = None + self._amount = None - @property - def redirect_url(self): + @classmethod + def create(cls, api_context, request_map, user_id, monetary_account_id, cash_register_id, tab_uuid, custom_headers=None): """ - :rtype: str + Create a new TabItem for a given Tab. + + :type api_context: context.ApiContext + :type request_map: dict[str, object] + :type user_id: int + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._redirect_url + if custom_headers is None: + custom_headers = {} - @property - def type_(self): - """ - :rtype: str - """ + api_client = client.ApiClient(api_context) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, cash_register_id, tab_uuid) + response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - return self._type_ + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) - @property - def sub_type(self): + @classmethod + def update(cls, api_context, request_map, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id, custom_headers=None): """ - :rtype: str + Modify a TabItem from a given Tab. + + :type api_context: context.ApiContext + :type request_map: dict[str, object] + :type user_id: int + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :type tab_item_shop_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._sub_type + if custom_headers is None: + custom_headers = {} - @property - def allow_chat(self): - """ - :rtype: bool - """ + api_client = client.ApiClient(api_context) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id) + response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - return self._allow_chat + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) - @property - def eligible_whitelist_id(self): + @classmethod + def delete(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id, custom_headers=None): """ - :rtype: int + Delete a specific TabItem from a Tab. This request returns an empty + response. + + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :type tab_item_shop_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone """ - return self._eligible_whitelist_id - - -class User(core.BunqModel): - """ - Using this call you can retrieve information of the user you are logged in - as. This includes your user id, which is referred to in endpoints. - - :type _UserLight: UserLight - :type _UserPerson: UserPerson - :type _UserCompany: UserCompany - """ - - # Error constants. - _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' - - # Endpoint constants. - _ENDPOINT_URL_READ = "user/{}" - _ENDPOINT_URL_LISTING = "user" + if custom_headers is None: + custom_headers = {} - # Object type. - _OBJECT_TYPE = "User" + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id) + response_raw = api_client.delete(endpoint_url, custom_headers) - def __init__(self): - self._UserLight = None - self._UserPerson = None - self._UserCompany = None + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) @classmethod - def get(cls, api_context, user_id, custom_headers=None): + def list(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, params=None, custom_headers=None): """ - Get a specific user. + Get a collection of TabItems from a given Tab. :type api_context: context.ApiContext :type user_id: int + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseUser + :rtype: BunqResponseTabItemShopList """ + if params is None: + params = {} + if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, cash_register_id, tab_uuid) + response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseUser.cast_from_bunq_response( - cls._from_json(response_raw) + return BunqResponseTabItemShopList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) @classmethod - def list(cls, api_context, params=None, custom_headers=None): + def get(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id, custom_headers=None): """ - Get a collection of all available users. + Get a specific TabItem from a given Tab. :type api_context: context.ApiContext - :type params: dict[str, str]|None + :type user_id: int + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :type tab_item_shop_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseUserList + :rtype: BunqResponseTabItemShop """ - if params is None: - params = {} - if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING - response_raw = api_client.get(endpoint_url, params, custom_headers) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseUserList.cast_from_bunq_response( - cls._from_json_list(response_raw) + return BunqResponseTabItemShop.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE) ) @property - def UserLight(self): + def id_(self): """ - :rtype: UserLight + :rtype: int """ - return self._UserLight + return self._id_ @property - def UserPerson(self): + def description(self): """ - :rtype: UserPerson + :rtype: str """ - return self._UserPerson + return self._description @property - def UserCompany(self): + def ean_code(self): """ - :rtype: UserCompany + :rtype: str """ - return self._UserCompany - def get_referenced_object(self): + return self._ean_code + + @property + def avatar_attachment(self): """ - :rtype: core.BunqModel - :raise: BunqException + :rtype: object_.AttachmentPublic """ - if self._UserLight is not None: - return self._UserLight + return self._avatar_attachment - if self._UserPerson is not None: - return self._UserPerson + @property + def tab_attachment(self): + """ + :rtype: list[object_.AttachmentTab] + """ - if self._UserCompany is not None: - return self._UserCompany + return self._tab_attachment - raise exception.BunqException(self._ERROR_NULL_FIELDS) + @property + def quantity(self): + """ + :rtype: float + """ + return self._quantity -class UserLight(core.BunqModel): + @property + def amount(self): + """ + :rtype: object_.Amount + """ + + return self._amount + + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._description is not None: + return False + + if self._ean_code is not None: + return False + + if self._avatar_attachment is not None: + return False + + if self._tab_attachment is not None: + return False + + if self._quantity is not None: + return False + + if self._amount is not None: + return False + + return True + + +class TabQrCodeContent(core.BunqModel): """ - Show the authenticated user, if it is a light user. + This call returns the raw content of the QR code that links to this Tab. + When a bunq user scans this QR code with the bunq app the Tab will be shown + on his/her device. + """ + + # Endpoint constants. + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/qr-code-content" + + # Object type. + _OBJECT_TYPE = "TabQrCodeContent" + + @classmethod + def list(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, custom_headers=None): + """ + Returns the raw content of the QR code that links to this Tab. The raw + content is the binary representation of a file, without any JSON + wrapping. + + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseBytes + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, cash_register_id, tab_uuid) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseBytes.cast_from_bunq_response( + client.BunqResponse(response_raw.body_bytes, response_raw.headers) + ) + + + def are_all_fields_none(self): + """ + :rtype: bool + """ + + return True + + +class TokenQrRequestIdeal(core.BunqModel): + """ + Using this call you create a request for payment from an external token + provided with an ideal transaction. Make sure your iDEAL payments are + compliant with the iDEAL standards, by following the following manual: https://www.bunq.com/files/media/legal/en/20170315_ideal_standards_en.pdf. + It's very important to keep these points in mind when you are using the + endpoint to make iDEAL payments from your application. - :type _id_: int - :type _created: str - :type _updated: str - :type _public_uuid: str - :type _first_name: str - :type _middle_name: str - :type _last_name: str - :type _legal_name: str - :type _display_name: str - :type _public_nick_name: str - :type _alias: list[object_.Pointer] - :type _social_security_number: str - :type _tax_resident: list[object_.TaxResident] - :type _document_type: str - :type _document_number: str - :type _document_country_of_issuance: str - :type _address_main: object_.Address - :type _address_postal: object_.Address - :type _date_of_birth: str - :type _place_of_birth: str - :type _country_of_birth: str - :type _nationality: str - :type _language: str - :type _region: str - :type _gender: str - :type _avatar: object_.Avatar - :type _version_terms_of_service: str + :type _time_responded: str + :type _time_expiry: str + :type _monetary_account_id: int + :type _amount_inquired: object_.Amount + :type _amount_responded: object_.Amount + :type _alias: object_.MonetaryAccountReference + :type _counterparty_alias: object_.MonetaryAccountReference + :type _description: str + :type _attachment: list[object_.Attachment] :type _status: str - :type _sub_status: str - :type _session_timeout: int - :type _daily_limit_without_confirmation_login: object_.Amount - :type _notification_filters: list[object_.NotificationFilter] + :type _minimum_age: int + :type _require_address: str + :type _address_shipping: object_.Address + :type _address_billing: object_.Address + :type _geolocation: object_.Geolocation + :type _redirect_url: str + :type _type_: str + :type _sub_type: str + :type _allow_chat: bool + :type _eligible_whitelist_id: int """ # Endpoint constants. - _ENDPOINT_URL_READ = "user-light/{}" + _ENDPOINT_URL_CREATE = "user/{}/token-qr-request-ideal" # Field constants. - FIELD_FIRST_NAME = "first_name" - FIELD_MIDDLE_NAME = "middle_name" - FIELD_LAST_NAME = "last_name" - FIELD_PUBLIC_NICK_NAME = "public_nick_name" - FIELD_COUNTER_BANK_IBAN = "counter_bank_iban" - FIELD_ADDRESS_MAIN = "address_main" - FIELD_ADDRESS_POSTAL = "address_postal" - FIELD_AVATAR_UUID = "avatar_uuid" - FIELD_SOCIAL_SECURITY_NUMBER = "social_security_number" - FIELD_TAX_RESIDENT = "tax_resident" - FIELD_DOCUMENT_TYPE = "document_type" - FIELD_DOCUMENT_NUMBER = "document_number" - FIELD_DOCUMENT_COUNTRY_OF_ISSUANCE = "document_country_of_issuance" - FIELD_DOCUMENT_FRONT_ATTACHMENT_ID = "document_front_attachment_id" - FIELD_DOCUMENT_BACK_ATTACHMENT_ID = "document_back_attachment_id" - FIELD_DATE_OF_BIRTH = "date_of_birth" - FIELD_PLACE_OF_BIRTH = "place_of_birth" - FIELD_COUNTRY_OF_BIRTH = "country_of_birth" - FIELD_NATIONALITY = "nationality" - FIELD_LANGUAGE = "language" - FIELD_REGION = "region" - FIELD_GENDER = "gender" - FIELD_STATUS = "status" - FIELD_SUB_STATUS = "sub_status" - FIELD_LEGAL_GUARDIAN_ALIAS = "legal_guardian_alias" - FIELD_SESSION_TIMEOUT = "session_timeout" - FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN = "daily_limit_without_confirmation_login" - FIELD_NOTIFICATION_FILTERS = "notification_filters" + FIELD_TOKEN = "token" # Object type. - _OBJECT_TYPE = "UserPerson" + _OBJECT_TYPE = "TokenQrRequestIdeal" def __init__(self): - self._id_ = None - self._created = None - self._updated = None - self._public_uuid = None - self._first_name = None - self._middle_name = None - self._last_name = None - self._legal_name = None - self._display_name = None - self._public_nick_name = None + self._time_responded = None + self._time_expiry = None + self._monetary_account_id = None + self._amount_inquired = None + self._amount_responded = None self._alias = None - self._social_security_number = None - self._tax_resident = None - self._document_type = None - self._document_number = None - self._document_country_of_issuance = None - self._address_main = None - self._address_postal = None - self._date_of_birth = None - self._place_of_birth = None - self._country_of_birth = None - self._nationality = None - self._language = None - self._region = None - self._gender = None - self._avatar = None - self._version_terms_of_service = None + self._counterparty_alias = None + self._description = None + self._attachment = None self._status = None - self._sub_status = None - self._session_timeout = None - self._daily_limit_without_confirmation_login = None - self._notification_filters = None + self._minimum_age = None + self._require_address = None + self._address_shipping = None + self._address_billing = None + self._geolocation = None + self._redirect_url = None + self._type_ = None + self._sub_type = None + self._allow_chat = None + self._eligible_whitelist_id = None @classmethod - def get(cls, api_context, user_light_id, custom_headers=None): + def create(cls, api_context, request_map, user_id, custom_headers=None): """ - Get a specific bunq light user. + Create a request from an ideal transaction. :type api_context: context.ApiContext - :type user_light_id: int + :type request_map: dict[str, object] + :type user_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseUserLight + :rtype: BunqResponseTokenQrRequestIdeal """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_light_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id) + response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - return BunqResponseUserLight.cast_from_bunq_response( + return BunqResponseTokenQrRequestIdeal.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) @property - def id_(self): + def time_responded(self): """ - :rtype: int + :rtype: str """ - return self._id_ + return self._time_responded @property - def created(self): + def time_expiry(self): """ :rtype: str """ - return self._created + return self._time_expiry @property - def updated(self): + def monetary_account_id(self): """ - :rtype: str + :rtype: int """ - return self._updated + return self._monetary_account_id @property - def public_uuid(self): + def amount_inquired(self): """ - :rtype: str + :rtype: object_.Amount """ - return self._public_uuid + return self._amount_inquired @property - def first_name(self): + def amount_responded(self): """ - :rtype: str + :rtype: object_.Amount """ - return self._first_name + return self._amount_responded @property - def middle_name(self): + def alias(self): """ - :rtype: str + :rtype: object_.MonetaryAccountReference """ - return self._middle_name + return self._alias @property - def last_name(self): + def counterparty_alias(self): """ - :rtype: str + :rtype: object_.MonetaryAccountReference """ - return self._last_name + return self._counterparty_alias @property - def legal_name(self): + def description(self): """ :rtype: str """ - return self._legal_name + return self._description @property - def display_name(self): + def attachment(self): """ - :rtype: str + :rtype: list[object_.Attachment] """ - return self._display_name + return self._attachment @property - def public_nick_name(self): + def status(self): """ :rtype: str """ - return self._public_nick_name + return self._status @property - def alias(self): + def minimum_age(self): """ - :rtype: list[object_.Pointer] + :rtype: int """ - return self._alias + return self._minimum_age @property - def social_security_number(self): + def require_address(self): """ :rtype: str """ - return self._social_security_number + return self._require_address @property - def tax_resident(self): + def address_shipping(self): """ - :rtype: list[object_.TaxResident] + :rtype: object_.Address """ - return self._tax_resident + return self._address_shipping @property - def document_type(self): + def address_billing(self): """ - :rtype: str + :rtype: object_.Address """ - return self._document_type + return self._address_billing @property - def document_number(self): + def geolocation(self): """ - :rtype: str + :rtype: object_.Geolocation """ - return self._document_number + return self._geolocation @property - def document_country_of_issuance(self): + def redirect_url(self): """ :rtype: str """ - return self._document_country_of_issuance - - @property - def address_main(self): - """ - :rtype: object_.Address - """ - - return self._address_main + return self._redirect_url @property - def address_postal(self): + def type_(self): """ - :rtype: object_.Address + :rtype: str """ - return self._address_postal + return self._type_ @property - def date_of_birth(self): + def sub_type(self): """ :rtype: str """ - return self._date_of_birth + return self._sub_type @property - def place_of_birth(self): + def allow_chat(self): """ - :rtype: str + :rtype: bool """ - return self._place_of_birth + return self._allow_chat @property - def country_of_birth(self): + def eligible_whitelist_id(self): """ - :rtype: str + :rtype: int """ - return self._country_of_birth + return self._eligible_whitelist_id - @property - def nationality(self): + def are_all_fields_none(self): """ - :rtype: str + :rtype: bool """ - return self._nationality + if self._time_responded is not None: + return False - @property - def language(self): - """ - :rtype: str - """ + if self._time_expiry is not None: + return False - return self._language + if self._monetary_account_id is not None: + return False - @property - def region(self): - """ - :rtype: str - """ + if self._amount_inquired is not None: + return False - return self._region + if self._amount_responded is not None: + return False - @property - def gender(self): - """ - :rtype: str - """ + if self._alias is not None: + return False - return self._gender + if self._counterparty_alias is not None: + return False - @property - def avatar(self): - """ - :rtype: object_.Avatar - """ + if self._description is not None: + return False - return self._avatar + if self._attachment is not None: + return False - @property - def version_terms_of_service(self): - """ - :rtype: str - """ + if self._status is not None: + return False - return self._version_terms_of_service + if self._minimum_age is not None: + return False - @property - def status(self): - """ - :rtype: str - """ + if self._require_address is not None: + return False - return self._status + if self._address_shipping is not None: + return False - @property - def sub_status(self): - """ - :rtype: str - """ + if self._address_billing is not None: + return False - return self._sub_status + if self._geolocation is not None: + return False - @property - def session_timeout(self): - """ - :rtype: int - """ + if self._redirect_url is not None: + return False - return self._session_timeout + if self._type_ is not None: + return False - @property - def daily_limit_without_confirmation_login(self): - """ - :rtype: object_.Amount - """ + if self._sub_type is not None: + return False - return self._daily_limit_without_confirmation_login + if self._allow_chat is not None: + return False - @property - def notification_filters(self): - """ - :rtype: list[object_.NotificationFilter] - """ + if self._eligible_whitelist_id is not None: + return False - return self._notification_filters + return True class BunqResponseInvoiceList(client.BunqResponse): @property @@ -13647,6 +16305,36 @@ def value(self): return super().value +class BunqResponseUser(client.BunqResponse): + @property + def value(self): + """ + :rtype: User + """ + + return super().value + + +class BunqResponseUserList(client.BunqResponse): + @property + def value(self): + """ + :rtype: list[User] + """ + + return super().value + + +class BunqResponseUserLight(client.BunqResponse): + @property + def value(self): + """ + :rtype: UserLight + """ + + return super().value + + class BunqResponseUserPerson(client.BunqResponse): @property def value(self): @@ -13836,33 +16524,3 @@ def value(self): return super().value - -class BunqResponseUser(client.BunqResponse): - @property - def value(self): - """ - :rtype: User - """ - - return super().value - - -class BunqResponseUserList(client.BunqResponse): - @property - def value(self): - """ - :rtype: list[User] - """ - - return super().value - - -class BunqResponseUserLight(client.BunqResponse): - @property - def value(self): - """ - :rtype: UserLight - """ - - return super().value - diff --git a/bunq/sdk/model/generated/object_.py b/bunq/sdk/model/generated/object_.py index 1566cdc..5d24a2a 100644 --- a/bunq/sdk/model/generated/object_.py +++ b/bunq/sdk/model/generated/object_.py @@ -25,6 +25,35 @@ def __init__(self): self.item = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.type_ is not None: + return False + + if self.type_description is not None: + return False + + if self.type_description_translated is not None: + return False + + if self.instance_description is not None: + return False + + if self.product_vat_exclusive is not None: + return False + + if self.product_vat_inclusive is not None: + return False + + if self.item is not None: + return False + + return True + + class Amount(core.BunqModel): """ :type value: str @@ -41,6 +70,20 @@ def __init__(self, value, currency): self.currency = currency + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.value is not None: + return False + + if self.currency is not None: + return False + + return True + + class InvoiceItem(core.BunqModel): """ :type billing_date: str @@ -66,6 +109,41 @@ def __init__(self): self.total_vat_inclusive = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.billing_date is not None: + return False + + if self.type_description is not None: + return False + + if self.type_description_translated is not None: + return False + + if self.unit_vat_exclusive is not None: + return False + + if self.unit_vat_inclusive is not None: + return False + + if self.vat is not None: + return False + + if self.quantity is not None: + return False + + if self.total_vat_exclusive is not None: + return False + + if self.total_vat_inclusive is not None: + return False + + return True + + class LabelMonetaryAccount(core.BunqModel): """ :type iban: str @@ -91,6 +169,41 @@ def __init__(self): self.swift_account_number = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.iban is not None: + return False + + if self.display_name is not None: + return False + + if self.avatar is not None: + return False + + if self.label_user is not None: + return False + + if self.country is not None: + return False + + if self.bunq_me is not None: + return False + + if self.is_light is not None: + return False + + if self.swift_bic is not None: + return False + + if self.swift_account_number is not None: + return False + + return True + + class Avatar(core.BunqModel): """ :type uuid: str @@ -108,6 +221,23 @@ def __init__(self, uuid): self.image = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.uuid is not None: + return False + + if self.anchor_uuid is not None: + return False + + if self.image is not None: + return False + + return True + + class Image(core.BunqModel): """ :type attachment_public_uuid: str @@ -123,6 +253,26 @@ def __init__(self): self.width = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.attachment_public_uuid is not None: + return False + + if self.content_type is not None: + return False + + if self.height is not None: + return False + + if self.width is not None: + return False + + return True + + class LabelUser(core.BunqModel): """ :type uuid: str @@ -146,6 +296,29 @@ def __init__(self, uuid, display_name, country): self.public_nick_name = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.uuid is not None: + return False + + if self.avatar is not None: + return False + + if self.public_nick_name is not None: + return False + + if self.display_name is not None: + return False + + if self.country is not None: + return False + + return True + + class Pointer(core.BunqModel): """ :type type_: str @@ -164,6 +337,23 @@ def __init__(self, type_, value): self.name = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.type_ is not None: + return False + + if self.value is not None: + return False + + if self.name is not None: + return False + + return True + + class Address(core.BunqModel): """ :type street: str @@ -193,7 +383,36 @@ def __init__(self, street, house_number, postal_code, city, country): self.province = None -class ChatMessageContent(core.BunqModel): + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.street is not None: + return False + + if self.house_number is not None: + return False + + if self.po_box is not None: + return False + + if self.postal_code is not None: + return False + + if self.city is not None: + return False + + if self.country is not None: + return False + + if self.province is not None: + return False + + return True + + +class ChatMessageContent(core.BunqModel, core.AnchoredObjectInterface): """ :type ChatMessageContentAnchorEvent: ChatMessageContentAnchorEvent :type ChatMessageContentAttachment: ChatMessageContentAttachment @@ -248,6 +467,34 @@ def get_referenced_object(self): raise exception.BunqException(self._ERROR_NULL_FIELDS) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.ChatMessageContentAnchorEvent is not None: + return False + + if self.ChatMessageContentAttachment is not None: + return False + + if self.ChatMessageContentGeolocation is not None: + return False + + if self.ChatMessageContentStatusConversationTitle is not None: + return False + + if self.ChatMessageContentStatusConversation is not None: + return False + + if self.ChatMessageContentStatusMembership is not None: + return False + + if self.ChatMessageContentText is not None: + return False + + return True + class ChatMessageContentAnchorEvent(core.BunqModel): """ @@ -258,7 +505,18 @@ def __init__(self): self.anchored_object = None -class AnchoredObject(core.BunqModel): + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.anchored_object is not None: + return False + + return True + + +class AnchoredObject(core.BunqModel, core.AnchoredObjectInterface): """ :type CardDebit: endpoint.CardDebit :type CardPinChange: endpoint.CardPinChange @@ -366,6 +624,67 @@ def get_referenced_object(self): raise exception.BunqException(self._ERROR_NULL_FIELDS) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.CardDebit is not None: + return False + + if self.CardPinChange is not None: + return False + + if self.CardResult is not None: + return False + + if self.DraftPayment is not None: + return False + + if self.IdealMerchantTransaction is not None: + return False + + if self.Invoice is not None: + return False + + if self.Payment is not None: + return False + + if self.PaymentBatch is not None: + return False + + if self.PromotionDisplay is not None: + return False + + if self.RequestInquiryBatch is not None: + return False + + if self.RequestInquiry is not None: + return False + + if self.RequestResponse is not None: + return False + + if self.ScheduledPaymentBatch is not None: + return False + + if self.ScheduledPayment is not None: + return False + + if self.ScheduledInstance is not None: + return False + + if self.ShareInviteBankInquiry is not None: + return False + + if self.ShareInviteBankResponse is not None: + return False + + if self.UserCredentialPasswordIp is not None: + return False + + return True + class CardLimit(core.BunqModel): """ @@ -388,6 +707,26 @@ def __init__(self, daily_limit, currency, type_): self.id_ = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.id_ is not None: + return False + + if self.daily_limit is not None: + return False + + if self.currency is not None: + return False + + if self.type_ is not None: + return False + + return True + + class CardCountryPermission(core.BunqModel): """ :type country: str @@ -405,6 +744,23 @@ def __init__(self, country): self.id_ = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.id_ is not None: + return False + + if self.country is not None: + return False + + if self.expiry_time is not None: + return False + + return True + + class CardPinAssignment(core.BunqModel): """ :type type_: str @@ -422,6 +778,20 @@ def __init__(self, type_): self.monetary_account_id = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.type_ is not None: + return False + + if self.monetary_account_id is not None: + return False + + return True + + class LabelCard(core.BunqModel): """ :type uuid: str @@ -441,6 +811,32 @@ def __init__(self): self.label_user = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.uuid is not None: + return False + + if self.type_ is not None: + return False + + if self.second_line is not None: + return False + + if self.expiry_date is not None: + return False + + if self.status is not None: + return False + + if self.label_user is not None: + return False + + return True + + class DraftPaymentResponse(core.BunqModel): """ :type status: str @@ -452,6 +848,20 @@ def __init__(self): self.user_alias_created = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.status is not None: + return False + + if self.user_alias_created is not None: + return False + + return True + + class DraftPaymentEntry(core.BunqModel): """ :type amount: Amount @@ -483,6 +893,38 @@ def __init__(self, amount, counterparty_alias, description): self.type_ = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.id_ is not None: + return False + + if self.amount is not None: + return False + + if self.alias is not None: + return False + + if self.counterparty_alias is not None: + return False + + if self.description is not None: + return False + + if self.merchant_reference is not None: + return False + + if self.type_ is not None: + return False + + if self.attachment is not None: + return False + + return True + + class AttachmentMonetaryAccountPayment(core.BunqModel): """ :type id_: int @@ -498,7 +940,21 @@ def __init__(self, id_): self.monetary_account_id = None -class DraftPaymentAnchorObject(core.BunqModel): + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.id_ is not None: + return False + + if self.monetary_account_id is not None: + return False + + return True + + +class DraftPaymentAnchorObject(core.BunqModel, core.AnchoredObjectInterface): """ :type Payment: endpoint.Payment :type PaymentBatch: endpoint.PaymentBatch @@ -526,6 +982,19 @@ def get_referenced_object(self): raise exception.BunqException(self._ERROR_NULL_FIELDS) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.Payment is not None: + return False + + if self.PaymentBatch is not None: + return False + + return True + class Geolocation(core.BunqModel): """ @@ -542,6 +1011,26 @@ def __init__(self): self.radius = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.latitude is not None: + return False + + if self.longitude is not None: + return False + + if self.altitude is not None: + return False + + if self.radius is not None: + return False + + return True + + class BunqId(core.BunqModel): """ :type id_: int @@ -555,6 +1044,17 @@ def __init__(self, id_): self.id_ = id_ + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.id_ is not None: + return False + + return True + + class Attachment(core.BunqModel): """ :type description: str @@ -566,6 +1066,20 @@ def __init__(self): self.content_type = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.description is not None: + return False + + if self.content_type is not None: + return False + + return True + + class SchedulePaymentEntry(core.BunqModel): """ :type amount: Amount @@ -593,11 +1107,37 @@ def __init__(self, amount, counterparty_alias, description): self.alias = None -class ScheduleAnchorObject(core.BunqModel): - """ - :type Payment: endpoint.Payment - :type PaymentBatch: endpoint.PaymentBatch - """ + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.amount is not None: + return False + + if self.alias is not None: + return False + + if self.counterparty_alias is not None: + return False + + if self.description is not None: + return False + + if self.attachment is not None: + return False + + if self.merchant_reference is not None: + return False + + return True + + +class ScheduleAnchorObject(core.BunqModel, core.AnchoredObjectInterface): + """ + :type Payment: endpoint.Payment + :type PaymentBatch: endpoint.PaymentBatch + """ # Error constants. _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' @@ -621,6 +1161,19 @@ def get_referenced_object(self): raise exception.BunqException(self._ERROR_NULL_FIELDS) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.Payment is not None: + return False + + if self.PaymentBatch is not None: + return False + + return True + class Error(core.BunqModel): """ @@ -633,7 +1186,21 @@ def __init__(self): self.error_description_translated = None -class ScheduleInstanceAnchorObject(core.BunqModel): + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.error_description is not None: + return False + + if self.error_description_translated is not None: + return False + + return True + + +class ScheduleInstanceAnchorObject(core.BunqModel, core.AnchoredObjectInterface): """ :type Payment: endpoint.Payment :type PaymentBatch: endpoint.PaymentBatch @@ -661,6 +1228,19 @@ def get_referenced_object(self): raise exception.BunqException(self._ERROR_NULL_FIELDS) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.Payment is not None: + return False + + if self.PaymentBatch is not None: + return False + + return True + class ShareDetail(core.BunqModel): """ @@ -675,6 +1255,23 @@ def __init__(self): self.draft_payment = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.payment is not None: + return False + + if self.read_only is not None: + return False + + if self.draft_payment is not None: + return False + + return True + + class ShareDetailPayment(core.BunqModel): """ :type make_payments: bool @@ -701,6 +1298,32 @@ def __init__(self, make_payments, view_balance, view_old_events, view_new_events self.budget = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.make_payments is not None: + return False + + if self.make_draft_payments is not None: + return False + + if self.view_balance is not None: + return False + + if self.view_old_events is not None: + return False + + if self.view_new_events is not None: + return False + + if self.budget is not None: + return False + + return True + + class BudgetRestriction(core.BunqModel): """ :type amount: Amount @@ -712,6 +1335,20 @@ def __init__(self): self.frequency = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.amount is not None: + return False + + if self.frequency is not None: + return False + + return True + + class ShareDetailReadOnly(core.BunqModel): """ :type view_balance: bool @@ -731,6 +1368,23 @@ def __init__(self, view_balance, view_old_events, view_new_events): self.view_new_events = view_new_events + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.view_balance is not None: + return False + + if self.view_old_events is not None: + return False + + if self.view_new_events is not None: + return False + + return True + + class ShareDetailDraftPayment(core.BunqModel): """ :type make_draft_payments: bool @@ -753,6 +1407,26 @@ def __init__(self, make_draft_payments, view_balance, view_old_events, view_new_ self.view_new_events = view_new_events + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.make_draft_payments is not None: + return False + + if self.view_balance is not None: + return False + + if self.view_old_events is not None: + return False + + if self.view_new_events is not None: + return False + + return True + + class PermittedDevice(core.BunqModel): """ :type description: str @@ -764,6 +1438,20 @@ def __init__(self): self.ip = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.description is not None: + return False + + if self.ip is not None: + return False + + return True + + class ChatMessageContentAttachment(core.BunqModel): """ :type attachment: Attachment @@ -773,6 +1461,17 @@ def __init__(self): self.attachment = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.attachment is not None: + return False + + return True + + class ChatMessageContentGeolocation(core.BunqModel): """ :type geolocation: Geolocation @@ -782,6 +1481,17 @@ def __init__(self): self.geolocation = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.geolocation is not None: + return False + + return True + + class ChatMessageContentStatusConversationTitle(core.BunqModel): """ :type title: str @@ -791,6 +1501,17 @@ def __init__(self): self.title = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.title is not None: + return False + + return True + + class ChatMessageContentStatusConversation(core.BunqModel): """ :type action: str @@ -800,6 +1521,17 @@ def __init__(self): self.action = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.action is not None: + return False + + return True + + class ChatMessageContentStatusMembership(core.BunqModel): """ :type action: str @@ -811,6 +1543,20 @@ def __init__(self): self.member = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.action is not None: + return False + + if self.member is not None: + return False + + return True + + class ChatMessageContentText(core.BunqModel): """ :type text: str @@ -820,6 +1566,17 @@ def __init__(self): self.text = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.text is not None: + return False + + return True + + class BunqMeMerchantAvailable(core.BunqModel): """ :type merchant_type: str @@ -831,6 +1588,20 @@ def __init__(self): self.available = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.merchant_type is not None: + return False + + if self.available is not None: + return False + + return True + + class CardMagStripePermission(core.BunqModel): """ :type expiry_time: str @@ -840,6 +1611,17 @@ def __init__(self): self.expiry_time = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.expiry_time is not None: + return False + + return True + + class NotificationFilter(core.BunqModel): """ :type notification_delivery_method: str @@ -859,6 +1641,23 @@ def __init__(self, notification_delivery_method, notification_target, category): self.category = category + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.notification_delivery_method is not None: + return False + + if self.notification_target is not None: + return False + + if self.category is not None: + return False + + return True + + class TabTextWaitingScreen(core.BunqModel): """ :type language: str @@ -875,6 +1674,20 @@ def __init__(self, language, description): self.description = description + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.language is not None: + return False + + if self.description is not None: + return False + + return True + + class TabVisibility(core.BunqModel): """ :type cash_register_qr_code: bool @@ -893,6 +1706,23 @@ def __init__(self, cash_register_qr_code, tab_qr_code): self.location = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.cash_register_qr_code is not None: + return False + + if self.tab_qr_code is not None: + return False + + if self.location is not None: + return False + + return True + + class AttachmentPublic(core.BunqModel): """ :type uuid: str @@ -906,6 +1736,23 @@ def __init__(self): self.content_type = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.uuid is not None: + return False + + if self.description is not None: + return False + + if self.content_type is not None: + return False + + return True + + class AttachmentTab(core.BunqModel): """ :type id_: int @@ -919,6 +1766,23 @@ def __init__(self): self.content_type = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.id_ is not None: + return False + + if self.description is not None: + return False + + if self.content_type is not None: + return False + + return True + + class Certificate(core.BunqModel): """ :type certificate: str @@ -932,6 +1796,17 @@ def __init__(self, certificate): self.certificate = certificate + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.certificate is not None: + return False + + return True + + class DraftShareInviteBankEntry(core.BunqModel): """ :type share_detail: ShareDetail @@ -949,6 +1824,23 @@ def __init__(self, share_detail): self.end_date = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.share_detail is not None: + return False + + if self.start_date is not None: + return False + + if self.end_date is not None: + return False + + return True + + class MonetaryAccountProfileFill(core.BunqModel): """ :type status: str @@ -973,6 +1865,29 @@ def __init__(self, status, balance_preferred, balance_threshold_low, method_fill self.issuer = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.status is not None: + return False + + if self.balance_preferred is not None: + return False + + if self.balance_threshold_low is not None: + return False + + if self.method_fill is not None: + return False + + if self.issuer is not None: + return False + + return True + + class Issuer(core.BunqModel): """ :type bic: str @@ -988,6 +1903,20 @@ def __init__(self, bic): self.name = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.bic is not None: + return False + + if self.name is not None: + return False + + return True + + class MonetaryAccountProfileDrain(core.BunqModel): """ :type status: str @@ -1010,6 +1939,26 @@ def __init__(self, status, balance_preferred, balance_threshold_high, savings_ac self.savings_account_alias = savings_account_alias + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.status is not None: + return False + + if self.balance_preferred is not None: + return False + + if self.balance_threshold_high is not None: + return False + + if self.savings_account_alias is not None: + return False + + return True + + class MonetaryAccountSetting(core.BunqModel): """ :type color: str @@ -1023,6 +1972,23 @@ def __init__(self): self.restriction_chat = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.color is not None: + return False + + if self.default_avatar_status is not None: + return False + + if self.restriction_chat is not None: + return False + + return True + + class NotificationUrl(core.BunqModel): """ :type target_url: str @@ -1038,19 +2004,38 @@ def __init__(self): self.object_ = None -class NotificationAnchorObject(core.BunqModel): + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.target_url is not None: + return False + + if self.category is not None: + return False + + if self.event_type is not None: + return False + + if self.object_ is not None: + return False + + return True + + +class NotificationAnchorObject(core.BunqModel, core.AnchoredObjectInterface): """ + :type BunqMeFundraiserResult: endpoint.BunqMeFundraiserResult :type BunqMeTab: endpoint.BunqMeTab :type BunqMeTabResultInquiry: endpoint.BunqMeTabResultInquiry :type BunqMeTabResultResponse: endpoint.BunqMeTabResultResponse - :type ChatMessageStatus: endpoint.ChatMessageStatus - :type ChatMessageUser: endpoint.ChatMessageUser - :type ChatMessageAnnouncement: endpoint.ChatMessageAnnouncement + :type ChatMessage: endpoint.ChatMessage :type DraftPayment: endpoint.DraftPayment :type IdealMerchantTransaction: endpoint.IdealMerchantTransaction :type Invoice: endpoint.Invoice :type MasterCardAction: endpoint.MasterCardAction - :type MonetaryAccountBank: endpoint.MonetaryAccountBank + :type MonetaryAccount: endpoint.MonetaryAccount :type Payment: endpoint.Payment :type PaymentBatch: endpoint.PaymentBatch :type RequestInquiry: endpoint.RequestInquiry @@ -1062,8 +2047,7 @@ class NotificationAnchorObject(core.BunqModel): :type ScheduledInstance: endpoint.ScheduleInstance :type TabResultInquiry: endpoint.TabResultInquiry :type TabResultResponse: endpoint.TabResultResponse - :type UserPerson: endpoint.UserPerson - :type UserCompany: endpoint.UserCompany + :type User: endpoint.User """ # Error constants. @@ -1071,17 +2055,16 @@ class NotificationAnchorObject(core.BunqModel): def __init__(self): + self.BunqMeFundraiserResult = None self.BunqMeTab = None self.BunqMeTabResultInquiry = None self.BunqMeTabResultResponse = None - self.ChatMessageStatus = None - self.ChatMessageUser = None - self.ChatMessageAnnouncement = None + self.ChatMessage = None self.DraftPayment = None self.IdealMerchantTransaction = None self.Invoice = None self.MasterCardAction = None - self.MonetaryAccountBank = None + self.MonetaryAccount = None self.Payment = None self.PaymentBatch = None self.RequestInquiry = None @@ -1093,8 +2076,7 @@ def __init__(self): self.ScheduledInstance = None self.TabResultInquiry = None self.TabResultResponse = None - self.UserPerson = None - self.UserCompany = None + self.User = None def get_referenced_object(self): """ @@ -1102,6 +2084,9 @@ def get_referenced_object(self): :raise: BunqException """ + if self.BunqMeFundraiserResult is not None: + return self.BunqMeFundraiserResult + if self.BunqMeTab is not None: return self.BunqMeTab @@ -1111,14 +2096,8 @@ def get_referenced_object(self): if self.BunqMeTabResultResponse is not None: return self.BunqMeTabResultResponse - if self.ChatMessageStatus is not None: - return self.ChatMessageStatus - - if self.ChatMessageUser is not None: - return self.ChatMessageUser - - if self.ChatMessageAnnouncement is not None: - return self.ChatMessageAnnouncement + if self.ChatMessage is not None: + return self.ChatMessage if self.DraftPayment is not None: return self.DraftPayment @@ -1132,8 +2111,8 @@ def get_referenced_object(self): if self.MasterCardAction is not None: return self.MasterCardAction - if self.MonetaryAccountBank is not None: - return self.MonetaryAccountBank + if self.MonetaryAccount is not None: + return self.MonetaryAccount if self.Payment is not None: return self.Payment @@ -1168,14 +2147,84 @@ def get_referenced_object(self): if self.TabResultResponse is not None: return self.TabResultResponse - if self.UserPerson is not None: - return self.UserPerson - - if self.UserCompany is not None: - return self.UserCompany + if self.User is not None: + return self.User raise exception.BunqException(self._ERROR_NULL_FIELDS) + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.BunqMeFundraiserResult is not None: + return False + + if self.BunqMeTab is not None: + return False + + if self.BunqMeTabResultInquiry is not None: + return False + + if self.BunqMeTabResultResponse is not None: + return False + + if self.ChatMessage is not None: + return False + + if self.DraftPayment is not None: + return False + + if self.IdealMerchantTransaction is not None: + return False + + if self.Invoice is not None: + return False + + if self.MasterCardAction is not None: + return False + + if self.MonetaryAccount is not None: + return False + + if self.Payment is not None: + return False + + if self.PaymentBatch is not None: + return False + + if self.RequestInquiry is not None: + return False + + if self.RequestInquiryBatch is not None: + return False + + if self.RequestResponse is not None: + return False + + if self.ShareInviteBankInquiry is not None: + return False + + if self.ShareInviteBankResponse is not None: + return False + + if self.ScheduledPayment is not None: + return False + + if self.ScheduledInstance is not None: + return False + + if self.TabResultInquiry is not None: + return False + + if self.TabResultResponse is not None: + return False + + if self.User is not None: + return False + + return True + class TaxResident(core.BunqModel): """ @@ -1193,6 +2242,20 @@ def __init__(self, country, tax_number): self.tax_number = tax_number + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.country is not None: + return False + + if self.tax_number is not None: + return False + + return True + + class Ubo(core.BunqModel): """ :type name: str @@ -1206,6 +2269,23 @@ def __init__(self): self.nationality = None + def are_all_fields_none(self): + """ + :rtype: bool + """ + + if self.name is not None: + return False + + if self.date_of_birth is not None: + return False + + if self.nationality is not None: + return False + + return True + + class MonetaryAccountReference(core.BunqModel): """ :type pointer: Pointer @@ -1259,3 +2339,12 @@ def create_from_label_monetary_account(cls, label_monetary_account): instance.pointer.name = label_monetary_account.display_name return instance + + def are_all_fields_none(self): + if self.pointer is not None: + return False + + if self.label_monetary_account is not None: + return False + + return True \ No newline at end of file