diff --git a/bunq/sdk/model/generated/endpoint.py b/bunq/sdk/model/generated/endpoint.py index c197f02..d590059 100644 --- a/bunq/sdk/model/generated/endpoint.py +++ b/bunq/sdk/model/generated/endpoint.py @@ -1,11 +1,12 @@ # -*- coding: utf-8 -*- from bunq.sdk import client from bunq.sdk import context -from bunq.sdk import exception from bunq.sdk import security +from bunq.sdk import exception from bunq.sdk.json import converter from bunq.sdk.model import core from bunq.sdk.model.generated import object_ +from bunq.sdk.json import converter class Invoice(core.BunqModel): @@ -2592,6 +2593,95 @@ def from_json(json_str): return converter.json_to_class(Payment, json_str) +class CardBatch(core.BunqModel): + """ + Used to update multiple cards in a batch. + + :param _cards: The cards that need to be updated. + :type _cards: list[object_.CardBatchEntry] + :param _updated_card_ids: The ids of the cards that have been updated. + :type _updated_card_ids: list[object_.BunqId] + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/card-batch" + + # Field constants. + FIELD_CARDS = "cards" + + # Object type. + _OBJECT_TYPE_POST = "CardBatch" + + _updated_card_ids = None + _cards_field_for_request = None + + def __init__(self, cards): + """ + :param cards: The cards that need to be updated. + :type cards: list[object_.CardBatchEntry] + """ + + self._cards_field_for_request = cards + + @classmethod + def create(cls, cards, custom_headers=None): + """ + :type user_id: int + :param cards: The cards that need to be updated. + :type cards: list[object_.CardBatchEntry] + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseCardBatch + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_CARDS: cards + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id()) + response_raw = api_client.post(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseCardBatch.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_POST) + ) + + @property + def updated_card_ids(self): + """ + :rtype: list[object_.BunqId] + """ + + return self._updated_card_ids + + def is_all_field_none(self): + """ + :rtype: bool + """ + + if self._updated_card_ids is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: CardBatch + """ + + return converter.json_to_class(CardBatch, json_str) + + class CardDebit(core.BunqModel): """ With bunq it is possible to order debit cards that can then be connected @@ -11926,28 +12016,237 @@ def from_json(json_str): return converter.json_to_class(MonetaryAccountLight, json_str) -class BunqMeFundraiserResult(core.BunqModel): +class NoteAttachmentBankSwitchServiceNetherlandsIncomingPayment(core.BunqModel): """ - bunq.me fundraiser result containing all payments. + Used to manage attachment notes. - :param _id_: The id of the bunq.me. + :param _description: Optional description of the attachment. + :type _description: str + :param _attachment_id: The reference to the uploaded file to attach to this + note. + :type _attachment_id: int + :param _id_: The id of the note. :type _id_: int - :param _created: The timestamp when the bunq.me was created. + :param _created: The timestamp of the note's creation. :type _created: str - :param _updated: The timestamp when the bunq.me was last updated. + :param _updated: The timestamp of the note's last update. :type _updated: str - :param _bunqme_fundraiser_profile: The bunq.me fundraiser profile. - :type _bunqme_fundraiser_profile: BunqMeFundraiserProfile - :param _payments: The list of payments, paid to the bunq.me fundraiser - profile. - :type _payments: list[Payment] + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + :param _attachment: The attachment attached to the note. + :type _attachment: list[object_.AttachmentMonetaryAccountPayment] """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/switch-service-payment/{}/note-attachment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/switch-service-payment/{}/note-attachment/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/switch-service-payment/{}/note-attachment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/switch-service-payment/{}/note-attachment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/switch-service-payment/{}/note-attachment/{}" + + # Field constants. + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT_ID = "attachment_id" + + # Object type. + _OBJECT_TYPE_GET = "NoteAttachment" + _id_ = None _created = None _updated = None - _bunqme_fundraiser_profile = None - _payments = None + _label_user_creator = None + _description = None + _attachment = None + _description_field_for_request = None + _attachment_id_field_for_request = None + + def __init__(self, attachment_id, description=None): + """ + :param attachment_id: The reference to the uploaded file to attach to this + note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + """ + + self._attachment_id_field_for_request = attachment_id + self._description_field_for_request = description + + @classmethod + def create(cls, switch_service_payment_id, attachment_id, + monetary_account_id=None, description=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type switch_service_payment_id: int + :param attachment_id: The reference to the uploaded file to attach to + this note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT_ID: attachment_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + switch_service_payment_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, switch_service_payment_id, + note_attachment_bank_switch_service_netherlands_incoming_payment_id, + monetary_account_id=None, description=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type switch_service_payment_id: int + :type + note_attachment_bank_switch_service_netherlands_incoming_payment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_DESCRIPTION: description + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + switch_service_payment_id, + note_attachment_bank_switch_service_netherlands_incoming_payment_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, switch_service_payment_id, + note_attachment_bank_switch_service_netherlands_incoming_payment_id, + monetary_account_id=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type switch_service_payment_id: int + :type + note_attachment_bank_switch_service_netherlands_incoming_payment_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + switch_service_payment_id, + note_attachment_bank_switch_service_netherlands_incoming_payment_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, switch_service_payment_id, monetary_account_id=None, + params=None, custom_headers=None): + """ + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type switch_service_payment_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: + BunqResponseNoteAttachmentBankSwitchServiceNetherlandsIncomingPaymentList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + switch_service_payment_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteAttachmentBankSwitchServiceNetherlandsIncomingPaymentList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, switch_service_payment_id, + note_attachment_bank_switch_service_netherlands_incoming_payment_id, + monetary_account_id=None, custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type switch_service_payment_id: int + :type + note_attachment_bank_switch_service_netherlands_incoming_payment_id: int + :type custom_headers: dict[str, str]|None + + :rtype: + BunqResponseNoteAttachmentBankSwitchServiceNetherlandsIncomingPayment + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + switch_service_payment_id, + note_attachment_bank_switch_service_netherlands_incoming_payment_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteAttachmentBankSwitchServiceNetherlandsIncomingPayment.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) @property def id_(self): @@ -11974,20 +12273,28 @@ def updated(self): return self._updated @property - def bunqme_fundraiser_profile(self): + def label_user_creator(self): """ - :rtype: BunqMeFundraiserProfile + :rtype: object_.LabelUser """ - return self._bunqme_fundraiser_profile + return self._label_user_creator @property - def payments(self): + def description(self): """ - :rtype: list[Payment] + :rtype: str """ - return self._payments + return self._description + + @property + def attachment(self): + """ + :rtype: list[object_.AttachmentMonetaryAccountPayment] + """ + + return self._attachment def is_all_field_none(self): """ @@ -12003,10 +12310,13 @@ def is_all_field_none(self): if self._updated is not None: return False - if self._bunqme_fundraiser_profile is not None: + if self._label_user_creator is not None: return False - if self._payments is not None: + if self._description is not None: + return False + + if self._attachment is not None: return False return True @@ -12016,138 +12326,283 @@ def from_json(json_str): """ :type json_str: str - :rtype: BunqMeFundraiserResult + :rtype: NoteAttachmentBankSwitchServiceNetherlandsIncomingPayment """ - return converter.json_to_class(BunqMeFundraiserResult, json_str) + return converter.json_to_class( + NoteAttachmentBankSwitchServiceNetherlandsIncomingPayment, json_str) -class BunqMeFundraiserProfile(core.BunqModel): +class NoteTextBankSwitchServiceNetherlandsIncomingPayment(core.BunqModel): """ - bunq.me public profile of the user. + Used to manage text notes. - :param _pointer: The pointer (url) which will be used to access the bunq.me - fundraiser profile. - :type _pointer: object_.MonetaryAccountReference - :param _color: The color chosen for the bunq.me fundraiser profile in - hexadecimal format. - :type _color: str - :param _alias: The LabelMonetaryAccount with the public information of the - User and the MonetaryAccount that created the bunq.me fundraiser profile. - :type _alias: object_.MonetaryAccountReference - :param _description: The description of the bunq.me fundraiser profile. - :type _description: str - :param _attachment: The attachments attached to the fundraiser profile. - :type _attachment: list[object_.AttachmentPublic] - :param _status: The status of the bunq.me fundraiser profile, can be ACTIVE - or DEACTIVATED. - :type _status: str - :param _redirect_url: The URL which the user is sent to when a payment is - completed. - :type _redirect_url: str + :param _content: The content of the note. + :type _content: str + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/switch-service-payment/{}/note-text" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/switch-service-payment/{}/note-text/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/switch-service-payment/{}/note-text/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/switch-service-payment/{}/note-text" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/switch-service-payment/{}/note-text/{}" + # Field constants. - FIELD_POINTER = "pointer" + FIELD_CONTENT = "content" - _color = None - _alias = None - _description = None - _attachment = None - _pointer = None - _status = None - _redirect_url = None - _pointer_field_for_request = None + # Object type. + _OBJECT_TYPE_GET = "NoteText" - def __init__(self, pointer): + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _content = None + _content_field_for_request = None + + def __init__(self, content=None): """ - :param pointer: The pointer (url) which will be used to access the bunq.me - fundraiser profile. - :type pointer: object_.Pointer + :param content: The content of the note. + :type content: str """ - self._pointer_field_for_request = pointer + self._content_field_for_request = content - @property - def color(self): + @classmethod + def create(cls, switch_service_payment_id, monetary_account_id=None, + content=None, custom_headers=None): """ - :rtype: str + :type user_id: int + :type monetary_account_id: int + :type switch_service_payment_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._color + if custom_headers is None: + custom_headers = {} - @property - def alias(self): + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + switch_service_payment_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, switch_service_payment_id, + note_text_bank_switch_service_netherlands_incoming_payment_id, + monetary_account_id=None, content=None, custom_headers=None): """ - :rtype: object_.MonetaryAccountReference + :type user_id: int + :type monetary_account_id: int + :type switch_service_payment_id: int + :type note_text_bank_switch_service_netherlands_incoming_payment_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._alias + if custom_headers is None: + custom_headers = {} - @property - def description(self): + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + switch_service_payment_id, + note_text_bank_switch_service_netherlands_incoming_payment_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, switch_service_payment_id, + note_text_bank_switch_service_netherlands_incoming_payment_id, + monetary_account_id=None, custom_headers=None): """ - :rtype: str + :type user_id: int + :type monetary_account_id: int + :type switch_service_payment_id: int + :type note_text_bank_switch_service_netherlands_incoming_payment_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone """ - return self._description + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + switch_service_payment_id, + note_text_bank_switch_service_netherlands_incoming_payment_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, switch_service_payment_id, monetary_account_id=None, + params=None, custom_headers=None): + """ + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type switch_service_payment_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: + BunqResponseNoteTextBankSwitchServiceNetherlandsIncomingPaymentList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + switch_service_payment_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteTextBankSwitchServiceNetherlandsIncomingPaymentList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, switch_service_payment_id, + note_text_bank_switch_service_netherlands_incoming_payment_id, + monetary_account_id=None, custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type switch_service_payment_id: int + :type note_text_bank_switch_service_netherlands_incoming_payment_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextBankSwitchServiceNetherlandsIncomingPayment + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + switch_service_payment_id, + note_text_bank_switch_service_netherlands_incoming_payment_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteTextBankSwitchServiceNetherlandsIncomingPayment.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) @property - def attachment(self): + def id_(self): """ - :rtype: list[object_.AttachmentPublic] + :rtype: int """ - return self._attachment + return self._id_ @property - def pointer(self): + def created(self): """ - :rtype: object_.MonetaryAccountReference + :rtype: str """ - return self._pointer + return self._created @property - def status(self): + def updated(self): """ :rtype: str """ - return self._status + return self._updated @property - def redirect_url(self): + def label_user_creator(self): + """ + :rtype: object_.LabelUser + """ + + return self._label_user_creator + + @property + def content(self): """ :rtype: str """ - return self._redirect_url + return self._content def is_all_field_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: + if self._id_ is not None: return False - if self._attachment is not None: + if self._created is not None: return False - if self._pointer is not None: + if self._updated is not None: return False - if self._status is not None: + if self._label_user_creator is not None: return False - if self._redirect_url is not None: + if self._content is not None: return False return True @@ -12157,164 +12612,120 @@ def from_json(json_str): """ :type json_str: str - :rtype: BunqMeFundraiserProfile + :rtype: NoteTextBankSwitchServiceNetherlandsIncomingPayment """ - return converter.json_to_class(BunqMeFundraiserProfile, json_str) + return converter.json_to_class( + NoteTextBankSwitchServiceNetherlandsIncomingPayment, json_str) -class BunqMeTabResultResponse(core.BunqModel): +class NoteAttachmentBunqMeFundraiserResult(core.BunqModel): """ - Used to view bunq.me TabResultResponse objects belonging to a tab. A - TabResultResponse is an object that holds details on a tab which has been - paid from the provided monetary account. + Used to manage attachment notes. - :param _payment: The payment made for the bunq.me tab. - :type _payment: Payment + :param _description: Optional description of the attachment. + :type _description: str + :param _attachment_id: The reference to the uploaded file to attach to this + note. + :type _attachment_id: int + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + :param _attachment: The attachment attached to the note. + :type _attachment: list[object_.AttachmentMonetaryAccountPayment] """ - _payment = None + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/bunqme-fundraiser-result/{}/note-attachment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/bunqme-fundraiser-result/{}/note-attachment/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/bunqme-fundraiser-result/{}/note-attachment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/bunqme-fundraiser-result/{}/note-attachment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/bunqme-fundraiser-result/{}/note-attachment/{}" - @property - def payment(self): - """ - :rtype: Payment - """ + # Field constants. + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT_ID = "attachment_id" - return self._payment + # Object type. + _OBJECT_TYPE_GET = "NoteAttachment" - def is_all_field_none(self): + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _description = None + _attachment = None + _description_field_for_request = None + _attachment_id_field_for_request = None + + def __init__(self, attachment_id, description=None): """ - :rtype: bool + :param attachment_id: The reference to the uploaded file to attach to this + note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str """ - if self._payment is not None: - return False - - return True + self._attachment_id_field_for_request = attachment_id + self._description_field_for_request = description - @staticmethod - def from_json(json_str): - """ - :type json_str: str - - :rtype: BunqMeTabResultResponse - """ - - return converter.json_to_class(BunqMeTabResultResponse, json_str) - - -class ChatMessage(core.BunqModel): - """ - Endpoint for retrieving the messages that are part of a conversation. - """ - - def is_all_field_none(self): - """ - :rtype: bool - """ - - return True - - @staticmethod - def from_json(json_str): + @classmethod + def create(cls, bunqme_fundraiser_result_id, attachment_id, + monetary_account_id=None, description=None, custom_headers=None): """ - :type json_str: str + :type user_id: int + :type monetary_account_id: int + :type bunqme_fundraiser_result_id: int + :param attachment_id: The reference to the uploaded file to attach to + this note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None - :rtype: ChatMessage + :rtype: BunqResponseInt """ - return converter.json_to_class(ChatMessage, json_str) - - -class IdealMerchantTransaction(core.BunqModel): - """ - View for requesting iDEAL transactions and polling their status. - - :param _amount_requested: The requested amount of money to add. - :type _amount_requested: object_.Amount - :param _issuer: The BIC of the issuer. - :type _issuer: str - :param _monetary_account_id: The id of the monetary account this ideal - merchant transaction links to. - :type _monetary_account_id: int - :param _alias: The alias of the monetary account to add money to. - :type _alias: object_.MonetaryAccountReference - :param _counterparty_alias: The alias of the monetary account the money - comes from. - :type _counterparty_alias: object_.MonetaryAccountReference - :param _amount_guaranteed: In case of a successful transaction, the amount - of money that will be transferred. - :type _amount_guaranteed: object_.Amount - :param _expiration: When the transaction will expire. - :type _expiration: str - :param _issuer_name: The Name of the issuer. - :type _issuer_name: str - :param _issuer_authentication_url: The URL to visit to - :type _issuer_authentication_url: str - :param _purchase_identifier: The 'purchase ID' of the iDEAL transaction. - :type _purchase_identifier: str - :param _status: The status of the transaction. - :type _status: str - :param _status_timestamp: When the status was last updated. - :type _status_timestamp: str - :param _transaction_identifier: The 'transaction ID' of the iDEAL - transaction. - :type _transaction_identifier: str - :param _allow_chat: Whether or not chat messages are allowed. - :type _allow_chat: bool - """ - - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/ideal-merchant-transaction" - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/ideal-merchant-transaction/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/ideal-merchant-transaction" - - # Field constants. - FIELD_AMOUNT_REQUESTED = "amount_requested" - FIELD_ISSUER = "issuer" - - # Object type. - _OBJECT_TYPE_GET = "IdealMerchantTransaction" + if custom_headers is None: + custom_headers = {} - _monetary_account_id = None - _alias = None - _counterparty_alias = None - _amount_guaranteed = None - _amount_requested = None - _expiration = None - _issuer = None - _issuer_name = None - _issuer_authentication_url = None - _purchase_identifier = None - _status = None - _status_timestamp = None - _transaction_identifier = None - _allow_chat = None - _amount_requested_field_for_request = None - _issuer_field_for_request = None + request_map = { + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT_ID: attachment_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) - def __init__(self, amount_requested, issuer): - """ - :param amount_requested: The requested amount of money to add. - :type amount_requested: object_.Amount - :param issuer: The BIC of the issuing bank to ask for money. - :type issuer: str - """ + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + bunqme_fundraiser_result_id) + response_raw = api_client.post(endpoint_url, request_bytes, + custom_headers) - self._amount_requested_field_for_request = amount_requested - self._issuer_field_for_request = issuer + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) @classmethod - def create(cls, amount_requested, issuer, monetary_account_id=None, - custom_headers=None): + def update(cls, bunqme_fundraiser_result_id, + note_attachment_bunq_me_fundraiser_result_id, + monetary_account_id=None, description=None, custom_headers=None): """ :type user_id: int :type monetary_account_id: int - :param amount_requested: The requested amount of money to add. - :type amount_requested: object_.Amount - :param issuer: The BIC of the issuing bank to ask for money. - :type issuer: str + :type bunqme_fundraiser_result_id: int + :type note_attachment_bunq_me_fundraiser_result_id: int + :param description: Optional description of the attachment. + :type description: str :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -12323,61 +12734,69 @@ def create(cls, amount_requested, issuer, monetary_account_id=None, if custom_headers is None: custom_headers = {} + api_client = client.ApiClient(cls._get_api_context()) + request_map = { - cls.FIELD_AMOUNT_REQUESTED: amount_requested, - cls.FIELD_ISSUER: issuer + cls.FIELD_DESCRIPTION: description } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) - api_client = client.ApiClient(cls._get_api_context()) request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), cls._determine_monetary_account_id( - monetary_account_id)) - response_raw = api_client.post(endpoint_url, request_bytes, - custom_headers) + monetary_account_id), + bunqme_fundraiser_result_id, + note_attachment_bunq_me_fundraiser_result_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) return BunqResponseInt.cast_from_bunq_response( cls._process_for_id(response_raw) ) @classmethod - def get(cls, ideal_merchant_transaction_id, monetary_account_id=None, - custom_headers=None): + def delete(cls, bunqme_fundraiser_result_id, + note_attachment_bunq_me_fundraiser_result_id, + monetary_account_id=None, custom_headers=None): """ - :type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int - :type ideal_merchant_transaction_id: int + :type bunqme_fundraiser_result_id: int + :type note_attachment_bunq_me_fundraiser_result_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseIdealMerchantTransaction + :rtype: BunqResponseNone """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - ideal_merchant_transaction_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + bunqme_fundraiser_result_id, + note_attachment_bunq_me_fundraiser_result_id) + response_raw = api_client.delete(endpoint_url, custom_headers) - return BunqResponseIdealMerchantTransaction.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) ) @classmethod - def list(cls, monetary_account_id=None, params=None, custom_headers=None): + def list(cls, bunqme_fundraiser_result_id, monetary_account_id=None, + params=None, custom_headers=None): """ + Manage the notes for a given user. + :type user_id: int :type monetary_account_id: int + :type bunqme_fundraiser_result_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseIdealMerchantTransactionList + :rtype: BunqResponseNoteAttachmentBunqMeFundraiserResultList """ if params is None: @@ -12389,170 +12808,113 @@ def list(cls, monetary_account_id=None, params=None, custom_headers=None): api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_LISTING.format( cls._determine_user_id(), - cls._determine_monetary_account_id(monetary_account_id)) + cls._determine_monetary_account_id(monetary_account_id), + bunqme_fundraiser_result_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseIdealMerchantTransactionList.cast_from_bunq_response( + return BunqResponseNoteAttachmentBunqMeFundraiserResultList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) ) - @property - def monetary_account_id(self): - """ - :rtype: int - """ - - return self._monetary_account_id - - @property - def alias(self): + @classmethod + def get(cls, bunqme_fundraiser_result_id, + note_attachment_bunq_me_fundraiser_result_id, + monetary_account_id=None, custom_headers=None): """ - :rtype: object_.MonetaryAccountReference + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type bunqme_fundraiser_result_id: int + :type note_attachment_bunq_me_fundraiser_result_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentBunqMeFundraiserResult """ - return self._alias + if custom_headers is None: + custom_headers = {} - @property - def counterparty_alias(self): - """ - :rtype: object_.MonetaryAccountReference - """ + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + bunqme_fundraiser_result_id, + note_attachment_bunq_me_fundraiser_result_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - return self._counterparty_alias + return BunqResponseNoteAttachmentBunqMeFundraiserResult.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) @property - def amount_guaranteed(self): + def id_(self): """ - :rtype: object_.Amount + :rtype: int """ - return self._amount_guaranteed + return self._id_ @property - def amount_requested(self): + def created(self): """ - :rtype: object_.Amount + :rtype: str """ - return self._amount_requested + return self._created @property - def expiration(self): + def updated(self): """ :rtype: str """ - return self._expiration + return self._updated @property - def issuer(self): + def label_user_creator(self): """ - :rtype: str + :rtype: object_.LabelUser """ - return self._issuer + return self._label_user_creator @property - def issuer_name(self): + def description(self): """ :rtype: str """ - return self._issuer_name + return self._description @property - def issuer_authentication_url(self): + def attachment(self): """ - :rtype: str + :rtype: list[object_.AttachmentMonetaryAccountPayment] """ - return self._issuer_authentication_url + return self._attachment - @property - def purchase_identifier(self): + def is_all_field_none(self): """ - :rtype: str + :rtype: bool """ - return self._purchase_identifier + if self._id_ is not None: + return False - @property - def status(self): - """ - :rtype: str - """ + if self._created is not None: + return False - return self._status + if self._updated is not None: + return False - @property - def status_timestamp(self): - """ - :rtype: str - """ - - return self._status_timestamp - - @property - def transaction_identifier(self): - """ - :rtype: str - """ - - return self._transaction_identifier - - @property - def allow_chat(self): - """ - :rtype: bool - """ - - return self._allow_chat - - def is_all_field_none(self): - """ - :rtype: bool - """ - - if self._monetary_account_id is not None: - return False - - if self._alias is not None: + if self._label_user_creator 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: + if self._description is not None: return False - if self._allow_chat is not None: + if self._attachment is not None: return False return True @@ -12562,481 +12924,590 @@ def from_json(json_str): """ :type json_str: str - :rtype: IdealMerchantTransaction + :rtype: NoteAttachmentBunqMeFundraiserResult """ - return converter.json_to_class(IdealMerchantTransaction, json_str) + return converter.json_to_class(NoteAttachmentBunqMeFundraiserResult, + json_str) -class MasterCardAction(core.BunqModel): +class NoteTextBunqMeFundraiserResult(core.BunqModel): """ - MasterCard transaction view. + Used to manage text notes. - :param _id_: The id of the MastercardAction. + :param _content: The content of the note. + :type _content: str + :param _id_: The id of the note. :type _id_: int - :param _monetary_account_id: The id of the monetary account this action - links to. - :type _monetary_account_id: int - :param _card_id: The id of the card this action links to. - :type _card_id: int - :param _amount_local: The amount of the transaction in local currency. - :type _amount_local: object_.Amount - :param _amount_billing: The amount of the transaction in the monetary - account's currency. - :type _amount_billing: object_.Amount - :param _amount_original_local: The original amount in local currency. - :type _amount_original_local: object_.Amount - :param _amount_original_billing: The original amount in the monetary - account's currency. - :type _amount_original_billing: object_.Amount - :param _amount_fee: The fee amount as charged by the merchant, if - applicable. - :type _amount_fee: object_.Amount - :param _decision: Why the transaction was denied, if it was denied, or just - ALLOWED. - :type _decision: str - :param _decision_description: Empty if allowed, otherwise a textual - explanation of why it was denied. - :type _decision_description: str - :param _decision_description_translated: Empty if allowed, otherwise a - textual explanation of why it was denied in user's language. - :type _decision_description_translated: str - :param _description: The description for this transaction to display. - :type _description: str - :param _authorisation_status: The status in the authorisation process. - :type _authorisation_status: str - :param _authorisation_type: The type of transaction that was delivered using - the card. - :type _authorisation_type: str - :param _pan_entry_mode_user: The type of entry mode the user used. Can be - 'ATM', 'ICC', 'MAGNETIC_STRIPE' or 'E_COMMERCE'. - :type _pan_entry_mode_user: str - :param _city: The city where the message originates from as announced by the - terminal. - :type _city: str - :param _alias: The monetary account label of the account that this action is - created for. - :type _alias: object_.MonetaryAccountReference - :param _counterparty_alias: The monetary account label of the counterparty. - :type _counterparty_alias: object_.MonetaryAccountReference - :param _label_card: The label of the card. - :type _label_card: object_.LabelCard - :param _token_status: If this is a tokenisation action, this shows the - status of the token. - :type _token_status: str - :param _reservation_expiry_time: If this is a reservation, the moment the - reservation will expire. - :type _reservation_expiry_time: str - :param _applied_limit: The type of the limit applied to validate if this - MasterCardAction was within the spending limits. The returned string matches - the limit types as defined in the card endpoint. - :type _applied_limit: str - :param _allow_chat: Whether or not chat messages are allowed. - :type _allow_chat: bool - :param _eligible_whitelist_id: The whitelist id for this mastercard action - or null. - :type _eligible_whitelist_id: int - :param _secure_code_id: The secure code id for this mastercard action or - null. - :type _secure_code_id: int - :param _wallet_provider_id: The ID of the wallet provider as defined by - MasterCard. 420 = bunq Android app with Tap&Pay; 103 = Apple Pay. - :type _wallet_provider_id: str - :param _request_reference_split_the_bill: The reference to the object used - for split the bill. Can be RequestInquiry or RequestInquiryBatch - :type _request_reference_split_the_bill: - list[object_.RequestInquiryReference] + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser """ # Endpoint constants. - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/mastercard-action/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/mastercard-action" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/bunqme-fundraiser-result/{}/note-text" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/bunqme-fundraiser-result/{}/note-text/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/bunqme-fundraiser-result/{}/note-text/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/bunqme-fundraiser-result/{}/note-text" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/bunqme-fundraiser-result/{}/note-text/{}" + + # Field constants. + FIELD_CONTENT = "content" # Object type. - _OBJECT_TYPE_GET = "MasterCardAction" + _OBJECT_TYPE_GET = "NoteText" _id_ = None - _monetary_account_id = None - _card_id = None - _amount_local = None - _amount_billing = None - _amount_original_local = None - _amount_original_billing = None - _amount_fee = None - _decision = None - _decision_description = None - _decision_description_translated = None - _description = None - _authorisation_status = None - _authorisation_type = None - _pan_entry_mode_user = None - _city = None - _alias = None - _counterparty_alias = None - _label_card = None - _token_status = None - _reservation_expiry_time = None - _applied_limit = None - _allow_chat = None - _eligible_whitelist_id = None - _secure_code_id = None - _wallet_provider_id = None - _request_reference_split_the_bill = None + _created = None + _updated = None + _label_user_creator = None + _content = None + _content_field_for_request = None + + def __init__(self, content=None): + """ + :param content: The content of the note. + :type content: str + """ + + self._content_field_for_request = content @classmethod - def get(cls, master_card_action_id, monetary_account_id=None, - custom_headers=None): + def create(cls, bunqme_fundraiser_result_id, monetary_account_id=None, + content=None, custom_headers=None): """ - :type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int - :type master_card_action_id: int + :type bunqme_fundraiser_result_id: int + :param content: The content of the note. + :type content: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseMasterCardAction + :rtype: BunqResponseInt """ if custom_headers is None: custom_headers = {} + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - master_card_action_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + bunqme_fundraiser_result_id) + response_raw = api_client.post(endpoint_url, request_bytes, + custom_headers) - return BunqResponseMasterCardAction.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @classmethod - def list(cls, monetary_account_id=None, params=None, custom_headers=None): + def update(cls, bunqme_fundraiser_result_id, + note_text_bunq_me_fundraiser_result_id, monetary_account_id=None, + content=None, custom_headers=None): """ :type user_id: int :type monetary_account_id: int - :type params: dict[str, str]|None + :type bunqme_fundraiser_result_id: int + :type note_text_bunq_me_fundraiser_result_id: int + :param content: The content of the note. + :type content: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseMasterCardActionList + :rtype: BunqResponseInt """ - if params is None: - params = {} - if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_LISTING.format( - cls._determine_user_id(), - cls._determine_monetary_account_id(monetary_account_id)) - response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseMasterCardActionList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) - ) + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) - @property - def id_(self): - """ - :rtype: int - """ + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + bunqme_fundraiser_result_id, + note_text_bunq_me_fundraiser_result_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) - return self._id_ + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) - @property - def monetary_account_id(self): + @classmethod + def delete(cls, bunqme_fundraiser_result_id, + note_text_bunq_me_fundraiser_result_id, monetary_account_id=None, + custom_headers=None): """ - :rtype: int + :type user_id: int + :type monetary_account_id: int + :type bunqme_fundraiser_result_id: int + :type note_text_bunq_me_fundraiser_result_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone """ - return self._monetary_account_id + if custom_headers is None: + custom_headers = {} - @property - def card_id(self): - """ - :rtype: int - """ + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + bunqme_fundraiser_result_id, + note_text_bunq_me_fundraiser_result_id) + response_raw = api_client.delete(endpoint_url, custom_headers) - return self._card_id + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) - @property - def amount_local(self): + @classmethod + def list(cls, bunqme_fundraiser_result_id, monetary_account_id=None, + params=None, custom_headers=None): """ - :rtype: object_.Amount + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type bunqme_fundraiser_result_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextBunqMeFundraiserResultList """ - return self._amount_local - - @property - def amount_billing(self): - """ - :rtype: object_.Amount - """ + if params is None: + params = {} - return self._amount_billing + if custom_headers is None: + custom_headers = {} - @property - def amount_original_local(self): - """ - :rtype: object_.Amount - """ + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + bunqme_fundraiser_result_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) - return self._amount_original_local + return BunqResponseNoteTextBunqMeFundraiserResultList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) - @property - def amount_original_billing(self): + @classmethod + def get(cls, bunqme_fundraiser_result_id, + note_text_bunq_me_fundraiser_result_id, monetary_account_id=None, + custom_headers=None): """ - :rtype: object_.Amount + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type bunqme_fundraiser_result_id: int + :type note_text_bunq_me_fundraiser_result_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextBunqMeFundraiserResult """ - return self._amount_original_billing + if custom_headers is None: + custom_headers = {} - @property - def amount_fee(self): - """ - :rtype: object_.Amount - """ + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + bunqme_fundraiser_result_id, + note_text_bunq_me_fundraiser_result_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - return self._amount_fee + return BunqResponseNoteTextBunqMeFundraiserResult.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) @property - def decision(self): + def id_(self): """ - :rtype: str + :rtype: int """ - return self._decision + return self._id_ @property - def decision_description(self): + def created(self): """ :rtype: str """ - return self._decision_description + return self._created @property - def decision_description_translated(self): + def updated(self): """ :rtype: str """ - return self._decision_description_translated + return self._updated @property - def description(self): + def label_user_creator(self): """ - :rtype: str + :rtype: object_.LabelUser """ - return self._description + return self._label_user_creator @property - def authorisation_status(self): + def content(self): """ :rtype: str """ - return self._authorisation_status + return self._content - @property - def authorisation_type(self): + def is_all_field_none(self): """ - :rtype: str + :rtype: bool """ - return self._authorisation_type + if self._id_ is not None: + return False - @property - def pan_entry_mode_user(self): - """ - :rtype: str - """ + if self._created is not None: + return False - return self._pan_entry_mode_user + if self._updated is not None: + return False - @property - def city(self): - """ - :rtype: str - """ + if self._label_user_creator is not None: + return False - return self._city + if self._content is not None: + return False - @property - def alias(self): + return True + + @staticmethod + def from_json(json_str): """ - :rtype: object_.MonetaryAccountReference + :type json_str: str + + :rtype: NoteTextBunqMeFundraiserResult """ - return self._alias + return converter.json_to_class(NoteTextBunqMeFundraiserResult, json_str) - @property - def counterparty_alias(self): - """ - :rtype: object_.MonetaryAccountReference - """ - return self._counterparty_alias +class NoteAttachmentDraftPayment(core.BunqModel): + """ + Used to manage attachment notes. + + :param _description: Optional description of the attachment. + :type _description: str + :param _attachment_id: The reference to the uploaded file to attach to this + note. + :type _attachment_id: int + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + :param _attachment: The attachment attached to the note. + :type _attachment: list[object_.AttachmentMonetaryAccountPayment] + """ - @property - def label_card(self): - """ - :rtype: object_.LabelCard - """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/draft-payment/{}/note-attachment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/draft-payment/{}/note-attachment/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/draft-payment/{}/note-attachment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/draft-payment/{}/note-attachment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/draft-payment/{}/note-attachment/{}" - return self._label_card + # Field constants. + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT_ID = "attachment_id" - @property - def token_status(self): - """ - :rtype: str - """ + # Object type. + _OBJECT_TYPE_GET = "NoteAttachment" - return self._token_status + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _description = None + _attachment = None + _description_field_for_request = None + _attachment_id_field_for_request = None - @property - def reservation_expiry_time(self): + def __init__(self, attachment_id, description=None): """ - :rtype: str + :param attachment_id: The reference to the uploaded file to attach to this + note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str """ - return self._reservation_expiry_time + self._attachment_id_field_for_request = attachment_id + self._description_field_for_request = description - @property - def applied_limit(self): + @classmethod + def create(cls, draft_payment_id, attachment_id, monetary_account_id=None, + description=None, custom_headers=None): """ - :rtype: str + :type user_id: int + :type monetary_account_id: int + :type draft_payment_id: int + :param attachment_id: The reference to the uploaded file to attach to + this note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._applied_limit + if custom_headers is None: + custom_headers = {} - @property - def allow_chat(self): - """ - :rtype: bool - """ + request_map = { + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT_ID: attachment_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) - return self._allow_chat + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + draft_payment_id) + response_raw = api_client.post(endpoint_url, request_bytes, + custom_headers) - @property - def eligible_whitelist_id(self): + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def update(cls, draft_payment_id, note_attachment_draft_payment_id, + monetary_account_id=None, description=None, custom_headers=None): """ - :rtype: int + :type user_id: int + :type monetary_account_id: int + :type draft_payment_id: int + :type note_attachment_draft_payment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._eligible_whitelist_id + if custom_headers is None: + custom_headers = {} - @property - def secure_code_id(self): - """ - :rtype: int - """ + api_client = client.ApiClient(cls._get_api_context()) - return self._secure_code_id + request_map = { + cls.FIELD_DESCRIPTION: description + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) - @property - def wallet_provider_id(self): - """ - :rtype: str - """ + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + draft_payment_id, + note_attachment_draft_payment_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) - return self._wallet_provider_id + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) - @property - def request_reference_split_the_bill(self): + @classmethod + def delete(cls, draft_payment_id, note_attachment_draft_payment_id, + monetary_account_id=None, custom_headers=None): """ - :rtype: list[object_.RequestInquiryReference] + :type user_id: int + :type monetary_account_id: int + :type draft_payment_id: int + :type note_attachment_draft_payment_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone """ - return self._request_reference_split_the_bill + if custom_headers is None: + custom_headers = {} - def is_all_field_none(self): + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + draft_payment_id, + note_attachment_draft_payment_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, draft_payment_id, monetary_account_id=None, params=None, + custom_headers=None): """ - :rtype: bool + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type draft_payment_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentDraftPaymentList """ - if self._id_ is not None: - return False + if params is None: + params = {} - if self._monetary_account_id is not None: - return False + if custom_headers is None: + custom_headers = {} - if self._card_id is not None: - return False + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + draft_payment_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) - if self._amount_local is not None: - return False + return BunqResponseNoteAttachmentDraftPaymentList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) - if self._amount_billing is not None: - return False + @classmethod + def get(cls, draft_payment_id, note_attachment_draft_payment_id, + monetary_account_id=None, custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type draft_payment_id: int + :type note_attachment_draft_payment_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentDraftPayment + """ - if self._amount_original_local is not None: - return False + if custom_headers is None: + custom_headers = {} - if self._amount_original_billing is not None: - return False + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + draft_payment_id, + note_attachment_draft_payment_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - if self._amount_fee is not None: - return False + return BunqResponseNoteAttachmentDraftPayment.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) - if self._decision is not None: - return False + @property + def id_(self): + """ + :rtype: int + """ - if self._decision_description is not None: - return False + return self._id_ - if self._decision_description_translated is not None: - return False + @property + def created(self): + """ + :rtype: str + """ - if self._description is not None: - return False + return self._created - if self._authorisation_status is not None: - return False + @property + def updated(self): + """ + :rtype: str + """ - if self._authorisation_type is not None: - return False + return self._updated - if self._pan_entry_mode_user is not None: - return False + @property + def label_user_creator(self): + """ + :rtype: object_.LabelUser + """ - if self._city is not None: - return False + return self._label_user_creator - if self._alias is not None: - return False + @property + def description(self): + """ + :rtype: str + """ - if self._counterparty_alias is not None: - return False + return self._description - if self._label_card is not None: - return False + @property + def attachment(self): + """ + :rtype: list[object_.AttachmentMonetaryAccountPayment] + """ - if self._token_status is not None: - return False + return self._attachment - if self._reservation_expiry_time is not None: - return False + def is_all_field_none(self): + """ + :rtype: bool + """ - if self._applied_limit is not None: + if self._id_ is not None: return False - if self._allow_chat is not None: + if self._created is not None: return False - if self._eligible_whitelist_id is not None: + if self._updated is not None: return False - if self._secure_code_id is not None: + if self._label_user_creator is not None: return False - if self._wallet_provider_id is not None: + if self._description is not None: return False - if self._request_reference_split_the_bill is not None: + if self._attachment is not None: return False return True @@ -13046,304 +13517,65 @@ def from_json(json_str): """ :type json_str: str - :rtype: MasterCardAction + :rtype: NoteAttachmentDraftPayment """ - return converter.json_to_class(MasterCardAction, json_str) + return converter.json_to_class(NoteAttachmentDraftPayment, json_str) -class RequestInquiry(core.BunqModel): +class NoteTextDraftPayment(core.BunqModel): """ - RequestInquiry, aka 'RFP' (Request for Payment), is one of the innovative - features that bunq offers. To request payment from another bunq account a - new Request Inquiry is created. As with payments you can add attachments to - a RFP. Requests for Payment are the foundation for a number of consumer - features like 'Split the bill' and 'Request forwarding'. We invite you to - invent your own based on the bunq api! + Used to manage text notes. - :param _amount_inquired: The requested amount. - :type _amount_inquired: object_.Amount - :param _counterparty_alias: The LabelMonetaryAccount with the public - information of the MonetaryAccount the money was requested from. - :type _counterparty_alias: object_.MonetaryAccountReference - :param _description: The description of the inquiry. - :type _description: str - :param _attachment: The attachments attached to the payment. - :type _attachment: list[object_.BunqId] - :param _merchant_reference: The client's custom reference that was attached - to the request and the mutation. - :type _merchant_reference: str - :param _status: The status of the request. - :type _status: str - :param _minimum_age: The minimum age the user accepting the RequestInquiry - must have. - :type _minimum_age: int - :param _require_address: Whether or not an address must be provided on - accept. - :type _require_address: str - :param _want_tip: [DEPRECATED] Whether or not the accepting user can give an - extra tip on top of the requested Amount. Defaults to false. - :type _want_tip: bool - :param _allow_amount_lower: [DEPRECATED] Whether or not the accepting user - can choose to accept with a lower amount than requested. Defaults to false. - :type _allow_amount_lower: bool - :param _allow_amount_higher: [DEPRECATED] Whether or not the accepting user - can choose to accept with a higher amount than requested. Defaults to false. - :type _allow_amount_higher: bool - :param _allow_bunqme: Whether or not sending a bunq.me request is allowed. - :type _allow_bunqme: bool - :param _redirect_url: The URL which the user is sent to after accepting or - rejecting the Request. - :type _redirect_url: str - :param _event_id: The ID of the associated event if the request was made - using 'split the bill'. - :type _event_id: int - :param _id_: The id of the created RequestInquiry. + :param _content: The content of the note. + :type _content: str + :param _id_: The id of the note. :type _id_: int - :param _created: The timestamp of the payment request's creation. + :param _created: The timestamp of the note's creation. :type _created: str - :param _updated: The timestamp of the payment request's last update. + :param _updated: The timestamp of the note's last update. :type _updated: str - :param _time_responded: The timestamp of when the payment request was - responded to. - :type _time_responded: str - :param _time_expiry: The timestamp of when the payment request expired. - :type _time_expiry: str - :param _monetary_account_id: The id of the monetary account the request - response applies to. - :type _monetary_account_id: int - :param _amount_responded: The responded amount. - :type _amount_responded: object_.Amount - :param _user_alias_created: The label that's displayed to the counterparty - with the mutation. Includes user. - :type _user_alias_created: object_.LabelUser - :param _user_alias_revoked: The label that's displayed to the counterparty - with the mutation. Includes user. - :type _user_alias_revoked: object_.LabelUser - :param _batch_id: The id of the batch if the request was part of a batch. - :type _batch_id: int - :param _scheduled_id: The id of the scheduled job if the request was - scheduled. - :type _scheduled_id: int - :param _bunqme_share_url: The url that points to the bunq.me request. - :type _bunqme_share_url: str - :param _address_shipping: The shipping address provided by the accepting - user if an address was requested. - :type _address_shipping: object_.Address - :param _address_billing: The billing address provided by the accepting user - if an address was requested. - :type _address_billing: object_.Address - :param _geolocation: The geolocation where the payment was done. - :type _geolocation: object_.Geolocation - :param _allow_chat: Whether or not chat messages are allowed. - :type _allow_chat: bool - :param _reference_split_the_bill: The reference to the object used for split - the bill. Can be Payment, PaymentBatch, ScheduleInstance, RequestResponse - and MasterCardAction - :type _reference_split_the_bill: - object_.RequestReferenceSplitTheBillAnchorObject + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser """ # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-inquiry" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-inquiry/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-inquiry" - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/request-inquiry/{}" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/draft-payment/{}/note-text" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/draft-payment/{}/note-text/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/draft-payment/{}/note-text/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/draft-payment/{}/note-text" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/draft-payment/{}/note-text/{}" # Field constants. - FIELD_AMOUNT_INQUIRED = "amount_inquired" - FIELD_COUNTERPARTY_ALIAS = "counterparty_alias" - FIELD_DESCRIPTION = "description" - FIELD_ATTACHMENT = "attachment" - FIELD_MERCHANT_REFERENCE = "merchant_reference" - FIELD_STATUS = "status" - FIELD_MINIMUM_AGE = "minimum_age" - FIELD_REQUIRE_ADDRESS = "require_address" - FIELD_WANT_TIP = "want_tip" - FIELD_ALLOW_AMOUNT_LOWER = "allow_amount_lower" - FIELD_ALLOW_AMOUNT_HIGHER = "allow_amount_higher" - FIELD_ALLOW_BUNQME = "allow_bunqme" - FIELD_REDIRECT_URL = "redirect_url" - FIELD_EVENT_ID = "event_id" + FIELD_CONTENT = "content" # Object type. - _OBJECT_TYPE_PUT = "RequestInquiry" - _OBJECT_TYPE_GET = "RequestInquiry" + _OBJECT_TYPE_GET = "NoteText" _id_ = None _created = None _updated = None - _time_responded = None - _time_expiry = None - _monetary_account_id = None - _amount_inquired = None - _amount_responded = None - _user_alias_created = None - _user_alias_revoked = None - _counterparty_alias = None - _description = None - _merchant_reference = None - _attachment = None - _status = None - _batch_id = None - _scheduled_id = None - _minimum_age = None - _require_address = None - _bunqme_share_url = None - _redirect_url = None - _address_shipping = None - _address_billing = None - _geolocation = None - _allow_chat = None - _reference_split_the_bill = None - _amount_inquired_field_for_request = None - _counterparty_alias_field_for_request = None - _description_field_for_request = None - _attachment_field_for_request = None - _merchant_reference_field_for_request = None - _status_field_for_request = None - _minimum_age_field_for_request = None - _require_address_field_for_request = None - _want_tip_field_for_request = None - _allow_amount_lower_field_for_request = None - _allow_amount_higher_field_for_request = None - _allow_bunqme_field_for_request = None - _redirect_url_field_for_request = None - _event_id_field_for_request = None + _label_user_creator = None + _content = None + _content_field_for_request = None - def __init__(self, amount_inquired, counterparty_alias, description, - allow_bunqme, attachment=None, merchant_reference=None, - status=None, minimum_age=None, require_address=None, - want_tip=None, allow_amount_lower=None, - allow_amount_higher=None, redirect_url=None, event_id=None): + def __init__(self, content=None): """ - :param amount_inquired: The Amount requested to be paid by the person the - RequestInquiry is sent to. Must be bigger than 0. - :type amount_inquired: object_.Amount - :param counterparty_alias: The Alias of the party we are requesting the - money from. Can be an Alias of type EMAIL, PHONE_NUMBER or IBAN. In case the - EMAIL or PHONE_NUMBER Alias does not refer to a bunq monetary account, - 'allow_bunqme' needs to be 'true' in order to trigger the creation of a - bunq.me request. Otherwise no request inquiry will be sent. - :type counterparty_alias: object_.Pointer - :param description: The description for the RequestInquiry. Maximum 9000 - characters. Field is required but can be an empty string. - :type description: str - :param allow_bunqme: Whether or not sending a bunq.me request is allowed. - :type allow_bunqme: bool - :param attachment: The Attachments to attach to the RequestInquiry. - :type attachment: list[object_.BunqId] - :param merchant_reference: Optional data to be included with the - RequestInquiry specific to the merchant. Has to be unique for the same - source MonetaryAccount. - :type merchant_reference: str - :param status: The status of the RequestInquiry. Ignored in POST requests - but can be used for revoking (cancelling) the RequestInquiry by setting - REVOKED with a PUT request. - :type status: str - :param minimum_age: The minimum age the user accepting the RequestInquiry - must have. Defaults to not checking. If set, must be between 12 and 100 - inclusive. - :type minimum_age: int - :param require_address: Whether a billing and shipping address must be - provided when paying the request. Possible values are: BILLING, SHIPPING, - BILLING_SHIPPING, NONE, OPTIONAL. Default is NONE. - :type require_address: str - :param want_tip: [DEPRECATED] Whether or not the accepting user can give an - extra tip on top of the requested Amount. Defaults to false. - :type want_tip: bool - :param allow_amount_lower: [DEPRECATED] Whether or not the accepting user - can choose to accept with a lower amount than requested. Defaults to false. - :type allow_amount_lower: bool - :param allow_amount_higher: [DEPRECATED] Whether or not the accepting user - can choose to accept with a higher amount than requested. Defaults to false. - :type allow_amount_higher: bool - :param redirect_url: The URL which the user is sent to after accepting or - rejecting the Request. - :type redirect_url: str - :param event_id: The ID of the associated event if the request was made - using 'split the bill'. - :type event_id: int + :param content: The content of the note. + :type content: str """ - self._amount_inquired_field_for_request = amount_inquired - self._counterparty_alias_field_for_request = counterparty_alias - self._description_field_for_request = description - self._allow_bunqme_field_for_request = allow_bunqme - self._attachment_field_for_request = attachment - self._merchant_reference_field_for_request = merchant_reference - self._status_field_for_request = status - self._minimum_age_field_for_request = minimum_age - self._require_address_field_for_request = require_address - self._want_tip_field_for_request = want_tip - self._allow_amount_lower_field_for_request = allow_amount_lower - self._allow_amount_higher_field_for_request = allow_amount_higher - self._redirect_url_field_for_request = redirect_url - self._event_id_field_for_request = event_id + self._content_field_for_request = content @classmethod - def create(cls, amount_inquired, counterparty_alias, description, - allow_bunqme, monetary_account_id=None, attachment=None, - merchant_reference=None, status=None, minimum_age=None, - require_address=None, want_tip=None, allow_amount_lower=None, - allow_amount_higher=None, redirect_url=None, event_id=None, + def create(cls, draft_payment_id, monetary_account_id=None, content=None, custom_headers=None): """ - Create a new payment request. - :type user_id: int :type monetary_account_id: int - :param amount_inquired: The Amount requested to be paid by the person - the RequestInquiry is sent to. Must be bigger than 0. - :type amount_inquired: object_.Amount - :param counterparty_alias: The Alias of the party we are requesting the - money from. Can be an Alias of type EMAIL, PHONE_NUMBER or IBAN. In case - the EMAIL or PHONE_NUMBER Alias does not refer to a bunq monetary - account, 'allow_bunqme' needs to be 'true' in order to trigger the - creation of a bunq.me request. Otherwise no request inquiry will be - sent. - :type counterparty_alias: object_.Pointer - :param description: The description for the RequestInquiry. Maximum 9000 - characters. Field is required but can be an empty string. - :type description: str - :param allow_bunqme: Whether or not sending a bunq.me request is - allowed. - :type allow_bunqme: bool - :param attachment: The Attachments to attach to the RequestInquiry. - :type attachment: list[object_.BunqId] - :param merchant_reference: Optional data to be included with the - RequestInquiry specific to the merchant. Has to be unique for the same - source MonetaryAccount. - :type merchant_reference: str - :param status: The status of the RequestInquiry. Ignored in POST - requests but can be used for revoking (cancelling) the RequestInquiry by - setting REVOKED with a PUT request. - :type status: str - :param minimum_age: The minimum age the user accepting the - RequestInquiry must have. Defaults to not checking. If set, must be - between 12 and 100 inclusive. - :type minimum_age: int - :param require_address: Whether a billing and shipping address must be - provided when paying the request. Possible values are: BILLING, - SHIPPING, BILLING_SHIPPING, NONE, OPTIONAL. Default is NONE. - :type require_address: str - :param want_tip: [DEPRECATED] Whether or not the accepting user can give - an extra tip on top of the requested Amount. Defaults to false. - :type want_tip: bool - :param allow_amount_lower: [DEPRECATED] Whether or not the accepting - user can choose to accept with a lower amount than requested. Defaults - to false. - :type allow_amount_lower: bool - :param allow_amount_higher: [DEPRECATED] Whether or not the accepting - user can choose to accept with a higher amount than requested. Defaults - to false. - :type allow_amount_higher: bool - :param redirect_url: The URL which the user is sent to after accepting - or rejecting the Request. - :type redirect_url: str - :param event_id: The ID of the associated event if the request was made - using 'split the bill'. - :type event_id: int + :type draft_payment_id: int + :param content: The content of the note. + :type content: str :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -13353,20 +13585,7 @@ def create(cls, amount_inquired, counterparty_alias, description, custom_headers = {} request_map = { - cls.FIELD_AMOUNT_INQUIRED: amount_inquired, - cls.FIELD_COUNTERPARTY_ALIAS: counterparty_alias, - cls.FIELD_DESCRIPTION: description, - cls.FIELD_ATTACHMENT: attachment, - cls.FIELD_MERCHANT_REFERENCE: merchant_reference, - cls.FIELD_STATUS: status, - cls.FIELD_MINIMUM_AGE: minimum_age, - cls.FIELD_REQUIRE_ADDRESS: require_address, - cls.FIELD_WANT_TIP: want_tip, - cls.FIELD_ALLOW_AMOUNT_LOWER: allow_amount_lower, - cls.FIELD_ALLOW_AMOUNT_HIGHER: allow_amount_higher, - cls.FIELD_ALLOW_BUNQME: allow_bunqme, - cls.FIELD_REDIRECT_URL: redirect_url, - cls.FIELD_EVENT_ID: event_id + cls.FIELD_CONTENT: content } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) @@ -13375,7 +13594,8 @@ def create(cls, amount_inquired, counterparty_alias, description, request_bytes = request_map_string.encode() endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), cls._determine_monetary_account_id( - monetary_account_id)) + monetary_account_id), + draft_payment_id) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) @@ -13384,21 +13604,18 @@ def create(cls, amount_inquired, counterparty_alias, description, ) @classmethod - def update(cls, request_inquiry_id, monetary_account_id=None, status=None, - custom_headers=None): + def update(cls, draft_payment_id, note_text_draft_payment_id, + monetary_account_id=None, content=None, custom_headers=None): """ - Revoke a request for payment, by updating the status to REVOKED. - :type user_id: int :type monetary_account_id: int - :type request_inquiry_id: int - :param status: The status of the RequestInquiry. Ignored in POST - requests but can be used for revoking (cancelling) the RequestInquiry by - setting REVOKED with a PUT request. - :type status: str + :type draft_payment_id: int + :type note_text_draft_payment_id: int + :param content: The content of the note. + :type content: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestInquiry + :rtype: BunqResponseInt """ if custom_headers is None: @@ -13407,7 +13624,7 @@ def update(cls, request_inquiry_id, monetary_account_id=None, status=None, api_client = client.ApiClient(cls._get_api_context()) request_map = { - cls.FIELD_STATUS: status + cls.FIELD_CONTENT: content } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) @@ -13416,25 +13633,56 @@ def update(cls, request_inquiry_id, monetary_account_id=None, status=None, endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), - request_inquiry_id) + draft_payment_id, + note_text_draft_payment_id) response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - return BunqResponseRequestInquiry.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_PUT) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @classmethod - def list(cls, monetary_account_id=None, params=None, custom_headers=None): + def delete(cls, draft_payment_id, note_text_draft_payment_id, + monetary_account_id=None, custom_headers=None): """ - Get all payment requests for a user's monetary account. + :type user_id: int + :type monetary_account_id: int + :type draft_payment_id: int + :type note_text_draft_payment_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + draft_payment_id, + note_text_draft_payment_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, draft_payment_id, monetary_account_id=None, params=None, + custom_headers=None): + """ + Manage the notes for a given user. :type user_id: int :type monetary_account_id: int + :type draft_payment_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestInquiryList + :rtype: BunqResponseNoteTextDraftPaymentList """ if params is None: @@ -13446,26 +13694,26 @@ def list(cls, monetary_account_id=None, params=None, custom_headers=None): api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_LISTING.format( cls._determine_user_id(), - cls._determine_monetary_account_id(monetary_account_id)) + cls._determine_monetary_account_id(monetary_account_id), + draft_payment_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseRequestInquiryList.cast_from_bunq_response( + return BunqResponseNoteTextDraftPaymentList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) ) @classmethod - def get(cls, request_inquiry_id, monetary_account_id=None, - custom_headers=None): + def get(cls, draft_payment_id, note_text_draft_payment_id, + monetary_account_id=None, custom_headers=None): """ - Get the details of a specific payment request, including its status. - :type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int - :type request_inquiry_id: int + :type draft_payment_id: int + :type note_text_draft_payment_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestInquiry + :rtype: BunqResponseNoteTextDraftPayment """ if custom_headers is None: @@ -13475,10 +13723,11 @@ def get(cls, request_inquiry_id, monetary_account_id=None, endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), - request_inquiry_id) + draft_payment_id, + note_text_draft_payment_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseRequestInquiry.cast_from_bunq_response( + return BunqResponseNoteTextDraftPayment.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE_GET) ) @@ -13507,188 +13756,328 @@ def updated(self): return self._updated @property - def time_responded(self): + def label_user_creator(self): """ - :rtype: str + :rtype: object_.LabelUser """ - return self._time_responded + return self._label_user_creator @property - def time_expiry(self): + def content(self): """ :rtype: str """ - return self._time_expiry + return self._content - @property - def monetary_account_id(self): + def is_all_field_none(self): """ - :rtype: int + :rtype: bool """ - return self._monetary_account_id + if self._id_ is not None: + return False - @property - def amount_inquired(self): - """ - :rtype: object_.Amount - """ + if self._created is not None: + return False - return self._amount_inquired + if self._updated is not None: + return False - @property - def amount_responded(self): - """ - :rtype: object_.Amount - """ + if self._label_user_creator is not None: + return False - return self._amount_responded + if self._content is not None: + return False - @property - def user_alias_created(self): + return True + + @staticmethod + def from_json(json_str): """ - :rtype: object_.LabelUser + :type json_str: str + + :rtype: NoteTextDraftPayment """ - return self._user_alias_created + return converter.json_to_class(NoteTextDraftPayment, json_str) - @property - def user_alias_revoked(self): - """ - :rtype: object_.LabelUser - """ - return self._user_alias_revoked +class NoteAttachmentIdealMerchantTransaction(core.BunqModel): + """ + Used to manage attachment notes. + + :param _description: Optional description of the attachment. + :type _description: str + :param _attachment_id: The reference to the uploaded file to attach to this + note. + :type _attachment_id: int + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + :param _attachment: The attachment attached to the note. + :type _attachment: list[object_.AttachmentMonetaryAccountPayment] + """ - @property - def counterparty_alias(self): - """ - :rtype: object_.MonetaryAccountReference - """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/ideal-merchant-transaction/{}/note-attachment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/ideal-merchant-transaction/{}/note-attachment/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/ideal-merchant-transaction/{}/note-attachment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/ideal-merchant-transaction/{}/note-attachment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/ideal-merchant-transaction/{}/note-attachment/{}" - return self._counterparty_alias + # Field constants. + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT_ID = "attachment_id" - @property - def description(self): - """ - :rtype: str - """ + # Object type. + _OBJECT_TYPE_GET = "NoteAttachment" - return self._description + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _description = None + _attachment = None + _description_field_for_request = None + _attachment_id_field_for_request = None - @property - def merchant_reference(self): + def __init__(self, attachment_id, description=None): """ - :rtype: str + :param attachment_id: The reference to the uploaded file to attach to this + note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str """ - return self._merchant_reference + self._attachment_id_field_for_request = attachment_id + self._description_field_for_request = description - @property - def attachment(self): + @classmethod + def create(cls, ideal_merchant_transaction_id, attachment_id, + monetary_account_id=None, description=None, custom_headers=None): """ - :rtype: list[object_.BunqId] + :type user_id: int + :type monetary_account_id: int + :type ideal_merchant_transaction_id: int + :param attachment_id: The reference to the uploaded file to attach to + this note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._attachment + if custom_headers is None: + custom_headers = {} - @property - def status(self): - """ - :rtype: str - """ + request_map = { + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT_ID: attachment_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) - return self._status + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + ideal_merchant_transaction_id) + response_raw = api_client.post(endpoint_url, request_bytes, + custom_headers) - @property - def batch_id(self): + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def update(cls, ideal_merchant_transaction_id, + note_attachment_ideal_merchant_transaction_id, + monetary_account_id=None, description=None, custom_headers=None): """ - :rtype: int + :type user_id: int + :type monetary_account_id: int + :type ideal_merchant_transaction_id: int + :type note_attachment_ideal_merchant_transaction_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._batch_id + if custom_headers is None: + custom_headers = {} - @property - def scheduled_id(self): - """ - :rtype: int - """ + api_client = client.ApiClient(cls._get_api_context()) - return self._scheduled_id + request_map = { + cls.FIELD_DESCRIPTION: description + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) - @property - def minimum_age(self): + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + ideal_merchant_transaction_id, + note_attachment_ideal_merchant_transaction_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, ideal_merchant_transaction_id, + note_attachment_ideal_merchant_transaction_id, + monetary_account_id=None, custom_headers=None): """ - :rtype: int + :type user_id: int + :type monetary_account_id: int + :type ideal_merchant_transaction_id: int + :type note_attachment_ideal_merchant_transaction_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone """ - return self._minimum_age + if custom_headers is None: + custom_headers = {} - @property - def require_address(self): + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + ideal_merchant_transaction_id, + note_attachment_ideal_merchant_transaction_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, ideal_merchant_transaction_id, monetary_account_id=None, + params=None, custom_headers=None): """ - :rtype: str + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type ideal_merchant_transaction_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentIdealMerchantTransactionList """ - return self._require_address + if params is None: + params = {} - @property - def bunqme_share_url(self): + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + ideal_merchant_transaction_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteAttachmentIdealMerchantTransactionList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, ideal_merchant_transaction_id, + note_attachment_ideal_merchant_transaction_id, + monetary_account_id=None, custom_headers=None): """ - :rtype: str + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type ideal_merchant_transaction_id: int + :type note_attachment_ideal_merchant_transaction_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentIdealMerchantTransaction """ - return self._bunqme_share_url + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + ideal_merchant_transaction_id, + note_attachment_ideal_merchant_transaction_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteAttachmentIdealMerchantTransaction.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) @property - def redirect_url(self): + def id_(self): """ - :rtype: str + :rtype: int """ - return self._redirect_url + return self._id_ @property - def address_shipping(self): + def created(self): """ - :rtype: object_.Address + :rtype: str """ - return self._address_shipping + return self._created @property - def address_billing(self): + def updated(self): """ - :rtype: object_.Address + :rtype: str """ - return self._address_billing + return self._updated @property - def geolocation(self): + def label_user_creator(self): """ - :rtype: object_.Geolocation + :rtype: object_.LabelUser """ - return self._geolocation + return self._label_user_creator @property - def allow_chat(self): + def description(self): """ - :rtype: bool + :rtype: str """ - return self._allow_chat + return self._description @property - def reference_split_the_bill(self): + def attachment(self): """ - :rtype: object_.RequestReferenceSplitTheBillAnchorObject + :rtype: list[object_.AttachmentMonetaryAccountPayment] """ - return self._reference_split_the_bill + return self._attachment def is_all_field_none(self): """ @@ -13704,75 +14093,15 @@ def is_all_field_none(self): if self._updated is not None: return False - if self._time_responded is not None: + if self._label_user_creator 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: + if self._description 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 - - if self._reference_split_the_bill is not None: - return False - return True @staticmethod @@ -13780,259 +14109,207 @@ def from_json(json_str): """ :type json_str: str - :rtype: RequestInquiry + :rtype: NoteAttachmentIdealMerchantTransaction """ - return converter.json_to_class(RequestInquiry, json_str) + return converter.json_to_class(NoteAttachmentIdealMerchantTransaction, + json_str) -class RequestResponse(core.BunqModel): +class NoteTextIdealMerchantTransaction(core.BunqModel): """ - A RequestResponse is what a user on the other side of a RequestInquiry gets - when he is sent one. So a RequestInquiry is the initiator and visible for - the user that sent it and that wants to receive the money. A RequestResponse - is what the other side sees, i.e. the user that pays the money to accept the - request. The content is almost identical. + Used to manage text notes. - :param _amount_responded: The Amount the RequestResponse was accepted with. - :type _amount_responded: object_.Amount - :param _status: The status of the RequestResponse. Can be ACCEPTED, PENDING, - REJECTED or REVOKED. - :type _status: str - :param _address_shipping: The shipping address provided by the accepting - user if an address was requested. - :type _address_shipping: object_.Address - :param _address_billing: The billing address provided by the accepting user - if an address was requested. - :type _address_billing: object_.Address - :param _id_: The id of the Request Response. + :param _content: The content of the note. + :type _content: str + :param _id_: The id of the note. :type _id_: int - :param _created: The timestamp when the Request Response was created. + :param _created: The timestamp of the note's creation. :type _created: str - :param _updated: The timestamp when the Request Response was last updated - (will be updated when chat messages are received). + :param _updated: The timestamp of the note's last update. :type _updated: str - :param _time_responded: The timestamp of when the RequestResponse was - responded to. - :type _time_responded: str - :param _time_expiry: The timestamp of when the RequestResponse expired or - will expire. - :type _time_expiry: str - :param _monetary_account_id: The id of the MonetaryAccount the - RequestResponse was received on. - :type _monetary_account_id: int - :param _amount_inquired: The requested Amount. - :type _amount_inquired: object_.Amount - :param _description: The description for the RequestResponse provided by the - requesting party. Maximum 9000 characters. - :type _description: str - :param _alias: The LabelMonetaryAccount with the public information of the - MonetaryAccount this RequestResponse was received on. - :type _alias: object_.MonetaryAccountReference - :param _counterparty_alias: The LabelMonetaryAccount with the public - information of the MonetaryAccount that is requesting money with this - RequestResponse. - :type _counterparty_alias: object_.MonetaryAccountReference - :param _attachment: The Attachments attached to the RequestResponse. - :type _attachment: list[object_.Attachment] - :param _minimum_age: The minimum age the user accepting the RequestResponse - must have. - :type _minimum_age: int - :param _require_address: Whether or not an address must be provided on - accept. - :type _require_address: str - :param _geolocation: The Geolocation where the RequestResponse was created. - :type _geolocation: object_.Geolocation - :param _type_: The type of the RequestInquiry. Can be DIRECT_DEBIT, - DIRECT_DEBIT_B2B, IDEAL, SOFORT or INTERNAL. - :type _type_: str - :param _sub_type: The subtype of the RequestInquiry. Can be ONCE or - RECURRING for DIRECT_DEBIT RequestInquiries and NONE for all other. - :type _sub_type: str - :param _redirect_url: The URL which the user is sent to after accepting or - rejecting the Request. - :type _redirect_url: str - :param _allow_chat: Whether or not chat messages are allowed. - :type _allow_chat: bool - :param _credit_scheme_identifier: The credit scheme id provided by the - counterparty for DIRECT_DEBIT inquiries. - :type _credit_scheme_identifier: str - :param _mandate_identifier: The mandate id provided by the counterparty for - DIRECT_DEBIT inquiries. - :type _mandate_identifier: str - :param _eligible_whitelist_id: The whitelist id for this action or null. - :type _eligible_whitelist_id: int - :param _request_reference_split_the_bill: The reference to the object used - for split the bill. Can be RequestInquiry or RequestInquiryBatch - :type _request_reference_split_the_bill: - list[object_.RequestInquiryReference] + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser """ # Endpoint constants. - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-response/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-response" - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/request-response/{}" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/ideal-merchant-transaction/{}/note-text" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/ideal-merchant-transaction/{}/note-text/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/ideal-merchant-transaction/{}/note-text/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/ideal-merchant-transaction/{}/note-text" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/ideal-merchant-transaction/{}/note-text/{}" # Field constants. - FIELD_AMOUNT_RESPONDED = "amount_responded" - FIELD_STATUS = "status" - FIELD_ADDRESS_SHIPPING = "address_shipping" - FIELD_ADDRESS_BILLING = "address_billing" + FIELD_CONTENT = "content" # Object type. - _OBJECT_TYPE_PUT = "RequestResponse" - _OBJECT_TYPE_GET = "RequestResponse" + _OBJECT_TYPE_GET = "NoteText" _id_ = None _created = None _updated = None - _time_responded = None - _time_expiry = None - _monetary_account_id = None - _amount_inquired = None - _amount_responded = None - _status = None - _description = None - _alias = None - _counterparty_alias = None - _attachment = None - _minimum_age = None - _require_address = None - _geolocation = None - _type_ = None - _sub_type = None - _redirect_url = None - _address_billing = None - _address_shipping = None - _allow_chat = None - _credit_scheme_identifier = None - _mandate_identifier = None - _eligible_whitelist_id = None - _request_reference_split_the_bill = None - _amount_responded_field_for_request = None - _status_field_for_request = None - _address_shipping_field_for_request = None - _address_billing_field_for_request = None + _label_user_creator = None + _content = None + _content_field_for_request = None - def __init__(self, status=None, amount_responded=None, - address_shipping=None, address_billing=None): + def __init__(self, content=None): """ - :param status: The responding status of the RequestResponse. Can be ACCEPTED - or REJECTED. - :type status: str - :param amount_responded: The Amount the user decides to pay. - :type amount_responded: object_.Amount - :param address_shipping: The shipping Address to return to the user who - created the RequestInquiry. Should only be provided if 'require_address' is - set to SHIPPING, BILLING_SHIPPING or OPTIONAL. - :type address_shipping: object_.Address - :param address_billing: The billing Address to return to the user who - created the RequestInquiry. Should only be provided if 'require_address' is - set to BILLING, BILLING_SHIPPING or OPTIONAL. - :type address_billing: object_.Address + :param content: The content of the note. + :type content: str """ - self._status_field_for_request = status - self._amount_responded_field_for_request = amount_responded - self._address_shipping_field_for_request = address_shipping - self._address_billing_field_for_request = address_billing + self._content_field_for_request = content @classmethod - def update(cls, request_response_id, monetary_account_id=None, - amount_responded=None, status=None, address_shipping=None, - address_billing=None, custom_headers=None): + def create(cls, ideal_merchant_transaction_id, monetary_account_id=None, + content=None, custom_headers=None): """ - Update the status to accept or reject the RequestResponse. - :type user_id: int :type monetary_account_id: int - :type request_response_id: int - :param amount_responded: The Amount the user decides to pay. - :type amount_responded: object_.Amount - :param status: The responding status of the RequestResponse. Can be - ACCEPTED or REJECTED. - :type status: str - :param address_shipping: The shipping Address to return to the user who - created the RequestInquiry. Should only be provided if 'require_address' - is set to SHIPPING, BILLING_SHIPPING or OPTIONAL. - :type address_shipping: object_.Address - :param address_billing: The billing Address to return to the user who - created the RequestInquiry. Should only be provided if 'require_address' - is set to BILLING, BILLING_SHIPPING or OPTIONAL. - :type address_billing: object_.Address + :type ideal_merchant_transaction_id: int + :param content: The content of the note. + :type content: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestResponse + :rtype: BunqResponseInt """ if custom_headers is None: custom_headers = {} - api_client = client.ApiClient(cls._get_api_context()) - request_map = { - cls.FIELD_AMOUNT_RESPONDED: amount_responded, - cls.FIELD_STATUS: status, - cls.FIELD_ADDRESS_SHIPPING: address_shipping, - cls.FIELD_ADDRESS_BILLING: address_billing + cls.FIELD_CONTENT: content } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) + api_client = client.ApiClient(cls._get_api_context()) request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), - request_response_id) - response_raw = api_client.put(endpoint_url, request_bytes, - custom_headers) + ideal_merchant_transaction_id) + response_raw = api_client.post(endpoint_url, request_bytes, + custom_headers) - return BunqResponseRequestResponse.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_PUT) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @classmethod - def list(cls, monetary_account_id=None, params=None, custom_headers=None): + def update(cls, ideal_merchant_transaction_id, + note_text_ideal_merchant_transaction_id, + monetary_account_id=None, content=None, custom_headers=None): """ - Get all RequestResponses for a MonetaryAccount. - :type user_id: int :type monetary_account_id: int - :type params: dict[str, str]|None + :type ideal_merchant_transaction_id: int + :type note_text_ideal_merchant_transaction_id: int + :param content: The content of the note. + :type content: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestResponseList + :rtype: BunqResponseInt """ - if params is None: - params = {} - if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_LISTING.format( - cls._determine_user_id(), - cls._determine_monetary_account_id(monetary_account_id)) - response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseRequestResponseList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) - ) + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) - @classmethod - def get(cls, request_response_id, monetary_account_id=None, - custom_headers=None): + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + ideal_merchant_transaction_id, + note_text_ideal_merchant_transaction_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, ideal_merchant_transaction_id, + note_text_ideal_merchant_transaction_id, + monetary_account_id=None, custom_headers=None): """ - Get the details for a specific existing RequestResponse. + :type user_id: int + :type monetary_account_id: int + :type ideal_merchant_transaction_id: int + :type note_text_ideal_merchant_transaction_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + ideal_merchant_transaction_id, + note_text_ideal_merchant_transaction_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, ideal_merchant_transaction_id, monetary_account_id=None, + params=None, custom_headers=None): + """ + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type ideal_merchant_transaction_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + :rtype: BunqResponseNoteTextIdealMerchantTransactionList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + ideal_merchant_transaction_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteTextIdealMerchantTransactionList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, ideal_merchant_transaction_id, + note_text_ideal_merchant_transaction_id, monetary_account_id=None, + custom_headers=None): + """ :type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int - :type request_response_id: int + :type ideal_merchant_transaction_id: int + :type note_text_ideal_merchant_transaction_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestResponse + :rtype: BunqResponseNoteTextIdealMerchantTransaction """ if custom_headers is None: @@ -14042,10 +14319,11 @@ def get(cls, request_response_id, monetary_account_id=None, endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), - request_response_id) + ideal_merchant_transaction_id, + note_text_ideal_merchant_transaction_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseRequestResponse.cast_from_bunq_response( + return BunqResponseNoteTextIdealMerchantTransaction.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE_GET) ) @@ -14074,188 +14352,326 @@ def updated(self): return self._updated @property - def time_responded(self): + def label_user_creator(self): """ - :rtype: str + :rtype: object_.LabelUser """ - return self._time_responded + return self._label_user_creator @property - def time_expiry(self): + def content(self): """ :rtype: str """ - return self._time_expiry + return self._content - @property - def monetary_account_id(self): + def is_all_field_none(self): """ - :rtype: int + :rtype: bool """ - return self._monetary_account_id - - @property - def amount_inquired(self): - """ - :rtype: object_.Amount - """ + if self._id_ is not None: + return False - return self._amount_inquired + if self._created is not None: + return False - @property - def amount_responded(self): - """ - :rtype: object_.Amount - """ + if self._updated is not None: + return False - return self._amount_responded + if self._label_user_creator is not None: + return False - @property - def status(self): - """ - :rtype: str - """ + if self._content is not None: + return False - return self._status + return True - @property - def description(self): + @staticmethod + def from_json(json_str): """ - :rtype: str + :type json_str: str + + :rtype: NoteTextIdealMerchantTransaction """ - return self._description + return converter.json_to_class(NoteTextIdealMerchantTransaction, + json_str) - @property - def alias(self): - """ - :rtype: object_.MonetaryAccountReference - """ - return self._alias +class NoteAttachmentMasterCardAction(core.BunqModel): + """ + Used to manage attachment notes. + + :param _description: Optional description of the attachment. + :type _description: str + :param _attachment_id: The reference to the uploaded file to attach to this + note. + :type _attachment_id: int + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + :param _attachment: The attachment attached to the note. + :type _attachment: list[object_.AttachmentMonetaryAccountPayment] + """ - @property - def counterparty_alias(self): - """ - :rtype: object_.MonetaryAccountReference - """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/mastercard-action/{}/note-attachment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/mastercard-action/{}/note-attachment/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/mastercard-action/{}/note-attachment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/mastercard-action/{}/note-attachment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/mastercard-action/{}/note-attachment/{}" - return self._counterparty_alias + # Field constants. + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT_ID = "attachment_id" - @property - def attachment(self): - """ - :rtype: list[object_.Attachment] - """ + # Object type. + _OBJECT_TYPE_GET = "NoteAttachment" - return self._attachment + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _description = None + _attachment = None + _description_field_for_request = None + _attachment_id_field_for_request = None - @property - def minimum_age(self): + def __init__(self, attachment_id, description=None): """ - :rtype: int + :param attachment_id: The reference to the uploaded file to attach to this + note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str """ - return self._minimum_age + self._attachment_id_field_for_request = attachment_id + self._description_field_for_request = description - @property - def require_address(self): + @classmethod + def create(cls, mastercard_action_id, attachment_id, + monetary_account_id=None, description=None, custom_headers=None): """ - :rtype: str + :type user_id: int + :type monetary_account_id: int + :type mastercard_action_id: int + :param attachment_id: The reference to the uploaded file to attach to + this note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._require_address - - @property - def geolocation(self): - """ - :rtype: object_.Geolocation - """ + if custom_headers is None: + custom_headers = {} - return self._geolocation + request_map = { + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT_ID: attachment_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) - @property - def type_(self): - """ - :rtype: str - """ + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + mastercard_action_id) + 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, mastercard_action_id, note_attachment_master_card_action_id, + monetary_account_id=None, description=None, custom_headers=None): """ - :rtype: str + :type user_id: int + :type monetary_account_id: int + :type mastercard_action_id: int + :type note_attachment_master_card_action_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._sub_type + if custom_headers is None: + custom_headers = {} - @property - def redirect_url(self): - """ - :rtype: str - """ + api_client = client.ApiClient(cls._get_api_context()) - return self._redirect_url + request_map = { + cls.FIELD_DESCRIPTION: description + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) - @property - def address_billing(self): - """ - :rtype: object_.Address - """ + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + mastercard_action_id, + note_attachment_master_card_action_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) - return self._address_billing + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) - @property - def address_shipping(self): + @classmethod + def delete(cls, mastercard_action_id, note_attachment_master_card_action_id, + monetary_account_id=None, custom_headers=None): """ - :rtype: object_.Address + :type user_id: int + :type monetary_account_id: int + :type mastercard_action_id: int + :type note_attachment_master_card_action_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone """ - return self._address_shipping + if custom_headers is None: + custom_headers = {} - @property - def allow_chat(self): + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + mastercard_action_id, + note_attachment_master_card_action_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, mastercard_action_id, monetary_account_id=None, params=None, + custom_headers=None): """ - :rtype: bool + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type mastercard_action_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentMasterCardActionList """ - return self._allow_chat + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + mastercard_action_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteAttachmentMasterCardActionList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, mastercard_action_id, note_attachment_master_card_action_id, + monetary_account_id=None, custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type mastercard_action_id: int + :type note_attachment_master_card_action_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentMasterCardAction + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + mastercard_action_id, + note_attachment_master_card_action_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteAttachmentMasterCardAction.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) @property - def credit_scheme_identifier(self): + def id_(self): + """ + :rtype: int + """ + + return self._id_ + + @property + def created(self): """ :rtype: str """ - return self._credit_scheme_identifier + return self._created @property - def mandate_identifier(self): + def updated(self): """ :rtype: str """ - return self._mandate_identifier + return self._updated @property - def eligible_whitelist_id(self): + def label_user_creator(self): """ - :rtype: int + :rtype: object_.LabelUser """ - return self._eligible_whitelist_id + return self._label_user_creator @property - def request_reference_split_the_bill(self): + def description(self): """ - :rtype: list[object_.RequestInquiryReference] + :rtype: str """ - return self._request_reference_split_the_bill + return self._description + + @property + def attachment(self): + """ + :rtype: list[object_.AttachmentMonetaryAccountPayment] + """ + + return self._attachment def is_all_field_none(self): """ @@ -14271,75 +14687,15 @@ def is_all_field_none(self): 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: + if self._label_user_creator 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 - - if self._request_reference_split_the_bill is not None: - return False - return True @staticmethod @@ -14347,106 +14703,102 @@ def from_json(json_str): """ :type json_str: str - :rtype: RequestResponse + :rtype: NoteAttachmentMasterCardAction """ - return converter.json_to_class(RequestResponse, json_str) + return converter.json_to_class(NoteAttachmentMasterCardAction, json_str) -class ScheduleInstance(core.BunqModel): +class NoteTextMasterCardAction(core.BunqModel): """ - view for reading, updating and listing the scheduled instance. + Used to manage text notes. - :param _state: The state of the scheduleInstance. (FINISHED_SUCCESSFULLY, - RETRY, FAILED_USER_ERROR) - :type _state: str - :param _time_start: The schedule start time (UTC). - :type _time_start: str - :param _time_end: The schedule end time (UTC). - :type _time_end: str - :param _error_message: The message when the scheduled instance has run and - failed due to user error. - :type _error_message: list[object_.Error] - :param _scheduled_object: The scheduled object. (Payment, PaymentBatch) - :type _scheduled_object: object_.ScheduleAnchorObject - :param _result_object: The result object of this schedule instance. - (Payment, PaymentBatch) - :type _result_object: object_.ScheduleInstanceAnchorObject - :param _request_reference_split_the_bill: The reference to the object used - for split the bill. Can be RequestInquiry or RequestInquiryBatch - :type _request_reference_split_the_bill: - list[object_.RequestInquiryReference] + :param _content: The content of the note. + :type _content: str + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser """ # Endpoint constants. - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/schedule/{}/schedule-instance" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/mastercard-action/{}/note-text" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/mastercard-action/{}/note-text/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/mastercard-action/{}/note-text/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/mastercard-action/{}/note-text" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/mastercard-action/{}/note-text/{}" # Field constants. - FIELD_STATE = "state" + FIELD_CONTENT = "content" # Object type. - _OBJECT_TYPE_GET = "ScheduledInstance" + _OBJECT_TYPE_GET = "NoteText" - _state = None - _time_start = None - _time_end = None - _error_message = None - _scheduled_object = None - _result_object = None - _request_reference_split_the_bill = None - _state_field_for_request = None + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _content = None + _content_field_for_request = None - def __init__(self, state=None): + def __init__(self, content=None): """ - :param state: Change the state of the scheduleInstance from - FAILED_USER_ERROR to RETRY. - :type state: str + :param content: The content of the note. + :type content: str """ - self._state_field_for_request = state + self._content_field_for_request = content @classmethod - def get(cls, schedule_id, schedule_instance_id, monetary_account_id=None, - custom_headers=None): + def create(cls, mastercard_action_id, monetary_account_id=None, + content=None, custom_headers=None): """ - :type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int - :type schedule_id: int - :type schedule_instance_id: int + :type mastercard_action_id: int + :param content: The content of the note. + :type content: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseScheduleInstance + :rtype: BunqResponseInt """ if custom_headers is None: custom_headers = {} + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - schedule_id, - schedule_instance_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + mastercard_action_id) + response_raw = api_client.post(endpoint_url, request_bytes, + custom_headers) - return BunqResponseScheduleInstance.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @classmethod - def update(cls, schedule_id, schedule_instance_id, monetary_account_id=None, - state=None, custom_headers=None): + def update(cls, mastercard_action_id, note_text_master_card_action_id, + monetary_account_id=None, content=None, custom_headers=None): """ :type user_id: int :type monetary_account_id: int - :type schedule_id: int - :type schedule_instance_id: int - :param state: Change the state of the scheduleInstance from - FAILED_USER_ERROR to RETRY. - :type state: str + :type mastercard_action_id: int + :type note_text_master_card_action_id: int + :param content: The content of the note. + :type content: str :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -14458,7 +14810,7 @@ def update(cls, schedule_id, schedule_instance_id, monetary_account_id=None, api_client = client.ApiClient(cls._get_api_context()) request_map = { - cls.FIELD_STATE: state + cls.FIELD_CONTENT: content } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) @@ -14467,8 +14819,8 @@ def update(cls, schedule_id, schedule_instance_id, monetary_account_id=None, endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), - schedule_id, - schedule_instance_id) + mastercard_action_id, + note_text_master_card_action_id) response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) @@ -14477,115 +14829,152 @@ def update(cls, schedule_id, schedule_instance_id, monetary_account_id=None, ) @classmethod - def list(cls, schedule_id, monetary_account_id=None, params=None, - custom_headers=None): + def delete(cls, mastercard_action_id, note_text_master_card_action_id, + monetary_account_id=None, custom_headers=None): """ :type user_id: int :type monetary_account_id: int - :type schedule_id: int - :type params: dict[str, str]|None + :type mastercard_action_id: int + :type note_text_master_card_action_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseScheduleInstanceList + :rtype: BunqResponseNone """ - if params is None: - params = {} - if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_LISTING.format( - cls._determine_user_id(), - cls._determine_monetary_account_id(monetary_account_id), - schedule_id) - response_raw = api_client.get(endpoint_url, params, custom_headers) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + mastercard_action_id, + note_text_master_card_action_id) + response_raw = api_client.delete(endpoint_url, custom_headers) - return BunqResponseScheduleInstanceList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) ) - @property - def state(self): + @classmethod + def list(cls, mastercard_action_id, monetary_account_id=None, params=None, + custom_headers=None): """ - :rtype: str + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type mastercard_action_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextMasterCardActionList """ - return self._state + if params is None: + params = {} - @property - def time_start(self): + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + mastercard_action_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteTextMasterCardActionList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, mastercard_action_id, note_text_master_card_action_id, + monetary_account_id=None, custom_headers=None): """ - :rtype: str + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type mastercard_action_id: int + :type note_text_master_card_action_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextMasterCardAction """ - return self._time_start + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + mastercard_action_id, + note_text_master_card_action_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteTextMasterCardAction.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) @property - def time_end(self): + def id_(self): """ - :rtype: str + :rtype: int """ - return self._time_end + return self._id_ @property - def error_message(self): + def created(self): """ - :rtype: list[object_.Error] + :rtype: str """ - return self._error_message + return self._created @property - def scheduled_object(self): + def updated(self): """ - :rtype: object_.ScheduleAnchorObject + :rtype: str """ - return self._scheduled_object + return self._updated @property - def result_object(self): + def label_user_creator(self): """ - :rtype: object_.ScheduleInstanceAnchorObject + :rtype: object_.LabelUser """ - return self._result_object + return self._label_user_creator @property - def request_reference_split_the_bill(self): + def content(self): """ - :rtype: list[object_.RequestInquiryReference] + :rtype: str """ - return self._request_reference_split_the_bill + return self._content def is_all_field_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: + if self._id_ is not None: return False - if self._error_message is not None: + if self._created is not None: return False - if self._scheduled_object is not None: + if self._updated is not None: return False - if self._result_object is not None: + if self._label_user_creator is not None: return False - if self._request_reference_split_the_bill is not None: + if self._content is not None: return False return True @@ -14595,79 +14984,188 @@ def from_json(json_str): """ :type json_str: str - :rtype: ScheduleInstance + :rtype: NoteTextMasterCardAction """ - return converter.json_to_class(ScheduleInstance, json_str) + return converter.json_to_class(NoteTextMasterCardAction, json_str) -class TabResultResponse(core.BunqModel): +class NoteAttachmentPaymentBatch(core.BunqModel): """ - Used to view TabResultResponse objects belonging to a tab. A - TabResultResponse is an object that holds details on a tab which has been - paid from the provided monetary account. + Used to manage attachment notes. - :param _tab: The Tab details. - :type _tab: Tab - :param _payment: The payment made for the Tab. - :type _payment: Payment - :param _request_reference_split_the_bill: The reference to the object used - for split the bill. Can be RequestInquiry or RequestInquiryBatch - :type _request_reference_split_the_bill: - list[object_.RequestInquiryReference] + :param _description: Optional description of the attachment. + :type _description: str + :param _attachment_id: The reference to the uploaded file to attach to this + note. + :type _attachment_id: int + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + :param _attachment: The attachment attached to the note. + :type _attachment: list[object_.AttachmentMonetaryAccountPayment] """ # Endpoint constants. - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/tab-result-response/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/tab-result-response" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/payment-batch/{}/note-attachment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/payment-batch/{}/note-attachment/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/payment-batch/{}/note-attachment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/payment-batch/{}/note-attachment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/payment-batch/{}/note-attachment/{}" + + # Field constants. + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT_ID = "attachment_id" # Object type. - _OBJECT_TYPE_GET = "TabResultResponse" + _OBJECT_TYPE_GET = "NoteAttachment" - _tab = None - _payment = None - _request_reference_split_the_bill = None + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _description = None + _attachment = None + _description_field_for_request = None + _attachment_id_field_for_request = None + + def __init__(self, attachment_id, description=None): + """ + :param attachment_id: The reference to the uploaded file to attach to this + note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + """ + + self._attachment_id_field_for_request = attachment_id + self._description_field_for_request = description @classmethod - def get(cls, tab_result_response_id, monetary_account_id=None, - custom_headers=None): + def create(cls, payment_batch_id, attachment_id, monetary_account_id=None, + description=None, custom_headers=None): """ - Used to view a single TabResultResponse belonging to a tab. + :type user_id: int + :type monetary_account_id: int + :type payment_batch_id: int + :param attachment_id: The reference to the uploaded file to attach to + this note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None - :type api_context: context.ApiContext + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT_ID: attachment_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + payment_batch_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, payment_batch_id, note_attachment_payment_batch_id, + monetary_account_id=None, description=None, custom_headers=None): + """ :type user_id: int :type monetary_account_id: int - :type tab_result_response_id: int + :type payment_batch_id: int + :type note_attachment_payment_batch_id: int + :param description: Optional description of the attachment. + :type description: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseTabResultResponse + :rtype: BunqResponseInt """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - tab_result_response_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseTabResultResponse.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + request_map = { + cls.FIELD_DESCRIPTION: description + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + payment_batch_id, + note_attachment_payment_batch_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @classmethod - def list(cls, monetary_account_id=None, params=None, custom_headers=None): + def delete(cls, payment_batch_id, note_attachment_payment_batch_id, + monetary_account_id=None, custom_headers=None): """ - Used to view a list of TabResultResponse objects belonging to a tab. + :type user_id: int + :type monetary_account_id: int + :type payment_batch_id: int + :type note_attachment_payment_batch_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + payment_batch_id, + note_attachment_payment_batch_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, payment_batch_id, monetary_account_id=None, params=None, + custom_headers=None): + """ + Manage the notes for a given user. :type user_id: int :type monetary_account_id: int + :type payment_batch_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseTabResultResponseList + :rtype: BunqResponseNoteAttachmentPaymentBatchList """ if params is None: @@ -14679,152 +15177,90 @@ def list(cls, monetary_account_id=None, params=None, custom_headers=None): api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_LISTING.format( cls._determine_user_id(), - cls._determine_monetary_account_id(monetary_account_id)) + cls._determine_monetary_account_id(monetary_account_id), + payment_batch_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseTabResultResponseList.cast_from_bunq_response( + return BunqResponseNoteAttachmentPaymentBatchList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) ) - @property - def tab(self): + @classmethod + def get(cls, payment_batch_id, note_attachment_payment_batch_id, + monetary_account_id=None, custom_headers=None): """ - :rtype: Tab + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type payment_batch_id: int + :type note_attachment_payment_batch_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentPaymentBatch """ - return self._tab + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + payment_batch_id, + note_attachment_payment_batch_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteAttachmentPaymentBatch.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) @property - def payment(self): + def id_(self): """ - :rtype: Payment - """ - - return self._payment - - @property - def request_reference_split_the_bill(self): - """ - :rtype: list[object_.RequestInquiryReference] - """ - - return self._request_reference_split_the_bill - - def is_all_field_none(self): - """ - :rtype: bool - """ - - if self._tab is not None: - return False - - if self._payment is not None: - return False - - if self._request_reference_split_the_bill is not None: - return False - - return True - - @staticmethod - def from_json(json_str): - """ - :type json_str: str - - :rtype: TabResultResponse - """ - - return converter.json_to_class(TabResultResponse, json_str) - - -class WhitelistResult(core.BunqModel): - """ - Whitelist an SDD so that when one comes in, it is automatically accepted. - - :param _id_: The ID of the whitelist entry. - :type _id_: int - :param _monetary_account_paying_id: The account from which payments will be - deducted when a transaction is matched with this whitelist. - :type _monetary_account_paying_id: int - :param _status: The status of the WhitelistResult. - :type _status: str - :param _error_message: The message when the whitelist result has failed due - to user error. - :type _error_message: list[object_.Error] - :param _whitelist: The corresponding whitelist. - :type _whitelist: Whitelist - :param _object_: The details of the external object the event was created - for. - :type _object_: object_.WhitelistResultViewAnchoredObject - :param _request_reference_split_the_bill: The reference to the object used - for split the bill. Can be RequestInquiry or RequestInquiryBatch - :type _request_reference_split_the_bill: - list[object_.RequestInquiryReference] - """ - - _id_ = None - _monetary_account_paying_id = None - _status = None - _error_message = None - _whitelist = None - _object_ = None - _request_reference_split_the_bill = None - - @property - def id_(self): - """ - :rtype: int + :rtype: int """ return self._id_ @property - def monetary_account_paying_id(self): - """ - :rtype: int - """ - - return self._monetary_account_paying_id - - @property - def status(self): + def created(self): """ :rtype: str """ - return self._status + return self._created @property - def error_message(self): + def updated(self): """ - :rtype: list[object_.Error] + :rtype: str """ - return self._error_message + return self._updated @property - def whitelist(self): + def label_user_creator(self): """ - :rtype: Whitelist + :rtype: object_.LabelUser """ - return self._whitelist + return self._label_user_creator @property - def object_(self): + def description(self): """ - :rtype: object_.WhitelistResultViewAnchoredObject + :rtype: str """ - return self._object_ + return self._description @property - def request_reference_split_the_bill(self): + def attachment(self): """ - :rtype: list[object_.RequestInquiryReference] + :rtype: list[object_.AttachmentMonetaryAccountPayment] """ - return self._request_reference_split_the_bill + return self._attachment def is_all_field_none(self): """ @@ -14834,22 +15270,19 @@ def is_all_field_none(self): if self._id_ is not None: return False - if self._monetary_account_paying_id is not None: - return False - - if self._status is not None: + if self._created is not None: return False - if self._error_message is not None: + if self._updated is not None: return False - if self._whitelist is not None: + if self._label_user_creator is not None: return False - if self._object_ is not None: + if self._description is not None: return False - if self._request_reference_split_the_bill is not None: + if self._attachment is not None: return False return True @@ -14859,122 +15292,65 @@ def from_json(json_str): """ :type json_str: str - :rtype: WhitelistResult - """ - - return converter.json_to_class(WhitelistResult, json_str) - - -class Whitelist(core.BunqModel): - """ - Whitelist a Request so that when one comes in, it is automatically accepted. - """ - - def is_all_field_none(self): - """ - :rtype: bool - """ - - return True - - @staticmethod - def from_json(json_str): - """ - :type json_str: str - - :rtype: Whitelist + :rtype: NoteAttachmentPaymentBatch """ - return converter.json_to_class(Whitelist, json_str) + return converter.json_to_class(NoteAttachmentPaymentBatch, json_str) -class RequestInquiryBatch(core.BunqModel): +class NoteTextPaymentBatch(core.BunqModel): """ - Create a batch of requests for payment, or show the request batches of a - monetary account. + Used to manage text notes. - :param _request_inquiries: The list of requests that were made. - :type _request_inquiries: list[RequestInquiry] - :param _status: The status of the request. - :type _status: str - :param _total_amount_inquired: The total amount originally inquired for this - batch. - :type _total_amount_inquired: object_.Amount - :param _event_id: The ID of the associated event if the request batch was - made using 'split the bill'. - :type _event_id: int - :param _reference_split_the_bill: The reference to the object used for split - the bill. Can be Payment, PaymentBatch, ScheduleInstance, RequestResponse - and MasterCardAction - :type _reference_split_the_bill: - object_.RequestReferenceSplitTheBillAnchorObject + :param _content: The content of the note. + :type _content: str + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser """ # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-inquiry-batch" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-inquiry-batch/{}" - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/request-inquiry-batch/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-inquiry-batch" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/payment-batch/{}/note-text" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/payment-batch/{}/note-text/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/payment-batch/{}/note-text/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/payment-batch/{}/note-text" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/payment-batch/{}/note-text/{}" # Field constants. - FIELD_REQUEST_INQUIRIES = "request_inquiries" - FIELD_STATUS = "status" - FIELD_TOTAL_AMOUNT_INQUIRED = "total_amount_inquired" - FIELD_EVENT_ID = "event_id" + FIELD_CONTENT = "content" # Object type. - _OBJECT_TYPE_GET = "RequestInquiryBatch" + _OBJECT_TYPE_GET = "NoteText" - _request_inquiries = None - _total_amount_inquired = None - _reference_split_the_bill = None - _request_inquiries_field_for_request = None - _status_field_for_request = None - _total_amount_inquired_field_for_request = None - _event_id_field_for_request = None + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _content = None + _content_field_for_request = None - def __init__(self, request_inquiries, total_amount_inquired, status=None, - event_id=None): + def __init__(self, content=None): """ - :param request_inquiries: The list of request inquiries we want to send in 1 - batch. - :type request_inquiries: list[RequestInquiry] - :param total_amount_inquired: The total amount originally inquired for this - batch. - :type total_amount_inquired: object_.Amount - :param status: The status of the request. - :type status: str - :param event_id: The ID of the associated event if the request batch was - made using 'split the bill'. - :type event_id: int + :param content: The content of the note. + :type content: str """ - self._request_inquiries_field_for_request = request_inquiries - self._total_amount_inquired_field_for_request = total_amount_inquired - self._status_field_for_request = status - self._event_id_field_for_request = event_id + self._content_field_for_request = content @classmethod - def create(cls, request_inquiries, total_amount_inquired, - monetary_account_id=None, status=None, event_id=None, + def create(cls, payment_batch_id, monetary_account_id=None, content=None, custom_headers=None): """ - Create a request batch by sending an array of single request objects, - that will become part of the batch. - :type user_id: int :type monetary_account_id: int - :param request_inquiries: The list of request inquiries we want to send - in 1 batch. - :type request_inquiries: list[RequestInquiry] - :param total_amount_inquired: The total amount originally inquired for - this batch. - :type total_amount_inquired: object_.Amount - :param status: The status of the request. - :type status: str - :param event_id: The ID of the associated event if the request batch was - made using 'split the bill'. - :type event_id: int + :type payment_batch_id: int + :param content: The content of the note. + :type content: str :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -14984,10 +15360,7 @@ def create(cls, request_inquiries, total_amount_inquired, custom_headers = {} request_map = { - cls.FIELD_REQUEST_INQUIRIES: request_inquiries, - cls.FIELD_STATUS: status, - cls.FIELD_TOTAL_AMOUNT_INQUIRED: total_amount_inquired, - cls.FIELD_EVENT_ID: event_id + cls.FIELD_CONTENT: content } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) @@ -14996,7 +15369,8 @@ def create(cls, request_inquiries, total_amount_inquired, request_bytes = request_map_string.encode() endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), cls._determine_monetary_account_id( - monetary_account_id)) + monetary_account_id), + payment_batch_id) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) @@ -15005,17 +15379,15 @@ def create(cls, request_inquiries, total_amount_inquired, ) @classmethod - def update(cls, request_inquiry_batch_id, monetary_account_id=None, - status=None, custom_headers=None): + def update(cls, payment_batch_id, note_text_payment_batch_id, + monetary_account_id=None, content=None, custom_headers=None): """ - Revoke a request batch. The status of all the requests will be set to - REVOKED. - :type user_id: int :type monetary_account_id: int - :type request_inquiry_batch_id: int - :param status: The status of the request. - :type status: str + :type payment_batch_id: int + :type note_text_payment_batch_id: int + :param content: The content of the note. + :type content: str :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -15027,7 +15399,7 @@ def update(cls, request_inquiry_batch_id, monetary_account_id=None, api_client = client.ApiClient(cls._get_api_context()) request_map = { - cls.FIELD_STATUS: status + cls.FIELD_CONTENT: content } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) @@ -15036,7 +15408,8 @@ def update(cls, request_inquiry_batch_id, monetary_account_id=None, endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), - request_inquiry_batch_id) + payment_batch_id, + note_text_payment_batch_id) response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) @@ -15045,45 +15418,46 @@ def update(cls, request_inquiry_batch_id, monetary_account_id=None, ) @classmethod - def get(cls, request_inquiry_batch_id, monetary_account_id=None, - custom_headers=None): + def delete(cls, payment_batch_id, note_text_payment_batch_id, + monetary_account_id=None, custom_headers=None): """ - Return the details of a specific request batch. - - :type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int - :type request_inquiry_batch_id: int + :type payment_batch_id: int + :type note_text_payment_batch_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestInquiryBatch + :rtype: BunqResponseNone """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - request_inquiry_batch_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) - - return BunqResponseRequestInquiryBatch.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + payment_batch_id, + note_text_payment_batch_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) ) @classmethod - def list(cls, monetary_account_id=None, params=None, custom_headers=None): + def list(cls, payment_batch_id, monetary_account_id=None, params=None, + custom_headers=None): """ - Return all the request batches for a monetary account. + Manage the notes for a given user. :type user_id: int :type monetary_account_id: int + :type payment_batch_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestInquiryBatchList + :rtype: BunqResponseNoteTextPaymentBatchList """ if params is None: @@ -15095,49 +15469,101 @@ def list(cls, monetary_account_id=None, params=None, custom_headers=None): api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_LISTING.format( cls._determine_user_id(), - cls._determine_monetary_account_id(monetary_account_id)) + cls._determine_monetary_account_id(monetary_account_id), + payment_batch_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseRequestInquiryBatchList.cast_from_bunq_response( + return BunqResponseNoteTextPaymentBatchList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) ) + @classmethod + def get(cls, payment_batch_id, note_text_payment_batch_id, + monetary_account_id=None, custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type payment_batch_id: int + :type note_text_payment_batch_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextPaymentBatch + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + payment_batch_id, + note_text_payment_batch_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteTextPaymentBatch.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + @property - def request_inquiries(self): + def id_(self): """ - :rtype: list[RequestInquiry] + :rtype: int """ - return self._request_inquiries + return self._id_ @property - def total_amount_inquired(self): + def created(self): """ - :rtype: object_.Amount + :rtype: str """ - return self._total_amount_inquired + return self._created @property - def reference_split_the_bill(self): + def updated(self): """ - :rtype: object_.RequestReferenceSplitTheBillAnchorObject + :rtype: str """ - return self._reference_split_the_bill + return self._updated + + @property + def label_user_creator(self): + """ + :rtype: object_.LabelUser + """ + + return self._label_user_creator + + @property + def content(self): + """ + :rtype: str + """ + + return self._content def is_all_field_none(self): """ :rtype: bool """ - if self._request_inquiries is not None: + if self._id_ is not None: return False - if self._total_amount_inquired is not None: + if self._created is not None: return False - if self._reference_split_the_bill is not None: + if self._updated is not None: + return False + + if self._label_user_creator is not None: + return False + + if self._content is not None: return False return True @@ -15147,64 +15573,80 @@ def from_json(json_str): """ :type json_str: str - :rtype: RequestInquiryBatch + :rtype: NoteTextPaymentBatch """ - return converter.json_to_class(RequestInquiryBatch, json_str) + return converter.json_to_class(NoteTextPaymentBatch, json_str) -class SchedulePayment(core.BunqModel): +class NoteAttachmentPayment(core.BunqModel): """ - Endpoint for schedule payments. + Used to manage attachment notes. - :param _payment: The payment details. - :type _payment: object_.SchedulePaymentEntry - :param _schedule: The schedule details. - :type _schedule: Schedule + :param _description: Optional description of the attachment. + :type _description: str + :param _attachment_id: The reference to the uploaded file to attach to this + note. + :type _attachment_id: int + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + :param _attachment: The attachment attached to the note. + :type _attachment: list[object_.AttachmentMonetaryAccountPayment] """ # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/schedule-payment" - _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/schedule-payment/{}" - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/schedule-payment/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/schedule-payment" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/schedule-payment/{}" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/payment/{}/note-attachment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/payment/{}/note-attachment/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/payment/{}/note-attachment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/payment/{}/note-attachment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/payment/{}/note-attachment/{}" # Field constants. - FIELD_PAYMENT = "payment" - FIELD_SCHEDULE = "schedule" + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT_ID = "attachment_id" # Object type. - _OBJECT_TYPE_GET = "ScheduledPayment" + _OBJECT_TYPE_GET = "NoteAttachment" - _payment = None - _schedule = None - _payment_field_for_request = None - _schedule_field_for_request = None + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _description = None + _attachment = None + _description_field_for_request = None + _attachment_id_field_for_request = None - def __init__(self, payment=None, schedule=None): + def __init__(self, attachment_id, description=None): """ - :param payment: The payment details. - :type payment: object_.SchedulePaymentEntry - :param schedule: The schedule details when creating or updating a scheduled - payment. - :type schedule: Schedule + :param attachment_id: The reference to the uploaded file to attach to this + note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str """ - self._payment_field_for_request = payment - self._schedule_field_for_request = schedule + self._attachment_id_field_for_request = attachment_id + self._description_field_for_request = description @classmethod - def create(cls, payment, schedule, monetary_account_id=None, - custom_headers=None): + def create(cls, payment_id, attachment_id, monetary_account_id=None, + description=None, custom_headers=None): """ :type user_id: int :type monetary_account_id: int - :param payment: The payment details. - :type payment: object_.SchedulePaymentEntry - :param schedule: The schedule details when creating or updating a - scheduled payment. - :type schedule: Schedule + :type payment_id: int + :param attachment_id: The reference to the uploaded file to attach to + this note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -15214,8 +15656,8 @@ def create(cls, payment, schedule, monetary_account_id=None, custom_headers = {} request_map = { - cls.FIELD_PAYMENT: payment, - cls.FIELD_SCHEDULE: schedule + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT_ID: attachment_id } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) @@ -15224,7 +15666,8 @@ def create(cls, payment, schedule, monetary_account_id=None, request_bytes = request_map_string.encode() endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), cls._determine_monetary_account_id( - monetary_account_id)) + monetary_account_id), + payment_id) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) @@ -15233,67 +15676,85 @@ def create(cls, payment, schedule, monetary_account_id=None, ) @classmethod - def delete(cls, schedule_payment_id, monetary_account_id=None, - custom_headers=None): + def update(cls, payment_id, note_attachment_payment_id, + monetary_account_id=None, description=None, custom_headers=None): """ :type user_id: int :type monetary_account_id: int - :type schedule_payment_id: int + :type payment_id: int + :type note_attachment_payment_id: int + :param description: Optional description of the attachment. + :type description: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseNone + :rtype: BunqResponseInt """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + + request_map = { + cls.FIELD_DESCRIPTION: description + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), cls._determine_monetary_account_id( monetary_account_id), - schedule_payment_id) - response_raw = api_client.delete(endpoint_url, custom_headers) + payment_id, + note_attachment_payment_id) + response_raw = api_client.put(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 get(cls, schedule_payment_id, monetary_account_id=None, - custom_headers=None): + def delete(cls, payment_id, note_attachment_payment_id, + monetary_account_id=None, custom_headers=None): """ - :type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int - :type schedule_payment_id: int + :type payment_id: int + :type note_attachment_payment_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseSchedulePayment + :rtype: BunqResponseNone """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - schedule_payment_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + payment_id, + note_attachment_payment_id) + response_raw = api_client.delete(endpoint_url, custom_headers) - return BunqResponseSchedulePayment.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) ) @classmethod - def list(cls, monetary_account_id=None, params=None, custom_headers=None): + def list(cls, payment_id, monetary_account_id=None, params=None, + custom_headers=None): """ + Manage the notes for a given user. + :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: BunqResponseSchedulePaymentList + :rtype: BunqResponseNoteAttachmentPaymentList """ if params is None: @@ -15305,201 +15766,286 @@ def list(cls, monetary_account_id=None, params=None, custom_headers=None): api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_LISTING.format( cls._determine_user_id(), - cls._determine_monetary_account_id(monetary_account_id)) + cls._determine_monetary_account_id(monetary_account_id), payment_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseSchedulePaymentList.cast_from_bunq_response( + return BunqResponseNoteAttachmentPaymentList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) ) @classmethod - def update(cls, schedule_payment_id, monetary_account_id=None, payment=None, - schedule=None, custom_headers=None): + def get(cls, payment_id, note_attachment_payment_id, + monetary_account_id=None, custom_headers=None): """ + :type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int - :type schedule_payment_id: int - :param payment: The payment details. - :type payment: object_.SchedulePaymentEntry - :param schedule: The schedule details when creating or updating a - scheduled payment. - :type schedule: Schedule + :type payment_id: int + :type note_attachment_payment_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseInt + :rtype: BunqResponseNoteAttachmentPayment """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + payment_id, + note_attachment_payment_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - request_map = { - cls.FIELD_PAYMENT: payment, - cls.FIELD_SCHEDULE: schedule - } - request_map_string = converter.class_to_json(request_map) - request_map_string = cls._remove_field_for_request(request_map_string) - - request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - schedule_payment_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 BunqResponseNoteAttachmentPayment.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) ) @property - def payment(self): + def id_(self): """ - :rtype: object_.SchedulePaymentEntry + :rtype: int """ - return self._payment + return self._id_ @property - def schedule(self): + def created(self): """ - :rtype: Schedule + :rtype: str """ - return self._schedule + return self._created - def is_all_field_none(self): + @property + def updated(self): """ - :rtype: bool + :rtype: str """ - if self._payment is not None: - return False - - if self._schedule is not None: - return False - - return True + return self._updated - @staticmethod - def from_json(json_str): + @property + def label_user_creator(self): """ - :type json_str: str - - :rtype: SchedulePayment + :rtype: object_.LabelUser """ - return converter.json_to_class(SchedulePayment, json_str) - + return self._label_user_creator -class Schedule(core.BunqModel): + @property + def description(self): + """ + :rtype: str + """ + + return self._description + + @property + def attachment(self): + """ + :rtype: list[object_.AttachmentMonetaryAccountPayment] + """ + + return self._attachment + + def is_all_field_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._label_user_creator is not None: + return False + + if self._description is not None: + return False + + if self._attachment is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: NoteAttachmentPayment + """ + + return converter.json_to_class(NoteAttachmentPayment, json_str) + + +class NoteTextPayment(core.BunqModel): """ - view for reading the scheduled definitions. + Used to manage text notes. - :param _time_start: The schedule start time (UTC). - :type _time_start: str - :param _time_end: The schedule end time (UTC). - :type _time_end: str - :param _recurrence_unit: The schedule recurrence unit, options: ONCE, - HOURLY, DAILY, WEEKLY, MONTHLY, YEARLY - :type _recurrence_unit: str - :param _recurrence_size: The schedule recurrence size. For example size 4 - and unit WEEKLY means the recurrence is every 4 weeks. - :type _recurrence_size: int - :param _status: The schedule status, options: ACTIVE, FINISHED, CANCELLED. - :type _status: str - :param _object_: The scheduled object. (Payment, PaymentBatch) - :type _object_: object_.ScheduleAnchorObject + :param _content: The content of the note. + :type _content: str + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser """ # Endpoint constants. - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/schedule/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/schedule" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/payment/{}/note-text" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/payment/{}/note-text/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/payment/{}/note-text/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/payment/{}/note-text" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/payment/{}/note-text/{}" # Field constants. - FIELD_TIME_START = "time_start" - FIELD_TIME_END = "time_end" - FIELD_RECURRENCE_UNIT = "recurrence_unit" - FIELD_RECURRENCE_SIZE = "recurrence_size" + FIELD_CONTENT = "content" # Object type. - _OBJECT_TYPE_GET = "Schedule" + _OBJECT_TYPE_GET = "NoteText" - _time_start = None - _time_end = None - _recurrence_unit = None - _recurrence_size = None - _status = None - _object_ = None - _time_start_field_for_request = None - _time_end_field_for_request = None - _recurrence_unit_field_for_request = None - _recurrence_size_field_for_request = None + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _content = None + _content_field_for_request = None - def __init__(self, time_start=None, recurrence_unit=None, - recurrence_size=None, time_end=None): + def __init__(self, content=None): """ - :param time_start: The schedule start time (UTC). - :type time_start: str - :param recurrence_unit: The schedule recurrence unit, options: ONCE, HOURLY, - DAILY, WEEKLY, MONTHLY, YEARLY - :type recurrence_unit: str - :param recurrence_size: The schedule recurrence size. For example size 4 and - unit WEEKLY means the recurrence is every 4 weeks. - :type recurrence_size: int - :param time_end: The schedule end time (UTC). - :type time_end: str + :param content: The content of the note. + :type content: str """ - self._time_start_field_for_request = time_start - self._recurrence_unit_field_for_request = recurrence_unit - self._recurrence_size_field_for_request = recurrence_size - self._time_end_field_for_request = time_end + self._content_field_for_request = content @classmethod - def get(cls, schedule_id, monetary_account_id=None, custom_headers=None): + def create(cls, payment_id, monetary_account_id=None, content=None, + custom_headers=None): """ - Get a specific schedule definition for a given monetary account. + :type user_id: int + :type monetary_account_id: int + :type payment_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None - :type api_context: context.ApiContext + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + payment_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, payment_id, note_text_payment_id, monetary_account_id=None, + content=None, custom_headers=None): + """ :type user_id: int :type monetary_account_id: int - :type schedule_id: int + :type payment_id: int + :type note_text_payment_id: int + :param content: The content of the note. + :type content: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseSchedule + :rtype: BunqResponseInt """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - schedule_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseSchedule.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + payment_id, + note_text_payment_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @classmethod - def list(cls, monetary_account_id=None, params=None, custom_headers=None): + def delete(cls, payment_id, note_text_payment_id, monetary_account_id=None, + custom_headers=None): """ - Get a collection of scheduled definition for a given monetary account. - 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 user_id: int + :type monetary_account_id: int + :type payment_id: int + :type note_text_payment_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + payment_id, + note_text_payment_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, payment_id, monetary_account_id=None, params=None, + custom_headers=None): + """ + Manage the notes for a given user. :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: BunqResponseScheduleList + :rtype: BunqResponseNoteTextPaymentList """ if params is None: @@ -15511,82 +16057,100 @@ def list(cls, monetary_account_id=None, params=None, custom_headers=None): api_client = client.ApiClient(cls._get_api_context()) endpoint_url = cls._ENDPOINT_URL_LISTING.format( cls._determine_user_id(), - cls._determine_monetary_account_id(monetary_account_id)) + cls._determine_monetary_account_id(monetary_account_id), payment_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseScheduleList.cast_from_bunq_response( + return BunqResponseNoteTextPaymentList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) ) - @property - def time_start(self): + @classmethod + def get(cls, payment_id, note_text_payment_id, monetary_account_id=None, + custom_headers=None): """ - :rtype: str + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type payment_id: int + :type note_text_payment_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextPayment """ - return self._time_start + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + payment_id, + note_text_payment_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteTextPayment.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) @property - def time_end(self): + def id_(self): """ - :rtype: str + :rtype: int """ - return self._time_end + return self._id_ @property - def recurrence_unit(self): + def created(self): """ :rtype: str """ - return self._recurrence_unit + return self._created @property - def recurrence_size(self): + def updated(self): """ - :rtype: int + :rtype: str """ - return self._recurrence_size + return self._updated @property - def status(self): + def label_user_creator(self): """ - :rtype: str + :rtype: object_.LabelUser """ - return self._status + return self._label_user_creator @property - def object_(self): + def content(self): """ - :rtype: object_.ScheduleAnchorObject + :rtype: str """ - return self._object_ + return self._content def is_all_field_none(self): """ :rtype: bool """ - if self._time_start is not None: - return False - - if self._time_end is not None: + if self._id_ is not None: return False - if self._recurrence_unit is not None: + if self._created is not None: return False - if self._recurrence_size is not None: + if self._updated is not None: return False - if self._status is not None: + if self._label_user_creator is not None: return False - if self._object_ is not None: + if self._content is not None: return False return True @@ -15596,80 +16160,190 @@ def from_json(json_str): """ :type json_str: str - :rtype: Schedule + :rtype: NoteTextPayment """ - return converter.json_to_class(Schedule, json_str) + return converter.json_to_class(NoteTextPayment, json_str) -class TabResultInquiry(core.BunqModel): +class NoteAttachmentRequestInquiryBatch(core.BunqModel): """ - Used to view TabResultInquiry objects belonging to a tab. A TabResultInquiry - is an object that holds details on both the tab and a single payment made - for that tab. + Used to manage attachment notes. - :param _tab: The Tab details. - :type _tab: Tab - :param _payment: The payment made for the Tab. - :type _payment: Payment + :param _description: Optional description of the attachment. + :type _description: str + :param _attachment_id: The reference to the uploaded file to attach to this + note. + :type _attachment_id: int + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + :param _attachment: The attachment attached to the note. + :type _attachment: list[object_.AttachmentMonetaryAccountPayment] """ # Endpoint constants. - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-result-inquiry/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-result-inquiry" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-inquiry-batch/{}/note-attachment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-inquiry-batch/{}/note-attachment/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/request-inquiry-batch/{}/note-attachment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-inquiry-batch/{}/note-attachment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/request-inquiry-batch/{}/note-attachment/{}" + + # Field constants. + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT_ID = "attachment_id" # Object type. - _OBJECT_TYPE_GET = "TabResultInquiry" + _OBJECT_TYPE_GET = "NoteAttachment" - _tab = None - _payment = None + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _description = None + _attachment = None + _description_field_for_request = None + _attachment_id_field_for_request = None + + def __init__(self, attachment_id, description=None): + """ + :param attachment_id: The reference to the uploaded file to attach to this + note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + """ + + self._attachment_id_field_for_request = attachment_id + self._description_field_for_request = description @classmethod - def get(cls, cash_register_id, tab_uuid, tab_result_inquiry_id, - monetary_account_id=None, custom_headers=None): + def create(cls, request_inquiry_batch_id, attachment_id, + monetary_account_id=None, description=None, custom_headers=None): """ - Used to view a single TabResultInquiry belonging to a tab. + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_batch_id: int + :param attachment_id: The reference to the uploaded file to attach to + this note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None - :type api_context: context.ApiContext + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT_ID: attachment_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_batch_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, request_inquiry_batch_id, + note_attachment_request_inquiry_batch_id, + monetary_account_id=None, description=None, custom_headers=None): + """ :type user_id: int :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :type tab_result_inquiry_id: int + :type request_inquiry_batch_id: int + :type note_attachment_request_inquiry_batch_id: int + :param description: Optional description of the attachment. + :type description: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseTabResultInquiry + :rtype: BunqResponseInt """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - cash_register_id, tab_uuid, - tab_result_inquiry_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseTabResultInquiry.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + request_map = { + cls.FIELD_DESCRIPTION: description + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_batch_id, + note_attachment_request_inquiry_batch_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @classmethod - def list(cls, cash_register_id, tab_uuid, monetary_account_id=None, + def delete(cls, request_inquiry_batch_id, + note_attachment_request_inquiry_batch_id, + monetary_account_id=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_batch_id: int + :type note_attachment_request_inquiry_batch_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_batch_id, + note_attachment_request_inquiry_batch_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, request_inquiry_batch_id, monetary_account_id=None, params=None, custom_headers=None): """ - Used to view a list of TabResultInquiry objects belonging to a tab. + Manage the notes for a given user. :type user_id: int :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str + :type request_inquiry_batch_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseTabResultInquiryList + :rtype: BunqResponseNoteAttachmentRequestInquiryBatchList """ if params is None: @@ -15682,38 +16356,112 @@ def list(cls, cash_register_id, tab_uuid, monetary_account_id=None, endpoint_url = cls._ENDPOINT_URL_LISTING.format( cls._determine_user_id(), cls._determine_monetary_account_id(monetary_account_id), - cash_register_id, tab_uuid) + request_inquiry_batch_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseTabResultInquiryList.cast_from_bunq_response( + return BunqResponseNoteAttachmentRequestInquiryBatchList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) ) + @classmethod + def get(cls, request_inquiry_batch_id, + note_attachment_request_inquiry_batch_id, monetary_account_id=None, + custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_batch_id: int + :type note_attachment_request_inquiry_batch_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentRequestInquiryBatch + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_batch_id, + note_attachment_request_inquiry_batch_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteAttachmentRequestInquiryBatch.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + @property - def tab(self): + def id_(self): """ - :rtype: Tab + :rtype: int """ - return self._tab + return self._id_ @property - def payment(self): + def created(self): """ - :rtype: Payment + :rtype: str """ - return self._payment + return self._created + + @property + def updated(self): + """ + :rtype: str + """ + + return self._updated + + @property + def label_user_creator(self): + """ + :rtype: object_.LabelUser + """ + + return self._label_user_creator + + @property + def description(self): + """ + :rtype: str + """ + + return self._description + + @property + def attachment(self): + """ + :rtype: list[object_.AttachmentMonetaryAccountPayment] + """ + + return self._attachment def is_all_field_none(self): """ :rtype: bool """ - if self._tab is not None: + if self._id_ is not None: return False - if self._payment is not None: + if self._created is not None: + return False + + if self._updated is not None: + return False + + if self._label_user_creator is not None: + return False + + if self._description is not None: + return False + + if self._attachment is not None: return False return True @@ -15723,74 +16471,175 @@ def from_json(json_str): """ :type json_str: str - :rtype: TabResultInquiry + :rtype: NoteAttachmentRequestInquiryBatch """ - return converter.json_to_class(TabResultInquiry, json_str) + return converter.json_to_class(NoteAttachmentRequestInquiryBatch, + json_str) -class User(core.BunqModel, core.AnchoredObjectInterface): +class NoteTextRequestInquiryBatch(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. + Used to manage text notes. - :param _UserLight: - :type _UserLight: UserLight - :param _UserPerson: - :type _UserPerson: UserPerson - :param _UserCompany: - :type _UserCompany: UserCompany - :param _UserApiKey: - :type _UserApiKey: UserApiKey + :param _content: The content of the note. + :type _content: str + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser """ - # 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" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-inquiry-batch/{}/note-text" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-inquiry-batch/{}/note-text/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/request-inquiry-batch/{}/note-text/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-inquiry-batch/{}/note-text" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/request-inquiry-batch/{}/note-text/{}" + + # Field constants. + FIELD_CONTENT = "content" # Object type. - _OBJECT_TYPE_GET = "User" + _OBJECT_TYPE_GET = "NoteText" - _UserLight = None - _UserPerson = None - _UserCompany = None - _UserApiKey = None + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _content = None + _content_field_for_request = None + + def __init__(self, content=None): + """ + :param content: The content of the note. + :type content: str + """ + + self._content_field_for_request = content @classmethod - def get(cls, user_id, custom_headers=None): + def create(cls, request_inquiry_batch_id, monetary_account_id=None, + content=None, custom_headers=None): """ - Get a specific user. - - :type api_context: context.ApiContext :type user_id: int + :type monetary_account_id: int + :type request_inquiry_batch_id: int + :param content: The content of the note. + :type content: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseUser + :rtype: BunqResponseInt """ if custom_headers is None: custom_headers = {} + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id()) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_batch_id) + response_raw = api_client.post(endpoint_url, request_bytes, + custom_headers) - return BunqResponseUser.cast_from_bunq_response( - cls._from_json(response_raw) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @classmethod - def list(cls, params=None, custom_headers=None): + def update(cls, request_inquiry_batch_id, + note_text_request_inquiry_batch_id, monetary_account_id=None, + content=None, custom_headers=None): """ - Get a collection of all available users. + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_batch_id: int + :type note_text_request_inquiry_batch_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_batch_id, + note_text_request_inquiry_batch_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, request_inquiry_batch_id, + note_text_request_inquiry_batch_id, monetary_account_id=None, + custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_batch_id: int + :type note_text_request_inquiry_batch_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_batch_id, + note_text_request_inquiry_batch_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, request_inquiry_batch_id, monetary_account_id=None, + params=None, custom_headers=None): + """ + Manage the notes for a given user. + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_batch_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseUserList + :rtype: BunqResponseNoteTextRequestInquiryBatchList """ if params is None: @@ -15800,80 +16649,103 @@ def list(cls, params=None, custom_headers=None): custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_LISTING + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + request_inquiry_batch_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseUserList.cast_from_bunq_response( - cls._from_json_list(response_raw) + return BunqResponseNoteTextRequestInquiryBatchList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) ) - @property - def UserLight(self): + @classmethod + def get(cls, request_inquiry_batch_id, note_text_request_inquiry_batch_id, + monetary_account_id=None, custom_headers=None): """ - :rtype: UserLight + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_batch_id: int + :type note_text_request_inquiry_batch_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextRequestInquiryBatch """ - return self._UserLight + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_batch_id, + note_text_request_inquiry_batch_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteTextRequestInquiryBatch.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) @property - def UserPerson(self): + def id_(self): """ - :rtype: UserPerson + :rtype: int """ - return self._UserPerson + return self._id_ @property - def UserCompany(self): + def created(self): """ - :rtype: UserCompany + :rtype: str """ - return self._UserCompany + return self._created @property - def UserApiKey(self): + def updated(self): """ - :rtype: UserApiKey + :rtype: str """ - return self._UserApiKey + return self._updated - def get_referenced_object(self): + @property + def label_user_creator(self): """ - :rtype: core.BunqModel - :raise: BunqException + :rtype: object_.LabelUser """ - 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 + return self._label_user_creator - if self._UserApiKey is not None: - return self._UserApiKey + @property + def content(self): + """ + :rtype: str + """ - raise exception.BunqException(self._ERROR_NULL_FIELDS) + return self._content def is_all_field_none(self): """ :rtype: bool """ - if self._UserLight is not None: + if self._id_ is not None: return False - if self._UserPerson is not None: + if self._created is not None: return False - if self._UserCompany is not None: + if self._updated is not None: return False - if self._UserApiKey is not None: + if self._label_user_creator is not None: + return False + + if self._content is not None: return False return True @@ -15883,123 +16755,7810 @@ def from_json(json_str): """ :type json_str: str - :rtype: User + :rtype: NoteTextRequestInquiryBatch """ - return converter.json_to_class(User, json_str) + return converter.json_to_class(NoteTextRequestInquiryBatch, json_str) -class UserLight(core.BunqModel): +class NoteAttachmentRequestInquiry(core.BunqModel): """ - Show the authenticated user, if it is a light user. + Used to manage attachment notes. - :param _first_name: The user's first name. - :type _first_name: str - :param _middle_name: The user's middle name. - :type _middle_name: str - :param _last_name: The user's last name. - :type _last_name: str - :param _public_nick_name: The public nick name for the user. - :type _public_nick_name: str - :param _address_main: The user's main address. - :type _address_main: object_.Address - :param _address_postal: The user's postal address. - :type _address_postal: object_.Address - :param _avatar_uuid: The public UUID of the user's avatar. - :type _avatar_uuid: str - :param _social_security_number: The user's social security number. - :type _social_security_number: str - :param _tax_resident: The user's tax residence numbers for different - countries. - :type _tax_resident: list[object_.TaxResident] - :param _document_type: The type of identification document the user - registered with. - :type _document_type: str - :param _document_number: The identification document number the user - registered with. - :type _document_number: str - :param _document_country_of_issuance: The country which issued the - identification document the user registered with. - :type _document_country_of_issuance: str - :param _document_front_attachment_id: The reference to the uploaded - picture/scan of the front side of the identification document. - :type _document_front_attachment_id: int - :param _document_back_attachment_id: The reference to the uploaded - picture/scan of the back side of the identification document. - :type _document_back_attachment_id: int - :param _date_of_birth: The user's date of birth. Accepts ISO8601 date - formats. - :type _date_of_birth: str - :param _place_of_birth: The user's place of birth. - :type _place_of_birth: str - :param _country_of_birth: The user's country of birth. Formatted as a SO - 3166-1 alpha-2 country code. - :type _country_of_birth: str - :param _nationality: The user's nationality. Formatted as a SO 3166-1 - alpha-2 country code. - :type _nationality: str - :param _language: The user's preferred language. Formatted as a ISO 639-1 - language code plus a ISO 3166-1 alpha-2 country code, seperated by an - underscore. - :type _language: str - :param _region: The user's preferred region. Formatted as a ISO 639-1 - language code plus a ISO 3166-1 alpha-2 country code, seperated by an - underscore. - :type _region: str - :param _gender: The user's gender. Can be MALE, FEMALE or UNKNOWN. - :type _gender: str - :param _status: The user status. The user status. Can be: ACTIVE, BLOCKED, - SIGNUP, DENIED or ABORTED. - :type _status: str - :param _sub_status: The user sub-status. Can be: NONE, FACE_RESET, APPROVAL, - APPROVAL_PARENT, AWAITING_PARENT, APPROVAL_SUPPORT, COUNTER_IBAN, IDEAL or - SUBMIT. - :type _sub_status: str - :param _legal_guardian_alias: The legal guardian of the user. Required for - minors. - :type _legal_guardian_alias: object_.Pointer - :param _session_timeout: The setting for the session timeout of the user in - seconds. - :type _session_timeout: int - :param _daily_limit_without_confirmation_login: The amount the user can pay - in the session without asking for credentials. - :type _daily_limit_without_confirmation_login: object_.Amount - :param _notification_filters: The types of notifications that will result in - a push notification or URL callback for this UserLight. - :type _notification_filters: list[object_.NotificationFilter] - :param _id_: The id of the user. + :param _description: Optional description of the attachment. + :type _description: str + :param _attachment_id: The reference to the uploaded file to attach to this + note. + :type _attachment_id: int + :param _id_: The id of the note. :type _id_: int - :param _created: The timestamp of the user object's creation. + :param _created: The timestamp of the note's creation. :type _created: str - :param _updated: The timestamp of the user object's last update. + :param _updated: The timestamp of the note's last update. :type _updated: str - :param _public_uuid: The user's public UUID. - :type _public_uuid: str - :param _legal_name: The user's legal name. - :type _legal_name: str - :param _display_name: The display name for the user. - :type _display_name: str - :param _alias: The aliases of the user. - :type _alias: list[object_.Pointer] - :param _avatar: The user's avatar. - :type _avatar: object_.Avatar - :param _version_terms_of_service: The version of the terms of service - accepted by the user. - :type _version_terms_of_service: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + :param _attachment: The attachment attached to the note. + :type _attachment: list[object_.AttachmentMonetaryAccountPayment] """ # Endpoint constants. - _ENDPOINT_URL_READ = "user-light/{}" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-inquiry/{}/note-attachment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-inquiry/{}/note-attachment/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/request-inquiry/{}/note-attachment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-inquiry/{}/note-attachment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/request-inquiry/{}/note-attachment/{}" # Field constants. - FIELD_FIRST_NAME = "first_name" - FIELD_MIDDLE_NAME = "middle_name" + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT_ID = "attachment_id" + + # Object type. + _OBJECT_TYPE_GET = "NoteAttachment" + + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _description = None + _attachment = None + _description_field_for_request = None + _attachment_id_field_for_request = None + + def __init__(self, attachment_id, description=None): + """ + :param attachment_id: The reference to the uploaded file to attach to this + note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + """ + + self._attachment_id_field_for_request = attachment_id + self._description_field_for_request = description + + @classmethod + def create(cls, request_inquiry_id, attachment_id, monetary_account_id=None, + description=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_id: int + :param attachment_id: The reference to the uploaded file to attach to + this note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT_ID: attachment_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_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, request_inquiry_id, note_attachment_request_inquiry_id, + monetary_account_id=None, description=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_id: int + :type note_attachment_request_inquiry_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_DESCRIPTION: description + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_id, + note_attachment_request_inquiry_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, request_inquiry_id, note_attachment_request_inquiry_id, + monetary_account_id=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_id: int + :type note_attachment_request_inquiry_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_id, + note_attachment_request_inquiry_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, request_inquiry_id, monetary_account_id=None, params=None, + custom_headers=None): + """ + Manage the notes for a given user. + + :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: BunqResponseNoteAttachmentRequestInquiryList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + request_inquiry_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteAttachmentRequestInquiryList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, request_inquiry_id, note_attachment_request_inquiry_id, + monetary_account_id=None, custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_id: int + :type note_attachment_request_inquiry_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentRequestInquiry + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_id, + note_attachment_request_inquiry_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteAttachmentRequestInquiry.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @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 label_user_creator(self): + """ + :rtype: object_.LabelUser + """ + + return self._label_user_creator + + @property + def description(self): + """ + :rtype: str + """ + + return self._description + + @property + def attachment(self): + """ + :rtype: list[object_.AttachmentMonetaryAccountPayment] + """ + + return self._attachment + + def is_all_field_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._label_user_creator is not None: + return False + + if self._description is not None: + return False + + if self._attachment is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: NoteAttachmentRequestInquiry + """ + + return converter.json_to_class(NoteAttachmentRequestInquiry, json_str) + + +class NoteTextRequestInquiry(core.BunqModel): + """ + Used to manage text notes. + + :param _content: The content of the note. + :type _content: str + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-inquiry/{}/note-text" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-inquiry/{}/note-text/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/request-inquiry/{}/note-text/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-inquiry/{}/note-text" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/request-inquiry/{}/note-text/{}" + + # Field constants. + FIELD_CONTENT = "content" + + # Object type. + _OBJECT_TYPE_GET = "NoteText" + + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _content = None + _content_field_for_request = None + + def __init__(self, content=None): + """ + :param content: The content of the note. + :type content: str + """ + + self._content_field_for_request = content + + @classmethod + def create(cls, request_inquiry_id, monetary_account_id=None, content=None, + custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_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, request_inquiry_id, note_text_request_inquiry_id, + monetary_account_id=None, content=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_id: int + :type note_text_request_inquiry_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_id, + note_text_request_inquiry_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, request_inquiry_id, note_text_request_inquiry_id, + monetary_account_id=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_id: int + :type note_text_request_inquiry_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_id, + note_text_request_inquiry_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, request_inquiry_id, monetary_account_id=None, params=None, + custom_headers=None): + """ + Manage the notes for a given user. + + :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: BunqResponseNoteTextRequestInquiryList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + request_inquiry_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteTextRequestInquiryList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, request_inquiry_id, note_text_request_inquiry_id, + monetary_account_id=None, custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_id: int + :type note_text_request_inquiry_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextRequestInquiry + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_id, + note_text_request_inquiry_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteTextRequestInquiry.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @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 label_user_creator(self): + """ + :rtype: object_.LabelUser + """ + + return self._label_user_creator + + @property + def content(self): + """ + :rtype: str + """ + + return self._content + + def is_all_field_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._label_user_creator is not None: + return False + + if self._content is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: NoteTextRequestInquiry + """ + + return converter.json_to_class(NoteTextRequestInquiry, json_str) + + +class NoteAttachmentRequestResponse(core.BunqModel): + """ + Used to manage attachment notes. + + :param _description: Optional description of the attachment. + :type _description: str + :param _attachment_id: The reference to the uploaded file to attach to this + note. + :type _attachment_id: int + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + :param _attachment: The attachment attached to the note. + :type _attachment: list[object_.AttachmentMonetaryAccountPayment] + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-response/{}/note-attachment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-response/{}/note-attachment/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/request-response/{}/note-attachment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-response/{}/note-attachment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/request-response/{}/note-attachment/{}" + + # Field constants. + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT_ID = "attachment_id" + + # Object type. + _OBJECT_TYPE_GET = "NoteAttachment" + + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _description = None + _attachment = None + _description_field_for_request = None + _attachment_id_field_for_request = None + + def __init__(self, attachment_id, description=None): + """ + :param attachment_id: The reference to the uploaded file to attach to this + note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + """ + + self._attachment_id_field_for_request = attachment_id + self._description_field_for_request = description + + @classmethod + def create(cls, request_response_id, attachment_id, + monetary_account_id=None, description=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_response_id: int + :param attachment_id: The reference to the uploaded file to attach to + this note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT_ID: attachment_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_response_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, request_response_id, note_attachment_request_response_id, + monetary_account_id=None, description=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_response_id: int + :type note_attachment_request_response_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_DESCRIPTION: description + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_response_id, + note_attachment_request_response_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, request_response_id, note_attachment_request_response_id, + monetary_account_id=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_response_id: int + :type note_attachment_request_response_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_response_id, + note_attachment_request_response_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, request_response_id, monetary_account_id=None, params=None, + custom_headers=None): + """ + Manage the notes for a given user. + + :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: BunqResponseNoteAttachmentRequestResponseList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + request_response_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteAttachmentRequestResponseList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, request_response_id, note_attachment_request_response_id, + monetary_account_id=None, custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type request_response_id: int + :type note_attachment_request_response_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentRequestResponse + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_response_id, + note_attachment_request_response_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteAttachmentRequestResponse.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @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 label_user_creator(self): + """ + :rtype: object_.LabelUser + """ + + return self._label_user_creator + + @property + def description(self): + """ + :rtype: str + """ + + return self._description + + @property + def attachment(self): + """ + :rtype: list[object_.AttachmentMonetaryAccountPayment] + """ + + return self._attachment + + def is_all_field_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._label_user_creator is not None: + return False + + if self._description is not None: + return False + + if self._attachment is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: NoteAttachmentRequestResponse + """ + + return converter.json_to_class(NoteAttachmentRequestResponse, json_str) + + +class NoteTextRequestResponse(core.BunqModel): + """ + Used to manage text notes. + + :param _content: The content of the note. + :type _content: str + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-response/{}/note-text" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-response/{}/note-text/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/request-response/{}/note-text/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-response/{}/note-text" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/request-response/{}/note-text/{}" + + # Field constants. + FIELD_CONTENT = "content" + + # Object type. + _OBJECT_TYPE_GET = "NoteText" + + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _content = None + _content_field_for_request = None + + def __init__(self, content=None): + """ + :param content: The content of the note. + :type content: str + """ + + self._content_field_for_request = content + + @classmethod + def create(cls, request_response_id, monetary_account_id=None, content=None, + custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_response_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_response_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, request_response_id, note_text_request_response_id, + monetary_account_id=None, content=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_response_id: int + :type note_text_request_response_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_response_id, + note_text_request_response_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, request_response_id, note_text_request_response_id, + monetary_account_id=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type request_response_id: int + :type note_text_request_response_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_response_id, + note_text_request_response_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, request_response_id, monetary_account_id=None, params=None, + custom_headers=None): + """ + Manage the notes for a given user. + + :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: BunqResponseNoteTextRequestResponseList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + request_response_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteTextRequestResponseList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, request_response_id, note_text_request_response_id, + monetary_account_id=None, custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type request_response_id: int + :type note_text_request_response_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextRequestResponse + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_response_id, + note_text_request_response_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteTextRequestResponse.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @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 label_user_creator(self): + """ + :rtype: object_.LabelUser + """ + + return self._label_user_creator + + @property + def content(self): + """ + :rtype: str + """ + + return self._content + + def is_all_field_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._label_user_creator is not None: + return False + + if self._content is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: NoteTextRequestResponse + """ + + return converter.json_to_class(NoteTextRequestResponse, json_str) + + +class NoteAttachmentScheduleInstance(core.BunqModel): + """ + Used to manage attachment notes. + + :param _description: Optional description of the attachment. + :type _description: str + :param _attachment_id: The reference to the uploaded file to attach to this + note. + :type _attachment_id: int + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + :param _attachment: The attachment attached to the note. + :type _attachment: list[object_.AttachmentMonetaryAccountPayment] + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}/note-attachment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}/note-attachment/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}/note-attachment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}/note-attachment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}/note-attachment/{}" + + # Field constants. + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT_ID = "attachment_id" + + # Object type. + _OBJECT_TYPE_GET = "NoteAttachment" + + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _description = None + _attachment = None + _description_field_for_request = None + _attachment_id_field_for_request = None + + def __init__(self, attachment_id, description=None): + """ + :param attachment_id: The reference to the uploaded file to attach to this + note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + """ + + self._attachment_id_field_for_request = attachment_id + self._description_field_for_request = description + + @classmethod + def create(cls, schedule_id, schedule_instance_id, attachment_id, + monetary_account_id=None, description=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type schedule_instance_id: int + :param attachment_id: The reference to the uploaded file to attach to + this note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT_ID: attachment_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_id, + schedule_instance_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, schedule_id, schedule_instance_id, + note_attachment_schedule_instance_id, monetary_account_id=None, + description=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type schedule_instance_id: int + :type note_attachment_schedule_instance_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_DESCRIPTION: description + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_id, + schedule_instance_id, + note_attachment_schedule_instance_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, schedule_id, schedule_instance_id, + note_attachment_schedule_instance_id, monetary_account_id=None, + custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type schedule_instance_id: int + :type note_attachment_schedule_instance_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_id, + schedule_instance_id, + note_attachment_schedule_instance_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, schedule_id, schedule_instance_id, monetary_account_id=None, + params=None, custom_headers=None): + """ + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type schedule_instance_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentScheduleInstanceList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + schedule_id, schedule_instance_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteAttachmentScheduleInstanceList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, schedule_id, schedule_instance_id, + note_attachment_schedule_instance_id, monetary_account_id=None, + custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type schedule_instance_id: int + :type note_attachment_schedule_instance_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentScheduleInstance + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_id, + schedule_instance_id, + note_attachment_schedule_instance_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteAttachmentScheduleInstance.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @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 label_user_creator(self): + """ + :rtype: object_.LabelUser + """ + + return self._label_user_creator + + @property + def description(self): + """ + :rtype: str + """ + + return self._description + + @property + def attachment(self): + """ + :rtype: list[object_.AttachmentMonetaryAccountPayment] + """ + + return self._attachment + + def is_all_field_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._label_user_creator is not None: + return False + + if self._description is not None: + return False + + if self._attachment is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: NoteAttachmentScheduleInstance + """ + + return converter.json_to_class(NoteAttachmentScheduleInstance, json_str) + + +class NoteTextScheduleInstance(core.BunqModel): + """ + Used to manage text notes. + + :param _content: The content of the note. + :type _content: str + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}/note-text" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}/note-text/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}/note-text/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}/note-text" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}/note-text/{}" + + # Field constants. + FIELD_CONTENT = "content" + + # Object type. + _OBJECT_TYPE_GET = "NoteText" + + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _content = None + _content_field_for_request = None + + def __init__(self, content=None): + """ + :param content: The content of the note. + :type content: str + """ + + self._content_field_for_request = content + + @classmethod + def create(cls, schedule_id, schedule_instance_id, monetary_account_id=None, + content=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type schedule_instance_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_id, + schedule_instance_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, schedule_id, schedule_instance_id, + note_text_schedule_instance_id, monetary_account_id=None, + content=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type schedule_instance_id: int + :type note_text_schedule_instance_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_id, + schedule_instance_id, + note_text_schedule_instance_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, schedule_id, schedule_instance_id, + note_text_schedule_instance_id, monetary_account_id=None, + custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type schedule_instance_id: int + :type note_text_schedule_instance_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_id, + schedule_instance_id, + note_text_schedule_instance_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, schedule_id, schedule_instance_id, monetary_account_id=None, + params=None, custom_headers=None): + """ + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type schedule_instance_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextScheduleInstanceList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + schedule_id, schedule_instance_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteTextScheduleInstanceList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, schedule_id, schedule_instance_id, + note_text_schedule_instance_id, monetary_account_id=None, + custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type schedule_instance_id: int + :type note_text_schedule_instance_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextScheduleInstance + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_id, + schedule_instance_id, + note_text_schedule_instance_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteTextScheduleInstance.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @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 label_user_creator(self): + """ + :rtype: object_.LabelUser + """ + + return self._label_user_creator + + @property + def content(self): + """ + :rtype: str + """ + + return self._content + + def is_all_field_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._label_user_creator is not None: + return False + + if self._content is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: NoteTextScheduleInstance + """ + + return converter.json_to_class(NoteTextScheduleInstance, json_str) + + +class NoteAttachmentSofortMerchantTransaction(core.BunqModel): + """ + Used to manage attachment notes. + + :param _description: Optional description of the attachment. + :type _description: str + :param _attachment_id: The reference to the uploaded file to attach to this + note. + :type _attachment_id: int + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + :param _attachment: The attachment attached to the note. + :type _attachment: list[object_.AttachmentMonetaryAccountPayment] + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/sofort-merchant-transaction/{}/note-attachment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/sofort-merchant-transaction/{}/note-attachment/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/sofort-merchant-transaction/{}/note-attachment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/sofort-merchant-transaction/{}/note-attachment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/sofort-merchant-transaction/{}/note-attachment/{}" + + # Field constants. + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT_ID = "attachment_id" + + # Object type. + _OBJECT_TYPE_GET = "NoteAttachment" + + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _description = None + _attachment = None + _description_field_for_request = None + _attachment_id_field_for_request = None + + def __init__(self, attachment_id, description=None): + """ + :param attachment_id: The reference to the uploaded file to attach to this + note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + """ + + self._attachment_id_field_for_request = attachment_id + self._description_field_for_request = description + + @classmethod + def create(cls, sofort_merchant_transaction_id, attachment_id, + monetary_account_id=None, description=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type sofort_merchant_transaction_id: int + :param attachment_id: The reference to the uploaded file to attach to + this note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT_ID: attachment_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + sofort_merchant_transaction_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, sofort_merchant_transaction_id, + note_attachment_sofort_merchant_transaction_id, + monetary_account_id=None, description=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type sofort_merchant_transaction_id: int + :type note_attachment_sofort_merchant_transaction_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_DESCRIPTION: description + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + sofort_merchant_transaction_id, + note_attachment_sofort_merchant_transaction_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, sofort_merchant_transaction_id, + note_attachment_sofort_merchant_transaction_id, + monetary_account_id=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type sofort_merchant_transaction_id: int + :type note_attachment_sofort_merchant_transaction_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + sofort_merchant_transaction_id, + note_attachment_sofort_merchant_transaction_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, sofort_merchant_transaction_id, monetary_account_id=None, + params=None, custom_headers=None): + """ + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type sofort_merchant_transaction_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentSofortMerchantTransactionList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + sofort_merchant_transaction_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteAttachmentSofortMerchantTransactionList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, sofort_merchant_transaction_id, + note_attachment_sofort_merchant_transaction_id, + monetary_account_id=None, custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type sofort_merchant_transaction_id: int + :type note_attachment_sofort_merchant_transaction_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentSofortMerchantTransaction + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + sofort_merchant_transaction_id, + note_attachment_sofort_merchant_transaction_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteAttachmentSofortMerchantTransaction.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @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 label_user_creator(self): + """ + :rtype: object_.LabelUser + """ + + return self._label_user_creator + + @property + def description(self): + """ + :rtype: str + """ + + return self._description + + @property + def attachment(self): + """ + :rtype: list[object_.AttachmentMonetaryAccountPayment] + """ + + return self._attachment + + def is_all_field_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._label_user_creator is not None: + return False + + if self._description is not None: + return False + + if self._attachment is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: NoteAttachmentSofortMerchantTransaction + """ + + return converter.json_to_class(NoteAttachmentSofortMerchantTransaction, + json_str) + + +class NoteTextSofortMerchantTransaction(core.BunqModel): + """ + Used to manage text notes. + + :param _content: The content of the note. + :type _content: str + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/sofort-merchant-transaction/{}/note-text" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/sofort-merchant-transaction/{}/note-text/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/sofort-merchant-transaction/{}/note-text/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/sofort-merchant-transaction/{}/note-text" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/sofort-merchant-transaction/{}/note-text/{}" + + # Field constants. + FIELD_CONTENT = "content" + + # Object type. + _OBJECT_TYPE_GET = "NoteText" + + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _content = None + _content_field_for_request = None + + def __init__(self, content=None): + """ + :param content: The content of the note. + :type content: str + """ + + self._content_field_for_request = content + + @classmethod + def create(cls, sofort_merchant_transaction_id, monetary_account_id=None, + content=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type sofort_merchant_transaction_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + sofort_merchant_transaction_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, sofort_merchant_transaction_id, + note_text_sofort_merchant_transaction_id, + monetary_account_id=None, content=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type sofort_merchant_transaction_id: int + :type note_text_sofort_merchant_transaction_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + sofort_merchant_transaction_id, + note_text_sofort_merchant_transaction_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, sofort_merchant_transaction_id, + note_text_sofort_merchant_transaction_id, + monetary_account_id=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type sofort_merchant_transaction_id: int + :type note_text_sofort_merchant_transaction_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + sofort_merchant_transaction_id, + note_text_sofort_merchant_transaction_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, sofort_merchant_transaction_id, monetary_account_id=None, + params=None, custom_headers=None): + """ + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type sofort_merchant_transaction_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextSofortMerchantTransactionList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + sofort_merchant_transaction_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteTextSofortMerchantTransactionList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, sofort_merchant_transaction_id, + note_text_sofort_merchant_transaction_id, monetary_account_id=None, + custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type sofort_merchant_transaction_id: int + :type note_text_sofort_merchant_transaction_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextSofortMerchantTransaction + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + sofort_merchant_transaction_id, + note_text_sofort_merchant_transaction_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteTextSofortMerchantTransaction.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @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 label_user_creator(self): + """ + :rtype: object_.LabelUser + """ + + return self._label_user_creator + + @property + def content(self): + """ + :rtype: str + """ + + return self._content + + def is_all_field_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._label_user_creator is not None: + return False + + if self._content is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: NoteTextSofortMerchantTransaction + """ + + return converter.json_to_class(NoteTextSofortMerchantTransaction, + json_str) + + +class NoteAttachmentWhitelistResult(core.BunqModel): + """ + Used to manage attachment notes. + + :param _description: Optional description of the attachment. + :type _description: str + :param _attachment_id: The reference to the uploaded file to attach to this + note. + :type _attachment_id: int + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + :param _attachment: The attachment attached to the note. + :type _attachment: list[object_.AttachmentMonetaryAccountPayment] + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/whitelist/{}/whitelist-result/{}/note-attachment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/whitelist/{}/whitelist-result/{}/note-attachment/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/whitelist/{}/whitelist-result/{}/note-attachment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/whitelist/{}/whitelist-result/{}/note-attachment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/whitelist/{}/whitelist-result/{}/note-attachment/{}" + + # Field constants. + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT_ID = "attachment_id" + + # Object type. + _OBJECT_TYPE_GET = "NoteAttachment" + + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _description = None + _attachment = None + _description_field_for_request = None + _attachment_id_field_for_request = None + + def __init__(self, attachment_id, description=None): + """ + :param attachment_id: The reference to the uploaded file to attach to this + note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + """ + + self._attachment_id_field_for_request = attachment_id + self._description_field_for_request = description + + @classmethod + def create(cls, whitelist_id, whitelist_result_id, attachment_id, + monetary_account_id=None, description=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type whitelist_id: int + :type whitelist_result_id: int + :param attachment_id: The reference to the uploaded file to attach to + this note. + :type attachment_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT_ID: attachment_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + whitelist_id, + whitelist_result_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, whitelist_id, whitelist_result_id, + note_attachment_whitelist_result_id, monetary_account_id=None, + description=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type whitelist_id: int + :type whitelist_result_id: int + :type note_attachment_whitelist_result_id: int + :param description: Optional description of the attachment. + :type description: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_DESCRIPTION: description + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + whitelist_id, + whitelist_result_id, + note_attachment_whitelist_result_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, whitelist_id, whitelist_result_id, + note_attachment_whitelist_result_id, monetary_account_id=None, + custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type whitelist_id: int + :type whitelist_result_id: int + :type note_attachment_whitelist_result_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + whitelist_id, + whitelist_result_id, + note_attachment_whitelist_result_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, whitelist_id, whitelist_result_id, monetary_account_id=None, + params=None, custom_headers=None): + """ + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type whitelist_id: int + :type whitelist_result_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentWhitelistResultList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + whitelist_id, whitelist_result_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteAttachmentWhitelistResultList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, whitelist_id, whitelist_result_id, + note_attachment_whitelist_result_id, monetary_account_id=None, + custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type whitelist_id: int + :type whitelist_result_id: int + :type note_attachment_whitelist_result_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteAttachmentWhitelistResult + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + whitelist_id, + whitelist_result_id, + note_attachment_whitelist_result_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteAttachmentWhitelistResult.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @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 label_user_creator(self): + """ + :rtype: object_.LabelUser + """ + + return self._label_user_creator + + @property + def description(self): + """ + :rtype: str + """ + + return self._description + + @property + def attachment(self): + """ + :rtype: list[object_.AttachmentMonetaryAccountPayment] + """ + + return self._attachment + + def is_all_field_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._label_user_creator is not None: + return False + + if self._description is not None: + return False + + if self._attachment is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: NoteAttachmentWhitelistResult + """ + + return converter.json_to_class(NoteAttachmentWhitelistResult, json_str) + + +class NoteTextWhitelistResult(core.BunqModel): + """ + Used to manage text notes. + + :param _content: The content of the note. + :type _content: str + :param _id_: The id of the note. + :type _id_: int + :param _created: The timestamp of the note's creation. + :type _created: str + :param _updated: The timestamp of the note's last update. + :type _updated: str + :param _label_user_creator: The label of the user who created this note. + :type _label_user_creator: object_.LabelUser + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/whitelist/{}/whitelist-result/{}/note-text" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/whitelist/{}/whitelist-result/{}/note-text/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/whitelist/{}/whitelist-result/{}/note-text/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/whitelist/{}/whitelist-result/{}/note-text" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/whitelist/{}/whitelist-result/{}/note-text/{}" + + # Field constants. + FIELD_CONTENT = "content" + + # Object type. + _OBJECT_TYPE_GET = "NoteText" + + _id_ = None + _created = None + _updated = None + _label_user_creator = None + _content = None + _content_field_for_request = None + + def __init__(self, content=None): + """ + :param content: The content of the note. + :type content: str + """ + + self._content_field_for_request = content + + @classmethod + def create(cls, whitelist_id, whitelist_result_id, monetary_account_id=None, + content=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type whitelist_id: int + :type whitelist_result_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + whitelist_id, + whitelist_result_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, whitelist_id, whitelist_result_id, + note_text_whitelist_result_id, monetary_account_id=None, + content=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type whitelist_id: int + :type whitelist_result_id: int + :type note_text_whitelist_result_id: int + :param content: The content of the note. + :type content: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_CONTENT: content + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + whitelist_id, + whitelist_result_id, + note_text_whitelist_result_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def delete(cls, whitelist_id, whitelist_result_id, + note_text_whitelist_result_id, monetary_account_id=None, + custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type whitelist_id: int + :type whitelist_result_id: int + :type note_text_whitelist_result_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + whitelist_id, + whitelist_result_id, + note_text_whitelist_result_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def list(cls, whitelist_id, whitelist_result_id, monetary_account_id=None, + params=None, custom_headers=None): + """ + Manage the notes for a given user. + + :type user_id: int + :type monetary_account_id: int + :type whitelist_id: int + :type whitelist_result_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextWhitelistResultList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + whitelist_id, whitelist_result_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseNoteTextWhitelistResultList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, whitelist_id, whitelist_result_id, + note_text_whitelist_result_id, monetary_account_id=None, + custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type whitelist_id: int + :type whitelist_result_id: int + :type note_text_whitelist_result_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNoteTextWhitelistResult + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + whitelist_id, + whitelist_result_id, + note_text_whitelist_result_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseNoteTextWhitelistResult.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @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 label_user_creator(self): + """ + :rtype: object_.LabelUser + """ + + return self._label_user_creator + + @property + def content(self): + """ + :rtype: str + """ + + return self._content + + def is_all_field_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._label_user_creator is not None: + return False + + if self._content is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: NoteTextWhitelistResult + """ + + return converter.json_to_class(NoteTextWhitelistResult, json_str) + + +class BunqMeFundraiserResult(core.BunqModel): + """ + bunq.me fundraiser result containing all payments. + + :param _id_: The id of the bunq.me. + :type _id_: int + :param _created: The timestamp when the bunq.me was created. + :type _created: str + :param _updated: The timestamp when the bunq.me was last updated. + :type _updated: str + :param _bunqme_fundraiser_profile: The bunq.me fundraiser profile. + :type _bunqme_fundraiser_profile: BunqMeFundraiserProfile + :param _payments: The list of payments, paid to the bunq.me fundraiser + profile. + :type _payments: list[Payment] + """ + + _id_ = None + _created = None + _updated = None + _bunqme_fundraiser_profile = None + _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 is_all_field_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 + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: BunqMeFundraiserResult + """ + + return converter.json_to_class(BunqMeFundraiserResult, json_str) + + +class BunqMeFundraiserProfile(core.BunqModel): + """ + bunq.me public profile of the user. + + :param _pointer: The pointer (url) which will be used to access the bunq.me + fundraiser profile. + :type _pointer: object_.MonetaryAccountReference + :param _color: The color chosen for the bunq.me fundraiser profile in + hexadecimal format. + :type _color: str + :param _alias: The LabelMonetaryAccount with the public information of the + User and the MonetaryAccount that created the bunq.me fundraiser profile. + :type _alias: object_.MonetaryAccountReference + :param _description: The description of the bunq.me fundraiser profile. + :type _description: str + :param _attachment: The attachments attached to the fundraiser profile. + :type _attachment: list[object_.AttachmentPublic] + :param _status: The status of the bunq.me fundraiser profile, can be ACTIVE + or DEACTIVATED. + :type _status: str + :param _redirect_url: The URL which the user is sent to when a payment is + completed. + :type _redirect_url: str + """ + + # Field constants. + FIELD_POINTER = "pointer" + + _color = None + _alias = None + _description = None + _attachment = None + _pointer = None + _status = None + _redirect_url = None + _pointer_field_for_request = None + + def __init__(self, pointer): + """ + :param pointer: The pointer (url) which will be used to access the bunq.me + fundraiser profile. + :type pointer: object_.Pointer + """ + + self._pointer_field_for_request = pointer + + @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 is_all_field_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 + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: BunqMeFundraiserProfile + """ + + return converter.json_to_class(BunqMeFundraiserProfile, json_str) + + +class BunqMeTabResultResponse(core.BunqModel): + """ + Used to view bunq.me TabResultResponse objects belonging to a tab. A + TabResultResponse is an object that holds details on a tab which has been + paid from the provided monetary account. + + :param _payment: The payment made for the bunq.me tab. + :type _payment: Payment + """ + + _payment = None + + @property + def payment(self): + """ + :rtype: Payment + """ + + return self._payment + + def is_all_field_none(self): + """ + :rtype: bool + """ + + if self._payment is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: BunqMeTabResultResponse + """ + + return converter.json_to_class(BunqMeTabResultResponse, json_str) + + +class ChatMessage(core.BunqModel): + """ + Endpoint for retrieving the messages that are part of a conversation. + """ + + def is_all_field_none(self): + """ + :rtype: bool + """ + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: ChatMessage + """ + + return converter.json_to_class(ChatMessage, json_str) + + +class IdealMerchantTransaction(core.BunqModel): + """ + View for requesting iDEAL transactions and polling their status. + + :param _amount_requested: The requested amount of money to add. + :type _amount_requested: object_.Amount + :param _issuer: The BIC of the issuer. + :type _issuer: str + :param _monetary_account_id: The id of the monetary account this ideal + merchant transaction links to. + :type _monetary_account_id: int + :param _alias: The alias of the monetary account to add money to. + :type _alias: object_.MonetaryAccountReference + :param _counterparty_alias: The alias of the monetary account the money + comes from. + :type _counterparty_alias: object_.MonetaryAccountReference + :param _amount_guaranteed: In case of a successful transaction, the amount + of money that will be transferred. + :type _amount_guaranteed: object_.Amount + :param _expiration: When the transaction will expire. + :type _expiration: str + :param _issuer_name: The Name of the issuer. + :type _issuer_name: str + :param _issuer_authentication_url: The URL to visit to + :type _issuer_authentication_url: str + :param _purchase_identifier: The 'purchase ID' of the iDEAL transaction. + :type _purchase_identifier: str + :param _status: The status of the transaction. + :type _status: str + :param _status_timestamp: When the status was last updated. + :type _status_timestamp: str + :param _transaction_identifier: The 'transaction ID' of the iDEAL + transaction. + :type _transaction_identifier: str + :param _allow_chat: Whether or not chat messages are allowed. + :type _allow_chat: bool + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/ideal-merchant-transaction" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/ideal-merchant-transaction/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/ideal-merchant-transaction" + + # Field constants. + FIELD_AMOUNT_REQUESTED = "amount_requested" + FIELD_ISSUER = "issuer" + + # Object type. + _OBJECT_TYPE_GET = "IdealMerchantTransaction" + + _monetary_account_id = None + _alias = None + _counterparty_alias = None + _amount_guaranteed = None + _amount_requested = None + _expiration = None + _issuer = None + _issuer_name = None + _issuer_authentication_url = None + _purchase_identifier = None + _status = None + _status_timestamp = None + _transaction_identifier = None + _allow_chat = None + _amount_requested_field_for_request = None + _issuer_field_for_request = None + + def __init__(self, amount_requested, issuer): + """ + :param amount_requested: The requested amount of money to add. + :type amount_requested: object_.Amount + :param issuer: The BIC of the issuing bank to ask for money. + :type issuer: str + """ + + self._amount_requested_field_for_request = amount_requested + self._issuer_field_for_request = issuer + + @classmethod + def create(cls, amount_requested, issuer, monetary_account_id=None, + custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :param amount_requested: The requested amount of money to add. + :type amount_requested: object_.Amount + :param issuer: The BIC of the issuing bank to ask for money. + :type issuer: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_AMOUNT_REQUESTED: amount_requested, + cls.FIELD_ISSUER: issuer + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_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 get(cls, ideal_merchant_transaction_id, monetary_account_id=None, + custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type ideal_merchant_transaction_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseIdealMerchantTransaction + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + ideal_merchant_transaction_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseIdealMerchantTransaction.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def list(cls, monetary_account_id=None, params=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseIdealMerchantTransactionList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id)) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseIdealMerchantTransactionList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @property + def monetary_account_id(self): + """ + :rtype: int + """ + + return self._monetary_account_id + + @property + def alias(self): + """ + :rtype: object_.MonetaryAccountReference + """ + + return self._alias + + @property + def counterparty_alias(self): + """ + :rtype: object_.MonetaryAccountReference + """ + + return self._counterparty_alias + + @property + def amount_guaranteed(self): + """ + :rtype: object_.Amount + """ + + return self._amount_guaranteed + + @property + def amount_requested(self): + """ + :rtype: object_.Amount + """ + + return self._amount_requested + + @property + def expiration(self): + """ + :rtype: str + """ + + return self._expiration + + @property + def issuer(self): + """ + :rtype: str + """ + + return self._issuer + + @property + def issuer_name(self): + """ + :rtype: str + """ + + return self._issuer_name + + @property + def issuer_authentication_url(self): + """ + :rtype: str + """ + + return self._issuer_authentication_url + + @property + def purchase_identifier(self): + """ + :rtype: str + """ + + return self._purchase_identifier + + @property + def status(self): + """ + :rtype: str + """ + + return self._status + + @property + def status_timestamp(self): + """ + :rtype: str + """ + + return self._status_timestamp + + @property + def transaction_identifier(self): + """ + :rtype: str + """ + + return self._transaction_identifier + + @property + def allow_chat(self): + """ + :rtype: bool + """ + + return self._allow_chat + + def is_all_field_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 + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: IdealMerchantTransaction + """ + + return converter.json_to_class(IdealMerchantTransaction, json_str) + + +class MasterCardAction(core.BunqModel): + """ + MasterCard transaction view. + + :param _id_: The id of the MastercardAction. + :type _id_: int + :param _monetary_account_id: The id of the monetary account this action + links to. + :type _monetary_account_id: int + :param _card_id: The id of the card this action links to. + :type _card_id: int + :param _amount_local: The amount of the transaction in local currency. + :type _amount_local: object_.Amount + :param _amount_billing: The amount of the transaction in the monetary + account's currency. + :type _amount_billing: object_.Amount + :param _amount_original_local: The original amount in local currency. + :type _amount_original_local: object_.Amount + :param _amount_original_billing: The original amount in the monetary + account's currency. + :type _amount_original_billing: object_.Amount + :param _amount_fee: The fee amount as charged by the merchant, if + applicable. + :type _amount_fee: object_.Amount + :param _card_authorisation_id_response: The response code by which + authorised transaction can be identified as authorised by bunq. + :type _card_authorisation_id_response: str + :param _decision: Why the transaction was denied, if it was denied, or just + ALLOWED. + :type _decision: str + :param _decision_description: Empty if allowed, otherwise a textual + explanation of why it was denied. + :type _decision_description: str + :param _decision_description_translated: Empty if allowed, otherwise a + textual explanation of why it was denied in user's language. + :type _decision_description_translated: str + :param _description: The description for this transaction to display. + :type _description: str + :param _authorisation_status: The status in the authorisation process. + :type _authorisation_status: str + :param _authorisation_type: The type of transaction that was delivered using + the card. + :type _authorisation_type: str + :param _pan_entry_mode_user: The type of entry mode the user used. Can be + 'ATM', 'ICC', 'MAGNETIC_STRIPE' or 'E_COMMERCE'. + :type _pan_entry_mode_user: str + :param _city: The city where the message originates from as announced by the + terminal. + :type _city: str + :param _alias: The monetary account label of the account that this action is + created for. + :type _alias: object_.MonetaryAccountReference + :param _counterparty_alias: The monetary account label of the counterparty. + :type _counterparty_alias: object_.MonetaryAccountReference + :param _label_card: The label of the card. + :type _label_card: object_.LabelCard + :param _token_status: If this is a tokenisation action, this shows the + status of the token. + :type _token_status: str + :param _reservation_expiry_time: If this is a reservation, the moment the + reservation will expire. + :type _reservation_expiry_time: str + :param _applied_limit: The type of the limit applied to validate if this + MasterCardAction was within the spending limits. The returned string matches + the limit types as defined in the card endpoint. + :type _applied_limit: str + :param _allow_chat: Whether or not chat messages are allowed. + :type _allow_chat: bool + :param _eligible_whitelist_id: The whitelist id for this mastercard action + or null. + :type _eligible_whitelist_id: int + :param _secure_code_id: The secure code id for this mastercard action or + null. + :type _secure_code_id: int + :param _wallet_provider_id: The ID of the wallet provider as defined by + MasterCard. 420 = bunq Android app with Tap&Pay; 103 = Apple Pay. + :type _wallet_provider_id: str + :param _request_reference_split_the_bill: The reference to the object used + for split the bill. Can be RequestInquiry or RequestInquiryBatch + :type _request_reference_split_the_bill: + list[object_.RequestInquiryReference] + """ + + # Endpoint constants. + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/mastercard-action/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/mastercard-action" + + # Object type. + _OBJECT_TYPE_GET = "MasterCardAction" + + _id_ = None + _monetary_account_id = None + _card_id = None + _amount_local = None + _amount_billing = None + _amount_original_local = None + _amount_original_billing = None + _amount_fee = None + _card_authorisation_id_response = None + _decision = None + _decision_description = None + _decision_description_translated = None + _description = None + _authorisation_status = None + _authorisation_type = None + _pan_entry_mode_user = None + _city = None + _alias = None + _counterparty_alias = None + _label_card = None + _token_status = None + _reservation_expiry_time = None + _applied_limit = None + _allow_chat = None + _eligible_whitelist_id = None + _secure_code_id = None + _wallet_provider_id = None + _request_reference_split_the_bill = None + + @classmethod + def get(cls, master_card_action_id, monetary_account_id=None, + custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type master_card_action_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseMasterCardAction + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + master_card_action_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseMasterCardAction.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def list(cls, monetary_account_id=None, params=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseMasterCardActionList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id)) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseMasterCardActionList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @property + def id_(self): + """ + :rtype: int + """ + + return self._id_ + + @property + def monetary_account_id(self): + """ + :rtype: int + """ + + return self._monetary_account_id + + @property + def card_id(self): + """ + :rtype: int + """ + + return self._card_id + + @property + def amount_local(self): + """ + :rtype: object_.Amount + """ + + return self._amount_local + + @property + def amount_billing(self): + """ + :rtype: object_.Amount + """ + + return self._amount_billing + + @property + def amount_original_local(self): + """ + :rtype: object_.Amount + """ + + return self._amount_original_local + + @property + def amount_original_billing(self): + """ + :rtype: object_.Amount + """ + + return self._amount_original_billing + + @property + def amount_fee(self): + """ + :rtype: object_.Amount + """ + + return self._amount_fee + + @property + def card_authorisation_id_response(self): + """ + :rtype: str + """ + + return self._card_authorisation_id_response + + @property + def decision(self): + """ + :rtype: str + """ + + return self._decision + + @property + def decision_description(self): + """ + :rtype: str + """ + + return self._decision_description + + @property + def decision_description_translated(self): + """ + :rtype: str + """ + + return self._decision_description_translated + + @property + def description(self): + """ + :rtype: str + """ + + return self._description + + @property + def authorisation_status(self): + """ + :rtype: str + """ + + return self._authorisation_status + + @property + def authorisation_type(self): + """ + :rtype: str + """ + + return self._authorisation_type + + @property + def pan_entry_mode_user(self): + """ + :rtype: str + """ + + return self._pan_entry_mode_user + + @property + def city(self): + """ + :rtype: str + """ + + return self._city + + @property + def alias(self): + """ + :rtype: object_.MonetaryAccountReference + """ + + return self._alias + + @property + def counterparty_alias(self): + """ + :rtype: object_.MonetaryAccountReference + """ + + return self._counterparty_alias + + @property + def label_card(self): + """ + :rtype: object_.LabelCard + """ + + return self._label_card + + @property + def token_status(self): + """ + :rtype: str + """ + + return self._token_status + + @property + def reservation_expiry_time(self): + """ + :rtype: str + """ + + return self._reservation_expiry_time + + @property + def applied_limit(self): + """ + :rtype: str + """ + + return self._applied_limit + + @property + def allow_chat(self): + """ + :rtype: bool + """ + + return self._allow_chat + + @property + def eligible_whitelist_id(self): + """ + :rtype: int + """ + + return self._eligible_whitelist_id + + @property + def secure_code_id(self): + """ + :rtype: int + """ + + return self._secure_code_id + + @property + def wallet_provider_id(self): + """ + :rtype: str + """ + + return self._wallet_provider_id + + @property + def request_reference_split_the_bill(self): + """ + :rtype: list[object_.RequestInquiryReference] + """ + + return self._request_reference_split_the_bill + + def is_all_field_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + 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._card_authorisation_id_response 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 + + if self._secure_code_id is not None: + return False + + if self._wallet_provider_id is not None: + return False + + if self._request_reference_split_the_bill is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: MasterCardAction + """ + + return converter.json_to_class(MasterCardAction, json_str) + + +class RequestInquiry(core.BunqModel): + """ + RequestInquiry, aka 'RFP' (Request for Payment), is one of the innovative + features that bunq offers. To request payment from another bunq account a + new Request Inquiry is created. As with payments you can add attachments to + a RFP. Requests for Payment are the foundation for a number of consumer + features like 'Split the bill' and 'Request forwarding'. We invite you to + invent your own based on the bunq api! + + :param _amount_inquired: The requested amount. + :type _amount_inquired: object_.Amount + :param _counterparty_alias: The LabelMonetaryAccount with the public + information of the MonetaryAccount the money was requested from. + :type _counterparty_alias: object_.MonetaryAccountReference + :param _description: The description of the inquiry. + :type _description: str + :param _attachment: The attachments attached to the payment. + :type _attachment: list[object_.BunqId] + :param _merchant_reference: The client's custom reference that was attached + to the request and the mutation. + :type _merchant_reference: str + :param _status: The status of the request. + :type _status: str + :param _minimum_age: The minimum age the user accepting the RequestInquiry + must have. + :type _minimum_age: int + :param _require_address: Whether or not an address must be provided on + accept. + :type _require_address: str + :param _want_tip: [DEPRECATED] Whether or not the accepting user can give an + extra tip on top of the requested Amount. Defaults to false. + :type _want_tip: bool + :param _allow_amount_lower: [DEPRECATED] Whether or not the accepting user + can choose to accept with a lower amount than requested. Defaults to false. + :type _allow_amount_lower: bool + :param _allow_amount_higher: [DEPRECATED] Whether or not the accepting user + can choose to accept with a higher amount than requested. Defaults to false. + :type _allow_amount_higher: bool + :param _allow_bunqme: Whether or not sending a bunq.me request is allowed. + :type _allow_bunqme: bool + :param _redirect_url: The URL which the user is sent to after accepting or + rejecting the Request. + :type _redirect_url: str + :param _event_id: The ID of the associated event if the request was made + using 'split the bill'. + :type _event_id: int + :param _id_: The id of the created RequestInquiry. + :type _id_: int + :param _created: The timestamp of the payment request's creation. + :type _created: str + :param _updated: The timestamp of the payment request's last update. + :type _updated: str + :param _time_responded: The timestamp of when the payment request was + responded to. + :type _time_responded: str + :param _time_expiry: The timestamp of when the payment request expired. + :type _time_expiry: str + :param _monetary_account_id: The id of the monetary account the request + response applies to. + :type _monetary_account_id: int + :param _amount_responded: The responded amount. + :type _amount_responded: object_.Amount + :param _user_alias_created: The label that's displayed to the counterparty + with the mutation. Includes user. + :type _user_alias_created: object_.LabelUser + :param _user_alias_revoked: The label that's displayed to the counterparty + with the mutation. Includes user. + :type _user_alias_revoked: object_.LabelUser + :param _batch_id: The id of the batch if the request was part of a batch. + :type _batch_id: int + :param _scheduled_id: The id of the scheduled job if the request was + scheduled. + :type _scheduled_id: int + :param _bunqme_share_url: The url that points to the bunq.me request. + :type _bunqme_share_url: str + :param _address_shipping: The shipping address provided by the accepting + user if an address was requested. + :type _address_shipping: object_.Address + :param _address_billing: The billing address provided by the accepting user + if an address was requested. + :type _address_billing: object_.Address + :param _geolocation: The geolocation where the payment was done. + :type _geolocation: object_.Geolocation + :param _allow_chat: Whether or not chat messages are allowed. + :type _allow_chat: bool + :param _reference_split_the_bill: The reference to the object used for split + the bill. Can be Payment, PaymentBatch, ScheduleInstance, RequestResponse + and MasterCardAction + :type _reference_split_the_bill: + object_.RequestReferenceSplitTheBillAnchorObject + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-inquiry" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-inquiry/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-inquiry" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/request-inquiry/{}" + + # Field constants. + FIELD_AMOUNT_INQUIRED = "amount_inquired" + FIELD_COUNTERPARTY_ALIAS = "counterparty_alias" + FIELD_DESCRIPTION = "description" + FIELD_ATTACHMENT = "attachment" + FIELD_MERCHANT_REFERENCE = "merchant_reference" + FIELD_STATUS = "status" + FIELD_MINIMUM_AGE = "minimum_age" + FIELD_REQUIRE_ADDRESS = "require_address" + FIELD_WANT_TIP = "want_tip" + FIELD_ALLOW_AMOUNT_LOWER = "allow_amount_lower" + FIELD_ALLOW_AMOUNT_HIGHER = "allow_amount_higher" + FIELD_ALLOW_BUNQME = "allow_bunqme" + FIELD_REDIRECT_URL = "redirect_url" + FIELD_EVENT_ID = "event_id" + + # Object type. + _OBJECT_TYPE_PUT = "RequestInquiry" + _OBJECT_TYPE_GET = "RequestInquiry" + + _id_ = None + _created = None + _updated = None + _time_responded = None + _time_expiry = None + _monetary_account_id = None + _amount_inquired = None + _amount_responded = None + _user_alias_created = None + _user_alias_revoked = None + _counterparty_alias = None + _description = None + _merchant_reference = None + _attachment = None + _status = None + _batch_id = None + _scheduled_id = None + _minimum_age = None + _require_address = None + _bunqme_share_url = None + _redirect_url = None + _address_shipping = None + _address_billing = None + _geolocation = None + _allow_chat = None + _reference_split_the_bill = None + _amount_inquired_field_for_request = None + _counterparty_alias_field_for_request = None + _description_field_for_request = None + _attachment_field_for_request = None + _merchant_reference_field_for_request = None + _status_field_for_request = None + _minimum_age_field_for_request = None + _require_address_field_for_request = None + _want_tip_field_for_request = None + _allow_amount_lower_field_for_request = None + _allow_amount_higher_field_for_request = None + _allow_bunqme_field_for_request = None + _redirect_url_field_for_request = None + _event_id_field_for_request = None + + def __init__(self, amount_inquired, counterparty_alias, description, + allow_bunqme, attachment=None, merchant_reference=None, + status=None, minimum_age=None, require_address=None, + want_tip=None, allow_amount_lower=None, + allow_amount_higher=None, redirect_url=None, event_id=None): + """ + :param amount_inquired: The Amount requested to be paid by the person the + RequestInquiry is sent to. Must be bigger than 0. + :type amount_inquired: object_.Amount + :param counterparty_alias: The Alias of the party we are requesting the + money from. Can be an Alias of type EMAIL, PHONE_NUMBER or IBAN. In case the + EMAIL or PHONE_NUMBER Alias does not refer to a bunq monetary account, + 'allow_bunqme' needs to be 'true' in order to trigger the creation of a + bunq.me request. Otherwise no request inquiry will be sent. + :type counterparty_alias: object_.Pointer + :param description: The description for the RequestInquiry. Maximum 9000 + characters. Field is required but can be an empty string. + :type description: str + :param allow_bunqme: Whether or not sending a bunq.me request is allowed. + :type allow_bunqme: bool + :param attachment: The Attachments to attach to the RequestInquiry. + :type attachment: list[object_.BunqId] + :param merchant_reference: Optional data to be included with the + RequestInquiry specific to the merchant. Has to be unique for the same + source MonetaryAccount. + :type merchant_reference: str + :param status: The status of the RequestInquiry. Ignored in POST requests + but can be used for revoking (cancelling) the RequestInquiry by setting + REVOKED with a PUT request. + :type status: str + :param minimum_age: The minimum age the user accepting the RequestInquiry + must have. Defaults to not checking. If set, must be between 12 and 100 + inclusive. + :type minimum_age: int + :param require_address: Whether a billing and shipping address must be + provided when paying the request. Possible values are: BILLING, SHIPPING, + BILLING_SHIPPING, NONE, OPTIONAL. Default is NONE. + :type require_address: str + :param want_tip: [DEPRECATED] Whether or not the accepting user can give an + extra tip on top of the requested Amount. Defaults to false. + :type want_tip: bool + :param allow_amount_lower: [DEPRECATED] Whether or not the accepting user + can choose to accept with a lower amount than requested. Defaults to false. + :type allow_amount_lower: bool + :param allow_amount_higher: [DEPRECATED] Whether or not the accepting user + can choose to accept with a higher amount than requested. Defaults to false. + :type allow_amount_higher: bool + :param redirect_url: The URL which the user is sent to after accepting or + rejecting the Request. + :type redirect_url: str + :param event_id: The ID of the associated event if the request was made + using 'split the bill'. + :type event_id: int + """ + + self._amount_inquired_field_for_request = amount_inquired + self._counterparty_alias_field_for_request = counterparty_alias + self._description_field_for_request = description + self._allow_bunqme_field_for_request = allow_bunqme + self._attachment_field_for_request = attachment + self._merchant_reference_field_for_request = merchant_reference + self._status_field_for_request = status + self._minimum_age_field_for_request = minimum_age + self._require_address_field_for_request = require_address + self._want_tip_field_for_request = want_tip + self._allow_amount_lower_field_for_request = allow_amount_lower + self._allow_amount_higher_field_for_request = allow_amount_higher + self._redirect_url_field_for_request = redirect_url + self._event_id_field_for_request = event_id + + @classmethod + def create(cls, amount_inquired, counterparty_alias, description, + allow_bunqme, monetary_account_id=None, attachment=None, + merchant_reference=None, status=None, minimum_age=None, + require_address=None, want_tip=None, allow_amount_lower=None, + allow_amount_higher=None, redirect_url=None, event_id=None, + custom_headers=None): + """ + Create a new payment request. + + :type user_id: int + :type monetary_account_id: int + :param amount_inquired: The Amount requested to be paid by the person + the RequestInquiry is sent to. Must be bigger than 0. + :type amount_inquired: object_.Amount + :param counterparty_alias: The Alias of the party we are requesting the + money from. Can be an Alias of type EMAIL, PHONE_NUMBER or IBAN. In case + the EMAIL or PHONE_NUMBER Alias does not refer to a bunq monetary + account, 'allow_bunqme' needs to be 'true' in order to trigger the + creation of a bunq.me request. Otherwise no request inquiry will be + sent. + :type counterparty_alias: object_.Pointer + :param description: The description for the RequestInquiry. Maximum 9000 + characters. Field is required but can be an empty string. + :type description: str + :param allow_bunqme: Whether or not sending a bunq.me request is + allowed. + :type allow_bunqme: bool + :param attachment: The Attachments to attach to the RequestInquiry. + :type attachment: list[object_.BunqId] + :param merchant_reference: Optional data to be included with the + RequestInquiry specific to the merchant. Has to be unique for the same + source MonetaryAccount. + :type merchant_reference: str + :param status: The status of the RequestInquiry. Ignored in POST + requests but can be used for revoking (cancelling) the RequestInquiry by + setting REVOKED with a PUT request. + :type status: str + :param minimum_age: The minimum age the user accepting the + RequestInquiry must have. Defaults to not checking. If set, must be + between 12 and 100 inclusive. + :type minimum_age: int + :param require_address: Whether a billing and shipping address must be + provided when paying the request. Possible values are: BILLING, + SHIPPING, BILLING_SHIPPING, NONE, OPTIONAL. Default is NONE. + :type require_address: str + :param want_tip: [DEPRECATED] Whether or not the accepting user can give + an extra tip on top of the requested Amount. Defaults to false. + :type want_tip: bool + :param allow_amount_lower: [DEPRECATED] Whether or not the accepting + user can choose to accept with a lower amount than requested. Defaults + to false. + :type allow_amount_lower: bool + :param allow_amount_higher: [DEPRECATED] Whether or not the accepting + user can choose to accept with a higher amount than requested. Defaults + to false. + :type allow_amount_higher: bool + :param redirect_url: The URL which the user is sent to after accepting + or rejecting the Request. + :type redirect_url: str + :param event_id: The ID of the associated event if the request was made + using 'split the bill'. + :type event_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_AMOUNT_INQUIRED: amount_inquired, + cls.FIELD_COUNTERPARTY_ALIAS: counterparty_alias, + cls.FIELD_DESCRIPTION: description, + cls.FIELD_ATTACHMENT: attachment, + cls.FIELD_MERCHANT_REFERENCE: merchant_reference, + cls.FIELD_STATUS: status, + cls.FIELD_MINIMUM_AGE: minimum_age, + cls.FIELD_REQUIRE_ADDRESS: require_address, + cls.FIELD_WANT_TIP: want_tip, + cls.FIELD_ALLOW_AMOUNT_LOWER: allow_amount_lower, + cls.FIELD_ALLOW_AMOUNT_HIGHER: allow_amount_higher, + cls.FIELD_ALLOW_BUNQME: allow_bunqme, + cls.FIELD_REDIRECT_URL: redirect_url, + cls.FIELD_EVENT_ID: event_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_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, request_inquiry_id, monetary_account_id=None, status=None, + custom_headers=None): + """ + Revoke a request for payment, by updating the status to REVOKED. + + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_id: int + :param status: The status of the RequestInquiry. Ignored in POST + requests but can be used for revoking (cancelling) the RequestInquiry by + setting REVOKED with a PUT request. + :type status: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseRequestInquiry + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_STATUS: status + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseRequestInquiry.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_PUT) + ) + + @classmethod + def list(cls, monetary_account_id=None, params=None, custom_headers=None): + """ + Get all payment requests for a user's monetary account. + + :type user_id: int + :type monetary_account_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseRequestInquiryList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id)) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseRequestInquiryList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, request_inquiry_id, monetary_account_id=None, + custom_headers=None): + """ + Get the details of a specific payment request, including its status. + + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseRequestInquiry + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseRequestInquiry.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @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 time_responded(self): + """ + :rtype: str + """ + + return self._time_responded + + @property + def time_expiry(self): + """ + :rtype: str + """ + + return self._time_expiry + + @property + def monetary_account_id(self): + """ + :rtype: int + """ + + return self._monetary_account_id + + @property + def amount_inquired(self): + """ + :rtype: object_.Amount + """ + + return self._amount_inquired + + @property + def amount_responded(self): + """ + :rtype: object_.Amount + """ + + return self._amount_responded + + @property + def user_alias_created(self): + """ + :rtype: object_.LabelUser + """ + + return self._user_alias_created + + @property + def user_alias_revoked(self): + """ + :rtype: object_.LabelUser + """ + + return self._user_alias_revoked + + @property + def counterparty_alias(self): + """ + :rtype: object_.MonetaryAccountReference + """ + + return self._counterparty_alias + + @property + def description(self): + """ + :rtype: str + """ + + return self._description + + @property + def merchant_reference(self): + """ + :rtype: str + """ + + return self._merchant_reference + + @property + def attachment(self): + """ + :rtype: list[object_.BunqId] + """ + + return self._attachment + + @property + def status(self): + """ + :rtype: str + """ + + return self._status + + @property + def batch_id(self): + """ + :rtype: int + """ + + return self._batch_id + + @property + def scheduled_id(self): + """ + :rtype: int + """ + + return self._scheduled_id + + @property + def minimum_age(self): + """ + :rtype: int + """ + + return self._minimum_age + + @property + def require_address(self): + """ + :rtype: str + """ + + return self._require_address + + @property + def bunqme_share_url(self): + """ + :rtype: str + """ + + return self._bunqme_share_url + + @property + def redirect_url(self): + """ + :rtype: str + """ + + return self._redirect_url + + @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 + + @property + def allow_chat(self): + """ + :rtype: bool + """ + + return self._allow_chat + + @property + def reference_split_the_bill(self): + """ + :rtype: object_.RequestReferenceSplitTheBillAnchorObject + """ + + return self._reference_split_the_bill + + def is_all_field_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 + + if self._reference_split_the_bill is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: RequestInquiry + """ + + return converter.json_to_class(RequestInquiry, json_str) + + +class RequestResponse(core.BunqModel): + """ + A RequestResponse is what a user on the other side of a RequestInquiry gets + when he is sent one. So a RequestInquiry is the initiator and visible for + the user that sent it and that wants to receive the money. A RequestResponse + is what the other side sees, i.e. the user that pays the money to accept the + request. The content is almost identical. + + :param _amount_responded: The Amount the RequestResponse was accepted with. + :type _amount_responded: object_.Amount + :param _status: The status of the RequestResponse. Can be ACCEPTED, PENDING, + REJECTED or REVOKED. + :type _status: str + :param _address_shipping: The shipping address provided by the accepting + user if an address was requested. + :type _address_shipping: object_.Address + :param _address_billing: The billing address provided by the accepting user + if an address was requested. + :type _address_billing: object_.Address + :param _id_: The id of the Request Response. + :type _id_: int + :param _created: The timestamp when the Request Response was created. + :type _created: str + :param _updated: The timestamp when the Request Response was last updated + (will be updated when chat messages are received). + :type _updated: str + :param _time_responded: The timestamp of when the RequestResponse was + responded to. + :type _time_responded: str + :param _time_expiry: The timestamp of when the RequestResponse expired or + will expire. + :type _time_expiry: str + :param _monetary_account_id: The id of the MonetaryAccount the + RequestResponse was received on. + :type _monetary_account_id: int + :param _amount_inquired: The requested Amount. + :type _amount_inquired: object_.Amount + :param _description: The description for the RequestResponse provided by the + requesting party. Maximum 9000 characters. + :type _description: str + :param _alias: The LabelMonetaryAccount with the public information of the + MonetaryAccount this RequestResponse was received on. + :type _alias: object_.MonetaryAccountReference + :param _counterparty_alias: The LabelMonetaryAccount with the public + information of the MonetaryAccount that is requesting money with this + RequestResponse. + :type _counterparty_alias: object_.MonetaryAccountReference + :param _attachment: The Attachments attached to the RequestResponse. + :type _attachment: list[object_.Attachment] + :param _minimum_age: The minimum age the user accepting the RequestResponse + must have. + :type _minimum_age: int + :param _require_address: Whether or not an address must be provided on + accept. + :type _require_address: str + :param _geolocation: The Geolocation where the RequestResponse was created. + :type _geolocation: object_.Geolocation + :param _type_: The type of the RequestInquiry. Can be DIRECT_DEBIT, + DIRECT_DEBIT_B2B, IDEAL, SOFORT or INTERNAL. + :type _type_: str + :param _sub_type: The subtype of the RequestInquiry. Can be ONCE or + RECURRING for DIRECT_DEBIT RequestInquiries and NONE for all other. + :type _sub_type: str + :param _redirect_url: The URL which the user is sent to after accepting or + rejecting the Request. + :type _redirect_url: str + :param _allow_chat: Whether or not chat messages are allowed. + :type _allow_chat: bool + :param _credit_scheme_identifier: The credit scheme id provided by the + counterparty for DIRECT_DEBIT inquiries. + :type _credit_scheme_identifier: str + :param _mandate_identifier: The mandate id provided by the counterparty for + DIRECT_DEBIT inquiries. + :type _mandate_identifier: str + :param _eligible_whitelist_id: The whitelist id for this action or null. + :type _eligible_whitelist_id: int + :param _request_reference_split_the_bill: The reference to the object used + for split the bill. Can be RequestInquiry or RequestInquiryBatch + :type _request_reference_split_the_bill: + list[object_.RequestInquiryReference] + """ + + # Endpoint constants. + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-response/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-response" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/request-response/{}" + + # Field constants. + FIELD_AMOUNT_RESPONDED = "amount_responded" + FIELD_STATUS = "status" + FIELD_ADDRESS_SHIPPING = "address_shipping" + FIELD_ADDRESS_BILLING = "address_billing" + + # Object type. + _OBJECT_TYPE_PUT = "RequestResponse" + _OBJECT_TYPE_GET = "RequestResponse" + + _id_ = None + _created = None + _updated = None + _time_responded = None + _time_expiry = None + _monetary_account_id = None + _amount_inquired = None + _amount_responded = None + _status = None + _description = None + _alias = None + _counterparty_alias = None + _attachment = None + _minimum_age = None + _require_address = None + _geolocation = None + _type_ = None + _sub_type = None + _redirect_url = None + _address_billing = None + _address_shipping = None + _allow_chat = None + _credit_scheme_identifier = None + _mandate_identifier = None + _eligible_whitelist_id = None + _request_reference_split_the_bill = None + _amount_responded_field_for_request = None + _status_field_for_request = None + _address_shipping_field_for_request = None + _address_billing_field_for_request = None + + def __init__(self, status=None, amount_responded=None, + address_shipping=None, address_billing=None): + """ + :param status: The responding status of the RequestResponse. Can be ACCEPTED + or REJECTED. + :type status: str + :param amount_responded: The Amount the user decides to pay. + :type amount_responded: object_.Amount + :param address_shipping: The shipping Address to return to the user who + created the RequestInquiry. Should only be provided if 'require_address' is + set to SHIPPING, BILLING_SHIPPING or OPTIONAL. + :type address_shipping: object_.Address + :param address_billing: The billing Address to return to the user who + created the RequestInquiry. Should only be provided if 'require_address' is + set to BILLING, BILLING_SHIPPING or OPTIONAL. + :type address_billing: object_.Address + """ + + self._status_field_for_request = status + self._amount_responded_field_for_request = amount_responded + self._address_shipping_field_for_request = address_shipping + self._address_billing_field_for_request = address_billing + + @classmethod + def update(cls, request_response_id, monetary_account_id=None, + amount_responded=None, status=None, address_shipping=None, + address_billing=None, custom_headers=None): + """ + Update the status to accept or reject the RequestResponse. + + :type user_id: int + :type monetary_account_id: int + :type request_response_id: int + :param amount_responded: The Amount the user decides to pay. + :type amount_responded: object_.Amount + :param status: The responding status of the RequestResponse. Can be + ACCEPTED or REJECTED. + :type status: str + :param address_shipping: The shipping Address to return to the user who + created the RequestInquiry. Should only be provided if 'require_address' + is set to SHIPPING, BILLING_SHIPPING or OPTIONAL. + :type address_shipping: object_.Address + :param address_billing: The billing Address to return to the user who + created the RequestInquiry. Should only be provided if 'require_address' + is set to BILLING, BILLING_SHIPPING or OPTIONAL. + :type address_billing: object_.Address + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseRequestResponse + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_AMOUNT_RESPONDED: amount_responded, + cls.FIELD_STATUS: status, + cls.FIELD_ADDRESS_SHIPPING: address_shipping, + cls.FIELD_ADDRESS_BILLING: address_billing + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_response_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseRequestResponse.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_PUT) + ) + + @classmethod + def list(cls, monetary_account_id=None, params=None, custom_headers=None): + """ + Get all RequestResponses for a MonetaryAccount. + + :type user_id: int + :type monetary_account_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseRequestResponseList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id)) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseRequestResponseList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, request_response_id, monetary_account_id=None, + custom_headers=None): + """ + Get the details for a specific existing RequestResponse. + + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type request_response_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseRequestResponse + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_response_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseRequestResponse.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @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 time_responded(self): + """ + :rtype: str + """ + + return self._time_responded + + @property + def time_expiry(self): + """ + :rtype: str + """ + + return self._time_expiry + + @property + def monetary_account_id(self): + """ + :rtype: int + """ + + return self._monetary_account_id + + @property + def amount_inquired(self): + """ + :rtype: object_.Amount + """ + + return self._amount_inquired + + @property + def amount_responded(self): + """ + :rtype: object_.Amount + """ + + return self._amount_responded + + @property + def status(self): + """ + :rtype: str + """ + + return self._status + + @property + def description(self): + """ + :rtype: str + """ + + return self._description + + @property + def alias(self): + """ + :rtype: object_.MonetaryAccountReference + """ + + return self._alias + + @property + def counterparty_alias(self): + """ + :rtype: object_.MonetaryAccountReference + """ + + return self._counterparty_alias + + @property + def attachment(self): + """ + :rtype: list[object_.Attachment] + """ + + return self._attachment + + @property + def minimum_age(self): + """ + :rtype: int + """ + + return self._minimum_age + + @property + def require_address(self): + """ + :rtype: str + """ + + return self._require_address + + @property + def geolocation(self): + """ + :rtype: object_.Geolocation + """ + + return self._geolocation + + @property + def type_(self): + """ + :rtype: str + """ + + return self._type_ + + @property + def sub_type(self): + """ + :rtype: str + """ + + return self._sub_type + + @property + def redirect_url(self): + """ + :rtype: str + """ + + return self._redirect_url + + @property + def address_billing(self): + """ + :rtype: object_.Address + """ + + return self._address_billing + + @property + def address_shipping(self): + """ + :rtype: object_.Address + """ + + return self._address_shipping + + @property + def allow_chat(self): + """ + :rtype: bool + """ + + return self._allow_chat + + @property + def credit_scheme_identifier(self): + """ + :rtype: str + """ + + return self._credit_scheme_identifier + + @property + def mandate_identifier(self): + """ + :rtype: str + """ + + return self._mandate_identifier + + @property + def eligible_whitelist_id(self): + """ + :rtype: int + """ + + return self._eligible_whitelist_id + + @property + def request_reference_split_the_bill(self): + """ + :rtype: list[object_.RequestInquiryReference] + """ + + return self._request_reference_split_the_bill + + def is_all_field_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._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 + + if self._request_reference_split_the_bill is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: RequestResponse + """ + + return converter.json_to_class(RequestResponse, json_str) + + +class ScheduleInstance(core.BunqModel): + """ + view for reading, updating and listing the scheduled instance. + + :param _state: The state of the scheduleInstance. (FINISHED_SUCCESSFULLY, + RETRY, FAILED_USER_ERROR) + :type _state: str + :param _time_start: The schedule start time (UTC). + :type _time_start: str + :param _time_end: The schedule end time (UTC). + :type _time_end: str + :param _error_message: The message when the scheduled instance has run and + failed due to user error. + :type _error_message: list[object_.Error] + :param _scheduled_object: The scheduled object. (Payment, PaymentBatch) + :type _scheduled_object: object_.ScheduleAnchorObject + :param _result_object: The result object of this schedule instance. + (Payment, PaymentBatch) + :type _result_object: object_.ScheduleInstanceAnchorObject + :param _request_reference_split_the_bill: The reference to the object used + for split the bill. Can be RequestInquiry or RequestInquiryBatch + :type _request_reference_split_the_bill: + list[object_.RequestInquiryReference] + """ + + # Endpoint constants. + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/schedule/{}/schedule-instance/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/schedule/{}/schedule-instance" + + # Field constants. + FIELD_STATE = "state" + + # Object type. + _OBJECT_TYPE_GET = "ScheduledInstance" + + _state = None + _time_start = None + _time_end = None + _error_message = None + _scheduled_object = None + _result_object = None + _request_reference_split_the_bill = None + _state_field_for_request = None + + def __init__(self, state=None): + """ + :param state: Change the state of the scheduleInstance from + FAILED_USER_ERROR to RETRY. + :type state: str + """ + + self._state_field_for_request = state + + @classmethod + def get(cls, schedule_id, schedule_instance_id, monetary_account_id=None, + custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type schedule_instance_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseScheduleInstance + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_id, + schedule_instance_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseScheduleInstance.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def update(cls, schedule_id, schedule_instance_id, monetary_account_id=None, + state=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type schedule_instance_id: int + :param state: Change the state of the scheduleInstance from + FAILED_USER_ERROR to RETRY. + :type state: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_STATE: state + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_id, + schedule_instance_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def list(cls, schedule_id, monetary_account_id=None, params=None, + custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseScheduleInstanceList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + schedule_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseScheduleInstanceList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @property + def state(self): + """ + :rtype: str + """ + + return self._state + + @property + def time_start(self): + """ + :rtype: str + """ + + return self._time_start + + @property + def time_end(self): + """ + :rtype: str + """ + + return self._time_end + + @property + def error_message(self): + """ + :rtype: list[object_.Error] + """ + + return self._error_message + + @property + def scheduled_object(self): + """ + :rtype: object_.ScheduleAnchorObject + """ + + return self._scheduled_object + + @property + def result_object(self): + """ + :rtype: object_.ScheduleInstanceAnchorObject + """ + + return self._result_object + + @property + def request_reference_split_the_bill(self): + """ + :rtype: list[object_.RequestInquiryReference] + """ + + return self._request_reference_split_the_bill + + def is_all_field_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 + + if self._request_reference_split_the_bill is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: ScheduleInstance + """ + + return converter.json_to_class(ScheduleInstance, json_str) + + +class TabResultResponse(core.BunqModel): + """ + Used to view TabResultResponse objects belonging to a tab. A + TabResultResponse is an object that holds details on a tab which has been + paid from the provided monetary account. + + :param _tab: The Tab details. + :type _tab: Tab + :param _payment: The payment made for the Tab. + :type _payment: Payment + :param _request_reference_split_the_bill: The reference to the object used + for split the bill. Can be RequestInquiry or RequestInquiryBatch + :type _request_reference_split_the_bill: + list[object_.RequestInquiryReference] + """ + + # Endpoint constants. + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/tab-result-response/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/tab-result-response" + + # Object type. + _OBJECT_TYPE_GET = "TabResultResponse" + + _tab = None + _payment = None + _request_reference_split_the_bill = None + + @classmethod + def get(cls, tab_result_response_id, monetary_account_id=None, + custom_headers=None): + """ + Used to view a single TabResultResponse belonging to a tab. + + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type tab_result_response_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseTabResultResponse + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + tab_result_response_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseTabResultResponse.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def list(cls, monetary_account_id=None, params=None, custom_headers=None): + """ + Used to view a list of TabResultResponse objects belonging to a tab. + + :type user_id: int + :type monetary_account_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseTabResultResponseList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id)) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseTabResultResponseList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @property + def tab(self): + """ + :rtype: Tab + """ + + return self._tab + + @property + def payment(self): + """ + :rtype: Payment + """ + + return self._payment + + @property + def request_reference_split_the_bill(self): + """ + :rtype: list[object_.RequestInquiryReference] + """ + + return self._request_reference_split_the_bill + + def is_all_field_none(self): + """ + :rtype: bool + """ + + if self._tab is not None: + return False + + if self._payment is not None: + return False + + if self._request_reference_split_the_bill is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: TabResultResponse + """ + + return converter.json_to_class(TabResultResponse, json_str) + + +class WhitelistResult(core.BunqModel): + """ + Whitelist an SDD so that when one comes in, it is automatically accepted. + + :param _id_: The ID of the whitelist entry. + :type _id_: int + :param _monetary_account_paying_id: The account from which payments will be + deducted when a transaction is matched with this whitelist. + :type _monetary_account_paying_id: int + :param _status: The status of the WhitelistResult. + :type _status: str + :param _error_message: The message when the whitelist result has failed due + to user error. + :type _error_message: list[object_.Error] + :param _whitelist: The corresponding whitelist. + :type _whitelist: Whitelist + :param _object_: The details of the external object the event was created + for. + :type _object_: object_.WhitelistResultViewAnchoredObject + :param _request_reference_split_the_bill: The reference to the object used + for split the bill. Can be RequestInquiry or RequestInquiryBatch + :type _request_reference_split_the_bill: + list[object_.RequestInquiryReference] + """ + + _id_ = None + _monetary_account_paying_id = None + _status = None + _error_message = None + _whitelist = None + _object_ = None + _request_reference_split_the_bill = None + + @property + def id_(self): + """ + :rtype: int + """ + + return self._id_ + + @property + def monetary_account_paying_id(self): + """ + :rtype: int + """ + + return self._monetary_account_paying_id + + @property + def status(self): + """ + :rtype: str + """ + + return self._status + + @property + def error_message(self): + """ + :rtype: list[object_.Error] + """ + + return self._error_message + + @property + def whitelist(self): + """ + :rtype: Whitelist + """ + + return self._whitelist + + @property + def object_(self): + """ + :rtype: object_.WhitelistResultViewAnchoredObject + """ + + return self._object_ + + @property + def request_reference_split_the_bill(self): + """ + :rtype: list[object_.RequestInquiryReference] + """ + + return self._request_reference_split_the_bill + + def is_all_field_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + if self._monetary_account_paying_id is not None: + return False + + if self._status is not None: + return False + + if self._error_message is not None: + return False + + if self._whitelist is not None: + return False + + if self._object_ is not None: + return False + + if self._request_reference_split_the_bill is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: WhitelistResult + """ + + return converter.json_to_class(WhitelistResult, json_str) + + +class Whitelist(core.BunqModel): + """ + Whitelist a Request so that when one comes in, it is automatically accepted. + """ + + def is_all_field_none(self): + """ + :rtype: bool + """ + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: Whitelist + """ + + return converter.json_to_class(Whitelist, json_str) + + +class RequestInquiryBatch(core.BunqModel): + """ + Create a batch of requests for payment, or show the request batches of a + monetary account. + + :param _request_inquiries: The list of requests that were made. + :type _request_inquiries: list[RequestInquiry] + :param _status: The status of the request. + :type _status: str + :param _total_amount_inquired: The total amount originally inquired for this + batch. + :type _total_amount_inquired: object_.Amount + :param _event_id: The ID of the associated event if the request batch was + made using 'split the bill'. + :type _event_id: int + :param _reference_split_the_bill: The reference to the object used for split + the bill. Can be Payment, PaymentBatch, ScheduleInstance, RequestResponse + and MasterCardAction + :type _reference_split_the_bill: + object_.RequestReferenceSplitTheBillAnchorObject + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-inquiry-batch" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-inquiry-batch/{}" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/request-inquiry-batch/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-inquiry-batch" + + # Field constants. + FIELD_REQUEST_INQUIRIES = "request_inquiries" + FIELD_STATUS = "status" + FIELD_TOTAL_AMOUNT_INQUIRED = "total_amount_inquired" + FIELD_EVENT_ID = "event_id" + + # Object type. + _OBJECT_TYPE_GET = "RequestInquiryBatch" + + _request_inquiries = None + _total_amount_inquired = None + _reference_split_the_bill = None + _request_inquiries_field_for_request = None + _status_field_for_request = None + _total_amount_inquired_field_for_request = None + _event_id_field_for_request = None + + def __init__(self, request_inquiries, total_amount_inquired, status=None, + event_id=None): + """ + :param request_inquiries: The list of request inquiries we want to send in 1 + batch. + :type request_inquiries: list[RequestInquiry] + :param total_amount_inquired: The total amount originally inquired for this + batch. + :type total_amount_inquired: object_.Amount + :param status: The status of the request. + :type status: str + :param event_id: The ID of the associated event if the request batch was + made using 'split the bill'. + :type event_id: int + """ + + self._request_inquiries_field_for_request = request_inquiries + self._total_amount_inquired_field_for_request = total_amount_inquired + self._status_field_for_request = status + self._event_id_field_for_request = event_id + + @classmethod + def create(cls, request_inquiries, total_amount_inquired, + monetary_account_id=None, status=None, event_id=None, + custom_headers=None): + """ + Create a request batch by sending an array of single request objects, + that will become part of the batch. + + :type user_id: int + :type monetary_account_id: int + :param request_inquiries: The list of request inquiries we want to send + in 1 batch. + :type request_inquiries: list[RequestInquiry] + :param total_amount_inquired: The total amount originally inquired for + this batch. + :type total_amount_inquired: object_.Amount + :param status: The status of the request. + :type status: str + :param event_id: The ID of the associated event if the request batch was + made using 'split the bill'. + :type event_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_REQUEST_INQUIRIES: request_inquiries, + cls.FIELD_STATUS: status, + cls.FIELD_TOTAL_AMOUNT_INQUIRED: total_amount_inquired, + cls.FIELD_EVENT_ID: event_id + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_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, request_inquiry_batch_id, monetary_account_id=None, + status=None, custom_headers=None): + """ + Revoke a request batch. The status of all the requests will be set to + REVOKED. + + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_batch_id: int + :param status: The status of the request. + :type status: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_STATUS: status + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_batch_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def get(cls, request_inquiry_batch_id, monetary_account_id=None, + custom_headers=None): + """ + Return the details of a specific request batch. + + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_batch_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseRequestInquiryBatch + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + request_inquiry_batch_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseRequestInquiryBatch.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def list(cls, monetary_account_id=None, params=None, custom_headers=None): + """ + Return all the request batches for a monetary account. + + :type user_id: int + :type monetary_account_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseRequestInquiryBatchList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id)) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseRequestInquiryBatchList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @property + def request_inquiries(self): + """ + :rtype: list[RequestInquiry] + """ + + return self._request_inquiries + + @property + def total_amount_inquired(self): + """ + :rtype: object_.Amount + """ + + return self._total_amount_inquired + + @property + def reference_split_the_bill(self): + """ + :rtype: object_.RequestReferenceSplitTheBillAnchorObject + """ + + return self._reference_split_the_bill + + def is_all_field_none(self): + """ + :rtype: bool + """ + + if self._request_inquiries is not None: + return False + + if self._total_amount_inquired is not None: + return False + + if self._reference_split_the_bill is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: RequestInquiryBatch + """ + + return converter.json_to_class(RequestInquiryBatch, json_str) + + +class SchedulePayment(core.BunqModel): + """ + Endpoint for schedule payments. + + :param _payment: The payment details. + :type _payment: object_.SchedulePaymentEntry + :param _schedule: The schedule details. + :type _schedule: Schedule + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/schedule-payment" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/schedule-payment/{}" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/schedule-payment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/schedule-payment" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/schedule-payment/{}" + + # Field constants. + FIELD_PAYMENT = "payment" + FIELD_SCHEDULE = "schedule" + + # Object type. + _OBJECT_TYPE_GET = "ScheduledPayment" + + _payment = None + _schedule = None + _payment_field_for_request = None + _schedule_field_for_request = None + + def __init__(self, payment=None, schedule=None): + """ + :param payment: The payment details. + :type payment: object_.SchedulePaymentEntry + :param schedule: The schedule details when creating or updating a scheduled + payment. + :type schedule: Schedule + """ + + self._payment_field_for_request = payment + self._schedule_field_for_request = schedule + + @classmethod + def create(cls, payment, schedule, monetary_account_id=None, + custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :param payment: The payment details. + :type payment: object_.SchedulePaymentEntry + :param schedule: The schedule details when creating or updating a + scheduled payment. + :type schedule: Schedule + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + request_map = { + cls.FIELD_PAYMENT: payment, + cls.FIELD_SCHEDULE: schedule + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_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 delete(cls, schedule_payment_id, monetary_account_id=None, + custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type schedule_payment_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_payment_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + @classmethod + def get(cls, schedule_payment_id, monetary_account_id=None, + custom_headers=None): + """ + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type schedule_payment_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseSchedulePayment + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_payment_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseSchedulePayment.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def list(cls, monetary_account_id=None, params=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseSchedulePaymentList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id)) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseSchedulePaymentList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def update(cls, schedule_payment_id, monetary_account_id=None, payment=None, + schedule=None, custom_headers=None): + """ + :type user_id: int + :type monetary_account_id: int + :type schedule_payment_id: int + :param payment: The payment details. + :type payment: object_.SchedulePaymentEntry + :param schedule: The schedule details when creating or updating a + scheduled payment. + :type schedule: Schedule + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_PAYMENT: payment, + cls.FIELD_SCHEDULE: schedule + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_payment_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 payment(self): + """ + :rtype: object_.SchedulePaymentEntry + """ + + return self._payment + + @property + def schedule(self): + """ + :rtype: Schedule + """ + + return self._schedule + + def is_all_field_none(self): + """ + :rtype: bool + """ + + if self._payment is not None: + return False + + if self._schedule is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: SchedulePayment + """ + + return converter.json_to_class(SchedulePayment, json_str) + + +class Schedule(core.BunqModel): + """ + view for reading the scheduled definitions. + + :param _time_start: The schedule start time (UTC). + :type _time_start: str + :param _time_end: The schedule end time (UTC). + :type _time_end: str + :param _recurrence_unit: The schedule recurrence unit, options: ONCE, + HOURLY, DAILY, WEEKLY, MONTHLY, YEARLY + :type _recurrence_unit: str + :param _recurrence_size: The schedule recurrence size. For example size 4 + and unit WEEKLY means the recurrence is every 4 weeks. + :type _recurrence_size: int + :param _status: The schedule status, options: ACTIVE, FINISHED, CANCELLED. + :type _status: str + :param _object_: The scheduled object. (Payment, PaymentBatch) + :type _object_: object_.ScheduleAnchorObject + """ + + # Endpoint constants. + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/schedule/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/schedule" + + # Field constants. + FIELD_TIME_START = "time_start" + FIELD_TIME_END = "time_end" + FIELD_RECURRENCE_UNIT = "recurrence_unit" + FIELD_RECURRENCE_SIZE = "recurrence_size" + + # Object type. + _OBJECT_TYPE_GET = "Schedule" + + _time_start = None + _time_end = None + _recurrence_unit = None + _recurrence_size = None + _status = None + _object_ = None + _time_start_field_for_request = None + _time_end_field_for_request = None + _recurrence_unit_field_for_request = None + _recurrence_size_field_for_request = None + + def __init__(self, time_start=None, recurrence_unit=None, + recurrence_size=None, time_end=None): + """ + :param time_start: The schedule start time (UTC). + :type time_start: str + :param recurrence_unit: The schedule recurrence unit, options: ONCE, HOURLY, + DAILY, WEEKLY, MONTHLY, YEARLY + :type recurrence_unit: str + :param recurrence_size: The schedule recurrence size. For example size 4 and + unit WEEKLY means the recurrence is every 4 weeks. + :type recurrence_size: int + :param time_end: The schedule end time (UTC). + :type time_end: str + """ + + self._time_start_field_for_request = time_start + self._recurrence_unit_field_for_request = recurrence_unit + self._recurrence_size_field_for_request = recurrence_size + self._time_end_field_for_request = time_end + + @classmethod + def get(cls, schedule_id, monetary_account_id=None, custom_headers=None): + """ + Get a specific schedule definition for a given monetary account. + + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type schedule_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseSchedule + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseSchedule.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def list(cls, monetary_account_id=None, params=None, custom_headers=None): + """ + Get a collection of scheduled definition for a given monetary account. + 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 user_id: int + :type monetary_account_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseScheduleList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id)) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseScheduleList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @property + def time_start(self): + """ + :rtype: str + """ + + return self._time_start + + @property + def time_end(self): + """ + :rtype: str + """ + + return self._time_end + + @property + def recurrence_unit(self): + """ + :rtype: str + """ + + return self._recurrence_unit + + @property + def recurrence_size(self): + """ + :rtype: int + """ + + return self._recurrence_size + + @property + def status(self): + """ + :rtype: str + """ + + return self._status + + @property + def object_(self): + """ + :rtype: object_.ScheduleAnchorObject + """ + + return self._object_ + + def is_all_field_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 + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: Schedule + """ + + return converter.json_to_class(Schedule, json_str) + + +class TabResultInquiry(core.BunqModel): + """ + Used to view TabResultInquiry objects belonging to a tab. A TabResultInquiry + is an object that holds details on both the tab and a single payment made + for that tab. + + :param _tab: The Tab details. + :type _tab: Tab + :param _payment: The payment made for the Tab. + :type _payment: Payment + """ + + # Endpoint constants. + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-result-inquiry/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-result-inquiry" + + # Object type. + _OBJECT_TYPE_GET = "TabResultInquiry" + + _tab = None + _payment = None + + @classmethod + def get(cls, cash_register_id, tab_uuid, tab_result_inquiry_id, + monetary_account_id=None, custom_headers=None): + """ + Used to view a single TabResultInquiry belonging to a 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 tab_result_inquiry_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseTabResultInquiry + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + cash_register_id, tab_uuid, + tab_result_inquiry_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseTabResultInquiry.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def list(cls, cash_register_id, tab_uuid, monetary_account_id=None, + params=None, custom_headers=None): + """ + Used to view a list of TabResultInquiry objects belonging to a tab. + + :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: BunqResponseTabResultInquiryList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + cash_register_id, tab_uuid) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseTabResultInquiryList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @property + def tab(self): + """ + :rtype: Tab + """ + + return self._tab + + @property + def payment(self): + """ + :rtype: Payment + """ + + return self._payment + + def is_all_field_none(self): + """ + :rtype: bool + """ + + if self._tab is not None: + return False + + if self._payment is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: TabResultInquiry + """ + + return converter.json_to_class(TabResultInquiry, json_str) + + +class User(core.BunqModel, core.AnchoredObjectInterface): + """ + 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. + + :param _UserLight: + :type _UserLight: UserLight + :param _UserPerson: + :type _UserPerson: UserPerson + :param _UserCompany: + :type _UserCompany: UserCompany + :param _UserApiKey: + :type _UserApiKey: UserApiKey + """ + + # 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_GET = "User" + + _UserLight = None + _UserPerson = None + _UserCompany = None + _UserApiKey = None + + @classmethod + def get(cls, 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(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_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, params=None, custom_headers=None): + """ + Get a collection of all available users. + + :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(cls._get_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 + + @property + def UserApiKey(self): + """ + :rtype: UserApiKey + """ + + return self._UserApiKey + + 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 + + if self._UserApiKey is not None: + return self._UserApiKey + + raise exception.BunqException(self._ERROR_NULL_FIELDS) + + def is_all_field_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 + + if self._UserApiKey is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: User + """ + + return converter.json_to_class(User, json_str) + + +class UserLight(core.BunqModel): + """ + Show the authenticated user, if it is a light user. + + :param _first_name: The user's first name. + :type _first_name: str + :param _middle_name: The user's middle name. + :type _middle_name: str + :param _last_name: The user's last name. + :type _last_name: str + :param _public_nick_name: The public nick name for the user. + :type _public_nick_name: str + :param _address_main: The user's main address. + :type _address_main: object_.Address + :param _address_postal: The user's postal address. + :type _address_postal: object_.Address + :param _avatar_uuid: The public UUID of the user's avatar. + :type _avatar_uuid: str + :param _social_security_number: The user's social security number. + :type _social_security_number: str + :param _tax_resident: The user's tax residence numbers for different + countries. + :type _tax_resident: list[object_.TaxResident] + :param _document_type: The type of identification document the user + registered with. + :type _document_type: str + :param _document_number: The identification document number the user + registered with. + :type _document_number: str + :param _document_country_of_issuance: The country which issued the + identification document the user registered with. + :type _document_country_of_issuance: str + :param _document_front_attachment_id: The reference to the uploaded + picture/scan of the front side of the identification document. + :type _document_front_attachment_id: int + :param _document_back_attachment_id: The reference to the uploaded + picture/scan of the back side of the identification document. + :type _document_back_attachment_id: int + :param _date_of_birth: The user's date of birth. Accepts ISO8601 date + formats. + :type _date_of_birth: str + :param _place_of_birth: The user's place of birth. + :type _place_of_birth: str + :param _country_of_birth: The user's country of birth. Formatted as a SO + 3166-1 alpha-2 country code. + :type _country_of_birth: str + :param _nationality: The user's nationality. Formatted as a SO 3166-1 + alpha-2 country code. + :type _nationality: str + :param _language: The user's preferred language. Formatted as a ISO 639-1 + language code plus a ISO 3166-1 alpha-2 country code, seperated by an + underscore. + :type _language: str + :param _region: The user's preferred region. Formatted as a ISO 639-1 + language code plus a ISO 3166-1 alpha-2 country code, seperated by an + underscore. + :type _region: str + :param _gender: The user's gender. Can be MALE, FEMALE or UNKNOWN. + :type _gender: str + :param _status: The user status. The user status. Can be: ACTIVE, BLOCKED, + SIGNUP, DENIED or ABORTED. + :type _status: str + :param _sub_status: The user sub-status. Can be: NONE, FACE_RESET, APPROVAL, + APPROVAL_PARENT, AWAITING_PARENT, APPROVAL_SUPPORT, COUNTER_IBAN, IDEAL or + SUBMIT. + :type _sub_status: str + :param _legal_guardian_alias: The legal guardian of the user. Required for + minors. + :type _legal_guardian_alias: object_.Pointer + :param _session_timeout: The setting for the session timeout of the user in + seconds. + :type _session_timeout: int + :param _daily_limit_without_confirmation_login: The amount the user can pay + in the session without asking for credentials. + :type _daily_limit_without_confirmation_login: object_.Amount + :param _notification_filters: The types of notifications that will result in + a push notification or URL callback for this UserLight. + :type _notification_filters: list[object_.NotificationFilter] + :param _id_: The id of the user. + :type _id_: int + :param _created: The timestamp of the user object's creation. + :type _created: str + :param _updated: The timestamp of the user object's last update. + :type _updated: str + :param _public_uuid: The user's public UUID. + :type _public_uuid: str + :param _legal_name: The user's legal name. + :type _legal_name: str + :param _display_name: The display name for the user. + :type _display_name: str + :param _alias: The aliases of the user. + :type _alias: list[object_.Pointer] + :param _avatar: The user's avatar. + :type _avatar: object_.Avatar + :param _version_terms_of_service: The version of the terms of service + accepted by the user. + :type _version_terms_of_service: str + """ + + # Endpoint constants. + _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_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" + + # Object type. + _OBJECT_TYPE_GET = "UserPerson" + + _id_ = None + _created = None + _updated = None + _public_uuid = None + _first_name = None + _middle_name = None + _last_name = None + _legal_name = None + _display_name = None + _public_nick_name = None + _alias = None + _social_security_number = None + _tax_resident = None + _document_type = None + _document_number = None + _document_country_of_issuance = None + _address_main = None + _address_postal = None + _date_of_birth = None + _place_of_birth = None + _country_of_birth = None + _nationality = None + _language = None + _region = None + _gender = None + _avatar = None + _version_terms_of_service = None + _status = None + _sub_status = None + _session_timeout = None + _daily_limit_without_confirmation_login = None + _notification_filters = None + _first_name_field_for_request = None + _middle_name_field_for_request = None + _last_name_field_for_request = None + _public_nick_name_field_for_request = None + _address_main_field_for_request = None + _address_postal_field_for_request = None + _avatar_uuid_field_for_request = None + _social_security_number_field_for_request = None + _tax_resident_field_for_request = None + _document_type_field_for_request = None + _document_number_field_for_request = None + _document_country_of_issuance_field_for_request = None + _document_front_attachment_id_field_for_request = None + _document_back_attachment_id_field_for_request = None + _date_of_birth_field_for_request = None + _place_of_birth_field_for_request = None + _country_of_birth_field_for_request = None + _nationality_field_for_request = None + _language_field_for_request = None + _region_field_for_request = None + _gender_field_for_request = None + _status_field_for_request = None + _sub_status_field_for_request = None + _legal_guardian_alias_field_for_request = None + _session_timeout_field_for_request = None + _daily_limit_without_confirmation_login_field_for_request = None + _notification_filters_field_for_request = None + + def __init__(self, social_security_number=None, legal_guardian_alias=None, + gender=None, nationality=None, country_of_birth=None, + place_of_birth=None, document_back_attachment_id=None, + document_front_attachment_id=None, + document_country_of_issuance=None, document_number=None, + document_type=None, tax_resident=None, address_postal=None, + first_name=None, middle_name=None, + daily_limit_without_confirmation_login=None, + session_timeout=None, sub_status=None, status=None, + region=None, language=None, date_of_birth=None, + avatar_uuid=None, address_main=None, public_nick_name=None, + last_name=None, notification_filters=None): + """ + :param first_name: The user's first name. + :type first_name: str + :param last_name: The user's last name. + :type last_name: str + :param public_nick_name: The user's public nick name. + :type public_nick_name: str + :param address_main: The user's main address. + :type address_main: object_.Address + :param avatar_uuid: The public UUID of the user's avatar. + :type avatar_uuid: str + :param date_of_birth: The user's date of birth. Accepts ISO8601 date + formats. + :type date_of_birth: str + :param language: The user's preferred language. Formatted as a ISO 639-1 + language code plus a ISO 3166-1 alpha-2 country code, seperated by an + underscore. + :type language: str + :param region: The user's preferred region. Formatted as a ISO 639-1 + language code plus a ISO 3166-1 alpha-2 country code, seperated by an + underscore. + :type region: str + :param status: The user status. You are not allowed to update the status via + PUT. + :type status: str + :param sub_status: The user sub-status. Can be updated to SUBMIT to apply + for a full bunq account. + :type sub_status: str + :param session_timeout: The setting for the session timeout of the user in + seconds. + :type session_timeout: int + :param daily_limit_without_confirmation_login: The amount the user can pay + in the session without asking for credentials. + :type daily_limit_without_confirmation_login: object_.Amount + :param middle_name: The user's middle name. + :type middle_name: str + :param address_postal: The user's postal address. + :type address_postal: object_.Address + :param social_security_number: The user's social security number. + :type social_security_number: str + :param tax_resident: The user's tax residence numbers for different + countries. + :type tax_resident: list[object_.TaxResident] + :param document_type: The type of identification document the user + registered with. + :type document_type: str + :param document_number: The identification document number the user + registered with. + :type document_number: str + :param document_country_of_issuance: The country which issued the + identification document the user registered with. + :type document_country_of_issuance: str + :param document_front_attachment_id: The reference to the uploaded + picture/scan of the front side of the identification document. + :type document_front_attachment_id: int + :param document_back_attachment_id: The reference to the uploaded + picture/scan of the back side of the identification document. + :type document_back_attachment_id: int + :param place_of_birth: The user's place of birth. + :type place_of_birth: str + :param country_of_birth: The user's country of birth. Formatted as a SO + 3166-1 alpha-2 country code. + :type country_of_birth: str + :param nationality: The user's nationality. Formatted as a SO 3166-1 alpha-2 + country code. + :type nationality: str + :param gender: The user's gender. Can be: MALE, FEMALE and UNKNOWN. + :type gender: str + :param legal_guardian_alias: The legal guardian of the user. Required for + minors. + :type legal_guardian_alias: object_.Pointer + :param notification_filters: The types of notifications that will result in + a push notification or URL callback for this UserLight. + :type notification_filters: list[object_.NotificationFilter] + """ + + self._first_name_field_for_request = first_name + self._last_name_field_for_request = last_name + self._public_nick_name_field_for_request = public_nick_name + self._address_main_field_for_request = address_main + self._avatar_uuid_field_for_request = avatar_uuid + self._date_of_birth_field_for_request = date_of_birth + self._language_field_for_request = language + self._region_field_for_request = region + self._status_field_for_request = status + self._sub_status_field_for_request = sub_status + self._session_timeout_field_for_request = session_timeout + self._daily_limit_without_confirmation_login_field_for_request = daily_limit_without_confirmation_login + self._middle_name_field_for_request = middle_name + self._address_postal_field_for_request = address_postal + self._social_security_number_field_for_request = social_security_number + self._tax_resident_field_for_request = tax_resident + self._document_type_field_for_request = document_type + self._document_number_field_for_request = document_number + self._document_country_of_issuance_field_for_request = document_country_of_issuance + self._document_front_attachment_id_field_for_request = document_front_attachment_id + self._document_back_attachment_id_field_for_request = document_back_attachment_id + self._place_of_birth_field_for_request = place_of_birth + self._country_of_birth_field_for_request = country_of_birth + self._nationality_field_for_request = nationality + self._gender_field_for_request = gender + self._legal_guardian_alias_field_for_request = legal_guardian_alias + self._notification_filters_field_for_request = notification_filters + + @classmethod + def get(cls, user_light_id, custom_headers=None): + """ + Get a specific bunq light user. + + :type api_context: context.ApiContext + :type user_light_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseUserLight + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_light_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseUserLight.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @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 public_uuid(self): + """ + :rtype: str + """ + + return self._public_uuid + + @property + def first_name(self): + """ + :rtype: str + """ + + 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): + """ + :rtype: str + """ + + return self._display_name + + @property + def public_nick_name(self): + """ + :rtype: str + """ + + return self._public_nick_name + + @property + def alias(self): + """ + :rtype: list[object_.Pointer] + """ + + return self._alias + + @property + def social_security_number(self): + """ + :rtype: str + """ + + return self._social_security_number + + @property + def tax_resident(self): + """ + :rtype: list[object_.TaxResident] + """ + + return self._tax_resident + + @property + def document_type(self): + """ + :rtype: str + """ + + return self._document_type + + @property + def document_number(self): + """ + :rtype: str + """ + + return self._document_number + + @property + def document_country_of_issuance(self): + """ + :rtype: str + """ + + return self._document_country_of_issuance + + @property + def address_main(self): + """ + :rtype: object_.Address + """ + + return self._address_main + + @property + def address_postal(self): + """ + :rtype: object_.Address + """ + + return self._address_postal + + @property + def date_of_birth(self): + """ + :rtype: str + """ + + return self._date_of_birth + + @property + def place_of_birth(self): + """ + :rtype: str + """ + + return self._place_of_birth + + @property + def country_of_birth(self): + """ + :rtype: str + """ + + return self._country_of_birth + + @property + def nationality(self): + """ + :rtype: str + """ + + return self._nationality + + @property + def language(self): + """ + :rtype: str + """ + + return self._language + + @property + def region(self): + """ + :rtype: str + """ + + return self._region + + @property + def gender(self): + """ + :rtype: str + """ + + 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): + """ + :rtype: str + """ + + return self._status + + @property + def sub_status(self): + """ + :rtype: str + """ + + return self._sub_status + + @property + def session_timeout(self): + """ + :rtype: int + """ + + return self._session_timeout + + @property + def daily_limit_without_confirmation_login(self): + """ + :rtype: object_.Amount + """ + + return self._daily_limit_without_confirmation_login + + @property + def notification_filters(self): + """ + :rtype: list[object_.NotificationFilter] + """ + + return self._notification_filters + + def is_all_field_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._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 + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: UserLight + """ + + return converter.json_to_class(UserLight, json_str) + + +class UserPerson(core.BunqModel): + """ + 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. + + :param _first_name: The person's first name. + :type _first_name: str + :param _middle_name: The person's middle name. + :type _middle_name: str + :param _last_name: The person's last name. + :type _last_name: str + :param _public_nick_name: The public nick name for the person. + :type _public_nick_name: str + :param _address_main: The person's main address. + :type _address_main: object_.Address + :param _address_postal: The person's postal address. + :type _address_postal: object_.Address + :param _avatar_uuid: The public UUID of the user's avatar. + :type _avatar_uuid: str + :param _tax_resident: The user's tax residence numbers for different + countries. + :type _tax_resident: list[object_.TaxResident] + :param _document_type: The type of identification document the person + registered with. + :type _document_type: str + :param _document_number: The identification document number the person + registered with. + :type _document_number: str + :param _document_country_of_issuance: The country which issued the + identification document the person registered with. + :type _document_country_of_issuance: str + :param _document_front_attachment_id: The reference to the uploaded + picture/scan of the front side of the identification document. + :type _document_front_attachment_id: int + :param _document_back_attachment_id: The reference to the uploaded + picture/scan of the back side of the identification document. + :type _document_back_attachment_id: int + :param _date_of_birth: The person's date of birth. Accepts ISO8601 date + formats. + :type _date_of_birth: str + :param _place_of_birth: The person's place of birth. + :type _place_of_birth: str + :param _country_of_birth: The person's country of birth. Formatted as a SO + 3166-1 alpha-2 country code. + :type _country_of_birth: str + :param _nationality: The person's nationality. Formatted as a SO 3166-1 + alpha-2 country code. + :type _nationality: str + :param _language: The person's preferred language. Formatted as a ISO 639-1 + language code plus a ISO 3166-1 alpha-2 country code, seperated by an + underscore. + :type _language: str + :param _region: The person's preferred region. Formatted as a ISO 639-1 + language code plus a ISO 3166-1 alpha-2 country code, seperated by an + underscore. + :type _region: str + :param _gender: The person's gender. Can be MALE, FEMALE or UNKNOWN. + :type _gender: str + :param _status: The user status. The user status. Can be: ACTIVE, BLOCKED, + SIGNUP, RECOVERY, DENIED or ABORTED. + :type _status: str + :param _sub_status: The user sub-status. Can be: NONE, FACE_RESET, APPROVAL, + APPROVAL_DIRECTOR, APPROVAL_PARENT, APPROVAL_SUPPORT, COUNTER_IBAN, IDEAL or + SUBMIT. + :type _sub_status: str + :param _legal_guardian_alias: The legal guardian of the user. Required for + minors. + :type _legal_guardian_alias: object_.Pointer + :param _session_timeout: The setting for the session timeout of the user in + seconds. + :type _session_timeout: int + :param _card_ids: Card ids used for centralized card limits. + :type _card_ids: list[object_.BunqId] + :param _card_limits: The centralized limits for user's cards. + :type _card_limits: list[object_.CardLimit] + :param _daily_limit_without_confirmation_login: The amount the user can pay + in the session without asking for credentials. + :type _daily_limit_without_confirmation_login: object_.Amount + :param _notification_filters: The types of notifications that will result in + a push notification or URL callback for this UserPerson. + :type _notification_filters: list[object_.NotificationFilter] + :param _id_: The id of the modified person object. + :type _id_: int + :param _created: The timestamp of the person object's creation. + :type _created: str + :param _updated: The timestamp of the person object's last update. + :type _updated: str + :param _public_uuid: The person's public UUID. + :type _public_uuid: str + :param _legal_name: The person's legal name. + :type _legal_name: str + :param _display_name: The display name for the person. + :type _display_name: str + :param _alias: The aliases of the user. + :type _alias: list[object_.Pointer] + :param _avatar: The user's avatar. + :type _avatar: object_.Avatar + :param _version_terms_of_service: The version of the terms of service + accepted by the user. + :type _version_terms_of_service: str + """ + + # Endpoint constants. + _ENDPOINT_URL_READ = "user-person/{}" + _ENDPOINT_URL_UPDATE = "user-person/{}" + + # 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_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" @@ -16017,6 +24576,8 @@ class UserLight(core.BunqModel): FIELD_SUB_STATUS = "sub_status" FIELD_LEGAL_GUARDIAN_ALIAS = "legal_guardian_alias" FIELD_SESSION_TIMEOUT = "session_timeout" + FIELD_CARD_IDS = "card_ids" + FIELD_CARD_LIMITS = "card_limits" FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN = "daily_limit_without_confirmation_login" FIELD_NOTIFICATION_FILTERS = "notification_filters" @@ -16034,7 +24595,6 @@ class UserLight(core.BunqModel): _display_name = None _public_nick_name = None _alias = None - _social_security_number = None _tax_resident = None _document_type = None _document_number = None @@ -16062,7 +24622,6 @@ class UserLight(core.BunqModel): _address_main_field_for_request = None _address_postal_field_for_request = None _avatar_uuid_field_for_request = None - _social_security_number_field_for_request = None _tax_resident_field_for_request = None _document_type_field_for_request = None _document_number_field_for_request = None @@ -16080,72 +24639,195 @@ class UserLight(core.BunqModel): _sub_status_field_for_request = None _legal_guardian_alias_field_for_request = None _session_timeout_field_for_request = None + _card_ids_field_for_request = None + _card_limits_field_for_request = None _daily_limit_without_confirmation_login_field_for_request = None _notification_filters_field_for_request = None - def __init__(self, social_security_number=None, legal_guardian_alias=None, - gender=None, nationality=None, country_of_birth=None, - place_of_birth=None, document_back_attachment_id=None, - document_front_attachment_id=None, - document_country_of_issuance=None, document_number=None, - document_type=None, tax_resident=None, address_postal=None, - first_name=None, middle_name=None, + def __init__(self, sub_status=None, card_limits=None, card_ids=None, + document_back_attachment_id=None, tax_resident=None, + address_postal=None, public_nick_name=None, last_name=None, + middle_name=None, first_name=None, daily_limit_without_confirmation_login=None, - session_timeout=None, sub_status=None, status=None, - region=None, language=None, date_of_birth=None, - avatar_uuid=None, address_main=None, public_nick_name=None, - last_name=None, notification_filters=None): + session_timeout=None, legal_guardian_alias=None, status=None, + address_main=None, gender=None, region=None, language=None, + nationality=None, country_of_birth=None, place_of_birth=None, + date_of_birth=None, document_front_attachment_id=None, + document_country_of_issuance=None, document_number=None, + document_type=None, avatar_uuid=None, + notification_filters=None): """ - :param first_name: The user's first name. - :type first_name: str - :param last_name: The user's last name. - :type last_name: str - :param public_nick_name: The user's public nick name. - :type public_nick_name: str :param address_main: The user's main address. :type address_main: object_.Address :param avatar_uuid: The public UUID of the user's avatar. :type avatar_uuid: str - :param date_of_birth: The user's date of birth. Accepts ISO8601 date + :param document_type: The type of identification document the person + registered with. + :type document_type: str + :param document_number: The identification document number the person + registered with. + :type document_number: str + :param document_country_of_issuance: The country which issued the + identification document the person registered with. + :type document_country_of_issuance: str + :param document_front_attachment_id: The reference to the uploaded + picture/scan of the front side of the identification document. + :type document_front_attachment_id: int + :param date_of_birth: The person's date of birth. Accepts ISO8601 date formats. :type date_of_birth: str - :param language: The user's preferred language. Formatted as a ISO 639-1 + :param place_of_birth: The person's place of birth. + :type place_of_birth: str + :param country_of_birth: The person's country of birth. Formatted as a SO + 3166-1 alpha-2 country code. + :type country_of_birth: str + :param nationality: The person's nationality. Formatted as a SO 3166-1 + alpha-2 country code. + :type nationality: str + :param language: The person's preferred language. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country code, seperated by an underscore. :type language: str - :param region: The user's preferred region. Formatted as a ISO 639-1 + :param region: The person's preferred region. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country code, seperated by an underscore. :type region: str + :param gender: The person's gender. Can be: MALE, FEMALE and UNKNOWN. + :type gender: str :param status: The user status. You are not allowed to update the status via PUT. :type status: str - :param sub_status: The user sub-status. Can be updated to SUBMIT to apply - for a full bunq account. + :param sub_status: The user sub-status. Can be updated to SUBMIT if status + is RECOVERY. :type sub_status: str + :param legal_guardian_alias: The legal guardian of the user. Required for + minors. + :type legal_guardian_alias: object_.Pointer :param session_timeout: The setting for the session timeout of the user in seconds. :type session_timeout: int :param daily_limit_without_confirmation_login: The amount the user can pay in the session without asking for credentials. :type daily_limit_without_confirmation_login: object_.Amount - :param middle_name: The user's middle name. + :param first_name: The person's first name. + :type first_name: str + :param middle_name: The person's middle name. :type middle_name: str - :param address_postal: The user's postal address. + :param last_name: The person's last name. + :type last_name: str + :param public_nick_name: The person's public nick name. + :type public_nick_name: str + :param address_postal: The person's postal address. :type address_postal: object_.Address - :param social_security_number: The user's social security number. - :type social_security_number: str :param tax_resident: The user's tax residence numbers for different countries. :type tax_resident: list[object_.TaxResident] - :param document_type: The type of identification document the user + :param document_back_attachment_id: The reference to the uploaded + picture/scan of the back side of the identification document. + :type document_back_attachment_id: int + :param card_ids: Card ids used for centralized card limits. + :type card_ids: list[object_.BunqId] + :param card_limits: The centralized limits for user's cards. + :type card_limits: list[object_.CardLimit] + :param notification_filters: The types of notifications that will result in + a push notification or URL callback for this UserPerson. + :type notification_filters: list[object_.NotificationFilter] + """ + + self._address_main_field_for_request = address_main + self._avatar_uuid_field_for_request = avatar_uuid + self._document_type_field_for_request = document_type + self._document_number_field_for_request = document_number + self._document_country_of_issuance_field_for_request = document_country_of_issuance + self._document_front_attachment_id_field_for_request = document_front_attachment_id + self._date_of_birth_field_for_request = date_of_birth + self._place_of_birth_field_for_request = place_of_birth + self._country_of_birth_field_for_request = country_of_birth + self._nationality_field_for_request = nationality + self._language_field_for_request = language + self._region_field_for_request = region + self._gender_field_for_request = gender + self._status_field_for_request = status + self._sub_status_field_for_request = sub_status + self._legal_guardian_alias_field_for_request = legal_guardian_alias + self._session_timeout_field_for_request = session_timeout + self._daily_limit_without_confirmation_login_field_for_request = daily_limit_without_confirmation_login + self._first_name_field_for_request = first_name + self._middle_name_field_for_request = middle_name + self._last_name_field_for_request = last_name + self._public_nick_name_field_for_request = public_nick_name + self._address_postal_field_for_request = address_postal + self._tax_resident_field_for_request = tax_resident + self._document_back_attachment_id_field_for_request = document_back_attachment_id + self._card_ids_field_for_request = card_ids + self._card_limits_field_for_request = card_limits + self._notification_filters_field_for_request = notification_filters + + @classmethod + def get(cls, custom_headers=None): + """ + Get a specific person. + + :type api_context: context.ApiContext + :type user_person_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseUserPerson + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id()) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseUserPerson.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def update(cls, first_name=None, middle_name=None, last_name=None, + public_nick_name=None, address_main=None, address_postal=None, + avatar_uuid=None, tax_resident=None, document_type=None, + document_number=None, document_country_of_issuance=None, + document_front_attachment_id=None, + document_back_attachment_id=None, date_of_birth=None, + place_of_birth=None, country_of_birth=None, nationality=None, + language=None, region=None, gender=None, status=None, + sub_status=None, legal_guardian_alias=None, session_timeout=None, + card_ids=None, card_limits=None, + daily_limit_without_confirmation_login=None, + notification_filters=None, custom_headers=None): + """ + Modify a specific person object's data. + + :type user_person_id: int + :param first_name: The person's first name. + :type first_name: str + :param middle_name: The person's middle name. + :type middle_name: str + :param last_name: The person's last name. + :type last_name: str + :param public_nick_name: The person's public nick name. + :type public_nick_name: str + :param address_main: The user's main address. + :type address_main: object_.Address + :param address_postal: The person's postal address. + :type address_postal: object_.Address + :param avatar_uuid: The public UUID of the user's avatar. + :type avatar_uuid: str + :param tax_resident: The user's tax residence numbers for different + countries. + :type tax_resident: list[object_.TaxResident] + :param document_type: The type of identification document the person registered with. :type document_type: str - :param document_number: The identification document number the user + :param document_number: The identification document number the person registered with. :type document_number: str :param document_country_of_issuance: The country which issued the - identification document the user registered with. + identification document the person registered with. :type document_country_of_issuance: str :param document_front_attachment_id: The reference to the uploaded picture/scan of the front side of the identification document. @@ -16153,73 +24835,99 @@ def __init__(self, social_security_number=None, legal_guardian_alias=None, :param document_back_attachment_id: The reference to the uploaded picture/scan of the back side of the identification document. :type document_back_attachment_id: int - :param place_of_birth: The user's place of birth. + :param date_of_birth: The person's date of birth. Accepts ISO8601 date + formats. + :type date_of_birth: str + :param place_of_birth: The person's place of birth. :type place_of_birth: str - :param country_of_birth: The user's country of birth. Formatted as a SO - 3166-1 alpha-2 country code. + :param country_of_birth: The person's country of birth. Formatted as a + SO 3166-1 alpha-2 country code. :type country_of_birth: str - :param nationality: The user's nationality. Formatted as a SO 3166-1 alpha-2 - country code. + :param nationality: The person's nationality. Formatted as a SO 3166-1 + alpha-2 country code. :type nationality: str - :param gender: The user's gender. Can be: MALE, FEMALE and UNKNOWN. + :param language: The person's preferred language. Formatted as a ISO + 639-1 language code plus a ISO 3166-1 alpha-2 country code, seperated by + an underscore. + :type language: str + :param region: The person's preferred region. Formatted as a ISO 639-1 + language code plus a ISO 3166-1 alpha-2 country code, seperated by an + underscore. + :type region: str + :param gender: The person's gender. Can be: MALE, FEMALE and UNKNOWN. :type gender: str - :param legal_guardian_alias: The legal guardian of the user. Required for - minors. - :type legal_guardian_alias: object_.Pointer - :param notification_filters: The types of notifications that will result in - a push notification or URL callback for this UserLight. + :param status: The user status. You are not allowed to update the status + via PUT. + :type status: str + :param sub_status: The user sub-status. Can be updated to SUBMIT if + status is RECOVERY. + :type sub_status: str + :param legal_guardian_alias: The legal guardian of the user. Required + for minors. + :type legal_guardian_alias: object_.Pointer + :param session_timeout: The setting for the session timeout of the user + in seconds. + :type session_timeout: int + :param card_ids: Card ids used for centralized card limits. + :type card_ids: list[object_.BunqId] + :param card_limits: The centralized limits for user's cards. + :type card_limits: list[object_.CardLimit] + :param daily_limit_without_confirmation_login: The amount the user can + pay in the session without asking for credentials. + :type daily_limit_without_confirmation_login: object_.Amount + :param notification_filters: The types of notifications that will result + in a push notification or URL callback for this UserPerson. :type notification_filters: list[object_.NotificationFilter] - """ - - self._first_name_field_for_request = first_name - self._last_name_field_for_request = last_name - self._public_nick_name_field_for_request = public_nick_name - self._address_main_field_for_request = address_main - self._avatar_uuid_field_for_request = avatar_uuid - self._date_of_birth_field_for_request = date_of_birth - self._language_field_for_request = language - self._region_field_for_request = region - self._status_field_for_request = status - self._sub_status_field_for_request = sub_status - self._session_timeout_field_for_request = session_timeout - self._daily_limit_without_confirmation_login_field_for_request = daily_limit_without_confirmation_login - self._middle_name_field_for_request = middle_name - self._address_postal_field_for_request = address_postal - self._social_security_number_field_for_request = social_security_number - self._tax_resident_field_for_request = tax_resident - self._document_type_field_for_request = document_type - self._document_number_field_for_request = document_number - self._document_country_of_issuance_field_for_request = document_country_of_issuance - self._document_front_attachment_id_field_for_request = document_front_attachment_id - self._document_back_attachment_id_field_for_request = document_back_attachment_id - self._place_of_birth_field_for_request = place_of_birth - self._country_of_birth_field_for_request = country_of_birth - self._nationality_field_for_request = nationality - self._gender_field_for_request = gender - self._legal_guardian_alias_field_for_request = legal_guardian_alias - self._notification_filters_field_for_request = notification_filters - - @classmethod - def get(cls, user_light_id, custom_headers=None): - """ - Get a specific bunq light user. - - :type api_context: context.ApiContext - :type user_light_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseUserLight + :rtype: BunqResponseInt """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_light_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseUserLight.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + request_map = { + cls.FIELD_FIRST_NAME: first_name, + cls.FIELD_MIDDLE_NAME: middle_name, + cls.FIELD_LAST_NAME: last_name, + cls.FIELD_PUBLIC_NICK_NAME: public_nick_name, + cls.FIELD_ADDRESS_MAIN: address_main, + cls.FIELD_ADDRESS_POSTAL: address_postal, + cls.FIELD_AVATAR_UUID: avatar_uuid, + cls.FIELD_TAX_RESIDENT: tax_resident, + cls.FIELD_DOCUMENT_TYPE: document_type, + cls.FIELD_DOCUMENT_NUMBER: document_number, + cls.FIELD_DOCUMENT_COUNTRY_OF_ISSUANCE: document_country_of_issuance, + cls.FIELD_DOCUMENT_FRONT_ATTACHMENT_ID: document_front_attachment_id, + cls.FIELD_DOCUMENT_BACK_ATTACHMENT_ID: document_back_attachment_id, + cls.FIELD_DATE_OF_BIRTH: date_of_birth, + cls.FIELD_PLACE_OF_BIRTH: place_of_birth, + cls.FIELD_COUNTRY_OF_BIRTH: country_of_birth, + cls.FIELD_NATIONALITY: nationality, + cls.FIELD_LANGUAGE: language, + cls.FIELD_REGION: region, + cls.FIELD_GENDER: gender, + cls.FIELD_STATUS: status, + cls.FIELD_SUB_STATUS: sub_status, + cls.FIELD_LEGAL_GUARDIAN_ALIAS: legal_guardian_alias, + cls.FIELD_SESSION_TIMEOUT: session_timeout, + cls.FIELD_CARD_IDS: card_ids, + cls.FIELD_CARD_LIMITS: card_limits, + cls.FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN: daily_limit_without_confirmation_login, + cls.FIELD_NOTIFICATION_FILTERS: notification_filters + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_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 @@ -16310,14 +25018,6 @@ def alias(self): return self._alias - @property - def social_security_number(self): - """ - :rtype: str - """ - - return self._social_security_number - @property def tax_resident(self): """ @@ -16516,9 +25216,6 @@ def is_all_field_none(self): 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 @@ -16586,62 +25283,29 @@ def from_json(json_str): """ :type json_str: str - :rtype: UserLight + :rtype: UserPerson """ - return converter.json_to_class(UserLight, json_str) + return converter.json_to_class(UserPerson, json_str) -class UserPerson(core.BunqModel): +class UserCompany(core.BunqModel): """ - 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 + 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. - :param _first_name: The person's first name. - :type _first_name: str - :param _middle_name: The person's middle name. - :type _middle_name: str - :param _last_name: The person's last name. - :type _last_name: str - :param _public_nick_name: The public nick name for the person. + :param _name: The company name. + :type _name: str + :param _public_nick_name: The company's public nick name. :type _public_nick_name: str - :param _address_main: The person's main address. + :param _avatar_uuid: The public UUID of the company's avatar. + :type _avatar_uuid: str + :param _address_main: The company's main address. :type _address_main: object_.Address - :param _address_postal: The person's postal address. + :param _address_postal: The company's postal address. :type _address_postal: object_.Address - :param _avatar_uuid: The public UUID of the user's avatar. - :type _avatar_uuid: str - :param _tax_resident: The user's tax residence numbers for different - countries. - :type _tax_resident: list[object_.TaxResident] - :param _document_type: The type of identification document the person - registered with. - :type _document_type: str - :param _document_number: The identification document number the person - registered with. - :type _document_number: str - :param _document_country_of_issuance: The country which issued the - identification document the person registered with. - :type _document_country_of_issuance: str - :param _document_front_attachment_id: The reference to the uploaded - picture/scan of the front side of the identification document. - :type _document_front_attachment_id: int - :param _document_back_attachment_id: The reference to the uploaded - picture/scan of the back side of the identification document. - :type _document_back_attachment_id: int - :param _date_of_birth: The person's date of birth. Accepts ISO8601 date - formats. - :type _date_of_birth: str - :param _place_of_birth: The person's place of birth. - :type _place_of_birth: str - :param _country_of_birth: The person's country of birth. Formatted as a SO - 3166-1 alpha-2 country code. - :type _country_of_birth: str - :param _nationality: The person's nationality. Formatted as a SO 3166-1 - alpha-2 country code. - :type _nationality: str :param _language: The person's preferred language. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country code, seperated by an underscore. @@ -16650,189 +25314,148 @@ class UserPerson(core.BunqModel): language code plus a ISO 3166-1 alpha-2 country code, seperated by an underscore. :type _region: str - :param _gender: The person's gender. Can be MALE, FEMALE or UNKNOWN. - :type _gender: str - :param _status: The user status. The user status. Can be: ACTIVE, BLOCKED, - SIGNUP, RECOVERY, DENIED or ABORTED. + :param _country: The country as an ISO 3166-1 alpha-2 country code.. + :type _country: str + :param _ubo: The names of the company's ultimate beneficiary owners. Minimum + zero, maximum four. + :type _ubo: list[object_.Ubo] + :param _chamber_of_commerce_number: The company's chamber of commerce + number. + :type _chamber_of_commerce_number: str + :param _status: The user status. Can be: ACTIVE, SIGNUP, RECOVERY. :type _status: str :param _sub_status: The user sub-status. Can be: NONE, FACE_RESET, APPROVAL, APPROVAL_DIRECTOR, APPROVAL_PARENT, APPROVAL_SUPPORT, COUNTER_IBAN, IDEAL or SUBMIT. :type _sub_status: str - :param _legal_guardian_alias: The legal guardian of the user. Required for - minors. - :type _legal_guardian_alias: object_.Pointer - :param _session_timeout: The setting for the session timeout of the user in - seconds. + :param _session_timeout: The setting for the session timeout of the company + in seconds. :type _session_timeout: int - :param _card_ids: Card ids used for centralized card limits. - :type _card_ids: list[object_.BunqId] - :param _card_limits: The centralized limits for user's cards. - :type _card_limits: list[object_.CardLimit] - :param _daily_limit_without_confirmation_login: The amount the user can pay - in the session without asking for credentials. + :param _daily_limit_without_confirmation_login: The amount the company can + pay in the session without asking for credentials. :type _daily_limit_without_confirmation_login: object_.Amount :param _notification_filters: The types of notifications that will result in - a push notification or URL callback for this UserPerson. + a push notification or URL callback for this UserCompany. :type _notification_filters: list[object_.NotificationFilter] - :param _id_: The id of the modified person object. + :param _id_: The id of the modified company. :type _id_: int - :param _created: The timestamp of the person object's creation. + :param _created: The timestamp of the company object's creation. :type _created: str - :param _updated: The timestamp of the person object's last update. + :param _updated: The timestamp of the company object's last update. :type _updated: str - :param _public_uuid: The person's public UUID. + :param _public_uuid: The company's public UUID. :type _public_uuid: str - :param _legal_name: The person's legal name. - :type _legal_name: str - :param _display_name: The display name for the person. + :param _display_name: The company's display name. :type _display_name: str - :param _alias: The aliases of the user. + :param _alias: The aliases of the account. :type _alias: list[object_.Pointer] - :param _avatar: The user's avatar. + :param _type_of_business_entity: The type of business entity. + :type _type_of_business_entity: str + :param _sector_of_industry: The sector of industry. + :type _sector_of_industry: str + :param _counter_bank_iban: The company's other bank account IBAN, through + which we verify it. + :type _counter_bank_iban: str + :param _avatar: The company's avatar. :type _avatar: object_.Avatar :param _version_terms_of_service: The version of the terms of service accepted by the user. :type _version_terms_of_service: str + :param _director_alias: The existing bunq user alias for the company's + director. + :type _director_alias: object_.LabelUser + :param _card_ids: Card ids used for centralized card limits. + :type _card_ids: list[object_.BunqId] + :param _card_limits: The centralized limits for user's cards. + :type _card_limits: list[object_.CardLimit] + :param _customer: The customer profile of the company. + :type _customer: Customer + :param _customer_limit: The customer limits of the company. + :type _customer_limit: CustomerLimit + :param _billing_contract: The subscription of the company. + :type _billing_contract: list[BillingContractSubscription] """ # Endpoint constants. - _ENDPOINT_URL_READ = "user-person/{}" - _ENDPOINT_URL_UPDATE = "user-person/{}" + _ENDPOINT_URL_READ = "user-company/{}" + _ENDPOINT_URL_UPDATE = "user-company/{}" # Field constants. - FIELD_FIRST_NAME = "first_name" - FIELD_MIDDLE_NAME = "middle_name" - FIELD_LAST_NAME = "last_name" + 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_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_GENDER = "gender" + FIELD_COUNTRY = "country" + FIELD_UBO = "ubo" + FIELD_CHAMBER_OF_COMMERCE_NUMBER = "chamber_of_commerce_number" FIELD_STATUS = "status" FIELD_SUB_STATUS = "sub_status" - FIELD_LEGAL_GUARDIAN_ALIAS = "legal_guardian_alias" FIELD_SESSION_TIMEOUT = "session_timeout" - FIELD_CARD_IDS = "card_ids" - FIELD_CARD_LIMITS = "card_limits" FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN = "daily_limit_without_confirmation_login" FIELD_NOTIFICATION_FILTERS = "notification_filters" # Object type. - _OBJECT_TYPE_GET = "UserPerson" + _OBJECT_TYPE_GET = "UserCompany" _id_ = None _created = None _updated = None _public_uuid = None - _first_name = None - _middle_name = None - _last_name = None - _legal_name = None + _name = None _display_name = None _public_nick_name = None _alias = None - _tax_resident = None - _document_type = None - _document_number = None - _document_country_of_issuance = None + _chamber_of_commerce_number = None + _type_of_business_entity = None + _sector_of_industry = None + _counter_bank_iban = None + _avatar = None _address_main = None _address_postal = None - _date_of_birth = None - _place_of_birth = None - _country_of_birth = None - _nationality = None + _version_terms_of_service = None + _director_alias = None _language = None + _country = None _region = None - _gender = None - _avatar = None - _version_terms_of_service = None + _ubo = None _status = None _sub_status = None _session_timeout = None + _card_ids = None + _card_limits = None _daily_limit_without_confirmation_login = None _notification_filters = None - _first_name_field_for_request = None - _middle_name_field_for_request = None - _last_name_field_for_request = None + _customer = None + _customer_limit = None + _billing_contract = None + _name_field_for_request = None _public_nick_name_field_for_request = None + _avatar_uuid_field_for_request = None _address_main_field_for_request = None _address_postal_field_for_request = None - _avatar_uuid_field_for_request = None - _tax_resident_field_for_request = None - _document_type_field_for_request = None - _document_number_field_for_request = None - _document_country_of_issuance_field_for_request = None - _document_front_attachment_id_field_for_request = None - _document_back_attachment_id_field_for_request = None - _date_of_birth_field_for_request = None - _place_of_birth_field_for_request = None - _country_of_birth_field_for_request = None - _nationality_field_for_request = None _language_field_for_request = None _region_field_for_request = None - _gender_field_for_request = None + _country_field_for_request = None + _ubo_field_for_request = None + _chamber_of_commerce_number_field_for_request = None _status_field_for_request = None _sub_status_field_for_request = None - _legal_guardian_alias_field_for_request = None _session_timeout_field_for_request = None - _card_ids_field_for_request = None - _card_limits_field_for_request = None _daily_limit_without_confirmation_login_field_for_request = None _notification_filters_field_for_request = None - def __init__(self, sub_status=None, card_limits=None, card_ids=None, - document_back_attachment_id=None, tax_resident=None, - address_postal=None, public_nick_name=None, last_name=None, - middle_name=None, first_name=None, + def __init__(self, address_main=None, language=None, region=None, name=None, + public_nick_name=None, avatar_uuid=None, address_postal=None, + country=None, ubo=None, chamber_of_commerce_number=None, + status=None, sub_status=None, session_timeout=None, daily_limit_without_confirmation_login=None, - session_timeout=None, legal_guardian_alias=None, status=None, - address_main=None, gender=None, region=None, language=None, - nationality=None, country_of_birth=None, place_of_birth=None, - date_of_birth=None, document_front_attachment_id=None, - document_country_of_issuance=None, document_number=None, - document_type=None, avatar_uuid=None, notification_filters=None): """ :param address_main: The user's main address. :type address_main: object_.Address - :param avatar_uuid: The public UUID of the user's avatar. - :type avatar_uuid: str - :param document_type: The type of identification document the person - registered with. - :type document_type: str - :param document_number: The identification document number the person - registered with. - :type document_number: str - :param document_country_of_issuance: The country which issued the - identification document the person registered with. - :type document_country_of_issuance: str - :param document_front_attachment_id: The reference to the uploaded - picture/scan of the front side of the identification document. - :type document_front_attachment_id: int - :param date_of_birth: The person's date of birth. Accepts ISO8601 date - formats. - :type date_of_birth: str - :param place_of_birth: The person's place of birth. - :type place_of_birth: str - :param country_of_birth: The person's country of birth. Formatted as a SO - 3166-1 alpha-2 country code. - :type country_of_birth: str - :param nationality: The person's nationality. Formatted as a SO 3166-1 - alpha-2 country code. - :type nationality: str :param language: The person's preferred language. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country code, seperated by an underscore. @@ -16841,87 +25464,64 @@ def __init__(self, sub_status=None, card_limits=None, card_ids=None, language code plus a ISO 3166-1 alpha-2 country code, seperated by an underscore. :type region: str - :param gender: The person's gender. Can be: MALE, FEMALE and UNKNOWN. - :type gender: str - :param status: The user status. You are not allowed to update the status via - PUT. + :param name: The company name. + :type name: str + :param public_nick_name: The company's nick name. + :type public_nick_name: str + :param avatar_uuid: The public UUID of the company's avatar. + :type avatar_uuid: str + :param address_postal: The company's postal address. + :type address_postal: object_.Address + :param country: The country where the company is registered. + :type country: str + :param ubo: The names and birth dates of the company's ultimate beneficiary + owners. Minimum zero, maximum four. + :type ubo: list[object_.Ubo] + :param chamber_of_commerce_number: The company's chamber of commerce number. + :type chamber_of_commerce_number: str + :param status: The user status. Can be: ACTIVE, SIGNUP, RECOVERY. :type status: str - :param sub_status: The user sub-status. Can be updated to SUBMIT if status - is RECOVERY. + :param sub_status: The user sub-status. Can be: NONE, FACE_RESET, APPROVAL, + APPROVAL_DIRECTOR, APPROVAL_PARENT, APPROVAL_SUPPORT, COUNTER_IBAN, IDEAL or + SUBMIT. :type sub_status: str - :param legal_guardian_alias: The legal guardian of the user. Required for - minors. - :type legal_guardian_alias: object_.Pointer - :param session_timeout: The setting for the session timeout of the user in - seconds. + :param session_timeout: The setting for the session timeout of the company + in seconds. :type session_timeout: int - :param daily_limit_without_confirmation_login: The amount the user can pay - in the session without asking for credentials. + :param daily_limit_without_confirmation_login: The amount the company can + pay in the session without asking for credentials. :type daily_limit_without_confirmation_login: object_.Amount - :param first_name: The person's first name. - :type first_name: str - :param middle_name: The person's middle name. - :type middle_name: str - :param last_name: The person's last name. - :type last_name: str - :param public_nick_name: The person's public nick name. - :type public_nick_name: str - :param address_postal: The person's postal address. - :type address_postal: object_.Address - :param tax_resident: The user's tax residence numbers for different - countries. - :type tax_resident: list[object_.TaxResident] - :param document_back_attachment_id: The reference to the uploaded - picture/scan of the back side of the identification document. - :type document_back_attachment_id: int - :param card_ids: Card ids used for centralized card limits. - :type card_ids: list[object_.BunqId] - :param card_limits: The centralized limits for user's cards. - :type card_limits: list[object_.CardLimit] :param notification_filters: The types of notifications that will result in - a push notification or URL callback for this UserPerson. + a push notification or URL callback for this UserCompany. :type notification_filters: list[object_.NotificationFilter] """ self._address_main_field_for_request = address_main - self._avatar_uuid_field_for_request = avatar_uuid - self._document_type_field_for_request = document_type - self._document_number_field_for_request = document_number - self._document_country_of_issuance_field_for_request = document_country_of_issuance - self._document_front_attachment_id_field_for_request = document_front_attachment_id - self._date_of_birth_field_for_request = date_of_birth - self._place_of_birth_field_for_request = place_of_birth - self._country_of_birth_field_for_request = country_of_birth - self._nationality_field_for_request = nationality self._language_field_for_request = language self._region_field_for_request = region - self._gender_field_for_request = gender + self._name_field_for_request = name + self._public_nick_name_field_for_request = public_nick_name + self._avatar_uuid_field_for_request = avatar_uuid + self._address_postal_field_for_request = address_postal + self._country_field_for_request = country + self._ubo_field_for_request = ubo + self._chamber_of_commerce_number_field_for_request = chamber_of_commerce_number self._status_field_for_request = status self._sub_status_field_for_request = sub_status - self._legal_guardian_alias_field_for_request = legal_guardian_alias self._session_timeout_field_for_request = session_timeout self._daily_limit_without_confirmation_login_field_for_request = daily_limit_without_confirmation_login - self._first_name_field_for_request = first_name - self._middle_name_field_for_request = middle_name - self._last_name_field_for_request = last_name - self._public_nick_name_field_for_request = public_nick_name - self._address_postal_field_for_request = address_postal - self._tax_resident_field_for_request = tax_resident - self._document_back_attachment_id_field_for_request = document_back_attachment_id - self._card_ids_field_for_request = card_ids - self._card_limits_field_for_request = card_limits self._notification_filters_field_for_request = notification_filters @classmethod - def get(cls, user_person_id, custom_headers=None): + def get(cls, custom_headers=None): """ - Get a specific person. + Get a specific company. :type api_context: context.ApiContext - :type user_person_id: int + :type user_company_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseUserPerson + :rtype: BunqResponseUserCompany """ if custom_headers is None: @@ -16931,71 +25531,32 @@ def get(cls, user_person_id, custom_headers=None): endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id()) response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseUserPerson.cast_from_bunq_response( + return BunqResponseUserCompany.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE_GET) ) @classmethod - def update(cls, user_person_id, first_name=None, middle_name=None, - last_name=None, public_nick_name=None, address_main=None, - address_postal=None, avatar_uuid=None, tax_resident=None, - document_type=None, document_number=None, - document_country_of_issuance=None, - document_front_attachment_id=None, - document_back_attachment_id=None, date_of_birth=None, - place_of_birth=None, country_of_birth=None, nationality=None, - language=None, region=None, gender=None, status=None, - sub_status=None, legal_guardian_alias=None, session_timeout=None, - card_ids=None, card_limits=None, + def update(cls, name=None, public_nick_name=None, avatar_uuid=None, + address_main=None, address_postal=None, language=None, + region=None, country=None, ubo=None, + chamber_of_commerce_number=None, status=None, sub_status=None, + session_timeout=None, daily_limit_without_confirmation_login=None, notification_filters=None, custom_headers=None): """ - Modify a specific person object's data. + Modify a specific company's data. - :type user_person_id: int - :param first_name: The person's first name. - :type first_name: str - :param middle_name: The person's middle name. - :type middle_name: str - :param last_name: The person's last name. - :type last_name: str - :param public_nick_name: The person's public nick name. + :type user_company_id: int + :param name: The company name. + :type name: str + :param public_nick_name: The company's nick name. :type public_nick_name: str + :param avatar_uuid: The public UUID of the company's avatar. + :type avatar_uuid: str :param address_main: The user's main address. :type address_main: object_.Address - :param address_postal: The person's postal address. + :param address_postal: The company's postal address. :type address_postal: object_.Address - :param avatar_uuid: The public UUID of the user's avatar. - :type avatar_uuid: str - :param tax_resident: The user's tax residence numbers for different - countries. - :type tax_resident: list[object_.TaxResident] - :param document_type: The type of identification document the person - registered with. - :type document_type: str - :param document_number: The identification document number the person - registered with. - :type document_number: str - :param document_country_of_issuance: The country which issued the - identification document the person registered with. - :type document_country_of_issuance: str - :param document_front_attachment_id: The reference to the uploaded - picture/scan of the front side of the identification document. - :type document_front_attachment_id: int - :param document_back_attachment_id: The reference to the uploaded - picture/scan of the back side of the identification document. - :type document_back_attachment_id: int - :param date_of_birth: The person's date of birth. Accepts ISO8601 date - formats. - :type date_of_birth: str - :param place_of_birth: The person's place of birth. - :type place_of_birth: str - :param country_of_birth: The person's country of birth. Formatted as a - SO 3166-1 alpha-2 country code. - :type country_of_birth: str - :param nationality: The person's nationality. Formatted as a SO 3166-1 - alpha-2 country code. - :type nationality: str :param language: The person's preferred language. Formatted as a ISO 639-1 language code plus a ISO 3166-1 alpha-2 country code, seperated by an underscore. @@ -17004,29 +25565,28 @@ def update(cls, user_person_id, first_name=None, middle_name=None, language code plus a ISO 3166-1 alpha-2 country code, seperated by an underscore. :type region: str - :param gender: The person's gender. Can be: MALE, FEMALE and UNKNOWN. - :type gender: str - :param status: The user status. You are not allowed to update the status - via PUT. + :param country: The country where the company is registered. + :type country: str + :param ubo: The names and birth dates of the company's ultimate + beneficiary owners. Minimum zero, maximum four. + :type ubo: list[object_.Ubo] + :param chamber_of_commerce_number: The company's chamber of commerce + number. + :type chamber_of_commerce_number: str + :param status: The user status. Can be: ACTIVE, SIGNUP, RECOVERY. :type status: str - :param sub_status: The user sub-status. Can be updated to SUBMIT if - status is RECOVERY. + :param sub_status: The user sub-status. Can be: NONE, FACE_RESET, + APPROVAL, APPROVAL_DIRECTOR, APPROVAL_PARENT, APPROVAL_SUPPORT, + COUNTER_IBAN, IDEAL or SUBMIT. :type sub_status: str - :param legal_guardian_alias: The legal guardian of the user. Required - for minors. - :type legal_guardian_alias: object_.Pointer - :param session_timeout: The setting for the session timeout of the user - in seconds. + :param session_timeout: The setting for the session timeout of the + company in seconds. :type session_timeout: int - :param card_ids: Card ids used for centralized card limits. - :type card_ids: list[object_.BunqId] - :param card_limits: The centralized limits for user's cards. - :type card_limits: list[object_.CardLimit] - :param daily_limit_without_confirmation_login: The amount the user can - pay in the session without asking for credentials. + :param daily_limit_without_confirmation_login: The amount the company + can pay in the session without asking for credentials. :type daily_limit_without_confirmation_login: object_.Amount :param notification_filters: The types of notifications that will result - in a push notification or URL callback for this UserPerson. + in a push notification or URL callback for this UserCompany. :type notification_filters: list[object_.NotificationFilter] :type custom_headers: dict[str, str]|None @@ -17039,32 +25599,19 @@ def update(cls, user_person_id, first_name=None, middle_name=None, api_client = client.ApiClient(cls._get_api_context()) request_map = { - cls.FIELD_FIRST_NAME: first_name, - cls.FIELD_MIDDLE_NAME: middle_name, - cls.FIELD_LAST_NAME: last_name, + cls.FIELD_NAME: name, cls.FIELD_PUBLIC_NICK_NAME: public_nick_name, + cls.FIELD_AVATAR_UUID: avatar_uuid, cls.FIELD_ADDRESS_MAIN: address_main, cls.FIELD_ADDRESS_POSTAL: address_postal, - cls.FIELD_AVATAR_UUID: avatar_uuid, - cls.FIELD_TAX_RESIDENT: tax_resident, - cls.FIELD_DOCUMENT_TYPE: document_type, - cls.FIELD_DOCUMENT_NUMBER: document_number, - cls.FIELD_DOCUMENT_COUNTRY_OF_ISSUANCE: document_country_of_issuance, - cls.FIELD_DOCUMENT_FRONT_ATTACHMENT_ID: document_front_attachment_id, - cls.FIELD_DOCUMENT_BACK_ATTACHMENT_ID: document_back_attachment_id, - cls.FIELD_DATE_OF_BIRTH: date_of_birth, - cls.FIELD_PLACE_OF_BIRTH: place_of_birth, - cls.FIELD_COUNTRY_OF_BIRTH: country_of_birth, - cls.FIELD_NATIONALITY: nationality, cls.FIELD_LANGUAGE: language, cls.FIELD_REGION: region, - cls.FIELD_GENDER: gender, + cls.FIELD_COUNTRY: country, + cls.FIELD_UBO: ubo, + cls.FIELD_CHAMBER_OF_COMMERCE_NUMBER: chamber_of_commerce_number, cls.FIELD_STATUS: status, cls.FIELD_SUB_STATUS: sub_status, - cls.FIELD_LEGAL_GUARDIAN_ALIAS: legal_guardian_alias, cls.FIELD_SESSION_TIMEOUT: session_timeout, - cls.FIELD_CARD_IDS: card_ids, - cls.FIELD_CARD_LIMITS: card_limits, cls.FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN: daily_limit_without_confirmation_login, cls.FIELD_NOTIFICATION_FILTERS: notification_filters } @@ -17097,333 +25644,671 @@ def created(self): return self._created @property - def updated(self): + def updated(self): + """ + :rtype: str + """ + + return self._updated + + @property + def public_uuid(self): + """ + :rtype: str + """ + + return self._public_uuid + + @property + def name(self): + """ + :rtype: str + """ + + return self._name + + @property + def display_name(self): + """ + :rtype: str + """ + + return self._display_name + + @property + def public_nick_name(self): + """ + :rtype: str + """ + + return self._public_nick_name + + @property + def alias(self): + """ + :rtype: list[object_.Pointer] + """ + + return self._alias + + @property + def chamber_of_commerce_number(self): + """ + :rtype: str + """ + + return self._chamber_of_commerce_number + + @property + def type_of_business_entity(self): + """ + :rtype: str + """ + + return self._type_of_business_entity + + @property + def sector_of_industry(self): + """ + :rtype: str + """ + + return self._sector_of_industry + + @property + def counter_bank_iban(self): + """ + :rtype: str + """ + + return self._counter_bank_iban + + @property + def avatar(self): + """ + :rtype: object_.Avatar + """ + + return self._avatar + + @property + def address_main(self): + """ + :rtype: object_.Address + """ + + return self._address_main + + @property + def address_postal(self): + """ + :rtype: object_.Address + """ + + return self._address_postal + + @property + def version_terms_of_service(self): + """ + :rtype: str + """ + + return self._version_terms_of_service + + @property + def director_alias(self): + """ + :rtype: object_.LabelUser + """ + + return self._director_alias + + @property + def language(self): + """ + :rtype: str + """ + + return self._language + + @property + def country(self): + """ + :rtype: str + """ + + return self._country + + @property + def region(self): + """ + :rtype: str + """ + + return self._region + + @property + def ubo(self): + """ + :rtype: list[object_.Ubo] + """ + + return self._ubo + + @property + def status(self): + """ + :rtype: str + """ + + return self._status + + @property + def sub_status(self): + """ + :rtype: str + """ + + return self._sub_status + + @property + def session_timeout(self): + """ + :rtype: int + """ + + return self._session_timeout + + @property + def card_ids(self): + """ + :rtype: list[object_.BunqId] + """ + + return self._card_ids + + @property + def card_limits(self): + """ + :rtype: list[object_.CardLimit] + """ + + return self._card_limits + + @property + def daily_limit_without_confirmation_login(self): + """ + :rtype: object_.Amount + """ + + return self._daily_limit_without_confirmation_login + + @property + def notification_filters(self): + """ + :rtype: list[object_.NotificationFilter] + """ + + return self._notification_filters + + @property + def customer(self): """ - :rtype: str + :rtype: Customer """ - return self._updated + return self._customer @property - def public_uuid(self): + def customer_limit(self): """ - :rtype: str + :rtype: CustomerLimit """ - return self._public_uuid + return self._customer_limit @property - def first_name(self): + def billing_contract(self): """ - :rtype: str + :rtype: list[BillingContractSubscription] """ - return self._first_name + return self._billing_contract - @property - def middle_name(self): + def is_all_field_none(self): """ - :rtype: str + :rtype: bool """ - return self._middle_name + if self._id_ is not None: + return False - @property - def last_name(self): + 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._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._card_ids is not None: + return False + + if self._card_limits 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 + + @staticmethod + def from_json(json_str): """ - :rtype: str + :type json_str: str + + :rtype: UserCompany """ - return self._last_name + return converter.json_to_class(UserCompany, json_str) - @property - def legal_name(self): + +class Customer(core.BunqModel): + """ + Used to view a customer. + + :param _billing_account_id: The primary billing account account's id. + :type _billing_account_id: str + :param _invoice_notification_preference: The preferred notification type for + invoices. + :type _invoice_notification_preference: str + :param _id_: The id of the customer. + :type _id_: int + :param _created: The timestamp of the customer object's creation. + :type _created: str + :param _updated: The timestamp of the customer object's last update. + :type _updated: str + """ + + # Endpoint constants. + _ENDPOINT_URL_LISTING = "user/{}/customer" + _ENDPOINT_URL_READ = "user/{}/customer/{}" + _ENDPOINT_URL_UPDATE = "user/{}/customer/{}" + + # Field constants. + FIELD_BILLING_ACCOUNT_ID = "billing_account_id" + FIELD_INVOICE_NOTIFICATION_PREFERENCE = "invoice_notification_preference" + + # Object type. + _OBJECT_TYPE_GET = "Customer" + + _id_ = None + _created = None + _updated = None + _billing_account_id = None + _invoice_notification_preference = None + _billing_account_id_field_for_request = None + _invoice_notification_preference_field_for_request = None + + def __init__(self, billing_account_id=None, + invoice_notification_preference=None): """ - :rtype: str + :param billing_account_id: The primary billing account account's id. + :type billing_account_id: str + :param invoice_notification_preference: The preferred notification type for + invoices + :type invoice_notification_preference: str """ - return self._legal_name + self._billing_account_id_field_for_request = billing_account_id + self._invoice_notification_preference_field_for_request = invoice_notification_preference - @property - def display_name(self): + @classmethod + def list(cls, params=None, custom_headers=None): """ - :rtype: str + :type user_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseCustomerList """ - return self._display_name + if params is None: + params = {} - @property - def public_nick_name(self): + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id()) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseCustomerList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def get(cls, customer_id, custom_headers=None): """ - :rtype: str + :type api_context: context.ApiContext + :type user_id: int + :type customer_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseCustomer """ - return self._public_nick_name + if custom_headers is None: + custom_headers = {} - @property - def alias(self): + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + customer_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseCustomer.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) + + @classmethod + def update(cls, customer_id, billing_account_id=None, + invoice_notification_preference=None, custom_headers=None): """ - :rtype: list[object_.Pointer] + :type user_id: int + :type customer_id: int + :param billing_account_id: The primary billing account account's id. + :type billing_account_id: str + :param invoice_notification_preference: The preferred notification type + for invoices + :type invoice_notification_preference: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._alias + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(cls._get_api_context()) + + request_map = { + cls.FIELD_BILLING_ACCOUNT_ID: billing_account_id, + cls.FIELD_INVOICE_NOTIFICATION_PREFERENCE: invoice_notification_preference + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + customer_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 tax_resident(self): + def id_(self): """ - :rtype: list[object_.TaxResident] + :rtype: int """ - return self._tax_resident + return self._id_ @property - def document_type(self): + def created(self): """ :rtype: str """ - return self._document_type + return self._created @property - def document_number(self): + def updated(self): """ :rtype: str """ - return self._document_number + return self._updated @property - def document_country_of_issuance(self): + def billing_account_id(self): """ :rtype: str """ - return self._document_country_of_issuance + return self._billing_account_id @property - def address_main(self): + def invoice_notification_preference(self): """ - :rtype: object_.Address + :rtype: str """ - return self._address_main + return self._invoice_notification_preference - @property - def address_postal(self): + def is_all_field_none(self): """ - :rtype: object_.Address + :rtype: bool """ - return self._address_postal - - @property - def date_of_birth(self): - """ - :rtype: str - """ + if self._id_ is not None: + return False - return self._date_of_birth + if self._created is not None: + return False - @property - def place_of_birth(self): - """ - :rtype: str - """ + if self._updated is not None: + return False - return self._place_of_birth + if self._billing_account_id is not None: + return False - @property - def country_of_birth(self): - """ - :rtype: str - """ + if self._invoice_notification_preference is not None: + return False - return self._country_of_birth + return True - @property - def nationality(self): + @staticmethod + def from_json(json_str): """ - :rtype: str + :type json_str: str + + :rtype: Customer """ - return self._nationality - - @property - def language(self): - """ - :rtype: str - """ + return converter.json_to_class(Customer, json_str) - return self._language - @property - def region(self): - """ - :rtype: str - """ +class CustomerLimit(core.BunqModel): + """ + Show the limits for the authenticated user. + + :param _limit_monetary_account: The limit of monetary accounts. + :type _limit_monetary_account: int + :param _limit_card_debit_maestro: The limit of Maestro cards. + :type _limit_card_debit_maestro: int + :param _limit_card_debit_mastercard: The limit of MasterCard cards. + :type _limit_card_debit_mastercard: int + :param _limit_card_debit_wildcard: The limit of wildcards, e.g. Maestro or + MasterCard cards. + :type _limit_card_debit_wildcard: int + :param _limit_card_debit_replacement: The limit of free replacement cards. + :type _limit_card_debit_replacement: int + """ - return self._region + # Endpoint constants. + _ENDPOINT_URL_LISTING = "user/{}/limit" - @property - def gender(self): - """ - :rtype: str - """ + # Object type. + _OBJECT_TYPE_GET = "CustomerLimit" - return self._gender + _limit_monetary_account = None + _limit_card_debit_maestro = None + _limit_card_debit_mastercard = None + _limit_card_debit_wildcard = None + _limit_card_debit_replacement = None - @property - def avatar(self): + @classmethod + def list(cls, params=None, custom_headers=None): """ - :rtype: object_.Avatar + Get all limits for the authenticated user. + + :type user_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseCustomerLimitList """ - return self._avatar + if params is None: + params = {} - @property - def version_terms_of_service(self): - """ - :rtype: str - """ + if custom_headers is None: + custom_headers = {} - return self._version_terms_of_service + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id()) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseCustomerLimitList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) @property - def status(self): + def limit_monetary_account(self): """ - :rtype: str + :rtype: int """ - return self._status + return self._limit_monetary_account @property - def sub_status(self): + def limit_card_debit_maestro(self): """ - :rtype: str + :rtype: int """ - return self._sub_status + return self._limit_card_debit_maestro @property - def session_timeout(self): + def limit_card_debit_mastercard(self): """ :rtype: int """ - return self._session_timeout + return self._limit_card_debit_mastercard @property - def daily_limit_without_confirmation_login(self): + def limit_card_debit_wildcard(self): """ - :rtype: object_.Amount + :rtype: int """ - return self._daily_limit_without_confirmation_login + return self._limit_card_debit_wildcard @property - def notification_filters(self): + def limit_card_debit_replacement(self): """ - :rtype: list[object_.NotificationFilter] + :rtype: int """ - return self._notification_filters + return self._limit_card_debit_replacement def is_all_field_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._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._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: + if self._limit_monetary_account is not None: return False - if self._sub_status is not None: + if self._limit_card_debit_maestro is not None: return False - if self._session_timeout is not None: + if self._limit_card_debit_mastercard is not None: return False - if self._daily_limit_without_confirmation_login is not None: + if self._limit_card_debit_wildcard is not None: return False - if self._notification_filters is not None: + if self._limit_card_debit_replacement is not None: return False return True @@ -17433,348 +26318,128 @@ def from_json(json_str): """ :type json_str: str - :rtype: UserPerson + :rtype: CustomerLimit """ - return converter.json_to_class(UserPerson, json_str) + return converter.json_to_class(CustomerLimit, json_str) -class UserCompany(core.BunqModel): +class BillingContractSubscription(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. + Show the subscription billing contract for the authenticated user. - :param _name: The company name. - :type _name: str - :param _public_nick_name: The company's public nick name. - :type _public_nick_name: str - :param _avatar_uuid: The public UUID of the company's avatar. - :type _avatar_uuid: str - :param _address_main: The company's main address. - :type _address_main: object_.Address - :param _address_postal: The company's postal address. - :type _address_postal: object_.Address - :param _language: The person's preferred language. Formatted as a ISO 639-1 - language code plus a ISO 3166-1 alpha-2 country code, seperated by an - underscore. - :type _language: str - :param _region: The person's preferred region. Formatted as a ISO 639-1 - language code plus a ISO 3166-1 alpha-2 country code, seperated by an - underscore. - :type _region: str - :param _country: The country as an ISO 3166-1 alpha-2 country code.. - :type _country: str - :param _ubo: The names of the company's ultimate beneficiary owners. Minimum - zero, maximum four. - :type _ubo: list[object_.Ubo] - :param _chamber_of_commerce_number: The company's chamber of commerce - number. - :type _chamber_of_commerce_number: str - :param _status: The user status. Can be: ACTIVE, SIGNUP, RECOVERY. - :type _status: str - :param _sub_status: The user sub-status. Can be: NONE, FACE_RESET, APPROVAL, - APPROVAL_DIRECTOR, APPROVAL_PARENT, APPROVAL_SUPPORT, COUNTER_IBAN, IDEAL or - SUBMIT. - :type _sub_status: str - :param _session_timeout: The setting for the session timeout of the company - in seconds. - :type _session_timeout: int - :param _daily_limit_without_confirmation_login: The amount the company can - pay in the session without asking for credentials. - :type _daily_limit_without_confirmation_login: object_.Amount - :param _notification_filters: The types of notifications that will result in - a push notification or URL callback for this UserCompany. - :type _notification_filters: list[object_.NotificationFilter] - :param _id_: The id of the modified company. + :param _subscription_type: The subscription type of the user. Can be one of + PERSON_SUPER_LIGHT_V1, PERSON_LIGHT_V1, PERSON_MORE_V1, PERSON_FREE_V1, + PERSON_PREMIUM_V1, COMPANY_V1, or COMPANY_V2. + :type _subscription_type: str + :param _id_: The id of the billing contract. :type _id_: int - :param _created: The timestamp of the company object's creation. + :param _created: The timestamp when the billing contract was made. :type _created: str - :param _updated: The timestamp of the company object's last update. + :param _updated: The timestamp when the billing contract was last updated. :type _updated: str - :param _public_uuid: The company's public UUID. - :type _public_uuid: str - :param _display_name: The company's display name. - :type _display_name: str - :param _alias: The aliases of the account. - :type _alias: list[object_.Pointer] - :param _type_of_business_entity: The type of business entity. - :type _type_of_business_entity: str - :param _sector_of_industry: The sector of industry. - :type _sector_of_industry: str - :param _counter_bank_iban: The company's other bank account IBAN, through - which we verify it. - :type _counter_bank_iban: str - :param _avatar: The company's avatar. - :type _avatar: object_.Avatar - :param _version_terms_of_service: The version of the terms of service - accepted by the user. - :type _version_terms_of_service: str - :param _director_alias: The existing bunq user alias for the company's - director. - :type _director_alias: object_.LabelUser - :param _card_ids: Card ids used for centralized card limits. - :type _card_ids: list[object_.BunqId] - :param _card_limits: The centralized limits for user's cards. - :type _card_limits: list[object_.CardLimit] - :param _customer: The customer profile of the company. - :type _customer: Customer - :param _customer_limit: The customer limits of the company. - :type _customer_limit: CustomerLimit - :param _billing_contract: The subscription of the company. - :type _billing_contract: list[BillingContractSubscription] + :param _contract_date_start: The date from when the billing contract is + valid. + :type _contract_date_start: str + :param _contract_date_end: The date until when the billing contract is + valid. + :type _contract_date_end: str + :param _contract_version: The version of the billing contract. + :type _contract_version: int + :param _status: The subscription status. + :type _status: str + :param _sub_status: The subscription substatus. + :type _sub_status: str """ # Endpoint constants. - _ENDPOINT_URL_READ = "user-company/{}" - _ENDPOINT_URL_UPDATE = "user-company/{}" + _ENDPOINT_URL_CREATE = "user/{}/billing-contract-subscription" + _ENDPOINT_URL_LISTING = "user/{}/billing-contract-subscription" # 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_NOTIFICATION_FILTERS = "notification_filters" + FIELD_SUBSCRIPTION_TYPE = "subscription_type" # Object type. - _OBJECT_TYPE_GET = "UserCompany" + _OBJECT_TYPE_GET = "BillingContractSubscription" _id_ = None _created = None _updated = None - _public_uuid = None - _name = None - _display_name = None - _public_nick_name = None - _alias = None - _chamber_of_commerce_number = None - _type_of_business_entity = None - _sector_of_industry = None - _counter_bank_iban = None - _avatar = None - _address_main = None - _address_postal = None - _version_terms_of_service = None - _director_alias = None - _language = None - _country = None - _region = None - _ubo = None + _contract_date_start = None + _contract_date_end = None + _contract_version = None + _subscription_type = None _status = None _sub_status = None - _session_timeout = None - _card_ids = None - _card_limits = None - _daily_limit_without_confirmation_login = None - _notification_filters = None - _customer = None - _customer_limit = None - _billing_contract = None - _name_field_for_request = None - _public_nick_name_field_for_request = None - _avatar_uuid_field_for_request = None - _address_main_field_for_request = None - _address_postal_field_for_request = None - _language_field_for_request = None - _region_field_for_request = None - _country_field_for_request = None - _ubo_field_for_request = None - _chamber_of_commerce_number_field_for_request = None - _status_field_for_request = None - _sub_status_field_for_request = None - _session_timeout_field_for_request = None - _daily_limit_without_confirmation_login_field_for_request = None - _notification_filters_field_for_request = None + _subscription_type_field_for_request = None - def __init__(self, address_main=None, language=None, region=None, name=None, - public_nick_name=None, avatar_uuid=None, address_postal=None, - country=None, ubo=None, chamber_of_commerce_number=None, - status=None, sub_status=None, session_timeout=None, - daily_limit_without_confirmation_login=None, - notification_filters=None): + def __init__(self, subscription_type): """ - :param address_main: The user's main address. - :type address_main: object_.Address - :param language: The person's preferred language. Formatted as a ISO 639-1 - language code plus a ISO 3166-1 alpha-2 country code, seperated by an - underscore. - :type language: str - :param region: The person's preferred region. Formatted as a ISO 639-1 - language code plus a ISO 3166-1 alpha-2 country code, seperated by an - underscore. - :type region: str - :param name: The company name. - :type name: str - :param public_nick_name: The company's nick name. - :type public_nick_name: str - :param avatar_uuid: The public UUID of the company's avatar. - :type avatar_uuid: str - :param address_postal: The company's postal address. - :type address_postal: object_.Address - :param country: The country where the company is registered. - :type country: str - :param ubo: The names and birth dates of the company's ultimate beneficiary - owners. Minimum zero, maximum four. - :type ubo: list[object_.Ubo] - :param chamber_of_commerce_number: The company's chamber of commerce number. - :type chamber_of_commerce_number: str - :param status: The user status. Can be: ACTIVE, SIGNUP, RECOVERY. - :type status: str - :param sub_status: The user sub-status. Can be: NONE, FACE_RESET, APPROVAL, - APPROVAL_DIRECTOR, APPROVAL_PARENT, APPROVAL_SUPPORT, COUNTER_IBAN, IDEAL or - SUBMIT. - :type sub_status: str - :param session_timeout: The setting for the session timeout of the company - in seconds. - :type session_timeout: int - :param daily_limit_without_confirmation_login: The amount the company can - pay in the session without asking for credentials. - :type daily_limit_without_confirmation_login: object_.Amount - :param notification_filters: The types of notifications that will result in - a push notification or URL callback for this UserCompany. - :type notification_filters: list[object_.NotificationFilter] + :param subscription_type: The subscription type of the user. Can be one of + PERSON_LIGHT_V1, PERSON_MORE_V1, PERSON_FREE_V1, PERSON_PREMIUM_V1, + COMPANY_V1, or COMPANY_V2. + :type subscription_type: str """ - self._address_main_field_for_request = address_main - self._language_field_for_request = language - self._region_field_for_request = region - self._name_field_for_request = name - self._public_nick_name_field_for_request = public_nick_name - self._avatar_uuid_field_for_request = avatar_uuid - self._address_postal_field_for_request = address_postal - self._country_field_for_request = country - self._ubo_field_for_request = ubo - self._chamber_of_commerce_number_field_for_request = chamber_of_commerce_number - self._status_field_for_request = status - self._sub_status_field_for_request = sub_status - self._session_timeout_field_for_request = session_timeout - self._daily_limit_without_confirmation_login_field_for_request = daily_limit_without_confirmation_login - self._notification_filters_field_for_request = notification_filters + self._subscription_type_field_for_request = subscription_type @classmethod - def get(cls, user_company_id, custom_headers=None): + def create(cls, subscription_type, custom_headers=None): """ - Get a specific company. - - :type api_context: context.ApiContext - :type user_company_id: int + :type user_id: int + :param subscription_type: The subscription type of the user. Can be one + of PERSON_LIGHT_V1, PERSON_MORE_V1, PERSON_FREE_V1, PERSON_PREMIUM_V1, + COMPANY_V1, or COMPANY_V2. + :type subscription_type: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseUserCompany + :rtype: BunqResponseInt """ if custom_headers is None: custom_headers = {} + request_map = { + cls.FIELD_SUBSCRIPTION_TYPE: subscription_type + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id()) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id()) + response_raw = api_client.post(endpoint_url, request_bytes, + custom_headers) - return BunqResponseUserCompany.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @classmethod - def update(cls, user_company_id, name=None, public_nick_name=None, - avatar_uuid=None, address_main=None, address_postal=None, - language=None, region=None, country=None, ubo=None, - chamber_of_commerce_number=None, status=None, sub_status=None, - session_timeout=None, - daily_limit_without_confirmation_login=None, - notification_filters=None, custom_headers=None): + def list(cls, params=None, custom_headers=None): """ - Modify a specific company's data. + Get all subscription billing contract for the authenticated user. - :type user_company_id: int - :param name: The company name. - :type name: str - :param public_nick_name: The company's nick name. - :type public_nick_name: str - :param avatar_uuid: The public UUID of the company's avatar. - :type avatar_uuid: str - :param address_main: The user's main address. - :type address_main: object_.Address - :param address_postal: The company's postal address. - :type address_postal: object_.Address - :param language: The person's preferred language. Formatted as a ISO - 639-1 language code plus a ISO 3166-1 alpha-2 country code, seperated by - an underscore. - :type language: str - :param region: The person's preferred region. Formatted as a ISO 639-1 - language code plus a ISO 3166-1 alpha-2 country code, seperated by an - underscore. - :type region: str - :param country: The country where the company is registered. - :type country: str - :param ubo: The names and birth dates of the company's ultimate - beneficiary owners. Minimum zero, maximum four. - :type ubo: list[object_.Ubo] - :param chamber_of_commerce_number: The company's chamber of commerce - number. - :type chamber_of_commerce_number: str - :param status: The user status. Can be: ACTIVE, SIGNUP, RECOVERY. - :type status: str - :param sub_status: The user sub-status. Can be: NONE, FACE_RESET, - APPROVAL, APPROVAL_DIRECTOR, APPROVAL_PARENT, APPROVAL_SUPPORT, - COUNTER_IBAN, IDEAL or SUBMIT. - :type sub_status: str - :param session_timeout: The setting for the session timeout of the - company in seconds. - :type session_timeout: int - :param daily_limit_without_confirmation_login: The amount the company - can pay in the session without asking for credentials. - :type daily_limit_without_confirmation_login: object_.Amount - :param notification_filters: The types of notifications that will result - in a push notification or URL callback for this UserCompany. - :type notification_filters: list[object_.NotificationFilter] + :type user_id: int + :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseInt + :rtype: BunqResponseBillingContractSubscriptionList """ + if params is None: + params = {} + if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id()) + response_raw = api_client.get(endpoint_url, params, custom_headers) - request_map = { - cls.FIELD_NAME: name, - cls.FIELD_PUBLIC_NICK_NAME: public_nick_name, - cls.FIELD_AVATAR_UUID: avatar_uuid, - cls.FIELD_ADDRESS_MAIN: address_main, - cls.FIELD_ADDRESS_POSTAL: address_postal, - cls.FIELD_LANGUAGE: language, - cls.FIELD_REGION: region, - cls.FIELD_COUNTRY: country, - cls.FIELD_UBO: ubo, - cls.FIELD_CHAMBER_OF_COMMERCE_NUMBER: chamber_of_commerce_number, - cls.FIELD_STATUS: status, - cls.FIELD_SUB_STATUS: sub_status, - cls.FIELD_SESSION_TIMEOUT: session_timeout, - cls.FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN: daily_limit_without_confirmation_login, - cls.FIELD_NOTIFICATION_FILTERS: notification_filters - } - request_map_string = converter.class_to_json(request_map) - request_map_string = cls._remove_field_for_request(request_map_string) - - request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_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 BunqResponseBillingContractSubscriptionList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) ) @property @@ -17802,325 +26467,462 @@ def updated(self): return self._updated @property - def public_uuid(self): - """ - :rtype: str - """ - - return self._public_uuid - - @property - def name(self): - """ - :rtype: str - """ - - return self._name - - @property - def display_name(self): + def contract_date_start(self): """ :rtype: str """ - return self._display_name + return self._contract_date_start @property - def public_nick_name(self): + def contract_date_end(self): """ :rtype: str """ - return self._public_nick_name + return self._contract_date_end @property - def alias(self): + def contract_version(self): """ - :rtype: list[object_.Pointer] + :rtype: int """ - return self._alias + return self._contract_version @property - def chamber_of_commerce_number(self): + def subscription_type(self): """ :rtype: str """ - return self._chamber_of_commerce_number + return self._subscription_type @property - def type_of_business_entity(self): + def status(self): """ :rtype: str """ - return self._type_of_business_entity + return self._status @property - def sector_of_industry(self): + def sub_status(self): """ :rtype: str """ - return self._sector_of_industry + return self._sub_status - @property - def counter_bank_iban(self): + def is_all_field_none(self): """ - :rtype: str + :rtype: bool """ - return self._counter_bank_iban - - @property - def avatar(self): - """ - :rtype: object_.Avatar - """ + if self._id_ is not None: + return False - return self._avatar + if self._created is not None: + return False - @property - def address_main(self): - """ - :rtype: object_.Address - """ + if self._updated is not None: + return False - return self._address_main + if self._contract_date_start is not None: + return False - @property - def address_postal(self): - """ - :rtype: object_.Address - """ + if self._contract_date_end is not None: + return False - return self._address_postal + if self._contract_version is not None: + return False - @property - def version_terms_of_service(self): - """ - :rtype: str - """ + if self._subscription_type is not None: + return False - return self._version_terms_of_service + if self._status is not None: + return False - @property - def director_alias(self): - """ - :rtype: object_.LabelUser - """ + if self._sub_status is not None: + return False - return self._director_alias + return True - @property - def language(self): + @staticmethod + def from_json(json_str): """ - :rtype: str + :type json_str: str + + :rtype: BillingContractSubscription """ - return self._language - - @property - def country(self): - """ - :rtype: str - """ + return converter.json_to_class(BillingContractSubscription, json_str) - return self._country - @property - def region(self): - """ - :rtype: str - """ +class UserApiKey(core.BunqModel): + """ + Used to view OAuth request detais in events. + + :param _id_: The id of the user. + :type _id_: int + :param _created: The timestamp of the user object's creation. + :type _created: str + :param _updated: The timestamp of the user object's last update. + :type _updated: str + :param _requested_by_user: The user who requested access. + :type _requested_by_user: object_.UserApiKeyAnchoredUser + :param _granted_by_user: The user who granted access. + :type _granted_by_user: object_.UserApiKeyAnchoredUser + """ - return self._region + _id_ = None + _created = None + _updated = None + _requested_by_user = None + _granted_by_user = None @property - def ubo(self): + def id_(self): """ - :rtype: list[object_.Ubo] + :rtype: int """ - return self._ubo + return self._id_ @property - def status(self): + def created(self): """ :rtype: str """ - return self._status + return self._created @property - def sub_status(self): + def updated(self): """ :rtype: str """ - return self._sub_status + return self._updated @property - def session_timeout(self): + def requested_by_user(self): """ - :rtype: int + :rtype: object_.UserApiKeyAnchoredUser """ - return self._session_timeout + return self._requested_by_user @property - def card_ids(self): + def granted_by_user(self): """ - :rtype: list[object_.BunqId] + :rtype: object_.UserApiKeyAnchoredUser """ - return self._card_ids + return self._granted_by_user - @property - def card_limits(self): + def is_all_field_none(self): """ - :rtype: list[object_.CardLimit] + :rtype: bool """ - return self._card_limits + if self._id_ is not None: + return False - @property - def daily_limit_without_confirmation_login(self): - """ - :rtype: object_.Amount - """ + if self._created is not None: + return False - return self._daily_limit_without_confirmation_login + if self._updated is not None: + return False - @property - def notification_filters(self): + if self._requested_by_user is not None: + return False + + if self._granted_by_user is not None: + return False + + return True + + @staticmethod + def from_json(json_str): """ - :rtype: list[object_.NotificationFilter] + :type json_str: str + + :rtype: UserApiKey """ - return self._notification_filters + return converter.json_to_class(UserApiKey, json_str) - @property - def customer(self): + +class PermittedIp(core.BunqModel): + """ + Manage the IPs which may be used for a credential of a user for server + authentication. + + :param _ip: The IP address. + :type _ip: str + :param _status: The status of the IP. May be "ACTIVE" or "INACTIVE". It is + only possible to make requests from "ACTIVE" IP addresses. Only "ACTIVE" IPs + will be billed. + :type _status: str + """ + + # 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" + + # Object type. + _OBJECT_TYPE_GET = "PermittedIp" + + _ip = None + _status = None + _ip_field_for_request = None + _status_field_for_request = None + + def __init__(self, ip, status=None): """ - :rtype: Customer + :param ip: The IP address. + :type ip: str + :param status: The status of the IP. May be "ACTIVE" or "INACTIVE". It is + only possible to make requests from "ACTIVE" IP addresses. Only "ACTIVE" IPs + will be billed. + :type status: str """ - return self._customer + self._ip_field_for_request = ip + self._status_field_for_request = status - @property - def customer_limit(self): + @classmethod + def get(cls, credential_password_ip_id, permitted_ip_id, + custom_headers=None): """ - :rtype: CustomerLimit + :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 """ - return self._customer_limit + if custom_headers is None: + custom_headers = {} - @property - def billing_contract(self): + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_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_GET) + ) + + @classmethod + def create(cls, credential_password_ip_id, ip, status=None, + custom_headers=None): """ - :rtype: list[BillingContractSubscription] + :type user_id: int + :type credential_password_ip_id: int + :param ip: The IP address. + :type ip: str + :param status: The status of the IP. May be "ACTIVE" or "INACTIVE". It + is only possible to make requests from "ACTIVE" IP addresses. Only + "ACTIVE" IPs will be billed. + :type status: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._billing_contract + if custom_headers is None: + custom_headers = {} - def is_all_field_none(self): + request_map = { + cls.FIELD_IP: ip, + cls.FIELD_STATUS: status + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) + + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_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, credential_password_ip_id, params=None, custom_headers=None): """ - :rtype: bool + :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 """ - if self._id_ is not None: - return False + if params is None: + params = {} - if self._created is not None: - return False + if custom_headers is None: + custom_headers = {} - if self._updated is not None: - return False + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), credential_password_ip_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) - if self._public_uuid is not None: - return False + return BunqResponsePermittedIpList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) - if self._name is not None: - return False + @classmethod + def update(cls, credential_password_ip_id, permitted_ip_id, status=None, + custom_headers=None): + """ + :type user_id: int + :type credential_password_ip_id: int + :type permitted_ip_id: int + :param status: The status of the IP. May be "ACTIVE" or "INACTIVE". It + is only possible to make requests from "ACTIVE" IP addresses. Only + "ACTIVE" IPs will be billed. + :type status: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ - if self._display_name is not None: - return False + if custom_headers is None: + custom_headers = {} - if self._public_nick_name is not None: - return False + api_client = client.ApiClient(cls._get_api_context()) - if self._alias is not None: - return False + request_map = { + cls.FIELD_STATUS: status + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) - if self._chamber_of_commerce_number is not None: - return False + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + credential_password_ip_id, + permitted_ip_id) + response_raw = api_client.put(endpoint_url, request_bytes, + custom_headers) - if self._type_of_business_entity is not None: - return False + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) - if self._sector_of_industry is not None: - return False + @property + def ip(self): + """ + :rtype: str + """ + + return self._ip + + @property + def status(self): + """ + :rtype: str + """ + + return self._status - if self._counter_bank_iban is not None: - return False + def is_all_field_none(self): + """ + :rtype: bool + """ - if self._avatar is not None: + if self._ip is not None: return False - if self._address_main is not None: + if self._status is not None: return False - if self._address_postal is not None: - return False + return True - if self._version_terms_of_service is not None: - return False + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: PermittedIp + """ - if self._director_alias is not None: - return False + return converter.json_to_class(PermittedIp, json_str) - if self._language is not None: - return False - if self._country is not None: - return False +class SandboxUser(core.BunqModel): + """ + Used to create a sandbox user. + + :param _api_key: The API key of the newly created sandbox user. + :type _api_key: str + """ - if self._region is not None: - return False + # Endpoint constants. + _ENDPOINT_URL_CREATE = "sandbox-user" - if self._ubo is not None: - return False + # Object type. + _OBJECT_TYPE_POST = "ApiKey" - if self._status is not None: - return False + _api_key = None - if self._sub_status is not None: - return False + @classmethod + def create(cls, custom_headers=None): + """ + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseSandboxUser + """ - if self._session_timeout is not None: - return False + if custom_headers is None: + custom_headers = {} - if self._card_ids is not None: - return False + request_map = { - if self._card_limits is not None: - return False + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) - if self._daily_limit_without_confirmation_login is not None: - return False + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE + response_raw = api_client.post(endpoint_url, request_bytes, + custom_headers) - if self._notification_filters is not None: - return False + return BunqResponseSandboxUser.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_POST) + ) - if self._customer is not None: - return False + @property + def api_key(self): + """ + :rtype: str + """ - if self._customer_limit is not None: - return False + return self._api_key - if self._billing_contract is not None: + def is_all_field_none(self): + """ + :rtype: bool + """ + + if self._api_key is not None: return False return True @@ -18130,120 +26932,95 @@ def from_json(json_str): """ :type json_str: str - :rtype: UserCompany + :rtype: SandboxUser """ - return converter.json_to_class(UserCompany, json_str) + return converter.json_to_class(SandboxUser, json_str) -class Customer(core.BunqModel): +class SchedulePaymentBatch(core.BunqModel): """ - Used to view a customer. + Endpoint for schedule payment batches. - :param _billing_account_id: The primary billing account account's id. - :type _billing_account_id: str - :param _invoice_notification_preference: The preferred notification type for - invoices - :type _invoice_notification_preference: str - :param _id_: The id of the customer. - :type _id_: int - :param _created: The timestamp of the customer object's creation. - :type _created: str - :param _updated: The timestamp of the customer object's last update. - :type _updated: str + :param _payments: The payment details. + :type _payments: list[object_.SchedulePaymentEntry] + :param _schedule: The schedule details. + :type _schedule: Schedule """ # Endpoint constants. - _ENDPOINT_URL_LISTING = "user/{}/customer" - _ENDPOINT_URL_READ = "user/{}/customer/{}" - _ENDPOINT_URL_UPDATE = "user/{}/customer/{}" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/schedule-payment-batch" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/schedule-payment-batch/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/schedule-payment-batch/{}" # Field constants. - FIELD_BILLING_ACCOUNT_ID = "billing_account_id" - FIELD_INVOICE_NOTIFICATION_PREFERENCE = "invoice_notification_preference" - - # Object type. - _OBJECT_TYPE_GET = "Customer" + FIELD_PAYMENTS = "payments" + FIELD_SCHEDULE = "schedule" - _id_ = None - _created = None - _updated = None - _billing_account_id = None - _billing_account_id_field_for_request = None - _invoice_notification_preference_field_for_request = None + _payments = None + _schedule = None + _payments_field_for_request = None + _schedule_field_for_request = None - def __init__(self, billing_account_id=None, - invoice_notification_preference=None): + def __init__(self, payments=None, schedule=None): """ - :param billing_account_id: The primary billing account account's id. - :type billing_account_id: str - :param invoice_notification_preference: The preferred notification type for - invoices - :type invoice_notification_preference: str + :param payments: The payment details. + :type payments: list[object_.SchedulePaymentEntry] + :param schedule: The schedule details when creating a scheduled payment. + :type schedule: Schedule """ - self._billing_account_id_field_for_request = billing_account_id - self._invoice_notification_preference_field_for_request = invoice_notification_preference + self._payments_field_for_request = payments + self._schedule_field_for_request = schedule @classmethod - def list(cls, params=None, custom_headers=None): + def create(cls, payments, schedule, monetary_account_id=None, + custom_headers=None): """ :type user_id: int - :type params: dict[str, str]|None + :type monetary_account_id: int + :param payments: The payment details. + :type payments: list[object_.SchedulePaymentEntry] + :param schedule: The schedule details when creating a scheduled payment. + :type schedule: Schedule :type custom_headers: dict[str, str]|None - :rtype: BunqResponseCustomerList + :rtype: BunqResponseInt """ - if params is None: - params = {} - if custom_headers is None: custom_headers = {} - api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_LISTING.format( - cls._determine_user_id()) - response_raw = api_client.get(endpoint_url, params, custom_headers) - - return BunqResponseCustomerList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) - ) - - @classmethod - def get(cls, 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 custom_headers is None: - custom_headers = {} + request_map = { + cls.FIELD_PAYMENTS: payments, + cls.FIELD_SCHEDULE: schedule + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), - customer_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id)) + response_raw = api_client.post(endpoint_url, request_bytes, + custom_headers) - return BunqResponseCustomer.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @classmethod - def update(cls, customer_id, billing_account_id=None, - invoice_notification_preference=None, custom_headers=None): + def update(cls, schedule_payment_batch_id, monetary_account_id=None, + payments=None, schedule=None, custom_headers=None): """ :type user_id: int - :type customer_id: int - :param billing_account_id: The primary billing account account's id. - :type billing_account_id: str - :param invoice_notification_preference: The preferred notification type - for invoices - :type invoice_notification_preference: str + :type monetary_account_id: int + :type schedule_payment_batch_id: int + :param payments: The payment details. + :type payments: list[object_.SchedulePaymentEntry] + :param schedule: The schedule details when creating a scheduled payment. + :type schedule: Schedule :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -18255,15 +27032,17 @@ def update(cls, customer_id, billing_account_id=None, api_client = client.ApiClient(cls._get_api_context()) request_map = { - cls.FIELD_BILLING_ACCOUNT_ID: billing_account_id, - cls.FIELD_INVOICE_NOTIFICATION_PREFERENCE: invoice_notification_preference + cls.FIELD_PAYMENTS: payments, + cls.FIELD_SCHEDULE: schedule } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) request_bytes = request_map_string.encode() endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), - customer_id) + cls._determine_monetary_account_id( + monetary_account_id), + schedule_payment_batch_id) response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) @@ -18271,53 +27050,57 @@ def update(cls, customer_id, billing_account_id=None, cls._process_for_id(response_raw) ) - @property - def id_(self): + @classmethod + def delete(cls, schedule_payment_batch_id, monetary_account_id=None, + custom_headers=None): """ - :rtype: int + :type user_id: int + :type monetary_account_id: int + :type schedule_payment_batch_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone """ - return self._id_ - - @property - def created(self): - """ - :rtype: str - """ + if custom_headers is None: + custom_headers = {} - return self._created + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + schedule_payment_batch_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) @property - def updated(self): + def payments(self): """ - :rtype: str + :rtype: list[object_.SchedulePaymentEntry] """ - return self._updated + return self._payments @property - def billing_account_id(self): + def schedule(self): """ - :rtype: str + :rtype: Schedule """ - return self._billing_account_id + return self._schedule def is_all_field_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: + if self._payments is not None: return False - if self._billing_account_id is not None: + if self._schedule is not None: return False return True @@ -18327,51 +27110,38 @@ def from_json(json_str): """ :type json_str: str - :rtype: Customer + :rtype: SchedulePaymentBatch """ - return converter.json_to_class(Customer, json_str) + return converter.json_to_class(SchedulePaymentBatch, json_str) -class CustomerLimit(core.BunqModel): +class ScheduleUser(core.BunqModel): """ - Show the limits for the authenticated user. - - :param _limit_monetary_account: The limit of monetary accounts. - :type _limit_monetary_account: int - :param _limit_card_debit_maestro: The limit of Maestro cards. - :type _limit_card_debit_maestro: int - :param _limit_card_debit_mastercard: The limit of MasterCard cards. - :type _limit_card_debit_mastercard: int - :param _limit_card_debit_wildcard: The limit of wildcards, e.g. Maestro or - MasterCard cards. - :type _limit_card_debit_wildcard: int - :param _limit_card_debit_replacement: The limit of free replacement cards. - :type _limit_card_debit_replacement: int + view for reading the scheduled definitions. """ # Endpoint constants. - _ENDPOINT_URL_LISTING = "user/{}/limit" + _ENDPOINT_URL_LISTING = "user/{}/schedule" # Object type. - _OBJECT_TYPE_GET = "CustomerLimit" - - _limit_monetary_account = None - _limit_card_debit_maestro = None - _limit_card_debit_mastercard = None - _limit_card_debit_wildcard = None - _limit_card_debit_replacement = None + _OBJECT_TYPE_GET = "ScheduleUser" @classmethod def list(cls, params=None, custom_headers=None): """ - Get all limits for the authenticated user. + 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 user_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseCustomerLimitList + :rtype: BunqResponseScheduleUserList """ if params is None: @@ -18385,68 +27155,157 @@ def list(cls, params=None, custom_headers=None): cls._determine_user_id()) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseCustomerLimitList.cast_from_bunq_response( + return BunqResponseScheduleUserList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) ) - @property - def limit_monetary_account(self): + def is_all_field_none(self): """ - :rtype: int + :rtype: bool """ - return self._limit_monetary_account + return True - @property - def limit_card_debit_maestro(self): + @staticmethod + def from_json(json_str): """ - :rtype: int + :type json_str: str + + :rtype: ScheduleUser """ - return self._limit_card_debit_maestro + return converter.json_to_class(ScheduleUser, json_str) - @property - def limit_card_debit_mastercard(self): + +class Session(core.BunqModel): + """ + Endpoint for operations over the current session. + """ + + # Endpoint constants. + _ENDPOINT_URL_DELETE = "session/{}" + + @classmethod + def delete(cls, session_id, custom_headers=None): """ - :rtype: int + Deletes the current session. + + :type session_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone """ - return self._limit_card_debit_mastercard + if custom_headers is None: + custom_headers = {} - @property - def limit_card_debit_wildcard(self): + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(session_id) + response_raw = api_client.delete(endpoint_url, custom_headers) + + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) + + def is_all_field_none(self): """ - :rtype: int + :rtype: bool """ - return self._limit_card_debit_wildcard + return True - @property - def limit_card_debit_replacement(self): + @staticmethod + def from_json(json_str): """ - :rtype: int + :type json_str: str + + :rtype: Session """ - return self._limit_card_debit_replacement + return converter.json_to_class(Session, json_str) - def is_all_field_none(self): + +class TabItemShopBatch(core.BunqModel): + """ + Create a batch of tab items. + + :param _tab_items: The list of tab items in the batch. + :type _tab_items: list[TabItemShop] + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item-batch" + + # Field constants. + FIELD_TAB_ITEMS = "tab_items" + + _tab_items = None + _tab_items_field_for_request = None + + def __init__(self, tab_items): """ - :rtype: bool + :param tab_items: The list of tab items we want to create in a single batch. + Limited to 50 items per batch. + :type tab_items: list[TabItemShop] """ - if self._limit_monetary_account is not None: - return False + self._tab_items_field_for_request = tab_items - if self._limit_card_debit_maestro is not None: - return False + @classmethod + def create(cls, cash_register_id, tab_uuid, tab_items, + monetary_account_id=None, custom_headers=None): + """ + Create tab items as a batch. + + :type user_id: int + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :param tab_items: The list of tab items we want to create in a single + batch. Limited to 50 items per batch. + :type tab_items: list[TabItemShop] + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ - if self._limit_card_debit_mastercard is not None: - return False + if custom_headers is None: + custom_headers = {} - if self._limit_card_debit_wildcard is not None: - return False + request_map = { + cls.FIELD_TAB_ITEMS: tab_items + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) - if self._limit_card_debit_replacement is not None: + api_client = client.ApiClient(cls._get_api_context()) + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + cash_register_id, + tab_uuid) + response_raw = api_client.post(endpoint_url, request_bytes, + custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @property + def tab_items(self): + """ + :rtype: list[TabItemShop] + """ + + return self._tab_items + + def is_all_field_none(self): + """ + :rtype: bool + """ + + if self._tab_items is not None: return False return True @@ -18456,79 +27315,131 @@ def from_json(json_str): """ :type json_str: str - :rtype: CustomerLimit + :rtype: TabItemShopBatch """ - return converter.json_to_class(CustomerLimit, json_str) + return converter.json_to_class(TabItemShopBatch, json_str) -class BillingContractSubscription(core.BunqModel): +class TabItemShop(core.BunqModel): """ - Show the subscription billing contract for the authenticated user. + 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. - :param _subscription_type: The subscription type of the user. Can be one of - PERSON_SUPER_LIGHT_V1, PERSON_LIGHT_V1, PERSON_MORE_V1, PERSON_FREE_V1, - PERSON_PREMIUM_V1, COMPANY_V1, or COMPANY_V2. - :type _subscription_type: str - :param _id_: The id of the billing contract. + :param _description: The TabItem's brief description. + :type _description: str + :param _ean_code: The TabItem's EAN code. + :type _ean_code: str + :param _avatar_attachment_uuid: An AttachmentPublic UUID that used as an + avatar for the TabItem. + :type _avatar_attachment_uuid: str + :param _tab_attachment: A list of AttachmentTab attached to the TabItem. + :type _tab_attachment: list[object_.AttachmentTab] + :param _quantity: The quantity of the TabItem. + :type _quantity: float + :param _amount: The money amount of the TabItem. + :type _amount: object_.Amount + :param _id_: The id of the created TabItem. :type _id_: int - :param _created: The timestamp when the billing contract was made. - :type _created: str - :param _updated: The timestamp when the billing contract was last updated. - :type _updated: str - :param _contract_date_start: The date from when the billing contract is - valid. - :type _contract_date_start: str - :param _contract_date_end: The date until when the billing contract is - valid. - :type _contract_date_end: str - :param _contract_version: The version of the billing contract. - :type _contract_version: int - :param _status: The subscription status. - :type _status: str - :param _sub_status: The subscription substatus. - :type _sub_status: str + :param _avatar_attachment: A struct with an AttachmentPublic UUID that used + as an avatar for the TabItem. + :type _avatar_attachment: object_.AttachmentPublic """ # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/billing-contract-subscription" - _ENDPOINT_URL_LISTING = "user/{}/billing-contract-subscription" + _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/{}" # Field constants. - FIELD_SUBSCRIPTION_TYPE = "subscription_type" + 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" # Object type. - _OBJECT_TYPE_GET = "BillingContractSubscription" + _OBJECT_TYPE_GET = "TabItem" _id_ = None - _created = None - _updated = None - _contract_date_start = None - _contract_date_end = None - _contract_version = None - _subscription_type = None - _status = None - _sub_status = None - _subscription_type_field_for_request = None + _description = None + _ean_code = None + _avatar_attachment = None + _tab_attachment = None + _quantity = None + _amount = None + _description_field_for_request = None + _ean_code_field_for_request = None + _avatar_attachment_uuid_field_for_request = None + _tab_attachment_field_for_request = None + _quantity_field_for_request = None + _amount_field_for_request = None - def __init__(self, subscription_type): + def __init__(self, description=None, ean_code=None, + avatar_attachment_uuid=None, tab_attachment=None, + quantity=None, amount=None): """ - :param subscription_type: The subscription type of the user. Can be one of - PERSON_LIGHT_V1, PERSON_MORE_V1, PERSON_FREE_V1, PERSON_PREMIUM_V1, - COMPANY_V1, or COMPANY_V2. - :type subscription_type: str + :param description: The TabItem's brief description. Can't be empty and must + be no longer than 100 characters + :type description: str + :param ean_code: The TabItem's EAN code. + :type ean_code: str + :param avatar_attachment_uuid: An AttachmentPublic UUID that used as an + avatar for the TabItem. + :type avatar_attachment_uuid: str + :param tab_attachment: A list of AttachmentTab attached to the TabItem. + :type tab_attachment: list[int] + :param quantity: The quantity of the TabItem. Formatted as a number + containing up to 15 digits, up to 15 decimals and using a dot. + :type quantity: str + :param amount: The money amount of the TabItem. Will not change the value of + the corresponding Tab. + :type amount: object_.Amount """ - self._subscription_type_field_for_request = subscription_type + self._description_field_for_request = description + self._ean_code_field_for_request = ean_code + self._avatar_attachment_uuid_field_for_request = avatar_attachment_uuid + self._tab_attachment_field_for_request = tab_attachment + self._quantity_field_for_request = quantity + self._amount_field_for_request = amount @classmethod - def create(cls, subscription_type, custom_headers=None): + def create(cls, cash_register_id, tab_uuid, description, + monetary_account_id=None, ean_code=None, + avatar_attachment_uuid=None, tab_attachment=None, quantity=None, + amount=None, custom_headers=None): """ + Create a new TabItem for a given Tab. + :type user_id: int - :param subscription_type: The subscription type of the user. Can be one - of PERSON_LIGHT_V1, PERSON_MORE_V1, PERSON_FREE_V1, PERSON_PREMIUM_V1, - COMPANY_V1, or COMPANY_V2. - :type subscription_type: str + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :param description: The TabItem's brief description. Can't be empty and + must be no longer than 100 characters + :type description: str + :param ean_code: The TabItem's EAN code. + :type ean_code: str + :param avatar_attachment_uuid: An AttachmentPublic UUID that used as an + avatar for the TabItem. + :type avatar_attachment_uuid: str + :param tab_attachment: A list of AttachmentTab attached to the TabItem. + :type tab_attachment: list[int] + :param quantity: The quantity of the TabItem. Formatted as a number + containing up to 15 digits, up to 15 decimals and using a dot. + :type quantity: str + :param amount: The money amount of the TabItem. Will not change the + value of the corresponding Tab. + :type amount: object_.Amount :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -18538,14 +27449,23 @@ def create(cls, subscription_type, custom_headers=None): custom_headers = {} request_map = { - cls.FIELD_SUBSCRIPTION_TYPE: subscription_type + cls.FIELD_DESCRIPTION: description, + cls.FIELD_EAN_CODE: ean_code, + cls.FIELD_AVATAR_ATTACHMENT_UUID: avatar_attachment_uuid, + cls.FIELD_TAB_ATTACHMENT: tab_attachment, + cls.FIELD_QUANTITY: quantity, + cls.FIELD_AMOUNT: amount } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) api_client = client.ApiClient(cls._get_api_context()) request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id()) + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + cash_register_id, + tab_uuid) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) @@ -18554,170 +27474,165 @@ def create(cls, subscription_type, custom_headers=None): ) @classmethod - def list(cls, params=None, custom_headers=None): + def update(cls, cash_register_id, tab_uuid, tab_item_shop_id, + monetary_account_id=None, description=None, ean_code=None, + avatar_attachment_uuid=None, tab_attachment=None, quantity=None, + amount=None, custom_headers=None): """ - Get all subscription billing contract for the authenticated user. + Modify a TabItem from a given Tab. :type user_id: int - :type params: dict[str, str]|None + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :type tab_item_shop_id: int + :param description: The TabItem's brief description. Can't be empty and + must be no longer than 100 characters + :type description: str + :param ean_code: The TabItem's EAN code. + :type ean_code: str + :param avatar_attachment_uuid: An AttachmentPublic UUID that used as an + avatar for the TabItem. + :type avatar_attachment_uuid: str + :param tab_attachment: A list of AttachmentTab attached to the TabItem. + :type tab_attachment: list[int] + :param quantity: The quantity of the TabItem. Formatted as a number + containing up to 15 digits, up to 15 decimals and using a dot. + :type quantity: str + :param amount: The money amount of the TabItem. Will not change the + value of the corresponding Tab. + :type amount: object_.Amount :type custom_headers: dict[str, str]|None - :rtype: BunqResponseBillingContractSubscriptionList + :rtype: BunqResponseInt """ - if params is None: - params = {} - if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_LISTING.format( - cls._determine_user_id()) - response_raw = api_client.get(endpoint_url, params, custom_headers) - - return BunqResponseBillingContractSubscriptionList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) - ) - - @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 contract_date_start(self): - """ - :rtype: str - """ - - return self._contract_date_start - - @property - def contract_date_end(self): - """ - :rtype: str - """ - - 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 - - @property - def status(self): - """ - :rtype: str - """ - return self._status + request_map = { + cls.FIELD_DESCRIPTION: description, + cls.FIELD_EAN_CODE: ean_code, + cls.FIELD_AVATAR_ATTACHMENT_UUID: avatar_attachment_uuid, + cls.FIELD_TAB_ATTACHMENT: tab_attachment, + cls.FIELD_QUANTITY: quantity, + cls.FIELD_AMOUNT: amount + } + request_map_string = converter.class_to_json(request_map) + request_map_string = cls._remove_field_for_request(request_map_string) - @property - def sub_status(self): - """ - :rtype: str - """ + request_bytes = request_map_string.encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), + cls._determine_monetary_account_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._sub_status + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) - def is_all_field_none(self): + @classmethod + def delete(cls, cash_register_id, tab_uuid, tab_item_shop_id, + monetary_account_id=None, custom_headers=None): """ - :rtype: bool + Delete a specific TabItem from a Tab. + + :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 """ - 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 custom_headers is None: + custom_headers = {} - if self._contract_date_start is not None: - return False + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + cash_register_id, + tab_uuid, + tab_item_shop_id) + response_raw = api_client.delete(endpoint_url, custom_headers) - if self._contract_date_end is not None: - return False + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) - if self._contract_version is not None: - return False + @classmethod + def list(cls, cash_register_id, tab_uuid, monetary_account_id=None, + params=None, custom_headers=None): + """ + Get a collection of TabItems from a given Tab. + + :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: BunqResponseTabItemShopList + """ - if self._subscription_type is not None: - return False + if params is None: + params = {} - if self._status is not None: - return False + if custom_headers is None: + custom_headers = {} - if self._sub_status is not None: - return False + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + cash_register_id, tab_uuid) + response_raw = api_client.get(endpoint_url, params, custom_headers) - return True + return BunqResponseTabItemShopList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + ) - @staticmethod - def from_json(json_str): + @classmethod + def get(cls, cash_register_id, tab_uuid, tab_item_shop_id, + monetary_account_id=None, custom_headers=None): """ - :type json_str: str + Get a specific TabItem from a given Tab. - :rtype: BillingContractSubscription + :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: BunqResponseTabItemShop """ - return converter.json_to_class(BillingContractSubscription, json_str) - + if custom_headers is None: + custom_headers = {} -class UserApiKey(core.BunqModel): - """ - Used to view OAuth request detais in events. - - :param _id_: The id of the user. - :type _id_: int - :param _created: The timestamp of the user object's creation. - :type _created: str - :param _updated: The timestamp of the user object's last update. - :type _updated: str - :param _requested_by_user: The user who requested access. - :type _requested_by_user: object_.UserApiKeyAnchoredUser - :param _granted_by_user: The user who granted access. - :type _granted_by_user: object_.UserApiKeyAnchoredUser - """ + api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + cls._determine_monetary_account_id( + monetary_account_id), + cash_register_id, tab_uuid, + tab_item_shop_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - _id_ = None - _created = None - _updated = None - _requested_by_user = None - _granted_by_user = None + return BunqResponseTabItemShop.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + ) @property def id_(self): @@ -18728,269 +27643,141 @@ def id_(self): return self._id_ @property - def created(self): + def description(self): """ :rtype: str """ - return self._created + return self._description @property - def updated(self): + def ean_code(self): """ :rtype: str """ - return self._updated + return self._ean_code @property - def requested_by_user(self): + def avatar_attachment(self): """ - :rtype: object_.UserApiKeyAnchoredUser + :rtype: object_.AttachmentPublic """ - return self._requested_by_user + return self._avatar_attachment @property - def granted_by_user(self): - """ - :rtype: object_.UserApiKeyAnchoredUser - """ - - return self._granted_by_user - - def is_all_field_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._requested_by_user is not None: - return False - - if self._granted_by_user is not None: - return False - - return True - - @staticmethod - def from_json(json_str): + def tab_attachment(self): """ - :type json_str: str - - :rtype: UserApiKey + :rtype: list[object_.AttachmentTab] """ - return converter.json_to_class(UserApiKey, json_str) - - -class PermittedIp(core.BunqModel): - """ - Manage the IPs which may be used for a credential of a user for server - authentication. - - :param _ip: The IP address. - :type _ip: str - :param _status: The status of the IP. May be "ACTIVE" or "INACTIVE". It is - only possible to make requests from "ACTIVE" IP addresses. Only "ACTIVE" IPs - will be billed. - :type _status: str - """ - - # 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" - - # Object type. - _OBJECT_TYPE_GET = "PermittedIp" - - _ip = None - _status = None - _ip_field_for_request = None - _status_field_for_request = None + return self._tab_attachment - def __init__(self, ip, status=None): + @property + def quantity(self): """ - :param ip: The IP address. - :type ip: str - :param status: The status of the IP. May be "ACTIVE" or "INACTIVE". It is - only possible to make requests from "ACTIVE" IP addresses. Only "ACTIVE" IPs - will be billed. - :type status: str + :rtype: float """ - self._ip_field_for_request = ip - self._status_field_for_request = status + return self._quantity - @classmethod - def get(cls, credential_password_ip_id, permitted_ip_id, - custom_headers=None): + @property + def amount(self): """ - :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 + :rtype: object_.Amount """ - if custom_headers is None: - custom_headers = {} - - api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_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_GET) - ) + return self._amount - @classmethod - def create(cls, credential_password_ip_id, ip, status=None, - custom_headers=None): + def is_all_field_none(self): """ - :type user_id: int - :type credential_password_ip_id: int - :param ip: The IP address. - :type ip: str - :param status: The status of the IP. May be "ACTIVE" or "INACTIVE". It - is only possible to make requests from "ACTIVE" IP addresses. Only - "ACTIVE" IPs will be billed. - :type status: str - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt + :rtype: bool """ - if custom_headers is None: - custom_headers = {} + if self._id_ is not None: + return False - request_map = { - cls.FIELD_IP: ip, - cls.FIELD_STATUS: status - } - request_map_string = converter.class_to_json(request_map) - request_map_string = cls._remove_field_for_request(request_map_string) + if self._description is not None: + return False - api_client = client.ApiClient(cls._get_api_context()) - request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), - credential_password_ip_id) - response_raw = api_client.post(endpoint_url, request_bytes, - custom_headers) + if self._ean_code is not None: + return False - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) + if self._avatar_attachment is not None: + return False - @classmethod - def list(cls, credential_password_ip_id, params=None, custom_headers=None): + 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 + + @staticmethod + def from_json(json_str): """ - :type user_id: int - :type credential_password_ip_id: int - :type params: dict[str, str]|None - :type custom_headers: dict[str, str]|None + :type json_str: str - :rtype: BunqResponsePermittedIpList + :rtype: TabItemShop """ - if params is None: - params = {} + return converter.json_to_class(TabItemShop, json_str) - if custom_headers is None: - custom_headers = {} - api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_LISTING.format( - cls._determine_user_id(), credential_password_ip_id) - response_raw = api_client.get(endpoint_url, params, custom_headers) +class TabQrCodeContent(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. + """ - return BunqResponsePermittedIpList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) - ) + # Endpoint constants. + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/qr-code-content" + + # Object type. + _OBJECT_TYPE_GET = "TabQrCodeContent" @classmethod - def update(cls, credential_password_ip_id, permitted_ip_id, status=None, - custom_headers=None): + def list(cls, cash_register_id, tab_uuid, monetary_account_id=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. + :type user_id: int - :type credential_password_ip_id: int - :type permitted_ip_id: int - :param status: The status of the IP. May be "ACTIVE" or "INACTIVE". It - is only possible to make requests from "ACTIVE" IP addresses. Only - "ACTIVE" IPs will be billed. - :type status: str + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseInt + :rtype: BunqResponseBytes """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id(), + cls._determine_monetary_account_id(monetary_account_id), + cash_register_id, tab_uuid) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - request_map = { - cls.FIELD_STATUS: status - } - request_map_string = converter.class_to_json(request_map) - request_map_string = cls._remove_field_for_request(request_map_string) - - request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_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) + return BunqResponseBytes.cast_from_bunq_response( + client.BunqResponse(response_raw.body_bytes, response_raw.headers) ) - @property - def ip(self): - """ - :rtype: str - """ - - return self._ip - - @property - def status(self): - """ - :rtype: str - """ - - return self._status - def is_all_field_none(self): """ :rtype: bool """ - if self._ip is not None: - return False - - if self._status is not None: - return False - return True @staticmethod @@ -18998,452 +27785,386 @@ def from_json(json_str): """ :type json_str: str - :rtype: PermittedIp + :rtype: TabQrCodeContent """ - return converter.json_to_class(PermittedIp, json_str) + return converter.json_to_class(TabQrCodeContent, json_str) -class SandboxUser(core.BunqModel): +class TokenQrRequestIdeal(core.BunqModel): """ - Used to create a sandbox user. + 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/terms-idealstandards. It's very important to keep these + points in mind when you are using the endpoint to make iDEAL payments from + your application. - :param _api_key: The API key of the newly created sandbox user. - :type _api_key: str + :param _token: The token passed from a site or read from a QR code. + :type _token: str + :param _id_: The id of the RequestResponse. + :type _id_: int + :param _time_responded: The timestamp of when the RequestResponse was + responded to. + :type _time_responded: str + :param _time_expiry: The timestamp of when the RequestResponse expired or + will expire. + :type _time_expiry: str + :param _monetary_account_id: The id of the MonetaryAccount the + RequestResponse was received on. + :type _monetary_account_id: int + :param _amount_inquired: The requested Amount. + :type _amount_inquired: object_.Amount + :param _amount_responded: The Amount the RequestResponse was accepted with. + :type _amount_responded: object_.Amount + :param _alias: The LabelMonetaryAccount with the public information of the + MonetaryAccount this RequestResponse was received on. + :type _alias: object_.MonetaryAccountReference + :param _counterparty_alias: The LabelMonetaryAccount with the public + information of the MonetaryAccount that is requesting money with this + RequestResponse. + :type _counterparty_alias: object_.MonetaryAccountReference + :param _description: The description for the RequestResponse provided by the + requesting party. Maximum 9000 characters. + :type _description: str + :param _attachment: The Attachments attached to the RequestResponse. + :type _attachment: list[object_.Attachment] + :param _status: The status of the created RequestResponse. Can only be + PENDING. + :type _status: str + :param _minimum_age: The minimum age the user accepting the RequestResponse + must have. + :type _minimum_age: int + :param _require_address: Whether or not an address must be provided on + accept. + :type _require_address: str + :param _address_shipping: The shipping address provided by the accepting + user if an address was requested. + :type _address_shipping: object_.Address + :param _address_billing: The billing address provided by the accepting user + if an address was requested. + :type _address_billing: object_.Address + :param _geolocation: The Geolocation where the RequestResponse was created. + :type _geolocation: object_.Geolocation + :param _redirect_url: The URL which the user is sent to after accepting or + rejecting the Request. + :type _redirect_url: str + :param _type_: The type of the RequestResponse. Can be only be IDEAL. + :type _type_: str + :param _sub_type: The subtype of the RequestResponse. Can be only be NONE. + :type _sub_type: str + :param _allow_chat: Whether or not chat messages are allowed. + :type _allow_chat: bool + :param _eligible_whitelist_id: The whitelist id for this action or null. + :type _eligible_whitelist_id: int """ # Endpoint constants. - _ENDPOINT_URL_CREATE = "sandbox-user" + _ENDPOINT_URL_CREATE = "user/{}/token-qr-request-ideal" + + # Field constants. + FIELD_TOKEN = "token" + + # Object type. + _OBJECT_TYPE_POST = "RequestResponse" + + _id_ = None + _time_responded = None + _time_expiry = None + _monetary_account_id = None + _amount_inquired = None + _amount_responded = None + _alias = None + _counterparty_alias = None + _description = None + _attachment = None + _status = None + _minimum_age = None + _require_address = None + _address_shipping = None + _address_billing = None + _geolocation = None + _redirect_url = None + _type_ = None + _sub_type = None + _allow_chat = None + _eligible_whitelist_id = None + _token_field_for_request = None - # Object type. - _OBJECT_TYPE_POST = "ApiKey" + def __init__(self, token): + """ + :param token: The token passed from a site or read from a QR code. + :type token: str + """ - _api_key = None + self._token_field_for_request = token @classmethod - def create(cls, custom_headers=None): + def create(cls, token, custom_headers=None): """ + Create a request from an ideal transaction. + + :type user_id: int + :param token: The token passed from a site or read from a QR code. + :type token: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseSandboxUser + :rtype: BunqResponseTokenQrRequestIdeal """ if custom_headers is None: custom_headers = {} request_map = { - + cls.FIELD_TOKEN: token } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) api_client = client.ApiClient(cls._get_api_context()) request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_CREATE + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id()) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - return BunqResponseSandboxUser.cast_from_bunq_response( + return BunqResponseTokenQrRequestIdeal.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE_POST) ) @property - def api_key(self): + def id_(self): """ - :rtype: str + :rtype: int """ - return self._api_key + return self._id_ - def is_all_field_none(self): + @property + def time_responded(self): """ - :rtype: bool + :rtype: str """ - if self._api_key is not None: - return False - - return True + return self._time_responded - @staticmethod - def from_json(json_str): + @property + def time_expiry(self): """ - :type json_str: str - - :rtype: SandboxUser + :rtype: str """ - return converter.json_to_class(SandboxUser, json_str) - - -class SchedulePaymentBatch(core.BunqModel): - """ - Endpoint for schedule payment batches. - - :param _payments: The payment details. - :type _payments: list[object_.SchedulePaymentEntry] - :param _schedule: The schedule details. - :type _schedule: Schedule - """ - - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/schedule-payment-batch" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/schedule-payment-batch/{}" - _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/schedule-payment-batch/{}" - - # Field constants. - FIELD_PAYMENTS = "payments" - FIELD_SCHEDULE = "schedule" - - _payments = None - _schedule = None - _payments_field_for_request = None - _schedule_field_for_request = None + return self._time_expiry - def __init__(self, payments=None, schedule=None): + @property + def monetary_account_id(self): """ - :param payments: The payment details. - :type payments: list[object_.SchedulePaymentEntry] - :param schedule: The schedule details when creating a scheduled payment. - :type schedule: Schedule + :rtype: int """ - self._payments_field_for_request = payments - self._schedule_field_for_request = schedule + return self._monetary_account_id - @classmethod - def create(cls, payments, schedule, monetary_account_id=None, - custom_headers=None): + @property + def amount_inquired(self): """ - :type user_id: int - :type monetary_account_id: int - :param payments: The payment details. - :type payments: list[object_.SchedulePaymentEntry] - :param schedule: The schedule details when creating a scheduled payment. - :type schedule: Schedule - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt + :rtype: object_.Amount """ - if custom_headers is None: - custom_headers = {} - - request_map = { - cls.FIELD_PAYMENTS: payments, - cls.FIELD_SCHEDULE: schedule - } - request_map_string = converter.class_to_json(request_map) - request_map_string = cls._remove_field_for_request(request_map_string) - - api_client = client.ApiClient(cls._get_api_context()) - request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id)) - response_raw = api_client.post(endpoint_url, request_bytes, - custom_headers) - - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) + return self._amount_inquired - @classmethod - def update(cls, schedule_payment_batch_id, monetary_account_id=None, - payments=None, schedule=None, custom_headers=None): + @property + def amount_responded(self): """ - :type user_id: int - :type monetary_account_id: int - :type schedule_payment_batch_id: int - :param payments: The payment details. - :type payments: list[object_.SchedulePaymentEntry] - :param schedule: The schedule details when creating a scheduled payment. - :type schedule: Schedule - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt + :rtype: object_.Amount """ - if custom_headers is None: - custom_headers = {} - - api_client = client.ApiClient(cls._get_api_context()) - - request_map = { - cls.FIELD_PAYMENTS: payments, - cls.FIELD_SCHEDULE: schedule - } - request_map_string = converter.class_to_json(request_map) - request_map_string = cls._remove_field_for_request(request_map_string) - - request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - schedule_payment_batch_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 self._amount_responded - @classmethod - def delete(cls, schedule_payment_batch_id, monetary_account_id=None, - custom_headers=None): + @property + def alias(self): """ - :type user_id: int - :type monetary_account_id: int - :type schedule_payment_batch_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseNone + :rtype: object_.MonetaryAccountReference """ - if custom_headers is None: - custom_headers = {} - - api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - schedule_payment_batch_id) - response_raw = api_client.delete(endpoint_url, custom_headers) - - return BunqResponseNone.cast_from_bunq_response( - client.BunqResponse(None, response_raw.headers) - ) + return self._alias @property - def payments(self): + def counterparty_alias(self): """ - :rtype: list[object_.SchedulePaymentEntry] + :rtype: object_.MonetaryAccountReference """ - return self._payments + return self._counterparty_alias @property - def schedule(self): + def description(self): """ - :rtype: Schedule + :rtype: str """ - return self._schedule + return self._description - def is_all_field_none(self): + @property + def attachment(self): """ - :rtype: bool + :rtype: list[object_.Attachment] """ - if self._payments is not None: - return False - - if self._schedule is not None: - return False - - return True + return self._attachment - @staticmethod - def from_json(json_str): + @property + def status(self): """ - :type json_str: str - - :rtype: SchedulePaymentBatch + :rtype: str """ - return converter.json_to_class(SchedulePaymentBatch, json_str) - - -class ScheduleUser(core.BunqModel): - """ - view for reading the scheduled definitions. - """ + return self._status - # Endpoint constants. - _ENDPOINT_URL_LISTING = "user/{}/schedule" + @property + def minimum_age(self): + """ + :rtype: int + """ - # Object type. - _OBJECT_TYPE_GET = "ScheduleUser" + return self._minimum_age - @classmethod - def list(cls, params=None, custom_headers=None): + @property + def require_address(self): """ - 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 user_id: int - :type params: dict[str, str]|None - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseScheduleUserList + :rtype: str """ - if params is None: - params = {} + return self._require_address - if custom_headers is None: - custom_headers = {} + @property + def address_shipping(self): + """ + :rtype: object_.Address + """ - api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_LISTING.format( - cls._determine_user_id()) - response_raw = api_client.get(endpoint_url, params, custom_headers) + return self._address_shipping - return BunqResponseScheduleUserList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) - ) + @property + def address_billing(self): + """ + :rtype: object_.Address + """ - def is_all_field_none(self): + return self._address_billing + + @property + def geolocation(self): """ - :rtype: bool + :rtype: object_.Geolocation """ - return True + return self._geolocation - @staticmethod - def from_json(json_str): + @property + def redirect_url(self): """ - :type json_str: str - - :rtype: ScheduleUser + :rtype: str """ - return converter.json_to_class(ScheduleUser, json_str) + return self._redirect_url + + @property + def type_(self): + """ + :rtype: str + """ + return self._type_ -class Session(core.BunqModel): - """ - Endpoint for operations over the current session. - """ + @property + def sub_type(self): + """ + :rtype: str + """ - # Endpoint constants. - _ENDPOINT_URL_DELETE = "session/{}" + return self._sub_type - @classmethod - def delete(cls, session_id, custom_headers=None): + @property + def allow_chat(self): """ - Deletes the current session. - - :type session_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseNone + :rtype: bool """ - if custom_headers is None: - custom_headers = {} + return self._allow_chat - api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_DELETE.format(session_id) - response_raw = api_client.delete(endpoint_url, custom_headers) + @property + def eligible_whitelist_id(self): + """ + :rtype: int + """ - return BunqResponseNone.cast_from_bunq_response( - client.BunqResponse(None, response_raw.headers) - ) + return self._eligible_whitelist_id def is_all_field_none(self): """ :rtype: bool """ - return True + if self._id_ is not None: + return False - @staticmethod - def from_json(json_str): - """ - :type json_str: str - - :rtype: Session - """ + if self._time_responded is not None: + return False - return converter.json_to_class(Session, json_str) + if self._time_expiry is not None: + return False + if self._monetary_account_id is not None: + return False -class TabItemShopBatch(core.BunqModel): - """ - Create a batch of tab items. - - :param _tab_items: The list of tab items in the batch. - :type _tab_items: list[TabItemShop] - """ + if self._amount_inquired is not None: + return False - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item-batch" + if self._amount_responded is not None: + return False - # Field constants. - FIELD_TAB_ITEMS = "tab_items" + if self._alias is not None: + return False - _tab_items = None - _tab_items_field_for_request = None + if self._counterparty_alias is not None: + return False - def __init__(self, tab_items): - """ - :param tab_items: The list of tab items we want to create in a single batch. - Limited to 50 items per batch. - :type tab_items: list[TabItemShop] - """ + if self._description is not None: + return False - self._tab_items_field_for_request = tab_items + if self._attachment is not None: + return False - @classmethod - def create(cls, cash_register_id, tab_uuid, tab_items, - monetary_account_id=None, custom_headers=None): - """ - Create tab items as a batch. - - :type user_id: int - :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :param tab_items: The list of tab items we want to create in a single - batch. Limited to 50 items per batch. - :type tab_items: list[TabItemShop] - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt - """ + if self._status is not None: + return False - if custom_headers is None: - custom_headers = {} + if self._minimum_age is not None: + return False - request_map = { - cls.FIELD_TAB_ITEMS: tab_items - } - request_map_string = converter.class_to_json(request_map) - request_map_string = cls._remove_field_for_request(request_map_string) + if self._require_address is not None: + return False - api_client = client.ApiClient(cls._get_api_context()) - request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - cash_register_id, - tab_uuid) - response_raw = api_client.post(endpoint_url, request_bytes, - custom_headers) + if self._address_shipping is not None: + return False - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) + if self._address_billing is not None: + return False - @property - def tab_items(self): - """ - :rtype: list[TabItemShop] - """ + if self._geolocation is not None: + return False - return self._tab_items + if self._redirect_url is not None: + return False - def is_all_field_none(self): - """ - :rtype: bool - """ + if self._type_ is not None: + return False - if self._tab_items is not None: + if self._sub_type 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 @@ -19453,323 +28174,175 @@ def from_json(json_str): """ :type json_str: str - :rtype: TabItemShopBatch + :rtype: TokenQrRequestIdeal """ - return converter.json_to_class(TabItemShopBatch, json_str) + return converter.json_to_class(TokenQrRequestIdeal, json_str) -class TabItemShop(core.BunqModel): +class TokenQrRequestSofort(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. + Using this call you can create a SOFORT Request assigned to your User by + providing the Token of the request. - :param _description: The TabItem's brief description. - :type _description: str - :param _ean_code: The TabItem's EAN code. - :type _ean_code: str - :param _avatar_attachment_uuid: An AttachmentPublic UUID that used as an - avatar for the TabItem. - :type _avatar_attachment_uuid: str - :param _tab_attachment: A list of AttachmentTab attached to the TabItem. - :type _tab_attachment: list[object_.AttachmentTab] - :param _quantity: The quantity of the TabItem. - :type _quantity: float - :param _amount: The money amount of the TabItem. - :type _amount: object_.Amount - :param _id_: The id of the created TabItem. - :type _id_: int - :param _avatar_attachment: A struct with an AttachmentPublic UUID that used - as an avatar for the TabItem. - :type _avatar_attachment: object_.AttachmentPublic + :param _token: The token passed from a site or read from a QR code. + :type _token: str """ - # 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/{}" - - # 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" + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/token-qr-request-sofort" + + # Field constants. + FIELD_TOKEN = "token" # Object type. - _OBJECT_TYPE_GET = "TabItem" + _OBJECT_TYPE_POST = "RequestResponse" - _id_ = None - _description = None - _ean_code = None - _avatar_attachment = None - _tab_attachment = None - _quantity = None - _amount = None - _description_field_for_request = None - _ean_code_field_for_request = None - _avatar_attachment_uuid_field_for_request = None - _tab_attachment_field_for_request = None - _quantity_field_for_request = None - _amount_field_for_request = None + _token_field_for_request = None - def __init__(self, description=None, ean_code=None, - avatar_attachment_uuid=None, tab_attachment=None, - quantity=None, amount=None): + def __init__(self, token): """ - :param description: The TabItem's brief description. Can't be empty and must - be no longer than 100 characters - :type description: str - :param ean_code: The TabItem's EAN code. - :type ean_code: str - :param avatar_attachment_uuid: An AttachmentPublic UUID that used as an - avatar for the TabItem. - :type avatar_attachment_uuid: str - :param tab_attachment: A list of AttachmentTab attached to the TabItem. - :type tab_attachment: list[int] - :param quantity: The quantity of the TabItem. Formatted as a number - containing up to 15 digits, up to 15 decimals and using a dot. - :type quantity: str - :param amount: The money amount of the TabItem. Will not change the value of - the corresponding Tab. - :type amount: object_.Amount + :param token: The token passed from a site or read from a QR code. + :type token: str """ - self._description_field_for_request = description - self._ean_code_field_for_request = ean_code - self._avatar_attachment_uuid_field_for_request = avatar_attachment_uuid - self._tab_attachment_field_for_request = tab_attachment - self._quantity_field_for_request = quantity - self._amount_field_for_request = amount + self._token_field_for_request = token @classmethod - def create(cls, cash_register_id, tab_uuid, description, - monetary_account_id=None, ean_code=None, - avatar_attachment_uuid=None, tab_attachment=None, quantity=None, - amount=None, custom_headers=None): + def create(cls, token, custom_headers=None): """ - Create a new TabItem for a given Tab. + Create a request from an SOFORT transaction. :type user_id: int - :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :param description: The TabItem's brief description. Can't be empty and - must be no longer than 100 characters - :type description: str - :param ean_code: The TabItem's EAN code. - :type ean_code: str - :param avatar_attachment_uuid: An AttachmentPublic UUID that used as an - avatar for the TabItem. - :type avatar_attachment_uuid: str - :param tab_attachment: A list of AttachmentTab attached to the TabItem. - :type tab_attachment: list[int] - :param quantity: The quantity of the TabItem. Formatted as a number - containing up to 15 digits, up to 15 decimals and using a dot. - :type quantity: str - :param amount: The money amount of the TabItem. Will not change the - value of the corresponding Tab. - :type amount: object_.Amount + :param token: The token passed from a site or read from a QR code. + :type token: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseInt + :rtype: BunqResponseTokenQrRequestSofort """ if custom_headers is None: custom_headers = {} request_map = { - cls.FIELD_DESCRIPTION: description, - cls.FIELD_EAN_CODE: ean_code, - cls.FIELD_AVATAR_ATTACHMENT_UUID: avatar_attachment_uuid, - cls.FIELD_TAB_ATTACHMENT: tab_attachment, - cls.FIELD_QUANTITY: quantity, - cls.FIELD_AMOUNT: amount + cls.FIELD_TOKEN: token } request_map_string = converter.class_to_json(request_map) request_map_string = cls._remove_field_for_request(request_map_string) api_client = client.ApiClient(cls._get_api_context()) request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - cash_register_id, - tab_uuid) + endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_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) + return BunqResponseTokenQrRequestSofort.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_POST) ) - @classmethod - def update(cls, cash_register_id, tab_uuid, tab_item_shop_id, - monetary_account_id=None, description=None, ean_code=None, - avatar_attachment_uuid=None, tab_attachment=None, quantity=None, - amount=None, custom_headers=None): + def is_all_field_none(self): """ - Modify a TabItem from a given Tab. - - :type user_id: int - :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :type tab_item_shop_id: int - :param description: The TabItem's brief description. Can't be empty and - must be no longer than 100 characters - :type description: str - :param ean_code: The TabItem's EAN code. - :type ean_code: str - :param avatar_attachment_uuid: An AttachmentPublic UUID that used as an - avatar for the TabItem. - :type avatar_attachment_uuid: str - :param tab_attachment: A list of AttachmentTab attached to the TabItem. - :type tab_attachment: list[int] - :param quantity: The quantity of the TabItem. Formatted as a number - containing up to 15 digits, up to 15 decimals and using a dot. - :type quantity: str - :param amount: The money amount of the TabItem. Will not change the - value of the corresponding Tab. - :type amount: object_.Amount - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt + :rtype: bool """ - if custom_headers is None: - custom_headers = {} - - api_client = client.ApiClient(cls._get_api_context()) - - request_map = { - cls.FIELD_DESCRIPTION: description, - cls.FIELD_EAN_CODE: ean_code, - cls.FIELD_AVATAR_ATTACHMENT_UUID: avatar_attachment_uuid, - cls.FIELD_TAB_ATTACHMENT: tab_attachment, - cls.FIELD_QUANTITY: quantity, - cls.FIELD_AMOUNT: amount - } - request_map_string = converter.class_to_json(request_map) - request_map_string = cls._remove_field_for_request(request_map_string) - - request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(cls._determine_user_id(), - cls._determine_monetary_account_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 BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) + return True - @classmethod - def delete(cls, cash_register_id, tab_uuid, tab_item_shop_id, - monetary_account_id=None, custom_headers=None): + @staticmethod + def from_json(json_str): """ - Delete a specific TabItem from a Tab. - - :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 + :type json_str: str - :rtype: BunqResponseNone + :rtype: TokenQrRequestSofort """ - if custom_headers is None: - custom_headers = {} + return converter.json_to_class(TokenQrRequestSofort, json_str) - api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_DELETE.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - cash_register_id, - tab_uuid, - tab_item_shop_id) - response_raw = api_client.delete(endpoint_url, custom_headers) - return BunqResponseNone.cast_from_bunq_response( - client.BunqResponse(None, response_raw.headers) - ) +class UserCredentialPasswordIp(core.BunqModel): + """ + Create a credential of a user for server authentication, or delete the + credential of a user for server authentication. + + :param _id_: The id of the credential. + :type _id_: int + :param _created: The timestamp of the credential object's creation. + :type _created: str + :param _updated: The timestamp of the credential object's last update. + :type _updated: str + :param _status: The status of the credential. + :type _status: str + :param _expiry_time: When the status is PENDING_FIRST_USE: when the + credential expires. + :type _expiry_time: str + :param _token_value: When the status is PENDING_FIRST_USE: the value of the + token. + :type _token_value: str + :param _permitted_device: When the status is ACTIVE: the details of the + device that may use the credential. + :type _permitted_device: object_.PermittedDevice + """ + + # Endpoint constants. + _ENDPOINT_URL_READ = "user/{}/credential-password-ip/{}" + _ENDPOINT_URL_LISTING = "user/{}/credential-password-ip" + + # Object type. + _OBJECT_TYPE_GET = "CredentialPasswordIp" + + _id_ = None + _created = None + _updated = None + _status = None + _expiry_time = None + _token_value = None + _permitted_device = None @classmethod - def list(cls, cash_register_id, tab_uuid, monetary_account_id=None, - params=None, custom_headers=None): + def get(cls, user_credential_password_ip_id, custom_headers=None): """ - 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 user_credential_password_ip_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseTabItemShopList + :rtype: BunqResponseUserCredentialPasswordIp """ - if params is None: - params = {} - if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_LISTING.format( - cls._determine_user_id(), - cls._determine_monetary_account_id(monetary_account_id), - cash_register_id, tab_uuid) - response_raw = api_client.get(endpoint_url, params, custom_headers) + endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), + user_credential_password_ip_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseTabItemShopList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) + return BunqResponseUserCredentialPasswordIp.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE_GET) ) @classmethod - def get(cls, cash_register_id, tab_uuid, tab_item_shop_id, - monetary_account_id=None, custom_headers=None): + def list(cls, params=None, custom_headers=None): """ - Get a specific TabItem 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 tab_item_shop_id: int + :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseTabItemShop + :rtype: BunqResponseUserCredentialPasswordIpList """ + if params is None: + params = {} + if custom_headers is None: custom_headers = {} api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), - cls._determine_monetary_account_id( - monetary_account_id), - cash_register_id, tab_uuid, - tab_item_shop_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + endpoint_url = cls._ENDPOINT_URL_LISTING.format( + cls._determine_user_id()) + response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseTabItemShop.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_GET) + return BunqResponseUserCredentialPasswordIpList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) ) @property @@ -19781,52 +28354,52 @@ 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 status(self): """ - :rtype: object_.AttachmentPublic + :rtype: str """ - return self._avatar_attachment + return self._status @property - def tab_attachment(self): + def expiry_time(self): """ - :rtype: list[object_.AttachmentTab] + :rtype: str """ - return self._tab_attachment + return self._expiry_time @property - def quantity(self): + def token_value(self): """ - :rtype: float + :rtype: str """ - return self._quantity + return self._token_value @property - def amount(self): + def permitted_device(self): """ - :rtype: object_.Amount + :rtype: object_.PermittedDevice """ - return self._amount + return self._permitted_device def is_all_field_none(self): """ @@ -19836,1373 +28409,1198 @@ def is_all_field_none(self): 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: + if self._created is not None: return False - if self._tab_attachment is not None: + if self._updated is not None: return False - if self._quantity is not None: + if self._status is not None: return False - if self._amount is not None: + if self._expiry_time is not None: return False - return True - - @staticmethod - def from_json(json_str): - """ - :type json_str: str - - :rtype: TabItemShop - """ - - return converter.json_to_class(TabItemShop, json_str) - - -class TabQrCodeContent(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. - """ - - # Endpoint constants. - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/qr-code-content" - - # Object type. - _OBJECT_TYPE_GET = "TabQrCodeContent" - - @classmethod - def list(cls, cash_register_id, tab_uuid, monetary_account_id=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. - - :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(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_LISTING.format( - cls._determine_user_id(), - cls._determine_monetary_account_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 is_all_field_none(self): - """ - :rtype: bool - """ - - return True - - @staticmethod - def from_json(json_str): - """ - :type json_str: str - - :rtype: TabQrCodeContent - """ - - return converter.json_to_class(TabQrCodeContent, json_str) - - -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/terms-idealstandards. It's very important to keep these - points in mind when you are using the endpoint to make iDEAL payments from - your application. - - :param _token: The token passed from a site or read from a QR code. - :type _token: str - :param _id_: The id of the RequestResponse. - :type _id_: int - :param _time_responded: The timestamp of when the RequestResponse was - responded to. - :type _time_responded: str - :param _time_expiry: The timestamp of when the RequestResponse expired or - will expire. - :type _time_expiry: str - :param _monetary_account_id: The id of the MonetaryAccount the - RequestResponse was received on. - :type _monetary_account_id: int - :param _amount_inquired: The requested Amount. - :type _amount_inquired: object_.Amount - :param _amount_responded: The Amount the RequestResponse was accepted with. - :type _amount_responded: object_.Amount - :param _alias: The LabelMonetaryAccount with the public information of the - MonetaryAccount this RequestResponse was received on. - :type _alias: object_.MonetaryAccountReference - :param _counterparty_alias: The LabelMonetaryAccount with the public - information of the MonetaryAccount that is requesting money with this - RequestResponse. - :type _counterparty_alias: object_.MonetaryAccountReference - :param _description: The description for the RequestResponse provided by the - requesting party. Maximum 9000 characters. - :type _description: str - :param _attachment: The Attachments attached to the RequestResponse. - :type _attachment: list[object_.Attachment] - :param _status: The status of the created RequestResponse. Can only be - PENDING. - :type _status: str - :param _minimum_age: The minimum age the user accepting the RequestResponse - must have. - :type _minimum_age: int - :param _require_address: Whether or not an address must be provided on - accept. - :type _require_address: str - :param _address_shipping: The shipping address provided by the accepting - user if an address was requested. - :type _address_shipping: object_.Address - :param _address_billing: The billing address provided by the accepting user - if an address was requested. - :type _address_billing: object_.Address - :param _geolocation: The Geolocation where the RequestResponse was created. - :type _geolocation: object_.Geolocation - :param _redirect_url: The URL which the user is sent to after accepting or - rejecting the Request. - :type _redirect_url: str - :param _type_: The type of the RequestResponse. Can be only be IDEAL. - :type _type_: str - :param _sub_type: The subtype of the RequestResponse. Can be only be NONE. - :type _sub_type: str - :param _allow_chat: Whether or not chat messages are allowed. - :type _allow_chat: bool - :param _eligible_whitelist_id: The whitelist id for this action or null. - :type _eligible_whitelist_id: int - """ - - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/token-qr-request-ideal" - - # Field constants. - FIELD_TOKEN = "token" - - # Object type. - _OBJECT_TYPE_POST = "RequestResponse" - - _id_ = None - _time_responded = None - _time_expiry = None - _monetary_account_id = None - _amount_inquired = None - _amount_responded = None - _alias = None - _counterparty_alias = None - _description = None - _attachment = None - _status = None - _minimum_age = None - _require_address = None - _address_shipping = None - _address_billing = None - _geolocation = None - _redirect_url = None - _type_ = None - _sub_type = None - _allow_chat = None - _eligible_whitelist_id = None - _token_field_for_request = None - - def __init__(self, token): - """ - :param token: The token passed from a site or read from a QR code. - :type token: str - """ - - self._token_field_for_request = token + if self._token_value is not None: + return False - @classmethod - def create(cls, token, custom_headers=None): + if self._permitted_device is not None: + return False + + return True + + @staticmethod + def from_json(json_str): """ - Create a request from an ideal transaction. - - :type user_id: int - :param token: The token passed from a site or read from a QR code. - :type token: str - :type custom_headers: dict[str, str]|None + :type json_str: str - :rtype: BunqResponseTokenQrRequestIdeal + :rtype: UserCredentialPasswordIp """ - if custom_headers is None: - custom_headers = {} + return converter.json_to_class(UserCredentialPasswordIp, json_str) - request_map = { - cls.FIELD_TOKEN: token - } - request_map_string = converter.class_to_json(request_map) - request_map_string = cls._remove_field_for_request(request_map_string) - api_client = client.ApiClient(cls._get_api_context()) - request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id()) - response_raw = api_client.post(endpoint_url, request_bytes, - custom_headers) +class BunqResponseInvoiceList(client.BunqResponse): + @property + def value(self): + """ + :rtype: list[Invoice] + """ - return BunqResponseTokenQrRequestIdeal.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_POST) - ) + return super().value + +class BunqResponseInvoice(client.BunqResponse): @property - def id_(self): + def value(self): """ - :rtype: int + :rtype: Invoice """ - return self._id_ + return super().value + +class BunqResponseInvoiceByUserList(client.BunqResponse): @property - def time_responded(self): + def value(self): """ - :rtype: str + :rtype: list[InvoiceByUser] """ - return self._time_responded + return super().value + +class BunqResponseInvoiceByUser(client.BunqResponse): @property - def time_expiry(self): + def value(self): """ - :rtype: str + :rtype: InvoiceByUser """ - return self._time_expiry + return super().value + +class BunqResponseBytes(client.BunqResponse): @property - def monetary_account_id(self): + def value(self): """ - :rtype: int + :rtype: bytes """ - return self._monetary_account_id + return super().value + +class BunqResponseInt(client.BunqResponse): @property - def amount_inquired(self): + def value(self): """ - :rtype: object_.Amount + :rtype: int """ - return self._amount_inquired + return super().value + +class BunqResponseStr(client.BunqResponse): @property - def amount_responded(self): + def value(self): """ - :rtype: object_.Amount + :rtype: str """ - return self._amount_responded + return super().value + +class BunqResponseAttachmentPublic(client.BunqResponse): @property - def alias(self): + def value(self): """ - :rtype: object_.MonetaryAccountReference + :rtype: AttachmentPublic """ - return self._alias + return super().value + +class BunqResponseAttachmentTab(client.BunqResponse): @property - def counterparty_alias(self): + def value(self): """ - :rtype: object_.MonetaryAccountReference + :rtype: AttachmentTab """ - return self._counterparty_alias + return super().value + +class BunqResponseTabAttachmentTab(client.BunqResponse): @property - def description(self): + def value(self): """ - :rtype: str + :rtype: TabAttachmentTab """ - return self._description + return super().value + +class BunqResponseAvatar(client.BunqResponse): @property - def attachment(self): + def value(self): """ - :rtype: list[object_.Attachment] + :rtype: Avatar """ - return self._attachment + return super().value + +class BunqResponseBunqMeTabList(client.BunqResponse): @property - def status(self): + def value(self): """ - :rtype: str + :rtype: list[BunqMeTab] """ - return self._status + return super().value + +class BunqResponseBunqMeTab(client.BunqResponse): @property - def minimum_age(self): + def value(self): """ - :rtype: int + :rtype: BunqMeTab """ - return self._minimum_age + return super().value + +class BunqResponsePayment(client.BunqResponse): @property - def require_address(self): + def value(self): """ - :rtype: str + :rtype: Payment """ - return self._require_address + return super().value + +class BunqResponsePaymentList(client.BunqResponse): @property - def address_shipping(self): + def value(self): """ - :rtype: object_.Address + :rtype: list[Payment] """ - return self._address_shipping + return super().value + +class BunqResponseCardBatch(client.BunqResponse): @property - def address_billing(self): + def value(self): """ - :rtype: object_.Address + :rtype: CardBatch """ - return self._address_billing + return super().value + +class BunqResponseCardDebit(client.BunqResponse): @property - def geolocation(self): + def value(self): """ - :rtype: object_.Geolocation + :rtype: CardDebit """ - return self._geolocation + return super().value + +class BunqResponseCardGeneratedCvc2(client.BunqResponse): @property - def redirect_url(self): + def value(self): """ - :rtype: str + :rtype: CardGeneratedCvc2 """ - return self._redirect_url + return super().value + +class BunqResponseCardGeneratedCvc2List(client.BunqResponse): @property - def type_(self): + def value(self): """ - :rtype: str + :rtype: list[CardGeneratedCvc2] """ - return self._type_ + return super().value + +class BunqResponseCardNameList(client.BunqResponse): @property - def sub_type(self): + def value(self): """ - :rtype: str + :rtype: list[CardName] """ - return self._sub_type + return super().value + +class BunqResponseCard(client.BunqResponse): @property - def allow_chat(self): + def value(self): """ - :rtype: bool + :rtype: Card """ - return self._allow_chat + return super().value + +class BunqResponseCardList(client.BunqResponse): @property - def eligible_whitelist_id(self): + def value(self): """ - :rtype: int + :rtype: list[Card] """ - return self._eligible_whitelist_id + return super().value - def is_all_field_none(self): + +class BunqResponseCashRegisterQrCode(client.BunqResponse): + @property + def value(self): """ - :rtype: bool + :rtype: CashRegisterQrCode """ - if self._id_ is not None: - return False + return super().value - if self._time_responded is not None: - return False - if self._time_expiry is not None: - return False +class BunqResponseCashRegisterQrCodeList(client.BunqResponse): + @property + def value(self): + """ + :rtype: list[CashRegisterQrCode] + """ - if self._monetary_account_id is not None: - return False + return super().value - if self._amount_inquired is not None: - return False - if self._amount_responded is not None: - return False +class BunqResponseCashRegister(client.BunqResponse): + @property + def value(self): + """ + :rtype: CashRegister + """ - if self._alias is not None: - return False + return super().value - if self._counterparty_alias is not None: - return False - if self._description is not None: - return False +class BunqResponseCashRegisterList(client.BunqResponse): + @property + def value(self): + """ + :rtype: list[CashRegister] + """ - if self._attachment is not None: - return False + return super().value - if self._status is not None: - return False - if self._minimum_age is not None: - return False +class BunqResponseTab(client.BunqResponse): + @property + def value(self): + """ + :rtype: Tab + """ - if self._require_address is not None: - return False + return super().value - if self._address_shipping is not None: - return False - if self._address_billing is not None: - return False +class BunqResponseTabList(client.BunqResponse): + @property + def value(self): + """ + :rtype: list[Tab] + """ - if self._geolocation is not None: - return False + return super().value - if self._redirect_url is not None: - return False - if self._type_ is not None: - return False +class BunqResponseNone(client.BunqResponse): + @property + def value(self): + """ + :rtype: None + """ - if self._sub_type is not None: - return False + return super().value - if self._allow_chat is not None: - return False - if self._eligible_whitelist_id is not None: - return False +class BunqResponseTabUsageSingle(client.BunqResponse): + @property + def value(self): + """ + :rtype: TabUsageSingle + """ - return True + return super().value - @staticmethod - def from_json(json_str): + +class BunqResponseTabUsageSingleList(client.BunqResponse): + @property + def value(self): """ - :type json_str: str - - :rtype: TokenQrRequestIdeal + :rtype: list[TabUsageSingle] """ - return converter.json_to_class(TokenQrRequestIdeal, json_str) + return super().value -class TokenQrRequestSofort(core.BunqModel): - """ - Using this call you can create a SOFORT Request assigned to your User by - providing the Token of the request. - - :param _token: The token passed from a site or read from a QR code. - :type _token: str - """ +class BunqResponseTabUsageMultiple(client.BunqResponse): + @property + def value(self): + """ + :rtype: TabUsageMultiple + """ - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/token-qr-request-sofort" + return super().value - # Field constants. - FIELD_TOKEN = "token" - # Object type. - _OBJECT_TYPE_POST = "RequestResponse" +class BunqResponseTabUsageMultipleList(client.BunqResponse): + @property + def value(self): + """ + :rtype: list[TabUsageMultiple] + """ - _token_field_for_request = None + return super().value - def __init__(self, token): + +class BunqResponseCertificatePinnedList(client.BunqResponse): + @property + def value(self): """ - :param token: The token passed from a site or read from a QR code. - :type token: str + :rtype: list[CertificatePinned] """ - self._token_field_for_request = token + return super().value - @classmethod - def create(cls, token, custom_headers=None): + +class BunqResponseCertificatePinned(client.BunqResponse): + @property + def value(self): """ - Create a request from an SOFORT transaction. - - :type user_id: int - :param token: The token passed from a site or read from a QR code. - :type token: str - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseTokenQrRequestSofort + :rtype: CertificatePinned """ - if custom_headers is None: - custom_headers = {} + return super().value - request_map = { - cls.FIELD_TOKEN: token - } - request_map_string = converter.class_to_json(request_map) - request_map_string = cls._remove_field_for_request(request_map_string) - api_client = client.ApiClient(cls._get_api_context()) - request_bytes = request_map_string.encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(cls._determine_user_id()) - response_raw = api_client.post(endpoint_url, request_bytes, - custom_headers) +class BunqResponseDeviceServer(client.BunqResponse): + @property + def value(self): + """ + :rtype: DeviceServer + """ - return BunqResponseTokenQrRequestSofort.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_POST) - ) + return super().value - def is_all_field_none(self): + +class BunqResponseDeviceServerList(client.BunqResponse): + @property + def value(self): """ - :rtype: bool + :rtype: list[DeviceServer] """ - return True + return super().value - @staticmethod - def from_json(json_str): + +class BunqResponseDevice(client.BunqResponse): + @property + def value(self): """ - :type json_str: str - - :rtype: TokenQrRequestSofort + :rtype: Device """ - return converter.json_to_class(TokenQrRequestSofort, json_str) - + return super().value -class UserCredentialPasswordIp(core.BunqModel): - """ - Create a credential of a user for server authentication, or delete the - credential of a user for server authentication. - - :param _id_: The id of the credential. - :type _id_: int - :param _created: The timestamp of the credential object's creation. - :type _created: str - :param _updated: The timestamp of the credential object's last update. - :type _updated: str - :param _status: The status of the credential. - :type _status: str - :param _expiry_time: When the status is PENDING_FIRST_USE: when the - credential expires. - :type _expiry_time: str - :param _token_value: When the status is PENDING_FIRST_USE: the value of the - token. - :type _token_value: str - :param _permitted_device: When the status is ACTIVE: the details of the - device that may use the credential. - :type _permitted_device: object_.PermittedDevice - """ - # Endpoint constants. - _ENDPOINT_URL_READ = "user/{}/credential-password-ip/{}" - _ENDPOINT_URL_LISTING = "user/{}/credential-password-ip" +class BunqResponseDeviceList(client.BunqResponse): + @property + def value(self): + """ + :rtype: list[Device] + """ - # Object type. - _OBJECT_TYPE_GET = "CredentialPasswordIp" + return super().value - _id_ = None - _created = None - _updated = None - _status = None - _expiry_time = None - _token_value = None - _permitted_device = None - @classmethod - def get(cls, user_credential_password_ip_id, custom_headers=None): +class BunqResponseDraftPaymentList(client.BunqResponse): + @property + def value(self): """ - :type api_context: context.ApiContext - :type user_id: int - :type user_credential_password_ip_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseUserCredentialPasswordIp + :rtype: list[DraftPayment] """ - if custom_headers is None: - custom_headers = {} - - api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_READ.format(cls._determine_user_id(), - user_credential_password_ip_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + return super().value - return BunqResponseUserCredentialPasswordIp.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE_GET) - ) - @classmethod - def list(cls, params=None, custom_headers=None): +class BunqResponseDraftPayment(client.BunqResponse): + @property + def value(self): """ - :type user_id: int - :type params: dict[str, str]|None - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseUserCredentialPasswordIpList + :rtype: DraftPayment """ - if params is None: - params = {} + return super().value - if custom_headers is None: - custom_headers = {} - api_client = client.ApiClient(cls._get_api_context()) - endpoint_url = cls._ENDPOINT_URL_LISTING.format( - cls._determine_user_id()) - response_raw = api_client.get(endpoint_url, params, custom_headers) +class BunqResponsePaymentBatch(client.BunqResponse): + @property + def value(self): + """ + :rtype: PaymentBatch + """ - return BunqResponseUserCredentialPasswordIpList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE_GET) - ) + return super().value + +class BunqResponsePaymentBatchList(client.BunqResponse): @property - def id_(self): + def value(self): """ - :rtype: int + :rtype: list[PaymentBatch] """ - return self._id_ + return super().value + +class BunqResponseDraftShareInviteApiKey(client.BunqResponse): @property - def created(self): + def value(self): """ - :rtype: str + :rtype: DraftShareInviteApiKey """ - return self._created + return super().value + +class BunqResponseDraftShareInviteApiKeyList(client.BunqResponse): @property - def updated(self): + def value(self): """ - :rtype: str + :rtype: list[DraftShareInviteApiKey] """ - return self._updated + return super().value + +class BunqResponseDraftShareInviteBank(client.BunqResponse): @property - def status(self): + def value(self): """ - :rtype: str + :rtype: DraftShareInviteBank """ - return self._status + return super().value + +class BunqResponseDraftShareInviteBankList(client.BunqResponse): @property - def expiry_time(self): + def value(self): """ - :rtype: str + :rtype: list[DraftShareInviteBank] """ - return self._expiry_time + return super().value + +class BunqResponseExportAnnualOverview(client.BunqResponse): @property - def token_value(self): + def value(self): """ - :rtype: str + :rtype: ExportAnnualOverview """ - return self._token_value + return super().value + +class BunqResponseExportAnnualOverviewList(client.BunqResponse): @property - def permitted_device(self): + def value(self): """ - :rtype: object_.PermittedDevice + :rtype: list[ExportAnnualOverview] """ - return self._permitted_device + return super().value - def is_all_field_none(self): + +class BunqResponseCustomerStatementExport(client.BunqResponse): + @property + def value(self): """ - :rtype: bool + :rtype: CustomerStatementExport """ - if self._id_ is not None: - return False + return super().value - if self._created is not None: - return False - if self._updated is not None: - return False +class BunqResponseCustomerStatementExportList(client.BunqResponse): + @property + def value(self): + """ + :rtype: list[CustomerStatementExport] + """ - if self._status is not None: - return False + return super().value - if self._expiry_time is not None: - return False - if self._token_value is not None: - return False +class BunqResponseInstallationServerPublicKeyList(client.BunqResponse): + @property + def value(self): + """ + :rtype: list[InstallationServerPublicKey] + """ - if self._permitted_device is not None: - return False + return super().value - return True - @staticmethod - def from_json(json_str): +class BunqResponseShareInviteBankInquiry(client.BunqResponse): + @property + def value(self): """ - :type json_str: str - - :rtype: UserCredentialPasswordIp + :rtype: ShareInviteBankInquiry """ - return converter.json_to_class(UserCredentialPasswordIp, json_str) + return super().value -class BunqResponseInvoiceList(client.BunqResponse): +class BunqResponseShareInviteBankInquiryList(client.BunqResponse): @property def value(self): """ - :rtype: list[Invoice] + :rtype: list[ShareInviteBankInquiry] """ return super().value -class BunqResponseInvoice(client.BunqResponse): +class BunqResponseShareInviteBankResponse(client.BunqResponse): @property def value(self): """ - :rtype: Invoice + :rtype: ShareInviteBankResponse """ return super().value -class BunqResponseInvoiceByUserList(client.BunqResponse): +class BunqResponseShareInviteBankResponseList(client.BunqResponse): @property def value(self): """ - :rtype: list[InvoiceByUser] + :rtype: list[ShareInviteBankResponse] """ return super().value -class BunqResponseInvoiceByUser(client.BunqResponse): +class BunqResponseMonetaryAccountBank(client.BunqResponse): @property def value(self): """ - :rtype: InvoiceByUser + :rtype: MonetaryAccountBank """ return super().value -class BunqResponseBytes(client.BunqResponse): +class BunqResponseMonetaryAccountBankList(client.BunqResponse): @property def value(self): """ - :rtype: bytes + :rtype: list[MonetaryAccountBank] """ return super().value -class BunqResponseInt(client.BunqResponse): +class BunqResponseMonetaryAccount(client.BunqResponse): @property def value(self): """ - :rtype: int + :rtype: MonetaryAccount """ return super().value -class BunqResponseStr(client.BunqResponse): +class BunqResponseMonetaryAccountList(client.BunqResponse): @property def value(self): """ - :rtype: str + :rtype: list[MonetaryAccount] """ return super().value -class BunqResponseAttachmentPublic(client.BunqResponse): +class BunqResponseMonetaryAccountJoint(client.BunqResponse): @property def value(self): """ - :rtype: AttachmentPublic + :rtype: MonetaryAccountJoint """ return super().value -class BunqResponseAttachmentTab(client.BunqResponse): +class BunqResponseMonetaryAccountJointList(client.BunqResponse): @property def value(self): """ - :rtype: AttachmentTab + :rtype: list[MonetaryAccountJoint] """ return super().value -class BunqResponseTabAttachmentTab(client.BunqResponse): +class BunqResponseMonetaryAccountLight(client.BunqResponse): @property def value(self): """ - :rtype: TabAttachmentTab + :rtype: MonetaryAccountLight """ return super().value -class BunqResponseAvatar(client.BunqResponse): +class BunqResponseMonetaryAccountLightList(client.BunqResponse): @property def value(self): """ - :rtype: Avatar + :rtype: list[MonetaryAccountLight] """ return super().value -class BunqResponseBunqMeTabList(client.BunqResponse): +class BunqResponseNoteAttachmentBankSwitchServiceNetherlandsIncomingPaymentList( + client.BunqResponse): @property def value(self): """ - :rtype: list[BunqMeTab] + :rtype: list[NoteAttachmentBankSwitchServiceNetherlandsIncomingPayment] """ return super().value -class BunqResponseBunqMeTab(client.BunqResponse): +class BunqResponseNoteAttachmentBankSwitchServiceNetherlandsIncomingPayment( + client.BunqResponse): @property def value(self): """ - :rtype: BunqMeTab + :rtype: NoteAttachmentBankSwitchServiceNetherlandsIncomingPayment """ return super().value -class BunqResponsePayment(client.BunqResponse): +class BunqResponseNoteTextBankSwitchServiceNetherlandsIncomingPaymentList( + client.BunqResponse): @property def value(self): """ - :rtype: Payment + :rtype: list[NoteTextBankSwitchServiceNetherlandsIncomingPayment] """ return super().value -class BunqResponsePaymentList(client.BunqResponse): +class BunqResponseNoteTextBankSwitchServiceNetherlandsIncomingPayment( + client.BunqResponse): @property def value(self): """ - :rtype: list[Payment] + :rtype: NoteTextBankSwitchServiceNetherlandsIncomingPayment """ return super().value -class BunqResponseCardDebit(client.BunqResponse): +class BunqResponseNoteAttachmentBunqMeFundraiserResultList(client.BunqResponse): @property def value(self): """ - :rtype: CardDebit + :rtype: list[NoteAttachmentBunqMeFundraiserResult] """ return super().value -class BunqResponseCardGeneratedCvc2(client.BunqResponse): +class BunqResponseNoteAttachmentBunqMeFundraiserResult(client.BunqResponse): @property def value(self): """ - :rtype: CardGeneratedCvc2 + :rtype: NoteAttachmentBunqMeFundraiserResult """ return super().value -class BunqResponseCardGeneratedCvc2List(client.BunqResponse): +class BunqResponseNoteTextBunqMeFundraiserResultList(client.BunqResponse): @property def value(self): """ - :rtype: list[CardGeneratedCvc2] + :rtype: list[NoteTextBunqMeFundraiserResult] """ return super().value -class BunqResponseCardNameList(client.BunqResponse): +class BunqResponseNoteTextBunqMeFundraiserResult(client.BunqResponse): @property def value(self): """ - :rtype: list[CardName] + :rtype: NoteTextBunqMeFundraiserResult """ return super().value -class BunqResponseCard(client.BunqResponse): +class BunqResponseNoteAttachmentDraftPaymentList(client.BunqResponse): @property def value(self): """ - :rtype: Card + :rtype: list[NoteAttachmentDraftPayment] """ return super().value -class BunqResponseCardList(client.BunqResponse): +class BunqResponseNoteAttachmentDraftPayment(client.BunqResponse): @property def value(self): """ - :rtype: list[Card] + :rtype: NoteAttachmentDraftPayment """ return super().value -class BunqResponseCashRegisterQrCode(client.BunqResponse): +class BunqResponseNoteTextDraftPaymentList(client.BunqResponse): @property def value(self): """ - :rtype: CashRegisterQrCode + :rtype: list[NoteTextDraftPayment] """ return super().value -class BunqResponseCashRegisterQrCodeList(client.BunqResponse): +class BunqResponseNoteTextDraftPayment(client.BunqResponse): @property def value(self): """ - :rtype: list[CashRegisterQrCode] + :rtype: NoteTextDraftPayment """ return super().value -class BunqResponseCashRegister(client.BunqResponse): +class BunqResponseNoteAttachmentIdealMerchantTransactionList( + client.BunqResponse): @property def value(self): """ - :rtype: CashRegister + :rtype: list[NoteAttachmentIdealMerchantTransaction] """ return super().value -class BunqResponseCashRegisterList(client.BunqResponse): +class BunqResponseNoteAttachmentIdealMerchantTransaction(client.BunqResponse): @property def value(self): """ - :rtype: list[CashRegister] + :rtype: NoteAttachmentIdealMerchantTransaction """ return super().value -class BunqResponseTab(client.BunqResponse): +class BunqResponseNoteTextIdealMerchantTransactionList(client.BunqResponse): @property def value(self): """ - :rtype: Tab + :rtype: list[NoteTextIdealMerchantTransaction] """ return super().value -class BunqResponseTabList(client.BunqResponse): +class BunqResponseNoteTextIdealMerchantTransaction(client.BunqResponse): @property def value(self): """ - :rtype: list[Tab] + :rtype: NoteTextIdealMerchantTransaction """ return super().value -class BunqResponseNone(client.BunqResponse): +class BunqResponseNoteAttachmentMasterCardActionList(client.BunqResponse): @property def value(self): """ - :rtype: None + :rtype: list[NoteAttachmentMasterCardAction] """ return super().value -class BunqResponseTabUsageSingle(client.BunqResponse): +class BunqResponseNoteAttachmentMasterCardAction(client.BunqResponse): @property def value(self): """ - :rtype: TabUsageSingle + :rtype: NoteAttachmentMasterCardAction """ return super().value -class BunqResponseTabUsageSingleList(client.BunqResponse): +class BunqResponseNoteTextMasterCardActionList(client.BunqResponse): @property def value(self): """ - :rtype: list[TabUsageSingle] + :rtype: list[NoteTextMasterCardAction] """ return super().value -class BunqResponseTabUsageMultiple(client.BunqResponse): +class BunqResponseNoteTextMasterCardAction(client.BunqResponse): @property def value(self): """ - :rtype: TabUsageMultiple + :rtype: NoteTextMasterCardAction """ return super().value -class BunqResponseTabUsageMultipleList(client.BunqResponse): +class BunqResponseNoteAttachmentPaymentBatchList(client.BunqResponse): @property def value(self): """ - :rtype: list[TabUsageMultiple] + :rtype: list[NoteAttachmentPaymentBatch] """ return super().value -class BunqResponseCertificatePinnedList(client.BunqResponse): +class BunqResponseNoteAttachmentPaymentBatch(client.BunqResponse): @property def value(self): """ - :rtype: list[CertificatePinned] + :rtype: NoteAttachmentPaymentBatch """ return super().value -class BunqResponseCertificatePinned(client.BunqResponse): +class BunqResponseNoteTextPaymentBatchList(client.BunqResponse): @property def value(self): """ - :rtype: CertificatePinned + :rtype: list[NoteTextPaymentBatch] """ return super().value -class BunqResponseDeviceServer(client.BunqResponse): +class BunqResponseNoteTextPaymentBatch(client.BunqResponse): @property def value(self): """ - :rtype: DeviceServer + :rtype: NoteTextPaymentBatch """ return super().value -class BunqResponseDeviceServerList(client.BunqResponse): +class BunqResponseNoteAttachmentPaymentList(client.BunqResponse): @property def value(self): """ - :rtype: list[DeviceServer] + :rtype: list[NoteAttachmentPayment] """ return super().value -class BunqResponseDevice(client.BunqResponse): +class BunqResponseNoteAttachmentPayment(client.BunqResponse): @property def value(self): """ - :rtype: Device + :rtype: NoteAttachmentPayment """ return super().value -class BunqResponseDeviceList(client.BunqResponse): +class BunqResponseNoteTextPaymentList(client.BunqResponse): @property def value(self): """ - :rtype: list[Device] + :rtype: list[NoteTextPayment] """ return super().value -class BunqResponseDraftPaymentList(client.BunqResponse): +class BunqResponseNoteTextPayment(client.BunqResponse): @property def value(self): """ - :rtype: list[DraftPayment] + :rtype: NoteTextPayment """ return super().value -class BunqResponseDraftPayment(client.BunqResponse): +class BunqResponseNoteAttachmentRequestInquiryBatchList(client.BunqResponse): @property def value(self): """ - :rtype: DraftPayment + :rtype: list[NoteAttachmentRequestInquiryBatch] """ return super().value -class BunqResponsePaymentBatch(client.BunqResponse): +class BunqResponseNoteAttachmentRequestInquiryBatch(client.BunqResponse): @property def value(self): """ - :rtype: PaymentBatch + :rtype: NoteAttachmentRequestInquiryBatch """ return super().value -class BunqResponsePaymentBatchList(client.BunqResponse): +class BunqResponseNoteTextRequestInquiryBatchList(client.BunqResponse): @property def value(self): """ - :rtype: list[PaymentBatch] + :rtype: list[NoteTextRequestInquiryBatch] """ return super().value -class BunqResponseDraftShareInviteApiKey(client.BunqResponse): +class BunqResponseNoteTextRequestInquiryBatch(client.BunqResponse): @property def value(self): """ - :rtype: DraftShareInviteApiKey + :rtype: NoteTextRequestInquiryBatch """ return super().value -class BunqResponseDraftShareInviteApiKeyList(client.BunqResponse): +class BunqResponseNoteAttachmentRequestInquiryList(client.BunqResponse): @property def value(self): """ - :rtype: list[DraftShareInviteApiKey] + :rtype: list[NoteAttachmentRequestInquiry] """ return super().value -class BunqResponseDraftShareInviteBank(client.BunqResponse): +class BunqResponseNoteAttachmentRequestInquiry(client.BunqResponse): @property def value(self): """ - :rtype: DraftShareInviteBank + :rtype: NoteAttachmentRequestInquiry """ return super().value -class BunqResponseDraftShareInviteBankList(client.BunqResponse): +class BunqResponseNoteTextRequestInquiryList(client.BunqResponse): @property def value(self): """ - :rtype: list[DraftShareInviteBank] + :rtype: list[NoteTextRequestInquiry] """ return super().value -class BunqResponseExportAnnualOverview(client.BunqResponse): +class BunqResponseNoteTextRequestInquiry(client.BunqResponse): @property def value(self): """ - :rtype: ExportAnnualOverview + :rtype: NoteTextRequestInquiry """ return super().value -class BunqResponseExportAnnualOverviewList(client.BunqResponse): +class BunqResponseNoteAttachmentRequestResponseList(client.BunqResponse): @property def value(self): """ - :rtype: list[ExportAnnualOverview] + :rtype: list[NoteAttachmentRequestResponse] """ return super().value -class BunqResponseCustomerStatementExport(client.BunqResponse): +class BunqResponseNoteAttachmentRequestResponse(client.BunqResponse): @property def value(self): """ - :rtype: CustomerStatementExport + :rtype: NoteAttachmentRequestResponse """ return super().value -class BunqResponseCustomerStatementExportList(client.BunqResponse): +class BunqResponseNoteTextRequestResponseList(client.BunqResponse): @property def value(self): """ - :rtype: list[CustomerStatementExport] + :rtype: list[NoteTextRequestResponse] """ return super().value -class BunqResponseInstallationServerPublicKeyList(client.BunqResponse): +class BunqResponseNoteTextRequestResponse(client.BunqResponse): @property def value(self): """ - :rtype: list[InstallationServerPublicKey] + :rtype: NoteTextRequestResponse """ return super().value -class BunqResponseShareInviteBankInquiry(client.BunqResponse): +class BunqResponseNoteAttachmentScheduleInstanceList(client.BunqResponse): @property def value(self): """ - :rtype: ShareInviteBankInquiry + :rtype: list[NoteAttachmentScheduleInstance] """ return super().value -class BunqResponseShareInviteBankInquiryList(client.BunqResponse): +class BunqResponseNoteAttachmentScheduleInstance(client.BunqResponse): @property def value(self): """ - :rtype: list[ShareInviteBankInquiry] + :rtype: NoteAttachmentScheduleInstance """ return super().value -class BunqResponseShareInviteBankResponse(client.BunqResponse): +class BunqResponseNoteTextScheduleInstanceList(client.BunqResponse): @property def value(self): """ - :rtype: ShareInviteBankResponse + :rtype: list[NoteTextScheduleInstance] """ return super().value -class BunqResponseShareInviteBankResponseList(client.BunqResponse): +class BunqResponseNoteTextScheduleInstance(client.BunqResponse): @property def value(self): """ - :rtype: list[ShareInviteBankResponse] + :rtype: NoteTextScheduleInstance """ return super().value -class BunqResponseMonetaryAccountBank(client.BunqResponse): +class BunqResponseNoteAttachmentSofortMerchantTransactionList( + client.BunqResponse): @property def value(self): """ - :rtype: MonetaryAccountBank + :rtype: list[NoteAttachmentSofortMerchantTransaction] """ return super().value -class BunqResponseMonetaryAccountBankList(client.BunqResponse): +class BunqResponseNoteAttachmentSofortMerchantTransaction(client.BunqResponse): @property def value(self): """ - :rtype: list[MonetaryAccountBank] + :rtype: NoteAttachmentSofortMerchantTransaction """ return super().value -class BunqResponseMonetaryAccount(client.BunqResponse): +class BunqResponseNoteTextSofortMerchantTransactionList(client.BunqResponse): @property def value(self): """ - :rtype: MonetaryAccount + :rtype: list[NoteTextSofortMerchantTransaction] """ return super().value -class BunqResponseMonetaryAccountList(client.BunqResponse): +class BunqResponseNoteTextSofortMerchantTransaction(client.BunqResponse): @property def value(self): """ - :rtype: list[MonetaryAccount] + :rtype: NoteTextSofortMerchantTransaction """ return super().value -class BunqResponseMonetaryAccountJoint(client.BunqResponse): +class BunqResponseNoteAttachmentWhitelistResultList(client.BunqResponse): @property def value(self): """ - :rtype: MonetaryAccountJoint + :rtype: list[NoteAttachmentWhitelistResult] """ return super().value -class BunqResponseMonetaryAccountJointList(client.BunqResponse): +class BunqResponseNoteAttachmentWhitelistResult(client.BunqResponse): @property def value(self): """ - :rtype: list[MonetaryAccountJoint] + :rtype: NoteAttachmentWhitelistResult """ return super().value -class BunqResponseMonetaryAccountLight(client.BunqResponse): +class BunqResponseNoteTextWhitelistResultList(client.BunqResponse): @property def value(self): """ - :rtype: MonetaryAccountLight + :rtype: list[NoteTextWhitelistResult] """ return super().value -class BunqResponseMonetaryAccountLightList(client.BunqResponse): +class BunqResponseNoteTextWhitelistResult(client.BunqResponse): @property def value(self): """ - :rtype: list[MonetaryAccountLight] + :rtype: NoteTextWhitelistResult """ return super().value diff --git a/bunq/sdk/model/generated/object_.py b/bunq/sdk/model/generated/object_.py index 8b64e54..c35c763 100644 --- a/bunq/sdk/model/generated/object_.py +++ b/bunq/sdk/model/generated/object_.py @@ -1,8 +1,8 @@ # -*- coding: utf-8 -*- -from bunq.sdk import exception -from bunq.sdk.json import converter from bunq.sdk.model import core +from bunq.sdk import exception from bunq.sdk.model.generated import endpoint +from bunq.sdk.json import converter class InvoiceItemGroup(core.BunqModel): @@ -1311,6 +1311,158 @@ def from_json(json_str): return converter.json_to_class(Geolocation, json_str) +class BunqId(core.BunqModel): + """ + :param _id_: An integer ID of an object. Unique per object type. + :type _id_: int + """ + + _id_ = None + _id__field_for_request = None + + def __init__(self, id_=None): + """ + :param id_: An integer ID of an object. Unique per object type. + :type id_: int + """ + + self._id__field_for_request = id_ + + @property + def id_(self): + """ + :rtype: int + """ + + return self._id_ + + def is_all_field_none(self): + """ + :rtype: bool + """ + + if self._id_ is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: BunqId + """ + + return converter.json_to_class(BunqId, json_str) + + +class CardBatchEntry(core.BunqModel): + """ + :param _id_: The ID of the card that needs to be updated. + :type _id_: int + :param _activation_code: The activation code required to set status to + ACTIVE initially. Can only set status to ACTIVE using activation code when + order_status is ACCEPTED_FOR_PRODUCTION and status is DEACTIVATED. + :type _activation_code: str + :param _status: The status to set for the card. Can be ACTIVE, DEACTIVATED, + LOST, STOLEN or CANCELLED, and can only be set to LOST/STOLEN/CANCELLED when + order status is + ACCEPTED_FOR_PRODUCTION/DELIVERED_TO_CUSTOMER/CARD_UPDATE_REQUESTED/CARD_UPDATE_SENT/CARD_UPDATE_ACCEPTED. + Can only be set to DEACTIVATED after initial activation, i.e. order_status + is + DELIVERED_TO_CUSTOMER/CARD_UPDATE_REQUESTED/CARD_UPDATE_SENT/CARD_UPDATE_ACCEPTED. + Mind that all the possible choices (apart from ACTIVE and DEACTIVATED) are + permanent and cannot be changed after. + :type _status: str + :param _limit: The limits to define for the card, among + CARD_LIMIT_CONTACTLESS, CARD_LIMIT_ATM, CARD_LIMIT_DIPPING and + CARD_LIMIT_POS_ICC (e.g. 25 EUR for CARD_LIMIT_CONTACTLESS). All the limits + must be provided on update. + :type _limit: list[CardLimit] + :param _mag_stripe_permission: Whether or not it is allowed to use the mag + stripe for the card. + :type _mag_stripe_permission: CardMagStripePermission + :param _country_permission: The countries for which to grant (temporary) + permissions to use the card. + :type _country_permission: list[CardCountryPermission] + :param _monetary_account_id_fallback: ID of the MA to be used as fallback + for this card if insufficient balance. Fallback account is removed if not + supplied. + :type _monetary_account_id_fallback: int + """ + + _id__field_for_request = None + _activation_code_field_for_request = None + _status_field_for_request = None + _limit_field_for_request = None + _mag_stripe_permission_field_for_request = None + _country_permission_field_for_request = None + _monetary_account_id_fallback_field_for_request = None + + def __init__(self, id_, activation_code=None, status=None, limit=None, + mag_stripe_permission=None, country_permission=None, + monetary_account_id_fallback=None): + """ + :param id_: The ID of the card that needs to be updated. + :type id_: int + :param activation_code: The activation code required to set status to ACTIVE + initially. Can only set status to ACTIVE using activation code when + order_status is ACCEPTED_FOR_PRODUCTION and status is DEACTIVATED. + :type activation_code: str + :param status: The status to set for the card. Can be ACTIVE, DEACTIVATED, + LOST, STOLEN or CANCELLED, and can only be set to LOST/STOLEN/CANCELLED when + order status is + ACCEPTED_FOR_PRODUCTION/DELIVERED_TO_CUSTOMER/CARD_UPDATE_REQUESTED/CARD_UPDATE_SENT/CARD_UPDATE_ACCEPTED. + Can only be set to DEACTIVATED after initial activation, i.e. order_status + is + DELIVERED_TO_CUSTOMER/CARD_UPDATE_REQUESTED/CARD_UPDATE_SENT/CARD_UPDATE_ACCEPTED. + Mind that all the possible choices (apart from ACTIVE and DEACTIVATED) are + permanent and cannot be changed after. + :type status: str + :param limit: The limits to define for the card, among + CARD_LIMIT_CONTACTLESS, CARD_LIMIT_ATM, CARD_LIMIT_DIPPING and + CARD_LIMIT_POS_ICC (e.g. 25 EUR for CARD_LIMIT_CONTACTLESS). All the limits + must be provided on update. + :type limit: list[CardLimit] + :param mag_stripe_permission: Whether or not it is allowed to use the mag + stripe for the card. + :type mag_stripe_permission: CardMagStripePermission + :param country_permission: The countries for which to grant (temporary) + permissions to use the card. + :type country_permission: list[CardCountryPermission] + :param monetary_account_id_fallback: ID of the MA to be used as fallback for + this card if insufficient balance. Fallback account is removed if not + supplied. + :type monetary_account_id_fallback: int + """ + + self._id__field_for_request = id_ + self._activation_code_field_for_request = activation_code + self._status_field_for_request = status + self._limit_field_for_request = limit + self._mag_stripe_permission_field_for_request = mag_stripe_permission + self._country_permission_field_for_request = country_permission + self._monetary_account_id_fallback_field_for_request = monetary_account_id_fallback + + def is_all_field_none(self): + """ + :rtype: bool + """ + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: CardBatchEntry + """ + + return converter.json_to_class(CardBatchEntry, json_str) + + class CardLimit(core.BunqModel): """ :param _daily_limit: The daily limit amount. @@ -1409,6 +1561,52 @@ def from_json(json_str): return converter.json_to_class(CardLimit, json_str) +class CardMagStripePermission(core.BunqModel): + """ + :param _expiry_time: Expiry time of this rule. + :type _expiry_time: str + """ + + _expiry_time = None + _expiry_time_field_for_request = None + + def __init__(self, expiry_time=None): + """ + :param expiry_time: Expiry time of this rule. + :type expiry_time: str + """ + + self._expiry_time_field_for_request = expiry_time + + @property + def expiry_time(self): + """ + :rtype: str + """ + + return self._expiry_time + + def is_all_field_none(self): + """ + :rtype: bool + """ + + if self._expiry_time is not None: + return False + + return True + + @staticmethod + def from_json(json_str): + """ + :type json_str: str + + :rtype: CardMagStripePermission + """ + + return converter.json_to_class(CardMagStripePermission, json_str) + + class CardCountryPermission(core.BunqModel): """ :param _country: The country to allow transactions in (e.g. NL, DE). @@ -1559,52 +1757,6 @@ def from_json(json_str): return converter.json_to_class(CardPinAssignment, json_str) -class CardMagStripePermission(core.BunqModel): - """ - :param _expiry_time: Expiry time of this rule. - :type _expiry_time: str - """ - - _expiry_time = None - _expiry_time_field_for_request = None - - def __init__(self, expiry_time=None): - """ - :param expiry_time: Expiry time of this rule. - :type expiry_time: str - """ - - self._expiry_time_field_for_request = expiry_time - - @property - def expiry_time(self): - """ - :rtype: str - """ - - return self._expiry_time - - def is_all_field_none(self): - """ - :rtype: bool - """ - - if self._expiry_time is not None: - return False - - return True - - @staticmethod - def from_json(json_str): - """ - :type json_str: str - - :rtype: CardMagStripePermission - """ - - return converter.json_to_class(CardMagStripePermission, json_str) - - class NotificationFilter(core.BunqModel): """ :param _notification_delivery_method: The delivery method via which @@ -1994,52 +2146,6 @@ def from_json(json_str): return converter.json_to_class(AttachmentTab, json_str) -class BunqId(core.BunqModel): - """ - :param _id_: An integer ID of an object. Unique per object type. - :type _id_: int - """ - - _id_ = None - _id__field_for_request = None - - def __init__(self, id_=None): - """ - :param id_: An integer ID of an object. Unique per object type. - :type id_: int - """ - - self._id__field_for_request = id_ - - @property - def id_(self): - """ - :rtype: int - """ - - return self._id_ - - def is_all_field_none(self): - """ - :rtype: bool - """ - - if self._id_ is not None: - return False - - return True - - @staticmethod - def from_json(json_str): - """ - :type json_str: str - - :rtype: BunqId - """ - - return converter.json_to_class(BunqId, json_str) - - class Certificate(core.BunqModel): """ :param _certificate: A single certificate in the chain in .PEM format. @@ -4597,23 +4703,32 @@ class TaxResident(core.BunqModel): :type _country: str :param _tax_number: The tax number. :type _tax_number: str + :param _status: The status of the tax number. Either CONFIRMED or + UNCONFIRMED. + :type _status: str """ _country = None _tax_number = None + _status = None _country_field_for_request = None _tax_number_field_for_request = None + _status_field_for_request = None - def __init__(self, country=None, tax_number=None): + def __init__(self, country=None, tax_number=None, status=None): """ :param country: The country of the tax number. :type country: str :param tax_number: The tax number. :type tax_number: str + :param status: The status of the tax number. Either CONFIRMED or + UNCONFIRMED. + :type status: str """ self._country_field_for_request = country self._tax_number_field_for_request = tax_number + self._status_field_for_request = status @property def country(self): @@ -4631,6 +4746,14 @@ def tax_number(self): return self._tax_number + @property + def status(self): + """ + :rtype: str + """ + + return self._status + def is_all_field_none(self): """ :rtype: bool @@ -4642,6 +4765,9 @@ def is_all_field_none(self): if self._tax_number is not None: return False + if self._status is not None: + return False + return True @staticmethod