diff --git a/VERSION b/VERSION index e96a871..d61567c 100644 --- a/VERSION +++ b/VERSION @@ -1 +1 @@ -0.12.2 \ No newline at end of file +0.12.3 \ No newline at end of file diff --git a/bunq/sdk/client.py b/bunq/sdk/client.py index 3fb913c..798bcf2 100644 --- a/bunq/sdk/client.py +++ b/bunq/sdk/client.py @@ -41,7 +41,7 @@ class ApiClient(object): HEADER_AUTHENTICATION = 'X-Bunq-Client-Authentication' # Default header values - _USER_AGENT_BUNQ = 'bunq-sdk-python/0.12.2' + _USER_AGENT_BUNQ = 'bunq-sdk-python/0.12.3' _GEOLOCATION_ZERO = '0 0 0 0 NL' _LANGUAGE_EN_US = 'en_US' _REGION_NL_NL = 'nl_NL' diff --git a/bunq/sdk/json/adapters.py b/bunq/sdk/json/adapters.py index b3edd33..d8b1054 100644 --- a/bunq/sdk/json/adapters.py +++ b/bunq/sdk/json/adapters.py @@ -3,9 +3,9 @@ from bunq.sdk import client from bunq.sdk import context -from bunq.sdk.model import core from bunq.sdk import security from bunq.sdk.json import converter +from bunq.sdk.model import core from bunq.sdk.model.generated import endpoint from bunq.sdk.model.generated import object_ @@ -387,20 +387,31 @@ def deserialize(cls, target_class, obj): share_detail.__dict__ = { cls._ATTRIBUTE_PAYMENT: converter.deserialize( object_.ShareDetailPayment, - obj[cls._FIELD_PAYMENT] + cls._get_field_or_none(cls._FIELD_DRAFT_PAYMENT, obj) ), cls._ATTRIBUTE_READ_ONLY: converter.deserialize( object_.ShareDetailReadOnly, - obj[cls._FIELD_READ_ONLY] + cls._get_field_or_none(cls._FIELD_READ_ONLY, obj) ), cls._ATTRIBUTE_DRAFT_PAYMENT: converter.deserialize( object_.ShareDetailDraftPayment, - obj[cls._FIELD_DRAFT_PAYMENT] + cls._get_field_or_none(cls._FIELD_DRAFT_PAYMENT, obj) ), } return share_detail + @staticmethod + def _get_field_or_none(field, obj): + """ + :type field: str + :type obj: dict + + :return: dict|None + """ + + return obj[field] if field in obj else None + @classmethod def serialize(cls, share_detail): """ diff --git a/bunq/sdk/json/converter.py b/bunq/sdk/json/converter.py index 5eeda5b..cf9c219 100644 --- a/bunq/sdk/json/converter.py +++ b/bunq/sdk/json/converter.py @@ -25,7 +25,7 @@ class JsonAdapter(object): _WARNING_KEY_UNKNOWN = '[bunq SDK beta] Key "{}" in "{}" is unknown.' # Overlapping key names to be suffixed by and underscore - _KEYS_OVERLAPPING = {'id', 'type'} + _KEYS_OVERLAPPING = {'id', 'type', 'object'} # Suffix to strip from the keys during serialization _SUFFIX_KEY_OVERLAPPING = '_' diff --git a/bunq/sdk/model/core.py b/bunq/sdk/model/core.py index 3c19a9f..f1135b1 100644 --- a/bunq/sdk/model/core.py +++ b/bunq/sdk/model/core.py @@ -1,5 +1,4 @@ from bunq.sdk import client -from bunq.sdk import context from bunq.sdk.json import converter @@ -269,7 +268,7 @@ def server_public_key(self): @classmethod def create(cls, api_context, public_key_string): """ - :type api_context: context.ApiContext + :type api_context: bunq.sdk.context.ApiContext :type public_key_string: str :rtype: client.BunqResponse[Installation] @@ -353,7 +352,7 @@ def user_company(self): @classmethod def create(cls, api_context): """ - :type api_context: context.ApiContext + :type api_context: bunq.sdk.context.ApiContext :rtype: client.BunqResponse[SessionServer] """ diff --git a/bunq/sdk/model/generated/endpoint.py b/bunq/sdk/model/generated/endpoint.py index fb4da42..125dff9 100644 --- a/bunq/sdk/model/generated/endpoint.py +++ b/bunq/sdk/model/generated/endpoint.py @@ -2,6 +2,7 @@ from bunq.sdk import client from bunq.sdk import context 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_ @@ -29,15 +30,15 @@ class Invoice(core.BunqModel): :type _vat_number: str """ + # Endpoint constants. + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/invoice" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/invoice/{}" + # Field constants. FIELD_STATUS = "status" FIELD_DESCRIPTION = "description" FIELD_EXTERNAL_URL = "external_url" - # Endpoint constants. - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/invoice" - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/invoice/{}" - # Object type. _OBJECT_TYPE = "Invoice" @@ -468,6 +469,9 @@ class ChatConversation(core.BunqModel): :type _ChatConversationReference: ChatConversationReference """ + # Error constants. + _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' + # Endpoint constants. _ENDPOINT_URL_LISTING = "user/{}/chat-conversation" _ENDPOINT_URL_READ = "user/{}/chat-conversation/{}" @@ -541,6 +545,19 @@ def ChatConversationReference(self): """ return self._ChatConversationReference + def get_referenced_object(self): + """ + :rtype: core.BunqModel + :raise: BunqException + """ + + if self._SupportConversationExternal is not None: + return self._SupportConversationExternal + + if self._ChatConversationReference is not None: + return self._ChatConversationReference + + raise exception.BunqException(self._ERROR_NULL_FIELDS) class ChatConversationSupportExternal(core.BunqModel): @@ -606,6 +623,9 @@ class ChatMessage(core.BunqModel): :type _ChatMessageUser: ChatMessageUser """ + # Error constants. + _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' + # Endpoint constants. _ENDPOINT_URL_LISTING = "user/{}/chat-conversation/{}/message" @@ -668,6 +688,22 @@ def ChatMessageUser(self): """ return self._ChatMessageUser + def get_referenced_object(self): + """ + :rtype: core.BunqModel + :raise: BunqException + """ + + if self._ChatMessageAnnouncement is not None: + return self._ChatMessageAnnouncement + + if self._ChatMessageStatus is not None: + return self._ChatMessageStatus + + if self._ChatMessageUser is not None: + return self._ChatMessageUser + + raise exception.BunqException(self._ERROR_NULL_FIELDS) class ChatMessageAnnouncement(core.BunqModel): @@ -755,6 +791,7 @@ class CardDebit(core.BunqModel): :type _updated: str :type _public_uuid: str :type _type_: str + :type _sub_type: str :type _second_line: str :type _name_on_card: str :type _primary_account_number_four_digit: str @@ -768,8 +805,12 @@ class CardDebit(core.BunqModel): :type _alias: object_.LabelUser :type _pin_code_assignment: list[object_.CardPinAssignment] :type _monetary_account_id_fallback: int + :type _country: str """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/card-debit" + # Field constants. FIELD_SECOND_LINE = "second_line" FIELD_NAME_ON_CARD = "name_on_card" @@ -778,9 +819,7 @@ class CardDebit(core.BunqModel): FIELD_TYPE = "type" FIELD_PIN_CODE_ASSIGNMENT = "pin_code_assignment" FIELD_MONETARY_ACCOUNT_ID_FALLBACK = "monetary_account_id_fallback" - - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/card-debit" + FIELD_COUNTRY = "country" # Object type. _OBJECT_TYPE = "CardDebit" @@ -791,6 +830,7 @@ def __init__(self): self._updated = None self._public_uuid = None self._type_ = None + self._sub_type = None self._second_line = None self._name_on_card = None self._primary_account_number_four_digit = None @@ -804,6 +844,7 @@ def __init__(self): self._alias = None self._pin_code_assignment = None self._monetary_account_id_fallback = None + self._country = None @classmethod def create(cls, api_context, request_map, user_id, custom_headers=None): @@ -871,6 +912,14 @@ def type_(self): return self._type_ + @property + def sub_type(self): + """ + :rtype: str + """ + + return self._sub_type + @property def second_line(self): """ @@ -975,6 +1024,14 @@ def monetary_account_id_fallback(self): return self._monetary_account_id_fallback + @property + def country(self): + """ + :rtype: str + """ + + return self._country + class CardPinChange(core.BunqModel): """ @@ -1341,18 +1398,18 @@ class DraftPayment(core.BunqModel): :type _object_: object_.DraftPaymentAnchorObject """ - # Field constants. - FIELD_STATUS = "status" - FIELD_ENTRIES = "entries" - FIELD_PREVIOUS_UPDATED_TIMESTAMP = "previous_updated_timestamp" - FIELD_NUMBER_OF_REQUIRED_ACCEPTS = "number_of_required_accepts" - # Endpoint constants. _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/draft-payment" _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/draft-payment/{}" _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/draft-payment" _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/draft-payment/{}" + # Field constants. + FIELD_STATUS = "status" + FIELD_ENTRIES = "entries" + FIELD_PREVIOUS_UPDATED_TIMESTAMP = "previous_updated_timestamp" + FIELD_NUMBER_OF_REQUIRED_ACCEPTS = "number_of_required_accepts" + # Object type. _OBJECT_TYPE = "DraftPayment" @@ -1571,6 +1628,11 @@ class Payment(core.BunqModel): :type _allow_chat: bool """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/payment" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/payment/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/payment" + # Field constants. FIELD_AMOUNT = "amount" FIELD_COUNTERPARTY_ALIAS = "counterparty_alias" @@ -1580,11 +1642,6 @@ class Payment(core.BunqModel): FIELD_ALLOW_BUNQTO = "allow_bunqto" FIELD_BUNQTO_STATUS = "bunqto_status" - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/payment" - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/payment/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/payment" - # Object type. _OBJECT_TYPE = "Payment" @@ -1885,16 +1942,16 @@ class PaymentBatch(core.BunqModel): :type _payments: list[Payment] """ - # Field constants. - FIELD_PAYMENTS = "payments" - FIELD_BUNQTO_STATUS = "bunqto_status" - # Endpoint constants. _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/payment-batch" _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/payment-batch/{}" _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/payment-batch/{}" _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/payment-batch" + # Field constants. + FIELD_PAYMENTS = "payments" + FIELD_BUNQTO_STATUS = "bunqto_status" + # Object type. _OBJECT_TYPE = "PaymentBatch" @@ -2038,15 +2095,15 @@ class IdealMerchantTransaction(core.BunqModel): :type _allow_chat: bool """ - # Field constants. - FIELD_AMOUNT_REQUESTED = "amount_requested" - FIELD_ISSUER = "issuer" - # 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 = "IdealMerchantTransaction" @@ -2262,13 +2319,13 @@ class PromotionDisplay(core.BunqModel): :type _status: str """ - # Field constants. - FIELD_STATUS = "status" - # Endpoint constants. _ENDPOINT_URL_READ = "user/{}/promotion-display/{}" _ENDPOINT_URL_UPDATE = "user/{}/promotion-display/{}" + # Field constants. + FIELD_STATUS = "status" + # Object type. _OBJECT_TYPE = "PromotionDisplay" @@ -2366,17 +2423,17 @@ class RequestInquiryBatch(core.BunqModel): :type _total_amount_inquired: object_.Amount """ - # Field constants. - FIELD_REQUEST_INQUIRIES = "request_inquiries" - FIELD_STATUS = "status" - FIELD_TOTAL_AMOUNT_INQUIRED = "total_amount_inquired" - # 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" + # Object type. _OBJECT_TYPE = "RequestInquiryBatch" @@ -2545,6 +2602,12 @@ class RequestInquiry(core.BunqModel): :type _allow_chat: bool """ + # 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" @@ -2560,12 +2623,6 @@ class RequestInquiry(core.BunqModel): FIELD_ALLOW_BUNQME = "allow_bunqme" FIELD_REDIRECT_URL = "redirect_url" - # 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/{}" - # Object type. _OBJECT_TYPE = "RequestInquiry" @@ -2938,17 +2995,17 @@ class RequestResponse(core.BunqModel): :type _eligible_whitelist_id: int """ + # 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" - # 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/{}" - # Object type. _OBJECT_TYPE = "RequestResponse" @@ -3265,20 +3322,20 @@ class SchedulePaymentBatch(core.BunqModel): Endpoint for schedule payment batches. :type _payments: list[object_.SchedulePaymentEntry] - :type _schedule: object_.Schedule + :type _schedule: Schedule """ - # Field constants. - FIELD_PAYMENTS = "payments" - FIELD_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" + # Object type. - _OBJECT_TYPE = "SchedulePaymentBatch" + _OBJECT_TYPE = "ScheduledPaymentBatch" def __init__(self): self._payments = None @@ -3318,7 +3375,7 @@ def update(cls, api_context, request_map, user_id, monetary_account_id, schedule :type schedule_payment_batch_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseInt + :rtype: BunqResponseSchedulePaymentBatch """ if custom_headers is None: @@ -3329,8 +3386,8 @@ def update(cls, api_context, request_map, user_id, monetary_account_id, schedule endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_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 BunqResponseSchedulePaymentBatch.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod @@ -3367,118 +3424,86 @@ def payments(self): @property def schedule(self): """ - :rtype: object_.Schedule + :rtype: Schedule """ return self._schedule -class SchedulePayment(core.BunqModel): +class Schedule(core.BunqModel): """ - Endpoint for schedule payments. + view for reading the scheduled definitions. - :type _payment: object_.SchedulePaymentEntry - :type _schedule: object_.Schedule + :type _time_start: str + :type _time_end: str + :type _recurrence_unit: str + :type _recurrence_size: int + :type _status: str + :type _object_: object_.ScheduleAnchorObject """ - # Field constants. - FIELD_PAYMENT = "payment" - FIELD_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/{}" + _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 = "SchedulePayment" + _OBJECT_TYPE = "Schedule" def __init__(self): - self._payment = None - self._schedule = None - - @classmethod - def create(cls, api_context, request_map, user_id, monetary_account_id, custom_headers=None): - """ - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type monetary_account_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt - """ - - if custom_headers is None: - custom_headers = {} - - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_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) - ) + self._time_start = None + self._time_end = None + self._recurrence_unit = None + self._recurrence_size = None + self._status = None + self._object_ = None @classmethod - def delete(cls, api_context, user_id, monetary_account_id, schedule_payment_id, custom_headers=None): + def get(cls, api_context, user_id, monetary_account_id, schedule_id, 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 + Get a specific schedule definition for a given monetary account. - :rtype: BunqResponseNone - """ - - if custom_headers is None: - custom_headers = {} - - api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_DELETE.format(user_id, monetary_account_id, 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, api_context, user_id, monetary_account_id, schedule_payment_id, custom_headers=None): - """ :type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int - :type schedule_payment_id: int + :type schedule_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseSchedulePayment + :rtype: BunqResponseSchedule """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, monetary_account_id, schedule_payment_id) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, monetary_account_id, schedule_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseSchedulePayment.cast_from_bunq_response( + return BunqResponseSchedule.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod def list(cls, api_context, user_id, monetary_account_id, 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 api_context: context.ApiContext :type user_id: int :type monetary_account_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseSchedulePaymentList + :rtype: BunqResponseScheduleList """ if params is None: @@ -3491,35 +3516,206 @@ def list(cls, api_context, user_id, monetary_account_id, params=None, custom_hea endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseSchedulePaymentList.cast_from_bunq_response( + return BunqResponseScheduleList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) - @classmethod - def update(cls, api_context, request_map, user_id, monetary_account_id, schedule_payment_id, custom_headers=None): + @property + def time_start(self): """ - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type monetary_account_id: int - :type schedule_payment_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt + :rtype: str """ - if custom_headers is None: - custom_headers = {} - - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, schedule_payment_id) - response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) + return self._time_start - return BunqResponseInt.cast_from_bunq_response( + @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_ + + +class SchedulePayment(core.BunqModel): + """ + Endpoint for schedule payments. + + :type _payment: object_.SchedulePaymentEntry + :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 = "ScheduledPayment" + + def __init__(self): + self._payment = None + self._schedule = None + + @classmethod + def create(cls, api_context, request_map, user_id, monetary_account_id, custom_headers=None): + """ + :type api_context: context.ApiContext + :type request_map: dict[str, object] + :type user_id: int + :type monetary_account_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(api_context) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_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, api_context, user_id, monetary_account_id, schedule_payment_id, 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: BunqResponseNone + """ + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(user_id, monetary_account_id, 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, api_context, user_id, monetary_account_id, schedule_payment_id, 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(api_context) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_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) + ) + + @classmethod + def list(cls, api_context, user_id, monetary_account_id, params=None, custom_headers=None): + """ + :type api_context: context.ApiContext + :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(api_context) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_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) + ) + + @classmethod + def update(cls, api_context, request_map, user_id, monetary_account_id, schedule_payment_id, custom_headers=None): + """ + :type api_context: context.ApiContext + :type request_map: dict[str, object] + :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(api_context) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, schedule_payment_id) + response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) + + return BunqResponseSchedulePayment.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE) + ) + @property def payment(self): """ @@ -3531,7 +3727,7 @@ def payment(self): @property def schedule(self): """ - :rtype: object_.Schedule + :rtype: Schedule """ return self._schedule @@ -3545,20 +3741,20 @@ class ScheduleInstance(core.BunqModel): :type _time_start: str :type _time_end: str :type _error_message: list[object_.Error] - :type _scheduled_object: core.BunqModel - :type _result_object: core.BunqModel + :type _scheduled_object: object_.ScheduleAnchorObject + :type _result_object: object_.ScheduleInstanceAnchorObject """ - # Field constants. - FIELD_STATE = "state" - # 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 = "ScheduleInstance" + _OBJECT_TYPE = "ScheduledInstance" def __init__(self): self._state = None @@ -3603,7 +3799,7 @@ def update(cls, api_context, request_map, user_id, monetary_account_id, schedule :type schedule_instance_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseInt + :rtype: BunqResponseScheduleInstance """ if custom_headers is None: @@ -3614,8 +3810,8 @@ def update(cls, api_context, request_map, user_id, monetary_account_id, schedule endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_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) + return BunqResponseScheduleInstance.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod @@ -3680,7 +3876,7 @@ def error_message(self): @property def scheduled_object(self): """ - :rtype: core.BunqModel + :rtype: object_.ScheduleAnchorObject """ return self._scheduled_object @@ -3688,7 +3884,7 @@ def scheduled_object(self): @property def result_object(self): """ - :rtype: core.BunqModel + :rtype: object_.ScheduleInstanceAnchorObject """ return self._result_object @@ -3709,25 +3905,27 @@ class ShareInviteBankInquiry(core.BunqModel): :type _draft_share_invite_bank_id: int :type _share_detail: object_.ShareDetail :type _status: str + :type _share_type: str :type _start_date: str :type _end_date: str :type _id_: int """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/share-invite-bank-inquiry" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/share-invite-bank-inquiry/{}" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/share-invite-bank-inquiry/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/share-invite-bank-inquiry" + # Field constants. FIELD_COUNTER_USER_ALIAS = "counter_user_alias" FIELD_DRAFT_SHARE_INVITE_BANK_ID = "draft_share_invite_bank_id" FIELD_SHARE_DETAIL = "share_detail" FIELD_STATUS = "status" + FIELD_SHARE_TYPE = "share_type" FIELD_START_DATE = "start_date" FIELD_END_DATE = "end_date" - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/share-invite-bank-inquiry" - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/share-invite-bank-inquiry/{}" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/share-invite-bank-inquiry/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/share-invite-bank-inquiry" - # Object type. _OBJECT_TYPE = "ShareInviteBankInquiry" @@ -3740,6 +3938,7 @@ def __init__(self): self._draft_share_invite_bank_id = None self._share_detail = None self._status = None + self._share_type = None self._start_date = None self._end_date = None self._id_ = None @@ -3918,6 +4117,14 @@ def status(self): return self._status + @property + def share_type(self): + """ + :rtype: str + """ + + return self._share_type + @property def start_date(self): """ @@ -3955,19 +4162,20 @@ class ShareInviteBankResponse(core.BunqModel): :type _draft_share_invite_bank_id: int :type _share_detail: object_.ShareDetail :type _status: str + :type _share_type: str :type _start_date: str :type _end_date: str :type _description: str """ - # Field constants. - FIELD_STATUS = "status" - # Endpoint constants. _ENDPOINT_URL_READ = "user/{}/share-invite-bank-response/{}" _ENDPOINT_URL_UPDATE = "user/{}/share-invite-bank-response/{}" _ENDPOINT_URL_LISTING = "user/{}/share-invite-bank-response" + # Field constants. + FIELD_STATUS = "status" + # Object type. _OBJECT_TYPE = "ShareInviteBankResponse" @@ -3978,6 +4186,7 @@ def __init__(self): self._draft_share_invite_bank_id = None self._share_detail = None self._status = None + self._share_type = None self._start_date = None self._end_date = None self._description = None @@ -4107,6 +4316,14 @@ def status(self): return self._status + @property + def share_type(self): + """ + :rtype: str + """ + + return self._share_type + @property def start_date(self): """ @@ -4475,13 +4692,13 @@ class ChatMessageAttachment(core.BunqModel): :type _id_: int """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/chat-conversation/{}/message-attachment" + # Field constants. FIELD_CLIENT_MESSAGE_UUID = "client_message_uuid" FIELD_ATTACHMENT = "attachment" - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/chat-conversation/{}/message-attachment" - # Object type. _OBJECT_TYPE = "Id" @@ -4531,13 +4748,13 @@ class ChatMessageText(core.BunqModel): :type _id_: int """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/chat-conversation/{}/message-text" + # Field constants. FIELD_CLIENT_MESSAGE_UUID = "client_message_uuid" FIELD_TEXT = "text" - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/chat-conversation/{}/message-text" - # Object type. _OBJECT_TYPE = "Id" @@ -5112,13 +5329,13 @@ class Avatar(core.BunqModel): :type _image: list[object_.Image] """ - # Field constants. - FIELD_ATTACHMENT_PUBLIC_UUID = "attachment_public_uuid" - # Endpoint constants. _ENDPOINT_URL_CREATE = "avatar" _ENDPOINT_URL_READ = "avatar/{}" + # Field constants. + FIELD_ATTACHMENT_PUBLIC_UUID = "attachment_public_uuid" + # Object type. _OBJECT_TYPE = "Avatar" @@ -5203,16 +5420,16 @@ class BunqMeTab(core.BunqModel): :type _result_inquiries: list[BunqMeTabResultInquiry] """ - # Field constants. - FIELD_BUNQME_TAB_ENTRY = "bunqme_tab_entry" - FIELD_STATUS = "status" - # Endpoint constants. _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/bunqme-tab" _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/bunqme-tab/{}" _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/bunqme-tab" _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/bunqme-tab/{}" + # Field constants. + FIELD_BUNQME_TAB_ENTRY = "bunqme_tab_entry" + FIELD_STATUS = "status" + # Object type. _OBJECT_TYPE = "BunqMeTab" @@ -5739,13 +5956,13 @@ class CardReplace(core.BunqModel): :type _id_: int """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/card/{}/replace" + # Field constants. FIELD_PIN_CODE = "pin_code" FIELD_SECOND_LINE = "second_line" - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/card/{}/replace" - # Object type. _OBJECT_TYPE = "CardReplace" @@ -5797,6 +6014,7 @@ class Card(core.BunqModel): :type _updated: str :type _public_uuid: str :type _type_: str + :type _sub_type: str :type _second_line: str :type _status: str :type _sub_status: str @@ -5811,8 +6029,14 @@ class Card(core.BunqModel): :type _label_monetary_account_current: object_.MonetaryAccountReference :type _pin_code_assignment: list[object_.CardPinAssignment] :type _monetary_account_id_fallback: int + :type _country: str """ + # Endpoint constants. + _ENDPOINT_URL_UPDATE = "user/{}/card/{}" + _ENDPOINT_URL_READ = "user/{}/card/{}" + _ENDPOINT_URL_LISTING = "user/{}/card" + # Field constants. FIELD_PIN_CODE = "pin_code" FIELD_ACTIVATION_CODE = "activation_code" @@ -5824,11 +6048,6 @@ class Card(core.BunqModel): FIELD_PIN_CODE_ASSIGNMENT = "pin_code_assignment" FIELD_MONETARY_ACCOUNT_ID_FALLBACK = "monetary_account_id_fallback" - # Endpoint constants. - _ENDPOINT_URL_UPDATE = "user/{}/card/{}" - _ENDPOINT_URL_READ = "user/{}/card/{}" - _ENDPOINT_URL_LISTING = "user/{}/card" - # Object type. _OBJECT_TYPE = "CardDebit" @@ -5838,6 +6057,7 @@ def __init__(self): self._updated = None self._public_uuid = None self._type_ = None + self._sub_type = None self._second_line = None self._status = None self._sub_status = None @@ -5852,6 +6072,7 @@ def __init__(self): self._label_monetary_account_current = None self._pin_code_assignment = None self._monetary_account_id_fallback = None + self._country = None @classmethod def update(cls, api_context, request_map, user_id, card_id, custom_headers=None): @@ -5974,6 +6195,14 @@ def type_(self): return self._type_ + @property + def sub_type(self): + """ + :rtype: str + """ + + return self._sub_type + @property def second_line(self): """ @@ -6086,6 +6315,14 @@ def monetary_account_id_fallback(self): return self._monetary_account_id_fallback + @property + def country(self): + """ + :rtype: str + """ + + return self._country + class CashRegisterQrCodeContent(core.BunqModel): """ @@ -6141,15 +6378,15 @@ class CashRegisterQrCode(core.BunqModel): :type _tab_object: Tab """ - # Field constants. - FIELD_STATUS = "status" - # Endpoint constants. _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register/{}/qr-code" _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/cash-register/{}/qr-code/{}" _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/cash-register/{}/qr-code/{}" _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/qr-code" + # Field constants. + FIELD_STATUS = "status" + # Object type. _OBJECT_TYPE = "TokenQrCashRegister" @@ -6345,6 +6582,12 @@ class CashRegister(core.BunqModel): :type _tab_text_waiting_screen: list[object_.TabTextWaitingScreen] """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/cash-register/{}" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/cash-register/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register" + # Field constants. FIELD_NAME = "name" FIELD_STATUS = "status" @@ -6353,12 +6596,6 @@ class CashRegister(core.BunqModel): FIELD_NOTIFICATION_FILTERS = "notification_filters" FIELD_TAB_TEXT_WAITING_SCREEN = "tab_text_waiting_screen" - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register" - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/cash-register/{}" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/cash-register/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register" - # Object type. _OBJECT_TYPE = "CashRegister" @@ -6572,6 +6809,9 @@ class Tab(core.BunqModel): :type _TabUsageMultiple: TabUsageMultiple """ + # Error constants. + _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' + # Endpoint constants. _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/cash-register/{}/tab/{}" _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab" @@ -6653,6 +6893,19 @@ def TabUsageMultiple(self): """ return self._TabUsageMultiple + def get_referenced_object(self): + """ + :rtype: core.BunqModel + :raise: BunqException + """ + + if self._TabUsageSingle is not None: + return self._TabUsageSingle + + if self._TabUsageMultiple is not None: + return self._TabUsageMultiple + + raise exception.BunqException(self._ERROR_NULL_FIELDS) class TabUsageSingle(core.BunqModel): @@ -6688,6 +6941,13 @@ class TabUsageSingle(core.BunqModel): :type _tab_attachment: list[object_.BunqId] """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-single" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-single/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-single/{}" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-single/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-single" + # Field constants. FIELD_MERCHANT_REFERENCE = "merchant_reference" FIELD_DESCRIPTION = "description" @@ -6703,13 +6963,6 @@ class TabUsageSingle(core.BunqModel): FIELD_EXPIRATION = "expiration" FIELD_TAB_ATTACHMENT = "tab_attachment" - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-single" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-single/{}" - _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-single/{}" - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-single/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-single" - # Object type. _OBJECT_TYPE = "TabUsageSingle" @@ -7142,6 +7395,13 @@ class TabUsageMultiple(core.BunqModel): :type _tab_attachment: list[object_.BunqId] """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-multiple" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-multiple/{}" + _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-multiple/{}" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-multiple/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-multiple" + # Field constants. FIELD_DESCRIPTION = "description" FIELD_STATUS = "status" @@ -7156,13 +7416,6 @@ class TabUsageMultiple(core.BunqModel): FIELD_EXPIRATION = "expiration" FIELD_TAB_ATTACHMENT = "tab_attachment" - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-multiple" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-multiple/{}" - _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-multiple/{}" - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-multiple/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab-usage-multiple" - # Object type. _OBJECT_TYPE = "TabUsageMultiple" @@ -7474,15 +7727,15 @@ class CertificatePinned(core.BunqModel): :type _id_: int """ - # Field constants. - FIELD_CERTIFICATE_CHAIN = "certificate_chain" - # Endpoint constants. _ENDPOINT_URL_CREATE = "user/{}/certificate-pinned" _ENDPOINT_URL_DELETE = "user/{}/certificate-pinned/{}" _ENDPOINT_URL_LISTING = "user/{}/certificate-pinned" _ENDPOINT_URL_READ = "user/{}/certificate-pinned/{}" + # Field constants. + FIELD_CERTIFICATE_CHAIN = "certificate_chain" + # Object type. _OBJECT_TYPE = "CertificatePinned" @@ -7620,16 +7873,16 @@ class DeviceServer(core.BunqModel): :type _status: str """ - # Field constants. - FIELD_DESCRIPTION = "description" - FIELD_SECRET = "secret" - FIELD_PERMITTED_IPS = "permitted_ips" - # Endpoint constants. _ENDPOINT_URL_CREATE = "device-server" _ENDPOINT_URL_READ = "device-server/{}" _ENDPOINT_URL_LISTING = "device-server" + # Field constants. + FIELD_DESCRIPTION = "description" + FIELD_SECRET = "secret" + FIELD_PERMITTED_IPS = "permitted_ips" + # Object type. _OBJECT_TYPE = "DeviceServer" @@ -7776,10 +8029,12 @@ class Device(core.BunqModel): Used to get a Device or a listing of Devices. Creating a DeviceServer should happen via /device-server - :type _DevicePhone: DevicePhone :type _DeviceServer: DeviceServer """ + # Error constants. + _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' + # Endpoint constants. _ENDPOINT_URL_READ = "device/{}" _ENDPOINT_URL_LISTING = "device" @@ -7788,7 +8043,6 @@ class Device(core.BunqModel): _OBJECT_TYPE = "Device" def __init__(self): - self._DevicePhone = None self._DeviceServer = None @classmethod @@ -7841,14 +8095,6 @@ def list(cls, api_context, params=None, custom_headers=None): cls._from_json_list(response_raw) ) - @property - def DevicePhone(self): - """ - :rtype: DevicePhone - """ - - return self._DevicePhone - @property def DeviceServer(self): """ @@ -7856,95 +8102,16 @@ def DeviceServer(self): """ return self._DeviceServer - - -class DevicePhone(core.BunqModel): - """ - Used to register a device. This is the only unsigned/verified request. - - :type _id_: int - :type _created: str - :type _updated: str - :type _description: str - :type _phone_number: str - :type _os: str - :type _status: str - """ - - # Field constants. - FIELD_DESCRIPTION = "description" - FIELD_PHONE_NUMBER = "phone_number" - FIELD_REMOVE_OLD_DEVICES = "remove_old_devices" - - # Object type. - _OBJECT_TYPE = "DevicePhone" - - def __init__(self): - self._id_ = None - self._created = None - self._updated = None - self._description = None - self._phone_number = None - self._os = None - self._status = 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 description(self): - """ - :rtype: str - """ - - return self._description - - @property - def phone_number(self): - """ - :rtype: str - """ - - return self._phone_number - - @property - def os(self): + def get_referenced_object(self): """ - :rtype: str + :rtype: core.BunqModel + :raise: BunqException """ - return self._os - - @property - def status(self): - """ - :rtype: str - """ + if self._DeviceServer is not None: + return self._DeviceServer - return self._status + raise exception.BunqException(self._ERROR_NULL_FIELDS) class DraftShareInviteBankQrCodeContent(core.BunqModel): @@ -8003,17 +8170,17 @@ class DraftShareInviteBank(core.BunqModel): :type _id_: int """ - # Field constants. - FIELD_STATUS = "status" - FIELD_EXPIRATION = "expiration" - FIELD_DRAFT_SHARE_SETTINGS = "draft_share_settings" - # Endpoint constants. _ENDPOINT_URL_CREATE = "user/{}/draft-share-invite-bank" _ENDPOINT_URL_READ = "user/{}/draft-share-invite-bank/{}" _ENDPOINT_URL_UPDATE = "user/{}/draft-share-invite-bank/{}" _ENDPOINT_URL_LISTING = "user/{}/draft-share-invite-bank" + # Field constants. + FIELD_STATUS = "status" + FIELD_EXPIRATION = "expiration" + FIELD_DRAFT_SHARE_SETTINGS = "draft_share_settings" + # Object type. _OBJECT_TYPE = "DraftShareInviteBank" @@ -8233,14 +8400,14 @@ class ExportAnnualOverview(core.BunqModel): :type _alias_user: object_.LabelUser """ - # Field constants. - FIELD_YEAR = "year" - # Endpoint constants. _ENDPOINT_URL_CREATE = "user/{}/export-annual-overview" _ENDPOINT_URL_READ = "user/{}/export-annual-overview/{}" _ENDPOINT_URL_LISTING = "user/{}/export-annual-overview" + # Field constants. + FIELD_YEAR = "year" + # Object type. _OBJECT_TYPE = "ExportAnnualOverview" @@ -8424,18 +8591,18 @@ class CustomerStatementExport(core.BunqModel): :type _alias_monetary_account: object_.MonetaryAccountReference """ - # Field constants. - FIELD_STATEMENT_FORMAT = "statement_format" - FIELD_DATE_START = "date_start" - FIELD_DATE_END = "date_end" - FIELD_REGIONAL_FORMAT = "regional_format" - # Endpoint constants. _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/customer-statement" _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/customer-statement/{}" _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/customer-statement" _ENDPOINT_URL_DELETE = "user/{}/monetary-account/{}/customer-statement/{}" + # Field constants. + FIELD_STATEMENT_FORMAT = "statement_format" + FIELD_DATE_START = "date_start" + FIELD_DATE_END = "date_end" + FIELD_REGIONAL_FORMAT = "regional_format" + # Object type. _OBJECT_TYPE = "CustomerStatementExport" @@ -8755,6 +8922,12 @@ class MonetaryAccountBank(core.BunqModel): :type _setting: object_.MonetaryAccountSetting """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account-bank" + _ENDPOINT_URL_READ = "user/{}/monetary-account-bank/{}" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account-bank/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account-bank" + # Field constants. FIELD_CURRENCY = "currency" FIELD_DESCRIPTION = "description" @@ -8770,12 +8943,6 @@ class MonetaryAccountBank(core.BunqModel): FIELD_NOTIFICATION_FILTERS = "notification_filters" FIELD_SETTING = "setting" - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account-bank" - _ENDPOINT_URL_READ = "user/{}/monetary-account-bank/{}" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account-bank/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account-bank" - # Object type. _OBJECT_TYPE = "MonetaryAccountBank" @@ -9114,6 +9281,9 @@ class MonetaryAccount(core.BunqModel): :type _MonetaryAccountBank: MonetaryAccountBank """ + # Error constants. + _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' + # Endpoint constants. _ENDPOINT_URL_READ = "user/{}/monetary-account/{}" _ENDPOINT_URL_LISTING = "user/{}/monetary-account" @@ -9182,103 +9352,138 @@ def MonetaryAccountBank(self): """ return self._MonetaryAccountBank + def get_referenced_object(self): + """ + :rtype: core.BunqModel + :raise: BunqException + """ + if self._MonetaryAccountBank is not None: + return self._MonetaryAccountBank -class PaymentChat(core.BunqModel): + raise exception.BunqException(self._ERROR_NULL_FIELDS) + + +class BunqMeTabResultResponse(core.BunqModel): """ - Manage the chat connected to a payment. + 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. - :type _id_: int - :type _created: str - :type _updated: str - :type _unread_message_count: int + :type _payment: Payment """ - # Field constants. - FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id" - - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/payment/{}/chat" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/payment/{}/chat/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/payment/{}/chat" - # Object type. - _OBJECT_TYPE = "ChatConversationPayment" + _OBJECT_TYPE = "BunqMeTabResultResponse" def __init__(self): - self._id_ = None - self._created = None - self._updated = None - self._unread_message_count = None + self._payment = None - @classmethod - def create(cls, api_context, request_map, user_id, monetary_account_id, payment_id, custom_headers=None): + + + @property + def payment(self): """ - Create a chat for a specific payment. - - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type monetary_account_id: int - :type payment_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt + :rtype: Payment """ - if custom_headers is None: - custom_headers = {} + return self._payment - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, payment_id) - response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) +class MasterCardAction(core.BunqModel): + """ + MasterCard transaction view. + + :type _monetary_account_id: int + :type _card_id: int + :type _amount_local: object_.Amount + :type _amount_billing: object_.Amount + :type _amount_original_local: object_.Amount + :type _amount_original_billing: object_.Amount + :type _amount_fee: object_.Amount + :type _decision: str + :type _decision_description: str + :type _decision_description_translated: str + :type _description: str + :type _authorisation_status: str + :type _authorisation_type: str + :type _pan_entry_mode_user: str + :type _city: str + :type _alias: object_.MonetaryAccountReference + :type _counterparty_alias: object_.MonetaryAccountReference + :type _label_card: object_.LabelCard + :type _token_status: str + :type _reservation_expiry_time: str + :type _applied_limit: str + :type _allow_chat: bool + :type _eligible_whitelist_id: int + """ + + # Endpoint constants. + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/mastercard-action/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/mastercard-action" + + # Object type. + _OBJECT_TYPE = "MasterCardAction" + + def __init__(self): + self._monetary_account_id = None + self._card_id = None + self._amount_local = None + self._amount_billing = None + self._amount_original_local = None + self._amount_original_billing = None + self._amount_fee = None + self._decision = None + self._decision_description = None + self._decision_description_translated = None + self._description = None + self._authorisation_status = None + self._authorisation_type = None + self._pan_entry_mode_user = None + self._city = None + self._alias = None + self._counterparty_alias = None + self._label_card = None + self._token_status = None + self._reservation_expiry_time = None + self._applied_limit = None + self._allow_chat = None + self._eligible_whitelist_id = None @classmethod - def update(cls, api_context, request_map, user_id, monetary_account_id, payment_id, payment_chat_id, custom_headers=None): + def get(cls, api_context, user_id, monetary_account_id, master_card_action_id, custom_headers=None): """ - Update the last read message in the chat of a specific payment. - :type api_context: context.ApiContext - :type request_map: dict[str, object] :type user_id: int :type monetary_account_id: int - :type payment_id: int - :type payment_chat_id: int + :type master_card_action_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponsePaymentChat + :rtype: BunqResponseMasterCardAction """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, payment_id, payment_chat_id) - response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, monetary_account_id, master_card_action_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponsePaymentChat.cast_from_bunq_response( + return BunqResponseMasterCardAction.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod - def list(cls, api_context, user_id, monetary_account_id, payment_id, params=None, custom_headers=None): + def list(cls, api_context, user_id, monetary_account_id, params=None, custom_headers=None): """ - Get the chat for a specific payment. - :type api_context: context.ApiContext :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: BunqResponsePaymentChatList + :rtype: BunqResponseMasterCardActionList """ if params is None: @@ -9288,286 +9493,260 @@ def list(cls, api_context, user_id, monetary_account_id, payment_id, params=None custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, payment_id) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponsePaymentChatList.cast_from_bunq_response( + return BunqResponseMasterCardActionList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) @property - def id_(self): + def monetary_account_id(self): """ :rtype: int """ - return self._id_ + return self._monetary_account_id @property - def created(self): + def card_id(self): """ - :rtype: str + :rtype: int """ - return self._created + return self._card_id @property - def updated(self): + def amount_local(self): """ - :rtype: str + :rtype: object_.Amount """ - return self._updated + return self._amount_local @property - def unread_message_count(self): + def amount_billing(self): """ - :rtype: int + :rtype: object_.Amount """ - return self._unread_message_count + return self._amount_billing + @property + def amount_original_local(self): + """ + :rtype: object_.Amount + """ -class PermittedIp(core.BunqModel): - """ - Manage the IPs which may be used for a credential of a user for server - authentication. - - :type _ip: str - :type _status: str - """ + return self._amount_original_local - # Field constants. - FIELD_IP = "ip" - FIELD_STATUS = "status" + @property + def amount_original_billing(self): + """ + :rtype: object_.Amount + """ - # 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/{}" + return self._amount_original_billing - # Object type. - _OBJECT_TYPE = "PermittedIp" + @property + def amount_fee(self): + """ + :rtype: object_.Amount + """ - def __init__(self): - self._ip = None - self._status = None + return self._amount_fee - @classmethod - def get(cls, api_context, user_id, credential_password_ip_id, permitted_ip_id, custom_headers=None): + @property + def decision(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: str """ - if custom_headers is None: - custom_headers = {} + return self._decision - api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, credential_password_ip_id, permitted_ip_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + @property + def decision_description(self): + """ + :rtype: str + """ - return BunqResponsePermittedIp.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE) - ) + return self._decision_description - @classmethod - def create(cls, api_context, request_map, user_id, credential_password_ip_id, custom_headers=None): + @property + def decision_description_translated(self): """ - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type credential_password_ip_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt + :rtype: str """ - if custom_headers is None: - custom_headers = {} + return self._decision_description_translated - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, credential_password_ip_id) - response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) + @property + def description(self): + """ + :rtype: str + """ - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) + return self._description - @classmethod - def list(cls, api_context, user_id, credential_password_ip_id, params=None, custom_headers=None): + @property + def authorisation_status(self): """ - :type api_context: context.ApiContext - :type user_id: int - :type credential_password_ip_id: int - :type params: dict[str, str]|None - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponsePermittedIpList + :rtype: str """ - if params is None: - params = {} - - if custom_headers is None: - custom_headers = {} + return self._authorisation_status - api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, credential_password_ip_id) - response_raw = api_client.get(endpoint_url, params, custom_headers) + @property + def authorisation_type(self): + """ + :rtype: str + """ - return BunqResponsePermittedIpList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE) - ) + return self._authorisation_type - @classmethod - def update(cls, api_context, request_map, user_id, credential_password_ip_id, permitted_ip_id, custom_headers=None): + @property + def pan_entry_mode_user(self): """ - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type credential_password_ip_id: int - :type permitted_ip_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt + :rtype: str """ - if custom_headers is None: - custom_headers = {} + return self._pan_entry_mode_user - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, credential_password_ip_id, permitted_ip_id) - response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) + @property + def city(self): + """ + :rtype: str + """ - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) + return self._city @property - def ip(self): + def alias(self): """ - :rtype: str + :rtype: object_.MonetaryAccountReference """ - return self._ip + return self._alias @property - def status(self): + def counterparty_alias(self): """ - :rtype: str + :rtype: object_.MonetaryAccountReference """ - return self._status + return self._counterparty_alias + @property + def label_card(self): + """ + :rtype: object_.LabelCard + """ -class RequestInquiryChat(core.BunqModel): - """ - Manage the chat connected to a request inquiry. In the same way a request - inquiry and a request response are created together, so that each side of - the interaction can work on a different object, also a request inquiry chat - and a request response chat are created at the same time. See - 'request-response-chat' for the chat endpoint for the responding user. - - :type _id_: int - :type _created: str - :type _updated: str - :type _unread_message_count: int - """ + return self._label_card - # Field constants. - FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id" + @property + def token_status(self): + """ + :rtype: str + """ - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-inquiry/{}/chat" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-inquiry/{}/chat/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-inquiry/{}/chat" + return self._token_status - # Object type. - _OBJECT_TYPE = "RequestInquiryChat" + @property + def reservation_expiry_time(self): + """ + :rtype: str + """ - def __init__(self): - self._id_ = None - self._created = None - self._updated = None - self._unread_message_count = None + return self._reservation_expiry_time - @classmethod - def create(cls, api_context, request_map, user_id, monetary_account_id, request_inquiry_id, custom_headers=None): + @property + def applied_limit(self): """ - Create a chat for a specific request inquiry. - - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type monetary_account_id: int - :type request_inquiry_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt + :rtype: str """ - if custom_headers is None: - custom_headers = {} + return self._applied_limit - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, request_inquiry_id) - response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) + @property + def allow_chat(self): + """ + :rtype: bool + """ - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) + return self._allow_chat + + @property + def eligible_whitelist_id(self): + """ + :rtype: int + """ + + return self._eligible_whitelist_id + + +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. + + :type _tab: 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 = "TabResultInquiry" + + def __init__(self): + self._tab = None + self._payment = None @classmethod - def update(cls, api_context, request_map, user_id, monetary_account_id, request_inquiry_id, request_inquiry_chat_id, custom_headers=None): + def get(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_result_inquiry_id, custom_headers=None): """ - Update the last read message in the chat of a specific request inquiry. + Used to view a single TabResultInquiry belonging to a tab. :type api_context: context.ApiContext - :type request_map: dict[str, object] :type user_id: int :type monetary_account_id: int - :type request_inquiry_id: int - :type request_inquiry_chat_id: int + :type cash_register_id: int + :type tab_uuid: str + :type tab_result_inquiry_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestInquiryChat + :rtype: BunqResponseTabResultInquiry """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, request_inquiry_id, request_inquiry_chat_id) - response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_result_inquiry_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseRequestInquiryChat.cast_from_bunq_response( + return BunqResponseTabResultInquiry.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod - def list(cls, api_context, user_id, monetary_account_id, request_inquiry_id, params=None, custom_headers=None): + def list(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, params=None, custom_headers=None): """ - Get the chat for a specific request inquiry. + Used to view a list of TabResultInquiry objects belonging to a tab. :type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int - :type request_inquiry_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: BunqResponseRequestInquiryChatList + :rtype: BunqResponseTabResultInquiryList """ if params is None: @@ -9577,145 +9756,88 @@ def list(cls, api_context, user_id, monetary_account_id, request_inquiry_id, par custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, request_inquiry_id) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, cash_register_id, tab_uuid) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseRequestInquiryChatList.cast_from_bunq_response( + return BunqResponseTabResultInquiryList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) @property - def id_(self): - """ - :rtype: int - """ - - return self._id_ - - @property - def created(self): - """ - :rtype: str - """ - - return self._created - - @property - def updated(self): + def tab(self): """ - :rtype: str + :rtype: Tab """ - return self._updated + return self._tab @property - def unread_message_count(self): + def payment(self): """ - :rtype: int + :rtype: Payment """ - return self._unread_message_count + return self._payment -class RequestResponseChat(core.BunqModel): +class TabResultResponse(core.BunqModel): """ - Manage the chat connected to a request response. In the same way a request - inquiry and a request response are created together, so that each side of - the interaction can work on a different object, also a request inquiry chat - and a request response chat are created at the same time. See - 'request-inquiry-chat' for the chat endpoint for the inquiring user. + 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. - :type _id_: int - :type _created: str - :type _updated: str - :type _unread_message_count: int + :type _tab: Tab + :type _payment: Payment """ - # Field constants. - FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id" - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-response/{}/chat" - _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-response/{}/chat/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-response/{}/chat" + _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/tab-result-response/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/tab-result-response" # Object type. - _OBJECT_TYPE = "RequestResponseChat" + _OBJECT_TYPE = "TabResultResponse" def __init__(self): - self._id_ = None - self._created = None - self._updated = None - self._unread_message_count = None - - @classmethod - def create(cls, api_context, request_map, user_id, monetary_account_id, request_response_id, custom_headers=None): - """ - Create a chat for a specific request response. - - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type monetary_account_id: int - :type request_response_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt - """ - - if custom_headers is None: - custom_headers = {} - - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_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) - ) + self._tab = None + self._payment = None @classmethod - def update(cls, api_context, request_map, user_id, monetary_account_id, request_response_id, request_response_chat_id, custom_headers=None): + def get(cls, api_context, user_id, monetary_account_id, tab_result_response_id, custom_headers=None): """ - Update the last read message in the chat of a specific request response. + Used to view a single TabResultResponse belonging to a tab. :type api_context: context.ApiContext - :type request_map: dict[str, object] :type user_id: int :type monetary_account_id: int - :type request_response_id: int - :type request_response_chat_id: int + :type tab_result_response_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestResponseChat + :rtype: BunqResponseTabResultResponse """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, request_response_id, request_response_chat_id) - response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, monetary_account_id, tab_result_response_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseRequestResponseChat.cast_from_bunq_response( + return BunqResponseTabResultResponse.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod - def list(cls, api_context, user_id, monetary_account_id, request_response_id, params=None, custom_headers=None): + def list(cls, api_context, user_id, monetary_account_id, params=None, custom_headers=None): """ - Get the chat for a specific request response. + Used to view a list of TabResultResponse objects belonging to a tab. :type api_context: context.ApiContext :type user_id: int :type monetary_account_id: int - :type request_response_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseRequestResponseChatList + :rtype: BunqResponseTabResultResponseList """ if params is None: @@ -9725,225 +9847,561 @@ def list(cls, api_context, user_id, monetary_account_id, request_response_id, pa custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, request_response_id) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseRequestResponseChatList.cast_from_bunq_response( + return BunqResponseTabResultResponseList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) @property - def id_(self): + def tab(self): """ - :rtype: int + :rtype: Tab """ - return self._id_ + return self._tab @property - def created(self): + def payment(self): """ - :rtype: str + :rtype: Payment """ - return self._created - - @property - def updated(self): - """ - :rtype: str - """ - - return self._updated - - @property - def unread_message_count(self): - """ - :rtype: int - """ - - return self._unread_message_count + return self._payment -class Schedule(core.BunqModel): +class UserPerson(core.BunqModel): """ - view for reading the scheduled definitions. + With UserPerson you can retrieve information regarding the authenticated + UserPerson and update specific fields.

Notification filters can be + set on a UserPerson level to receive callbacks. For more information check + the dedicated callbacks page. + + :type _id_: int + :type _created: str + :type _updated: str + :type _public_uuid: str + :type _first_name: str + :type _middle_name: str + :type _last_name: str + :type _legal_name: str + :type _display_name: str + :type _public_nick_name: str + :type _alias: list[object_.Pointer] + :type _tax_resident: list[object_.TaxResident] + :type _document_type: str + :type _document_number: str + :type _document_country_of_issuance: str + :type _address_main: object_.Address + :type _address_postal: object_.Address + :type _date_of_birth: str + :type _place_of_birth: str + :type _country_of_birth: str + :type _nationality: str + :type _language: str + :type _region: str + :type _gender: str + :type _avatar: object_.Avatar + :type _version_terms_of_service: str + :type _status: str + :type _sub_status: str + :type _session_timeout: int + :type _daily_limit_without_confirmation_login: object_.Amount + :type _notification_filters: list[object_.NotificationFilter] """ # Endpoint constants. - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/schedule/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/schedule" + _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_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_COUNTER_BANK_IBAN = "counter_bank_iban" + FIELD_NOTIFICATION_FILTERS = "notification_filters" # Object type. - _OBJECT_TYPE = "Schedule" + _OBJECT_TYPE = "UserPerson" + + def __init__(self): + self._id_ = None + self._created = None + self._updated = None + self._public_uuid = None + self._first_name = None + self._middle_name = None + self._last_name = None + self._legal_name = None + self._display_name = None + self._public_nick_name = None + self._alias = None + self._tax_resident = None + self._document_type = None + self._document_number = None + self._document_country_of_issuance = None + self._address_main = None + self._address_postal = None + self._date_of_birth = None + self._place_of_birth = None + self._country_of_birth = None + self._nationality = None + self._language = None + self._region = None + self._gender = None + self._avatar = None + self._version_terms_of_service = None + self._status = None + self._sub_status = None + self._session_timeout = None + self._daily_limit_without_confirmation_login = None + self._notification_filters = None @classmethod - def get(cls, api_context, user_id, monetary_account_id, schedule_id, custom_headers=None): + def get(cls, api_context, user_person_id, custom_headers=None): """ - Get a specific schedule definition for a given monetary account. + Get a specific person. :type api_context: context.ApiContext - :type user_id: int - :type monetary_account_id: int - :type schedule_id: int + :type user_person_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseSchedule + :rtype: BunqResponseUserPerson """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, monetary_account_id, schedule_id) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_person_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseSchedule.cast_from_bunq_response( + return BunqResponseUserPerson.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod - def list(cls, api_context, user_id, monetary_account_id, params=None, custom_headers=None): + def update(cls, api_context, request_map, user_person_id, 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. + Modify a specific person object's data. :type api_context: context.ApiContext - :type user_id: int - :type monetary_account_id: int - :type params: dict[str, str]|None + :type request_map: dict[str, object] + :type user_person_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseScheduleList + :rtype: BunqResponseInt """ - if params is None: - params = {} - if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id) - response_raw = api_client.get(endpoint_url, params, custom_headers) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_person_id) + response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - return BunqResponseScheduleList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) + @property + def id_(self): + """ + :rtype: int + """ -class ScheduleUser(core.BunqModel): - """ - view for reading the scheduled definitions. - """ + return self._id_ - # Endpoint constants. - _ENDPOINT_URL_LISTING = "user/{}/schedule" + @property + def created(self): + """ + :rtype: str + """ - # Object type. - _OBJECT_TYPE = "ScheduleUser" + return self._created - @classmethod - def list(cls, api_context, user_id, params=None, custom_headers=None): + @property + def updated(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 api_context: context.ApiContext - :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._updated - if custom_headers is None: - custom_headers = {} + @property + def public_uuid(self): + """ + :rtype: str + """ - api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) - response_raw = api_client.get(endpoint_url, params, custom_headers) + return self._public_uuid - return BunqResponseScheduleUserList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE) - ) + @property + def first_name(self): + """ + :rtype: str + """ + return self._first_name -class Session(core.BunqModel): - """ - Endpoint for operations over the current session. - """ + @property + def middle_name(self): + """ + :rtype: str + """ - # Endpoint constants. - _ENDPOINT_URL_DELETE = "session/{}" + return self._middle_name - # Object type. - _OBJECT_TYPE = "Session" + @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 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 + + +class UserCompany(core.BunqModel): + """ + With UserCompany you can retrieve information regarding the authenticated + UserCompany and update specific fields.

Notification filters can be + set on a UserCompany level to receive callbacks. For more information check + the dedicated callbacks page. + + :type _id_: int + :type _created: str + :type _updated: str + :type _public_uuid: str + :type _name: str + :type _display_name: str + :type _public_nick_name: str + :type _alias: list[object_.Pointer] + :type _chamber_of_commerce_number: str + :type _type_of_business_entity: str + :type _sector_of_industry: str + :type _counter_bank_iban: str + :type _avatar: object_.Avatar + :type _address_main: object_.Address + :type _address_postal: object_.Address + :type _version_terms_of_service: str + :type _director_alias: object_.LabelUser + :type _language: str + :type _country: str + :type _region: str + :type _ubo: list[object_.Ubo] + :type _status: str + :type _sub_status: str + :type _session_timeout: int + :type _daily_limit_without_confirmation_login: object_.Amount + :type _notification_filters: list[object_.NotificationFilter] + :type _customer: Customer + :type _customer_limit: CustomerLimit + :type _billing_contract: list[BillingContractSubscription] + """ + + # Endpoint constants. + _ENDPOINT_URL_READ = "user-company/{}" + _ENDPOINT_URL_UPDATE = "user-company/{}" + + # Field constants. + FIELD_NAME = "name" + FIELD_PUBLIC_NICK_NAME = "public_nick_name" + FIELD_AVATAR_UUID = "avatar_uuid" + FIELD_ADDRESS_MAIN = "address_main" + FIELD_ADDRESS_POSTAL = "address_postal" + FIELD_LANGUAGE = "language" + FIELD_REGION = "region" + FIELD_COUNTRY = "country" + FIELD_UBO = "ubo" + FIELD_CHAMBER_OF_COMMERCE_NUMBER = "chamber_of_commerce_number" + FIELD_STATUS = "status" + FIELD_SUB_STATUS = "sub_status" + FIELD_SESSION_TIMEOUT = "session_timeout" + FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN = "daily_limit_without_confirmation_login" + FIELD_COUNTER_BANK_IBAN = "counter_bank_iban" + FIELD_NOTIFICATION_FILTERS = "notification_filters" + + # Object type. + _OBJECT_TYPE = "UserCompany" + + def __init__(self): + self._id_ = None + self._created = None + self._updated = None + self._public_uuid = None + self._name = None + self._display_name = None + self._public_nick_name = None + self._alias = None + self._chamber_of_commerce_number = None + self._type_of_business_entity = None + self._sector_of_industry = None + self._counter_bank_iban = None + self._avatar = None + self._address_main = None + self._address_postal = None + self._version_terms_of_service = None + self._director_alias = None + self._language = None + self._country = None + self._region = None + self._ubo = None + self._status = None + self._sub_status = None + self._session_timeout = None + self._daily_limit_without_confirmation_login = None + self._notification_filters = None + self._customer = None + self._customer_limit = None + self._billing_contract = None @classmethod - def delete(cls, api_context, session_id, custom_headers=None): + def get(cls, api_context, user_company_id, custom_headers=None): """ - Deletes the current session. No response is returned for this request. + Get a specific company. :type api_context: context.ApiContext - :type session_id: int + :type user_company_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseNone + :rtype: BunqResponseUserCompany """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_DELETE.format(session_id) - response_raw = api_client.delete(endpoint_url, custom_headers) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_company_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseNone.cast_from_bunq_response( - client.BunqResponse(None, response_raw.headers) + return BunqResponseUserCompany.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE) ) - -class TabItemShopBatch(core.BunqModel): - """ - Create a batch of tab items. - - :type _tab_items: list[TabItemShop] - """ - - # Field constants. - FIELD_TAB_ITEMS = "tab_items" - - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item-batch" - - # Object type. - _OBJECT_TYPE = "TabItemShopBatch" - - def __init__(self): - self._tab_items = None - @classmethod - def create(cls, api_context, request_map, user_id, monetary_account_id, cash_register_id, tab_uuid, custom_headers=None): + def update(cls, api_context, request_map, user_company_id, custom_headers=None): """ - Create tab items as a batch. + Modify a specific company's data. :type api_context: context.ApiContext :type request_map: dict[str, object] - :type user_id: int - :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str + :type user_company_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -9954,420 +10412,412 @@ def create(cls, api_context, request_map, user_id, monetary_account_id, cash_reg api_client = client.ApiClient(api_context) request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, cash_register_id, tab_uuid) - response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_company_id) + response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) return BunqResponseInt.cast_from_bunq_response( cls._process_for_id(response_raw) ) @property - def tab_items(self): + def id_(self): """ - :rtype: list[TabItemShop] + :rtype: int """ - return self._tab_items + return self._id_ + @property + def created(self): + """ + :rtype: str + """ -class TabItemShop(core.BunqModel): - """ - After you’ve created a Tab using /tab-usage-single or /tab-usage-multiple - you can add items and attachments using tab-item. You can only add or modify - TabItems of a Tab which status is OPEN. The amount of the TabItems will not - influence the total_amount of the corresponding Tab. However, if you've - created any TabItems for a Tab the sum of the amounts of these items must be - equal to the total_amount of the Tab when you change its status to - PAYABLE/WAITING_FOR_PAYMENT. - - :type _id_: int - :type _description: str - :type _ean_code: str - :type _avatar_attachment: object_.AttachmentPublic - :type _tab_attachment: list[object_.AttachmentTab] - :type _quantity: float - :type _amount: object_.Amount - """ + return self._created - # 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" + @property + def updated(self): + """ + :rtype: 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/{}" + return self._updated - # Object type. - _OBJECT_TYPE = "TabItem" + @property + def public_uuid(self): + """ + :rtype: str + """ - def __init__(self): - self._id_ = None - self._description = None - self._ean_code = None - self._avatar_attachment = None - self._tab_attachment = None - self._quantity = None - self._amount = None + return self._public_uuid - @classmethod - def create(cls, api_context, request_map, user_id, monetary_account_id, cash_register_id, tab_uuid, custom_headers=None): + @property + def name(self): """ - Create a new TabItem for a given Tab. - - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt + :rtype: str """ - if custom_headers is None: - custom_headers = {} + return self._name - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, cash_register_id, tab_uuid) - response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) + @property + def display_name(self): + """ + :rtype: str + """ - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) + return self._display_name - @classmethod - def update(cls, api_context, request_map, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id, custom_headers=None): + @property + def public_nick_name(self): """ - Modify a TabItem from a given Tab. - - :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_id: int - :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :type tab_item_shop_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseInt + :rtype: str """ - if custom_headers is None: - custom_headers = {} + return self._public_nick_name - api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id) - response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) + @property + def alias(self): + """ + :rtype: list[object_.Pointer] + """ - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) - ) + return self._alias - @classmethod - def delete(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id, custom_headers=None): + @property + def chamber_of_commerce_number(self): """ - Delete a specific TabItem from a Tab. This request returns an empty - response. - - :type api_context: context.ApiContext - :type user_id: int - :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :type tab_item_shop_id: int - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseNone + :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 """ - if custom_headers is None: - custom_headers = {} + return self._director_alias - api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_DELETE.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id) - response_raw = api_client.delete(endpoint_url, custom_headers) + @property + def language(self): + """ + :rtype: str + """ - return BunqResponseNone.cast_from_bunq_response( - client.BunqResponse(None, response_raw.headers) - ) + return self._language - @classmethod - def list(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, params=None, custom_headers=None): + @property + def country(self): """ - Get a collection of TabItems from a given Tab. - - :type api_context: context.ApiContext - :type user_id: int - :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :type params: dict[str, str]|None - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseTabItemShopList + :rtype: str """ - if params is None: - params = {} - - if custom_headers is None: - custom_headers = {} + return self._country - api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, cash_register_id, tab_uuid) - response_raw = api_client.get(endpoint_url, params, custom_headers) + @property + def region(self): + """ + :rtype: str + """ - return BunqResponseTabItemShopList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE) - ) + return self._region - @classmethod - def get(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id, custom_headers=None): + @property + def ubo(self): """ - 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 custom_headers: dict[str, str]|None - - :rtype: BunqResponseTabItemShop + :rtype: list[object_.Ubo] """ - if custom_headers is None: - custom_headers = {} + return self._ubo - api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + @property + def status(self): + """ + :rtype: str + """ - return BunqResponseTabItemShop.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE) - ) + return self._status @property - def id_(self): + def sub_status(self): """ - :rtype: int + :rtype: str """ - return self._id_ + return self._sub_status @property - def description(self): + def session_timeout(self): """ - :rtype: str + :rtype: int """ - return self._description + return self._session_timeout @property - def ean_code(self): + def daily_limit_without_confirmation_login(self): """ - :rtype: str + :rtype: object_.Amount """ - return self._ean_code + return self._daily_limit_without_confirmation_login @property - def avatar_attachment(self): + def notification_filters(self): """ - :rtype: object_.AttachmentPublic + :rtype: list[object_.NotificationFilter] """ - return self._avatar_attachment + return self._notification_filters @property - def tab_attachment(self): + def customer(self): """ - :rtype: list[object_.AttachmentTab] + :rtype: Customer """ - return self._tab_attachment + return self._customer @property - def quantity(self): + def customer_limit(self): """ - :rtype: float + :rtype: CustomerLimit """ - return self._quantity + return self._customer_limit @property - def amount(self): + def billing_contract(self): """ - :rtype: object_.Amount + :rtype: list[BillingContractSubscription] """ - return self._amount + return self._billing_contract -class TabResultInquiry(core.BunqModel): +class Customer(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 view a customer. - :type _tab: Tab - :type _payment: Payment + :type _id_: int + :type _created: str + :type _updated: str + :type _billing_account_id: str """ # 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_LISTING = "user/{}/customer" + _ENDPOINT_URL_READ = "user/{}/customer/{}" + _ENDPOINT_URL_UPDATE = "user/{}/customer/{}" + + # Field constants. + FIELD_BILLING_ACCOUNT_ID = "billing_account_id" # Object type. - _OBJECT_TYPE = "TabResultInquiry" + _OBJECT_TYPE = "Customer" def __init__(self): - self._tab = None - self._payment = None + self._id_ = None + self._created = None + self._updated = None + self._billing_account_id = None @classmethod - def get(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_result_inquiry_id, custom_headers=None): + def list(cls, api_context, user_id, params=None, custom_headers=None): """ - Used to view a single TabResultInquiry belonging to a tab. + :type api_context: context.ApiContext + :type user_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + :rtype: BunqResponseCustomerList + """ + + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponseCustomerList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE) + ) + + @classmethod + def get(cls, api_context, user_id, customer_id, custom_headers=None): + """ :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 customer_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseTabResultInquiry + :rtype: BunqResponseCustomer """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_result_inquiry_id) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, customer_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseTabResultInquiry.cast_from_bunq_response( + return BunqResponseCustomer.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod - def list(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, params=None, custom_headers=None): + def update(cls, api_context, request_map, user_id, customer_id, custom_headers=None): """ - Used to view a list of TabResultInquiry objects belonging to a tab. - :type api_context: context.ApiContext + :type request_map: dict[str, object] :type user_id: int - :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :type params: dict[str, str]|None + :type customer_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseTabResultInquiryList + :rtype: BunqResponseInt """ - if params is None: - params = {} - if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, cash_register_id, tab_uuid) - response_raw = api_client.get(endpoint_url, params, custom_headers) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, customer_id) + response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - return BunqResponseTabResultInquiryList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @property - 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 -class TabResultResponse(core.BunqModel): + @property + def billing_account_id(self): + """ + :rtype: str + """ + + return self._billing_account_id + + +class CustomerLimit(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. + Show the limits for the authenticated user. - :type _tab: Tab - :type _payment: Payment + :type _limit_monetary_account: int + :type _limit_card_debit_maestro: int + :type _limit_card_debit_mastercard: int + :type _limit_card_debit_wildcard: int + :type _limit_card_debit_replacement: int """ # Endpoint constants. - _ENDPOINT_URL_READ = "user/{}/monetary-account/{}/tab-result-response/{}" - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/tab-result-response" + _ENDPOINT_URL_LISTING = "user/{}/limit" # Object type. - _OBJECT_TYPE = "TabResultResponse" + _OBJECT_TYPE = "CustomerLimit" def __init__(self): - self._tab = None - self._payment = None - - @classmethod - def get(cls, api_context, user_id, monetary_account_id, tab_result_response_id, 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(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_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) - ) + self._limit_monetary_account = None + self._limit_card_debit_maestro = None + self._limit_card_debit_mastercard = None + self._limit_card_debit_wildcard = None + self._limit_card_debit_replacement = None @classmethod - def list(cls, api_context, user_id, monetary_account_id, params=None, custom_headers=None): + def list(cls, api_context, user_id, params=None, custom_headers=None): """ - Used to view a list of TabResultResponse objects belonging to a tab. + Get all limits for the authenticated user. :type api_context: context.ApiContext :type user_id: int - :type monetary_account_id: int :type params: dict[str, str]|None :type custom_headers: dict[str, str]|None - :rtype: BunqResponseTabResultResponseList + :rtype: BunqResponseCustomerLimitList """ if params is None: @@ -10377,145 +10827,95 @@ def list(cls, api_context, user_id, monetary_account_id, params=None, custom_hea custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseTabResultResponseList.cast_from_bunq_response( + return BunqResponseCustomerLimitList.cast_from_bunq_response( cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) @property - def tab(self): + def limit_monetary_account(self): """ - :rtype: Tab + :rtype: int """ - return self._tab + return self._limit_monetary_account @property - def payment(self): + def limit_card_debit_maestro(self): """ - :rtype: Payment + :rtype: int """ - return self._payment - - -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 self._limit_card_debit_maestro - # Endpoint constants. - _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/qr-code-content" + @property + def limit_card_debit_mastercard(self): + """ + :rtype: int + """ - # Object type. - _OBJECT_TYPE = "TabQrCodeContent" + return self._limit_card_debit_mastercard - @classmethod - def list(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, custom_headers=None): + @property + def limit_card_debit_wildcard(self): """ - Returns the raw content of the QR code that links to this Tab. The raw - content is the binary representation of a file, without any JSON - wrapping. - - :type api_context: context.ApiContext - :type user_id: int - :type monetary_account_id: int - :type cash_register_id: int - :type tab_uuid: str - :type custom_headers: dict[str, str]|None - - :rtype: BunqResponseBytes + :rtype: int """ - if custom_headers is None: - custom_headers = {} + return self._limit_card_debit_wildcard - api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, cash_register_id, tab_uuid) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + @property + def limit_card_debit_replacement(self): + """ + :rtype: int + """ - return BunqResponseBytes.cast_from_bunq_response( - client.BunqResponse(response_raw.body_bytes, response_raw.headers) - ) + return self._limit_card_debit_replacement -class TokenQrRequestIdeal(core.BunqModel): +class BillingContractSubscription(core.BunqModel): """ - Using this call you create a request for payment from an external token - provided with an ideal transaction. Make sure your iDEAL payments are - compliant with the iDEAL standards, by following the following manual: https://www.bunq.com/files/media/legal/en/20170315_ideal_standards_en.pdf. - It's very important to keep these points in mind when you are using the - endpoint to make iDEAL payments from your application. + Show the subscription billing contract for the authenticated user. - :type _time_responded: str - :type _time_expiry: str - :type _monetary_account_id: int - :type _amount_inquired: object_.Amount - :type _amount_responded: object_.Amount - :type _alias: object_.MonetaryAccountReference - :type _counterparty_alias: object_.MonetaryAccountReference - :type _description: str - :type _attachment: list[object_.Attachment] - :type _status: str - :type _minimum_age: int - :type _require_address: str - :type _address_shipping: object_.Address - :type _address_billing: object_.Address - :type _geolocation: object_.Geolocation - :type _redirect_url: str - :type _type_: str - :type _sub_type: str - :type _allow_chat: bool - :type _eligible_whitelist_id: int + :type _id_: int + :type _created: str + :type _updated: str + :type _contract_date_start: str + :type _contract_date_end: str + :type _contract_version: int + :type _subscription_type: str """ - # Field constants. - FIELD_TOKEN = "token" - # Endpoint constants. - _ENDPOINT_URL_CREATE = "user/{}/token-qr-request-ideal" + _ENDPOINT_URL_CREATE = "user/{}/billing-contract-subscription" + _ENDPOINT_URL_LISTING = "user/{}/billing-contract-subscription" + + # Field constants. + FIELD_SUBSCRIPTION_TYPE = "subscription_type" # Object type. - _OBJECT_TYPE = "TokenQrRequestIdeal" + _OBJECT_TYPE = "BillingContractSubscription" def __init__(self): - self._time_responded = None - self._time_expiry = None - self._monetary_account_id = None - self._amount_inquired = None - self._amount_responded = None - self._alias = None - self._counterparty_alias = None - self._description = None - self._attachment = None - self._status = None - self._minimum_age = None - self._require_address = None - self._address_shipping = None - self._address_billing = None - self._geolocation = None - self._redirect_url = None - self._type_ = None - self._sub_type = None - self._allow_chat = None - self._eligible_whitelist_id = None + self._id_ = None + self._created = None + self._updated = None + self._contract_date_start = None + self._contract_date_end = None + self._contract_version = None + self._subscription_type = None @classmethod def create(cls, api_context, request_map, user_id, custom_headers=None): """ - Create a request from an ideal transaction. - :type api_context: context.ApiContext :type request_map: dict[str, object] :type user_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseTokenQrRequestIdeal + :rtype: BunqResponseBillingContractSubscription """ if custom_headers is None: @@ -10526,296 +10926,294 @@ def create(cls, api_context, request_map, user_id, custom_headers=None): endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - return BunqResponseTokenQrRequestIdeal.cast_from_bunq_response( + return BunqResponseBillingContractSubscription.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) - @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): + @classmethod + def list(cls, api_context, user_id, params=None, custom_headers=None): """ - :rtype: int + Get all subscription billing contract for the authenticated user. + + :type api_context: context.ApiContext + :type user_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseBillingContractSubscriptionList """ - return self._monetary_account_id - - @property - def amount_inquired(self): - """ - :rtype: object_.Amount - """ + if params is None: + params = {} - return self._amount_inquired + if custom_headers is None: + custom_headers = {} - @property - def amount_responded(self): - """ - :rtype: object_.Amount - """ + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) - return self._amount_responded + return BunqResponseBillingContractSubscriptionList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE) + ) @property - def alias(self): + def id_(self): """ - :rtype: object_.MonetaryAccountReference + :rtype: int """ - return self._alias + return self._id_ @property - def counterparty_alias(self): + def created(self): """ - :rtype: object_.MonetaryAccountReference + :rtype: str """ - return self._counterparty_alias + return self._created @property - def description(self): + def updated(self): """ :rtype: str """ - return self._description + return self._updated @property - def attachment(self): + def contract_date_start(self): """ - :rtype: list[object_.Attachment] + :rtype: str """ - return self._attachment + return self._contract_date_start @property - def status(self): + def contract_date_end(self): """ :rtype: str """ - return self._status + return self._contract_date_end @property - def minimum_age(self): + def contract_version(self): """ :rtype: int """ - return self._minimum_age + return self._contract_version @property - def require_address(self): + def subscription_type(self): """ :rtype: str """ - return self._require_address + return self._subscription_type - @property - def address_shipping(self): - """ - :rtype: object_.Address - """ - return self._address_shipping +class PaymentChat(core.BunqModel): + """ + Manage the chat connected to a payment. + + :type _id_: int + :type _created: str + :type _updated: str + :type _unread_message_count: int + """ - @property - def address_billing(self): + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/payment/{}/chat" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/payment/{}/chat/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/payment/{}/chat" + + # Field constants. + FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id" + + # Object type. + _OBJECT_TYPE = "ChatConversationPayment" + + def __init__(self): + self._id_ = None + self._created = None + self._updated = None + self._unread_message_count = None + + @classmethod + def create(cls, api_context, request_map, user_id, monetary_account_id, payment_id, custom_headers=None): """ - :rtype: object_.Address + Create a chat for a specific payment. + + :type api_context: context.ApiContext + :type request_map: dict[str, object] + :type user_id: int + :type monetary_account_id: int + :type payment_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._address_billing + if custom_headers is None: + custom_headers = {} - @property - def geolocation(self): + api_client = client.ApiClient(api_context) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, payment_id) + response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) + + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) + + @classmethod + def update(cls, api_context, request_map, user_id, monetary_account_id, payment_id, payment_chat_id, custom_headers=None): """ - :rtype: object_.Geolocation + Update the last read message in the chat of a specific payment. + + :type api_context: context.ApiContext + :type request_map: dict[str, object] + :type user_id: int + :type monetary_account_id: int + :type payment_id: int + :type payment_chat_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponsePaymentChat """ - return self._geolocation + if custom_headers is None: + custom_headers = {} - @property - def redirect_url(self): + api_client = client.ApiClient(api_context) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, payment_id, payment_chat_id) + response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) + + return BunqResponsePaymentChat.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE) + ) + + @classmethod + def list(cls, api_context, user_id, monetary_account_id, payment_id, params=None, custom_headers=None): """ - :rtype: str + Get the chat for a specific payment. + + :type api_context: context.ApiContext + :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: BunqResponsePaymentChatList """ - return self._redirect_url + if params is None: + params = {} + + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, payment_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) + + return BunqResponsePaymentChatList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE) + ) @property - def type_(self): + def id_(self): """ - :rtype: str + :rtype: int """ - return self._type_ + return self._id_ @property - def sub_type(self): + def created(self): """ :rtype: str """ - return self._sub_type + return self._created @property - def allow_chat(self): + def updated(self): """ - :rtype: bool + :rtype: str """ - return self._allow_chat + return self._updated @property - def eligible_whitelist_id(self): + def unread_message_count(self): """ :rtype: int """ - return self._eligible_whitelist_id + return self._unread_message_count -class UserCompany(core.BunqModel): +class PermittedIp(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. + Manage the IPs which may be used for a credential of a user for server + authentication. - :type _id_: int - :type _created: str - :type _updated: str - :type _public_uuid: str - :type _name: str - :type _display_name: str - :type _public_nick_name: str - :type _alias: list[object_.Pointer] - :type _chamber_of_commerce_number: str - :type _type_of_business_entity: str - :type _sector_of_industry: str - :type _counter_bank_iban: str - :type _avatar: object_.Avatar - :type _address_main: object_.Address - :type _address_postal: object_.Address - :type _version_terms_of_service: str - :type _director_alias: object_.LabelUser - :type _language: str - :type _country: str - :type _region: str - :type _ubo: list[object_.Ubo] + :type _ip: str :type _status: str - :type _sub_status: str - :type _session_timeout: int - :type _daily_limit_without_confirmation_login: object_.Amount - :type _notification_filters: list[object_.NotificationFilter] - :type _customer: Customer - :type _customer_limit: CustomerLimit - :type _billing_contract: list[BillingContractSubscription] """ + # Endpoint constants. + _ENDPOINT_URL_READ = "user/{}/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_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_IP = "ip" FIELD_STATUS = "status" - FIELD_SUB_STATUS = "sub_status" - FIELD_SESSION_TIMEOUT = "session_timeout" - FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN = "daily_limit_without_confirmation_login" - FIELD_COUNTER_BANK_IBAN = "counter_bank_iban" - FIELD_NOTIFICATION_FILTERS = "notification_filters" - - # Endpoint constants. - _ENDPOINT_URL_READ = "user-company/{}" - _ENDPOINT_URL_UPDATE = "user-company/{}" # Object type. - _OBJECT_TYPE = "UserCompany" + _OBJECT_TYPE = "PermittedIp" def __init__(self): - self._id_ = None - self._created = None - self._updated = None - self._public_uuid = None - self._name = None - self._display_name = None - self._public_nick_name = None - self._alias = None - self._chamber_of_commerce_number = None - self._type_of_business_entity = None - self._sector_of_industry = None - self._counter_bank_iban = None - self._avatar = None - self._address_main = None - self._address_postal = None - self._version_terms_of_service = None - self._director_alias = None - self._language = None - self._country = None - self._region = None - self._ubo = None + self._ip = None self._status = None - self._sub_status = None - self._session_timeout = None - self._daily_limit_without_confirmation_login = None - self._notification_filters = None - self._customer = None - self._customer_limit = None - self._billing_contract = None @classmethod - def get(cls, api_context, user_company_id, custom_headers=None): + def get(cls, api_context, user_id, credential_password_ip_id, permitted_ip_id, custom_headers=None): """ - Get a specific company. - :type api_context: context.ApiContext - :type user_company_id: int + :type user_id: int + :type credential_password_ip_id: int + :type permitted_ip_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseUserCompany + :rtype: BunqResponsePermittedIp """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_company_id) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, credential_password_ip_id, permitted_ip_id) response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseUserCompany.cast_from_bunq_response( + return BunqResponsePermittedIp.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod - def update(cls, api_context, request_map, user_company_id, custom_headers=None): + def create(cls, api_context, request_map, user_id, credential_password_ip_id, custom_headers=None): """ - Modify a specific company's data. - :type api_context: context.ApiContext :type request_map: dict[str, object] - :type user_company_id: int + :type user_id: int + :type credential_password_ip_id: int :type custom_headers: dict[str, str]|None :rtype: BunqResponseInt @@ -10826,342 +11224,342 @@ def update(cls, api_context, request_map, user_company_id, custom_headers=None): api_client = client.ApiClient(api_context) request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_company_id) - response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, credential_password_ip_id) + response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) return BunqResponseInt.cast_from_bunq_response( cls._process_for_id(response_raw) ) - @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 name(self): - """ - :rtype: str - """ - - return self._name - - @property - def display_name(self): + @classmethod + def list(cls, api_context, user_id, credential_password_ip_id, params=None, custom_headers=None): """ - :rtype: str + :type api_context: context.ApiContext + :type user_id: int + :type credential_password_ip_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponsePermittedIpList """ - return self._display_name - - @property - def public_nick_name(self): - """ - :rtype: str - """ + if params is None: + params = {} - return self._public_nick_name + if custom_headers is None: + custom_headers = {} - @property - def alias(self): - """ - :rtype: list[object_.Pointer] - """ + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, credential_password_ip_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) - return self._alias + return BunqResponsePermittedIpList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE) + ) - @property - def chamber_of_commerce_number(self): + @classmethod + def update(cls, api_context, request_map, user_id, credential_password_ip_id, permitted_ip_id, custom_headers=None): """ - :rtype: str + :type api_context: context.ApiContext + :type request_map: dict[str, object] + :type user_id: int + :type credential_password_ip_id: int + :type permitted_ip_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._chamber_of_commerce_number + if custom_headers is None: + custom_headers = {} - @property - def type_of_business_entity(self): - """ - :rtype: str - """ + api_client = client.ApiClient(api_context) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, credential_password_ip_id, permitted_ip_id) + response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - return self._type_of_business_entity + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) @property - def sector_of_industry(self): + def ip(self): """ :rtype: str """ - return self._sector_of_industry + return self._ip @property - def counter_bank_iban(self): + def status(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 + return self._status - @property - def version_terms_of_service(self): - """ - :rtype: str - """ - return self._version_terms_of_service +class RequestInquiryChat(core.BunqModel): + """ + Manage the chat connected to a request inquiry. In the same way a request + inquiry and a request response are created together, so that each side of + the interaction can work on a different object, also a request inquiry chat + and a request response chat are created at the same time. See + 'request-response-chat' for the chat endpoint for the responding user. + + :type _id_: int + :type _created: str + :type _updated: str + :type _unread_message_count: int + """ - @property - def director_alias(self): - """ - :rtype: object_.LabelUser - """ + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-inquiry/{}/chat" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-inquiry/{}/chat/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-inquiry/{}/chat" - return self._director_alias + # Field constants. + FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id" - @property - def language(self): - """ - :rtype: str - """ + # Object type. + _OBJECT_TYPE = "RequestInquiryChat" - return self._language + def __init__(self): + self._id_ = None + self._created = None + self._updated = None + self._unread_message_count = None - @property - def country(self): + @classmethod + def create(cls, api_context, request_map, user_id, monetary_account_id, request_inquiry_id, custom_headers=None): """ - :rtype: str + Create a chat for a specific request inquiry. + + :type api_context: context.ApiContext + :type request_map: dict[str, object] + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._country + if custom_headers is None: + custom_headers = {} - @property - def region(self): - """ - :rtype: str - """ + api_client = client.ApiClient(api_context) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, request_inquiry_id) + response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - return self._region + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) - @property - def ubo(self): + @classmethod + def update(cls, api_context, request_map, user_id, monetary_account_id, request_inquiry_id, request_inquiry_chat_id, custom_headers=None): """ - :rtype: list[object_.Ubo] + Update the last read message in the chat of a specific request inquiry. + + :type api_context: context.ApiContext + :type request_map: dict[str, object] + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_id: int + :type request_inquiry_chat_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseRequestInquiryChat """ - return self._ubo + if custom_headers is None: + custom_headers = {} - @property - def status(self): - """ - :rtype: str - """ + api_client = client.ApiClient(api_context) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, request_inquiry_id, request_inquiry_chat_id) + response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - return self._status + return BunqResponseRequestInquiryChat.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE) + ) - @property - def sub_status(self): + @classmethod + def list(cls, api_context, user_id, monetary_account_id, request_inquiry_id, params=None, custom_headers=None): """ - :rtype: str + Get the chat for a specific request inquiry. + + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type request_inquiry_id: int + :type params: dict[str, str]|None + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseRequestInquiryChatList """ - return self._sub_status - - @property - def session_timeout(self): - """ - :rtype: int - """ + if params is None: + params = {} - return self._session_timeout + if custom_headers is None: + custom_headers = {} - @property - def daily_limit_without_confirmation_login(self): - """ - :rtype: object_.Amount - """ + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, request_inquiry_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) - return self._daily_limit_without_confirmation_login + return BunqResponseRequestInquiryChatList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE) + ) @property - def notification_filters(self): + def id_(self): """ - :rtype: list[object_.NotificationFilter] + :rtype: int """ - return self._notification_filters + return self._id_ @property - def customer(self): + def created(self): """ - :rtype: Customer + :rtype: str """ - return self._customer + return self._created @property - def customer_limit(self): + def updated(self): """ - :rtype: CustomerLimit + :rtype: str """ - return self._customer_limit + return self._updated @property - def billing_contract(self): + def unread_message_count(self): """ - :rtype: list[BillingContractSubscription] + :rtype: int """ - return self._billing_contract + return self._unread_message_count -class Customer(core.BunqModel): +class RequestResponseChat(core.BunqModel): """ - Used to view a customer. + Manage the chat connected to a request response. In the same way a request + inquiry and a request response are created together, so that each side of + the interaction can work on a different object, also a request inquiry chat + and a request response chat are created at the same time. See + 'request-inquiry-chat' for the chat endpoint for the inquiring user. :type _id_: int :type _created: str :type _updated: str - :type _billing_account_id: str + :type _unread_message_count: int """ - # Field constants. - FIELD_BILLING_ACCOUNT_ID = "billing_account_id" - # Endpoint constants. - _ENDPOINT_URL_LISTING = "user/{}/customer" - _ENDPOINT_URL_READ = "user/{}/customer/{}" - _ENDPOINT_URL_UPDATE = "user/{}/customer/{}" + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/request-response/{}/chat" + _ENDPOINT_URL_UPDATE = "user/{}/monetary-account/{}/request-response/{}/chat/{}" + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/request-response/{}/chat" + + # Field constants. + FIELD_LAST_READ_MESSAGE_ID = "last_read_message_id" # Object type. - _OBJECT_TYPE = "Customer" + _OBJECT_TYPE = "RequestResponseChat" def __init__(self): self._id_ = None self._created = None self._updated = None - self._billing_account_id = None + self._unread_message_count = None @classmethod - def list(cls, api_context, user_id, params=None, custom_headers=None): + def create(cls, api_context, request_map, user_id, monetary_account_id, request_response_id, custom_headers=None): """ + Create a chat for a specific request response. + :type api_context: context.ApiContext + :type request_map: dict[str, object] :type user_id: int - :type params: dict[str, str]|None + :type monetary_account_id: int + :type request_response_id: int :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(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) - response_raw = api_client.get(endpoint_url, params, custom_headers) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, request_response_id) + response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - return BunqResponseCustomerList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @classmethod - def get(cls, api_context, user_id, customer_id, custom_headers=None): + def update(cls, api_context, request_map, user_id, monetary_account_id, request_response_id, request_response_chat_id, custom_headers=None): """ + Update the last read message in the chat of a specific request response. + :type api_context: context.ApiContext + :type request_map: dict[str, object] :type user_id: int - :type customer_id: int + :type monetary_account_id: int + :type request_response_id: int + :type request_response_chat_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseCustomer + :rtype: BunqResponseRequestResponseChat """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, customer_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, request_response_id, request_response_chat_id) + response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - return BunqResponseCustomer.cast_from_bunq_response( + return BunqResponseRequestResponseChat.cast_from_bunq_response( cls._from_json(response_raw, cls._OBJECT_TYPE) ) @classmethod - def update(cls, api_context, request_map, user_id, customer_id, custom_headers=None): + def list(cls, api_context, user_id, monetary_account_id, request_response_id, params=None, custom_headers=None): """ + Get the chat for a specific request response. + :type api_context: context.ApiContext - :type request_map: dict[str, object] :type user_id: int - :type customer_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: BunqResponseInt + :rtype: BunqResponseRequestResponseChatList """ + if params is None: + params = {} + if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, customer_id) - response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, request_response_id) + response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) + return BunqResponseRequestResponseChatList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) @property @@ -11189,47 +11587,41 @@ def updated(self): return self._updated @property - def billing_account_id(self): + def unread_message_count(self): """ - :rtype: str + :rtype: int """ - return self._billing_account_id + return self._unread_message_count -class CustomerLimit(core.BunqModel): +class ScheduleUser(core.BunqModel): """ - Show the limits for the authenticated user. - - :type _limit_monetary_account: int - :type _limit_card_debit_maestro: int - :type _limit_card_debit_mastercard: int - :type _limit_card_debit_replacement: int + view for reading the scheduled definitions. """ # Endpoint constants. - _ENDPOINT_URL_LISTING = "user/{}/limit" + _ENDPOINT_URL_LISTING = "user/{}/schedule" # Object type. - _OBJECT_TYPE = "CustomerLimit" - - def __init__(self): - self._limit_monetary_account = None - self._limit_card_debit_maestro = None - self._limit_card_debit_mastercard = None - self._limit_card_debit_replacement = None + _OBJECT_TYPE = "ScheduleUser" @classmethod def list(cls, api_context, user_id, 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 api_context: context.ApiContext :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: @@ -11242,84 +11634,162 @@ def list(cls, api_context, user_id, params=None, custom_headers=None): endpoint_url = cls._ENDPOINT_URL_LISTING.format(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) ) - @property - def limit_monetary_account(self): + +class Session(core.BunqModel): + """ + Endpoint for operations over the current session. + """ + + # Endpoint constants. + _ENDPOINT_URL_DELETE = "session/{}" + + # Object type. + _OBJECT_TYPE = "Session" + + @classmethod + def delete(cls, api_context, session_id, custom_headers=None): """ - :rtype: int + Deletes the current session. No response is returned for this request. + + :type api_context: context.ApiContext + :type session_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone """ - return self._limit_monetary_account + if custom_headers is None: + custom_headers = {} - @property - def limit_card_debit_maestro(self): + api_client = client.ApiClient(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) + ) + + +class TabItemShopBatch(core.BunqModel): + """ + Create a batch of tab items. + + :type _tab_items: list[TabItemShop] + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/tab-item-batch" + + # Field constants. + FIELD_TAB_ITEMS = "tab_items" + + # Object type. + _OBJECT_TYPE = "TabItemShopBatch" + + def __init__(self): + self._tab_items = None + + @classmethod + def create(cls, api_context, request_map, user_id, monetary_account_id, cash_register_id, tab_uuid, custom_headers=None): """ - :rtype: int + Create tab items as a batch. + + :type api_context: context.ApiContext + :type request_map: dict[str, object] + :type user_id: int + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseInt """ - return self._limit_card_debit_maestro + if custom_headers is None: + custom_headers = {} - @property - def limit_card_debit_mastercard(self): - """ - :rtype: int - """ + api_client = client.ApiClient(api_context) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, cash_register_id, tab_uuid) + response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - return self._limit_card_debit_mastercard + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) + ) @property - def limit_card_debit_replacement(self): + def tab_items(self): """ - :rtype: int + :rtype: list[TabItemShop] """ - return self._limit_card_debit_replacement + return self._tab_items -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. :type _id_: int - :type _created: str - :type _updated: str - :type _contract_date_start: str - :type _contract_date_end: str - :type _contract_version: int - :type _subscription_type: str + :type _description: str + :type _ean_code: str + :type _avatar_attachment: object_.AttachmentPublic + :type _tab_attachment: list[object_.AttachmentTab] + :type _quantity: float + :type _amount: object_.Amount """ - # Field constants. - FIELD_SUBSCRIPTION_TYPE = "subscription_type" - # 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_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 = "BillingContractSubscription" + _OBJECT_TYPE = "TabItem" def __init__(self): self._id_ = None - self._created = None - self._updated = None - self._contract_date_start = None - self._contract_date_end = None - self._contract_version = None - self._subscription_type = None + self._description = None + self._ean_code = None + self._avatar_attachment = None + self._tab_attachment = None + self._quantity = None + self._amount = None @classmethod - def create(cls, api_context, request_map, user_id, custom_headers=None): + def create(cls, api_context, request_map, user_id, monetary_account_id, cash_register_id, tab_uuid, custom_headers=None): """ + Create a new TabItem for a given Tab. + :type api_context: context.ApiContext :type request_map: dict[str, object] :type user_id: int + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str :type custom_headers: dict[str, str]|None - :rtype: BunqResponseBillingContractSubscription + :rtype: BunqResponseInt """ if custom_headers is None: @@ -11327,252 +11797,125 @@ def create(cls, api_context, request_map, user_id, custom_headers=None): api_client = client.ApiClient(api_context) request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id) + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id, monetary_account_id, cash_register_id, tab_uuid) response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) - return BunqResponseBillingContractSubscription.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) @classmethod - def list(cls, api_context, user_id, params=None, custom_headers=None): + def update(cls, api_context, request_map, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id, custom_headers=None): """ - Get all subscription billing contract for the authenticated user. + Modify a TabItem from a given Tab. :type api_context: context.ApiContext + :type request_map: dict[str, object] :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 :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(api_context) - endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id) - response_raw = api_client.get(endpoint_url, params, custom_headers) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id) + response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) - return BunqResponseBillingContractSubscriptionList.cast_from_bunq_response( - cls._from_json_list(response_raw, cls._OBJECT_TYPE) + return BunqResponseInt.cast_from_bunq_response( + cls._process_for_id(response_raw) ) - @property - 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 + @classmethod + def delete(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id, custom_headers=None): + """ + Delete a specific TabItem from a Tab. This request returns an empty + response. + + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :type tab_item_shop_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseNone """ - return self._subscription_type - - -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. - - :type _id_: int - :type _created: str - :type _updated: str - :type _public_uuid: str - :type _first_name: str - :type _middle_name: str - :type _last_name: str - :type _legal_name: str - :type _display_name: str - :type _public_nick_name: str - :type _alias: list[object_.Pointer] - :type _tax_resident: list[object_.TaxResident] - :type _document_type: str - :type _document_number: str - :type _document_country_of_issuance: str - :type _address_main: object_.Address - :type _address_postal: object_.Address - :type _date_of_birth: str - :type _place_of_birth: str - :type _country_of_birth: str - :type _nationality: str - :type _language: str - :type _region: str - :type _gender: str - :type _avatar: object_.Avatar - :type _version_terms_of_service: str - :type _status: str - :type _sub_status: str - :type _session_timeout: int - :type _daily_limit_without_confirmation_login: object_.Amount - :type _notification_filters: list[object_.NotificationFilter] - """ - - # 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_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_COUNTER_BANK_IBAN = "counter_bank_iban" - FIELD_NOTIFICATION_FILTERS = "notification_filters" - - # Endpoint constants. - _ENDPOINT_URL_READ = "user-person/{}" - _ENDPOINT_URL_UPDATE = "user-person/{}" + if custom_headers is None: + custom_headers = {} - # Object type. - _OBJECT_TYPE = "UserPerson" + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_DELETE.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id) + response_raw = api_client.delete(endpoint_url, custom_headers) - def __init__(self): - self._id_ = None - self._created = None - self._updated = None - self._public_uuid = None - self._first_name = None - self._middle_name = None - self._last_name = None - self._legal_name = None - self._display_name = None - self._public_nick_name = None - self._alias = None - self._tax_resident = None - self._document_type = None - self._document_number = None - self._document_country_of_issuance = None - self._address_main = None - self._address_postal = None - self._date_of_birth = None - self._place_of_birth = None - self._country_of_birth = None - self._nationality = None - self._language = None - self._region = None - self._gender = None - self._avatar = None - self._version_terms_of_service = None - self._status = None - self._sub_status = None - self._session_timeout = None - self._daily_limit_without_confirmation_login = None - self._notification_filters = None + return BunqResponseNone.cast_from_bunq_response( + client.BunqResponse(None, response_raw.headers) + ) @classmethod - def get(cls, api_context, user_person_id, custom_headers=None): + def list(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, params=None, custom_headers=None): """ - Get a specific person. + Get a collection of TabItems from a given Tab. :type api_context: context.ApiContext - :type user_person_id: int + :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: BunqResponseUserPerson + :rtype: BunqResponseTabItemShopList """ + if params is None: + params = {} + if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - endpoint_url = cls._ENDPOINT_URL_READ.format(user_person_id) - response_raw = api_client.get(endpoint_url, {}, custom_headers) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, cash_register_id, tab_uuid) + response_raw = api_client.get(endpoint_url, params, custom_headers) - return BunqResponseUserPerson.cast_from_bunq_response( - cls._from_json(response_raw, cls._OBJECT_TYPE) + return BunqResponseTabItemShopList.cast_from_bunq_response( + cls._from_json_list(response_raw, cls._OBJECT_TYPE) ) @classmethod - def update(cls, api_context, request_map, user_person_id, custom_headers=None): + def get(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id, custom_headers=None): """ - Modify a specific person object's data. + Get a specific TabItem from a given Tab. :type api_context: context.ApiContext - :type request_map: dict[str, object] - :type user_person_id: int + :type user_id: int + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :type tab_item_shop_id: int :type custom_headers: dict[str, str]|None - :rtype: BunqResponseInt + :rtype: BunqResponseTabItemShop """ if custom_headers is None: custom_headers = {} api_client = client.ApiClient(api_context) - request_bytes = converter.class_to_json(request_map).encode() - endpoint_url = cls._ENDPOINT_URL_UPDATE.format(user_person_id) - response_raw = api_client.put(endpoint_url, request_bytes, custom_headers) + endpoint_url = cls._ENDPOINT_URL_READ.format(user_id, monetary_account_id, cash_register_id, tab_uuid, tab_item_shop_id) + response_raw = api_client.get(endpoint_url, {}, custom_headers) - return BunqResponseInt.cast_from_bunq_response( - cls._process_for_id(response_raw) + return BunqResponseTabItemShop.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE) ) @property @@ -11584,244 +11927,342 @@ 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 public_uuid(self): + def avatar_attachment(self): """ - :rtype: str + :rtype: object_.AttachmentPublic """ - return self._public_uuid + return self._avatar_attachment @property - def first_name(self): + def tab_attachment(self): """ - :rtype: str + :rtype: list[object_.AttachmentTab] """ - return self._first_name + return self._tab_attachment @property - def middle_name(self): + def quantity(self): """ - :rtype: str + :rtype: float """ - return self._middle_name + return self._quantity @property - def last_name(self): + def amount(self): """ - :rtype: str + :rtype: object_.Amount """ - return self._last_name + return self._amount - @property - def legal_name(self): - """ - :rtype: str - """ - return self._legal_name +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. + """ - @property - def display_name(self): - """ - :rtype: str - """ + # Endpoint constants. + _ENDPOINT_URL_LISTING = "user/{}/monetary-account/{}/cash-register/{}/tab/{}/qr-code-content" - return self._display_name + # Object type. + _OBJECT_TYPE = "TabQrCodeContent" - @property - def public_nick_name(self): + @classmethod + def list(cls, api_context, user_id, monetary_account_id, cash_register_id, tab_uuid, custom_headers=None): """ - :rtype: str + Returns the raw content of the QR code that links to this Tab. The raw + content is the binary representation of a file, without any JSON + wrapping. + + :type api_context: context.ApiContext + :type user_id: int + :type monetary_account_id: int + :type cash_register_id: int + :type tab_uuid: str + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseBytes """ - return self._public_nick_name + if custom_headers is None: + custom_headers = {} - @property - def alias(self): + api_client = client.ApiClient(api_context) + endpoint_url = cls._ENDPOINT_URL_LISTING.format(user_id, monetary_account_id, cash_register_id, tab_uuid) + response_raw = api_client.get(endpoint_url, {}, custom_headers) + + return BunqResponseBytes.cast_from_bunq_response( + client.BunqResponse(response_raw.body_bytes, response_raw.headers) + ) + + +class TokenQrRequestIdeal(core.BunqModel): + """ + Using this call you create a request for payment from an external token + provided with an ideal transaction. Make sure your iDEAL payments are + compliant with the iDEAL standards, by following the following manual: https://www.bunq.com/files/media/legal/en/20170315_ideal_standards_en.pdf. + It's very important to keep these points in mind when you are using the + endpoint to make iDEAL payments from your application. + + :type _time_responded: str + :type _time_expiry: str + :type _monetary_account_id: int + :type _amount_inquired: object_.Amount + :type _amount_responded: object_.Amount + :type _alias: object_.MonetaryAccountReference + :type _counterparty_alias: object_.MonetaryAccountReference + :type _description: str + :type _attachment: list[object_.Attachment] + :type _status: str + :type _minimum_age: int + :type _require_address: str + :type _address_shipping: object_.Address + :type _address_billing: object_.Address + :type _geolocation: object_.Geolocation + :type _redirect_url: str + :type _type_: str + :type _sub_type: str + :type _allow_chat: bool + :type _eligible_whitelist_id: int + """ + + # Endpoint constants. + _ENDPOINT_URL_CREATE = "user/{}/token-qr-request-ideal" + + # Field constants. + FIELD_TOKEN = "token" + + # Object type. + _OBJECT_TYPE = "TokenQrRequestIdeal" + + def __init__(self): + self._time_responded = None + self._time_expiry = None + self._monetary_account_id = None + self._amount_inquired = None + self._amount_responded = None + self._alias = None + self._counterparty_alias = None + self._description = None + self._attachment = None + self._status = None + self._minimum_age = None + self._require_address = None + self._address_shipping = None + self._address_billing = None + self._geolocation = None + self._redirect_url = None + self._type_ = None + self._sub_type = None + self._allow_chat = None + self._eligible_whitelist_id = None + + @classmethod + def create(cls, api_context, request_map, user_id, custom_headers=None): """ - :rtype: list[object_.Pointer] + Create a request from an ideal transaction. + + :type api_context: context.ApiContext + :type request_map: dict[str, object] + :type user_id: int + :type custom_headers: dict[str, str]|None + + :rtype: BunqResponseTokenQrRequestIdeal """ - return self._alias + if custom_headers is None: + custom_headers = {} + + api_client = client.ApiClient(api_context) + request_bytes = converter.class_to_json(request_map).encode() + endpoint_url = cls._ENDPOINT_URL_CREATE.format(user_id) + response_raw = api_client.post(endpoint_url, request_bytes, custom_headers) + + return BunqResponseTokenQrRequestIdeal.cast_from_bunq_response( + cls._from_json(response_raw, cls._OBJECT_TYPE) + ) @property - def tax_resident(self): + def time_responded(self): """ - :rtype: list[object_.TaxResident] + :rtype: str """ - return self._tax_resident + return self._time_responded @property - def document_type(self): + def time_expiry(self): """ :rtype: str """ - return self._document_type + return self._time_expiry @property - def document_number(self): + def monetary_account_id(self): """ - :rtype: str + :rtype: int """ - return self._document_number + return self._monetary_account_id @property - def document_country_of_issuance(self): + def amount_inquired(self): """ - :rtype: str + :rtype: object_.Amount """ - return self._document_country_of_issuance + return self._amount_inquired @property - def address_main(self): + def amount_responded(self): """ - :rtype: object_.Address + :rtype: object_.Amount """ - return self._address_main + return self._amount_responded @property - def address_postal(self): + def alias(self): """ - :rtype: object_.Address + :rtype: object_.MonetaryAccountReference """ - return self._address_postal + return self._alias @property - def date_of_birth(self): + def counterparty_alias(self): """ - :rtype: str + :rtype: object_.MonetaryAccountReference """ - return self._date_of_birth + return self._counterparty_alias @property - def place_of_birth(self): + def description(self): """ :rtype: str """ - return self._place_of_birth + return self._description @property - def country_of_birth(self): + def attachment(self): """ - :rtype: str + :rtype: list[object_.Attachment] """ - return self._country_of_birth + return self._attachment @property - def nationality(self): + def status(self): """ :rtype: str """ - return self._nationality + return self._status @property - def language(self): + def minimum_age(self): """ - :rtype: str + :rtype: int """ - return self._language + return self._minimum_age @property - def region(self): + def require_address(self): """ :rtype: str """ - return self._region + return self._require_address @property - def gender(self): + def address_shipping(self): """ - :rtype: str + :rtype: object_.Address """ - return self._gender + return self._address_shipping @property - def avatar(self): + def address_billing(self): """ - :rtype: object_.Avatar + :rtype: object_.Address """ - return self._avatar + return self._address_billing @property - def version_terms_of_service(self): + def geolocation(self): """ - :rtype: str + :rtype: object_.Geolocation """ - return self._version_terms_of_service + return self._geolocation @property - def status(self): + def redirect_url(self): """ :rtype: str """ - return self._status + return self._redirect_url @property - def sub_status(self): + def type_(self): """ :rtype: str """ - return self._sub_status + return self._type_ @property - def session_timeout(self): + def sub_type(self): """ - :rtype: int + :rtype: str """ - return self._session_timeout + return self._sub_type @property - def daily_limit_without_confirmation_login(self): + def allow_chat(self): """ - :rtype: object_.Amount + :rtype: bool """ - return self._daily_limit_without_confirmation_login + return self._allow_chat @property - def notification_filters(self): + def eligible_whitelist_id(self): """ - :rtype: list[object_.NotificationFilter] + :rtype: int """ - return self._notification_filters + return self._eligible_whitelist_id class User(core.BunqModel): @@ -11834,6 +12275,9 @@ class User(core.BunqModel): :type _UserCompany: UserCompany """ + # Error constants. + _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' + # Endpoint constants. _ENDPOINT_URL_READ = "user/{}" _ENDPOINT_URL_LISTING = "user" @@ -11918,6 +12362,22 @@ def UserCompany(self): """ return self._UserCompany + def get_referenced_object(self): + """ + :rtype: core.BunqModel + :raise: BunqException + """ + + if self._UserLight is not None: + return self._UserLight + + if self._UserPerson is not None: + return self._UserPerson + + if self._UserCompany is not None: + return self._UserCompany + + raise exception.BunqException(self._ERROR_NULL_FIELDS) class UserLight(core.BunqModel): @@ -11958,6 +12418,9 @@ class UserLight(core.BunqModel): :type _notification_filters: list[object_.NotificationFilter] """ + # Endpoint constants. + _ENDPOINT_URL_READ = "user-light/{}" + # Field constants. FIELD_FIRST_NAME = "first_name" FIELD_MIDDLE_NAME = "middle_name" @@ -11988,9 +12451,6 @@ class UserLight(core.BunqModel): FIELD_DAILY_LIMIT_WITHOUT_CONFIRMATION_LOGIN = "daily_limit_without_confirmation_login" FIELD_NOTIFICATION_FILTERS = "notification_filters" - # Endpoint constants. - _ENDPOINT_URL_READ = "user-light/{}" - # Object type. _OBJECT_TYPE = "UserPerson" @@ -12587,6 +13047,16 @@ def value(self): return super().value +class BunqResponseSchedulePaymentBatch(client.BunqResponse): + @property + def value(self): + """ + :rtype: SchedulePaymentBatch + """ + + return super().value + + class BunqResponseNone(client.BunqResponse): @property def value(self): @@ -12597,6 +13067,26 @@ def value(self): return super().value +class BunqResponseSchedule(client.BunqResponse): + @property + def value(self): + """ + :rtype: Schedule + """ + + return super().value + + +class BunqResponseScheduleList(client.BunqResponse): + @property + def value(self): + """ + :rtype: list[Schedule] + """ + + return super().value + + class BunqResponseSchedulePayment(client.BunqResponse): @property def value(self): @@ -13097,251 +13587,251 @@ def value(self): return super().value -class BunqResponsePaymentChat(client.BunqResponse): +class BunqResponseMasterCardAction(client.BunqResponse): @property def value(self): """ - :rtype: PaymentChat + :rtype: MasterCardAction """ return super().value -class BunqResponsePaymentChatList(client.BunqResponse): +class BunqResponseMasterCardActionList(client.BunqResponse): @property def value(self): """ - :rtype: list[PaymentChat] + :rtype: list[MasterCardAction] """ return super().value -class BunqResponsePermittedIp(client.BunqResponse): +class BunqResponseTabResultInquiry(client.BunqResponse): @property def value(self): """ - :rtype: PermittedIp + :rtype: TabResultInquiry """ return super().value -class BunqResponsePermittedIpList(client.BunqResponse): +class BunqResponseTabResultInquiryList(client.BunqResponse): @property def value(self): """ - :rtype: list[PermittedIp] + :rtype: list[TabResultInquiry] """ return super().value -class BunqResponseRequestInquiryChat(client.BunqResponse): +class BunqResponseTabResultResponse(client.BunqResponse): @property def value(self): """ - :rtype: RequestInquiryChat + :rtype: TabResultResponse """ return super().value -class BunqResponseRequestInquiryChatList(client.BunqResponse): +class BunqResponseTabResultResponseList(client.BunqResponse): @property def value(self): """ - :rtype: list[RequestInquiryChat] + :rtype: list[TabResultResponse] """ return super().value -class BunqResponseRequestResponseChat(client.BunqResponse): +class BunqResponseUserPerson(client.BunqResponse): @property def value(self): """ - :rtype: RequestResponseChat + :rtype: UserPerson """ return super().value -class BunqResponseRequestResponseChatList(client.BunqResponse): +class BunqResponseUserCompany(client.BunqResponse): @property def value(self): """ - :rtype: list[RequestResponseChat] + :rtype: UserCompany """ return super().value -class BunqResponseSchedule(client.BunqResponse): +class BunqResponseCustomerList(client.BunqResponse): @property def value(self): """ - :rtype: Schedule + :rtype: list[Customer] """ return super().value -class BunqResponseScheduleList(client.BunqResponse): +class BunqResponseCustomer(client.BunqResponse): @property def value(self): """ - :rtype: list[Schedule] + :rtype: Customer """ return super().value -class BunqResponseScheduleUserList(client.BunqResponse): +class BunqResponseCustomerLimitList(client.BunqResponse): @property def value(self): """ - :rtype: list[ScheduleUser] + :rtype: list[CustomerLimit] """ return super().value -class BunqResponseTabItemShopList(client.BunqResponse): +class BunqResponseBillingContractSubscription(client.BunqResponse): @property def value(self): """ - :rtype: list[TabItemShop] + :rtype: BillingContractSubscription """ return super().value -class BunqResponseTabItemShop(client.BunqResponse): +class BunqResponseBillingContractSubscriptionList(client.BunqResponse): @property def value(self): """ - :rtype: TabItemShop + :rtype: list[BillingContractSubscription] """ return super().value -class BunqResponseTabResultInquiry(client.BunqResponse): +class BunqResponsePaymentChat(client.BunqResponse): @property def value(self): """ - :rtype: TabResultInquiry + :rtype: PaymentChat """ return super().value -class BunqResponseTabResultInquiryList(client.BunqResponse): +class BunqResponsePaymentChatList(client.BunqResponse): @property def value(self): """ - :rtype: list[TabResultInquiry] + :rtype: list[PaymentChat] """ return super().value -class BunqResponseTabResultResponse(client.BunqResponse): +class BunqResponsePermittedIp(client.BunqResponse): @property def value(self): """ - :rtype: TabResultResponse + :rtype: PermittedIp """ return super().value -class BunqResponseTabResultResponseList(client.BunqResponse): +class BunqResponsePermittedIpList(client.BunqResponse): @property def value(self): """ - :rtype: list[TabResultResponse] + :rtype: list[PermittedIp] """ return super().value -class BunqResponseTokenQrRequestIdeal(client.BunqResponse): +class BunqResponseRequestInquiryChat(client.BunqResponse): @property def value(self): """ - :rtype: TokenQrRequestIdeal + :rtype: RequestInquiryChat """ return super().value -class BunqResponseUserCompany(client.BunqResponse): +class BunqResponseRequestInquiryChatList(client.BunqResponse): @property def value(self): """ - :rtype: UserCompany + :rtype: list[RequestInquiryChat] """ return super().value -class BunqResponseCustomerList(client.BunqResponse): +class BunqResponseRequestResponseChat(client.BunqResponse): @property def value(self): """ - :rtype: list[Customer] + :rtype: RequestResponseChat """ return super().value -class BunqResponseCustomer(client.BunqResponse): +class BunqResponseRequestResponseChatList(client.BunqResponse): @property def value(self): """ - :rtype: Customer + :rtype: list[RequestResponseChat] """ return super().value -class BunqResponseCustomerLimitList(client.BunqResponse): +class BunqResponseScheduleUserList(client.BunqResponse): @property def value(self): """ - :rtype: list[CustomerLimit] + :rtype: list[ScheduleUser] """ return super().value -class BunqResponseBillingContractSubscription(client.BunqResponse): +class BunqResponseTabItemShopList(client.BunqResponse): @property def value(self): """ - :rtype: BillingContractSubscription + :rtype: list[TabItemShop] """ return super().value -class BunqResponseBillingContractSubscriptionList(client.BunqResponse): +class BunqResponseTabItemShop(client.BunqResponse): @property def value(self): """ - :rtype: list[BillingContractSubscription] + :rtype: TabItemShop """ return super().value -class BunqResponseUserPerson(client.BunqResponse): +class BunqResponseTokenQrRequestIdeal(client.BunqResponse): @property def value(self): """ - :rtype: UserPerson + :rtype: TokenQrRequestIdeal """ return super().value diff --git a/bunq/sdk/model/generated/object_.py b/bunq/sdk/model/generated/object_.py index 2aa6e79..1566cdc 100644 --- a/bunq/sdk/model/generated/object_.py +++ b/bunq/sdk/model/generated/object_.py @@ -1,5 +1,6 @@ # -*- coding: utf-8 -*- from bunq.sdk.model import core +from bunq.sdk import exception from bunq.sdk.model.generated import endpoint @@ -205,6 +206,10 @@ class ChatMessageContent(core.BunqModel): :type ChatMessageContentText: ChatMessageContentText """ + # Error constants. + _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' + + def __init__(self): self.ChatMessageContentAnchorEvent = None self.ChatMessageContentAttachment = None @@ -214,6 +219,35 @@ def __init__(self): self.ChatMessageContentStatusMembership = None self.ChatMessageContentText = None + def get_referenced_object(self): + """ + :rtype: core.BunqModel + :raise: BunqException + """ + + if self.ChatMessageContentAnchorEvent is not None: + return self.ChatMessageContentAnchorEvent + + if self.ChatMessageContentAttachment is not None: + return self.ChatMessageContentAttachment + + if self.ChatMessageContentGeolocation is not None: + return self.ChatMessageContentGeolocation + + if self.ChatMessageContentStatusConversationTitle is not None: + return self.ChatMessageContentStatusConversationTitle + + if self.ChatMessageContentStatusConversation is not None: + return self.ChatMessageContentStatusConversation + + if self.ChatMessageContentStatusMembership is not None: + return self.ChatMessageContentStatusMembership + + if self.ChatMessageContentText is not None: + return self.ChatMessageContentText + + raise exception.BunqException(self._ERROR_NULL_FIELDS) + class ChatMessageContentAnchorEvent(core.BunqModel): """ @@ -246,6 +280,10 @@ class AnchoredObject(core.BunqModel): :type UserCredentialPasswordIp: endpoint.UserCredentialPasswordIp """ + # Error constants. + _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' + + def __init__(self): self.CardDebit = None self.CardPinChange = None @@ -266,6 +304,68 @@ def __init__(self): self.ShareInviteBankResponse = None self.UserCredentialPasswordIp = None + def get_referenced_object(self): + """ + :rtype: core.BunqModel + :raise: BunqException + """ + + if self.CardDebit is not None: + return self.CardDebit + + if self.CardPinChange is not None: + return self.CardPinChange + + if self.CardResult is not None: + return self.CardResult + + if self.DraftPayment is not None: + return self.DraftPayment + + if self.IdealMerchantTransaction is not None: + return self.IdealMerchantTransaction + + if self.Invoice is not None: + return self.Invoice + + if self.Payment is not None: + return self.Payment + + if self.PaymentBatch is not None: + return self.PaymentBatch + + if self.PromotionDisplay is not None: + return self.PromotionDisplay + + if self.RequestInquiryBatch is not None: + return self.RequestInquiryBatch + + if self.RequestInquiry is not None: + return self.RequestInquiry + + if self.RequestResponse is not None: + return self.RequestResponse + + if self.ScheduledPaymentBatch is not None: + return self.ScheduledPaymentBatch + + if self.ScheduledPayment is not None: + return self.ScheduledPayment + + if self.ScheduledInstance is not None: + return self.ScheduledInstance + + if self.ShareInviteBankInquiry is not None: + return self.ShareInviteBankInquiry + + if self.ShareInviteBankResponse is not None: + return self.ShareInviteBankResponse + + if self.UserCredentialPasswordIp is not None: + return self.UserCredentialPasswordIp + + raise exception.BunqException(self._ERROR_NULL_FIELDS) + class CardLimit(core.BunqModel): """ @@ -404,10 +504,28 @@ class DraftPaymentAnchorObject(core.BunqModel): :type PaymentBatch: endpoint.PaymentBatch """ + # Error constants. + _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' + + def __init__(self): self.Payment = None self.PaymentBatch = None + def get_referenced_object(self): + """ + :rtype: core.BunqModel + :raise: BunqException + """ + + if self.Payment is not None: + return self.Payment + + if self.PaymentBatch is not None: + return self.PaymentBatch + + raise exception.BunqException(self._ERROR_NULL_FIELDS) + class Geolocation(core.BunqModel): """ @@ -475,29 +593,33 @@ def __init__(self, amount, counterparty_alias, description): self.alias = None -class Schedule(core.BunqModel): +class ScheduleAnchorObject(core.BunqModel): """ - :type time_start: str - :type time_end: str - :type recurrence_unit: str - :type recurrence_size: int - :type status: str - :type object_: core.BunqModel + :type Payment: endpoint.Payment + :type PaymentBatch: endpoint.PaymentBatch """ - def __init__(self, time_start, recurrence_unit, recurrence_size): + # Error constants. + _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' + + + def __init__(self): + self.Payment = None + self.PaymentBatch = None + + def get_referenced_object(self): """ - :type time_start: str - :type recurrence_unit: str - :type recurrence_size: int + :rtype: core.BunqModel + :raise: BunqException """ - self.time_start = time_start - self.recurrence_unit = recurrence_unit - self.recurrence_size = recurrence_size - self.time_end = None - self.status = None - self.object_ = None + if self.Payment is not None: + return self.Payment + + if self.PaymentBatch is not None: + return self.PaymentBatch + + raise exception.BunqException(self._ERROR_NULL_FIELDS) class Error(core.BunqModel): @@ -511,6 +633,35 @@ def __init__(self): self.error_description_translated = None +class ScheduleInstanceAnchorObject(core.BunqModel): + """ + :type Payment: endpoint.Payment + :type PaymentBatch: endpoint.PaymentBatch + """ + + # Error constants. + _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' + + + def __init__(self): + self.Payment = None + self.PaymentBatch = None + + def get_referenced_object(self): + """ + :rtype: core.BunqModel + :raise: BunqException + """ + + if self.Payment is not None: + return self.Payment + + if self.PaymentBatch is not None: + return self.PaymentBatch + + raise exception.BunqException(self._ERROR_NULL_FIELDS) + + class ShareDetail(core.BunqModel): """ :type payment: ShareDetailPayment @@ -872,17 +1023,158 @@ def __init__(self): self.restriction_chat = None -class Ubo(core.BunqModel): +class NotificationUrl(core.BunqModel): """ - :type name: str - :type date_of_birth: str - :type nationality: str + :type target_url: str + :type category: str + :type event_type: str + :type object_: NotificationAnchorObject """ def __init__(self): - self.name = None - self.date_of_birth = None - self.nationality = None + self.target_url = None + self.category = None + self.event_type = None + self.object_ = None + + +class NotificationAnchorObject(core.BunqModel): + """ + :type BunqMeTab: endpoint.BunqMeTab + :type BunqMeTabResultInquiry: endpoint.BunqMeTabResultInquiry + :type BunqMeTabResultResponse: endpoint.BunqMeTabResultResponse + :type ChatMessageStatus: endpoint.ChatMessageStatus + :type ChatMessageUser: endpoint.ChatMessageUser + :type ChatMessageAnnouncement: endpoint.ChatMessageAnnouncement + :type DraftPayment: endpoint.DraftPayment + :type IdealMerchantTransaction: endpoint.IdealMerchantTransaction + :type Invoice: endpoint.Invoice + :type MasterCardAction: endpoint.MasterCardAction + :type MonetaryAccountBank: endpoint.MonetaryAccountBank + :type Payment: endpoint.Payment + :type PaymentBatch: endpoint.PaymentBatch + :type RequestInquiry: endpoint.RequestInquiry + :type RequestInquiryBatch: endpoint.RequestInquiryBatch + :type RequestResponse: endpoint.RequestResponse + :type ShareInviteBankInquiry: endpoint.ShareInviteBankInquiry + :type ShareInviteBankResponse: endpoint.ShareInviteBankResponse + :type ScheduledPayment: endpoint.SchedulePayment + :type ScheduledInstance: endpoint.ScheduleInstance + :type TabResultInquiry: endpoint.TabResultInquiry + :type TabResultResponse: endpoint.TabResultResponse + :type UserPerson: endpoint.UserPerson + :type UserCompany: endpoint.UserCompany + """ + + # Error constants. + _ERROR_NULL_FIELDS = 'All fields of an extended model or object are null.' + + + def __init__(self): + self.BunqMeTab = None + self.BunqMeTabResultInquiry = None + self.BunqMeTabResultResponse = None + self.ChatMessageStatus = None + self.ChatMessageUser = None + self.ChatMessageAnnouncement = None + self.DraftPayment = None + self.IdealMerchantTransaction = None + self.Invoice = None + self.MasterCardAction = None + self.MonetaryAccountBank = None + self.Payment = None + self.PaymentBatch = None + self.RequestInquiry = None + self.RequestInquiryBatch = None + self.RequestResponse = None + self.ShareInviteBankInquiry = None + self.ShareInviteBankResponse = None + self.ScheduledPayment = None + self.ScheduledInstance = None + self.TabResultInquiry = None + self.TabResultResponse = None + self.UserPerson = None + self.UserCompany = None + + def get_referenced_object(self): + """ + :rtype: core.BunqModel + :raise: BunqException + """ + + if self.BunqMeTab is not None: + return self.BunqMeTab + + if self.BunqMeTabResultInquiry is not None: + return self.BunqMeTabResultInquiry + + if self.BunqMeTabResultResponse is not None: + return self.BunqMeTabResultResponse + + if self.ChatMessageStatus is not None: + return self.ChatMessageStatus + + if self.ChatMessageUser is not None: + return self.ChatMessageUser + + if self.ChatMessageAnnouncement is not None: + return self.ChatMessageAnnouncement + + if self.DraftPayment is not None: + return self.DraftPayment + + if self.IdealMerchantTransaction is not None: + return self.IdealMerchantTransaction + + if self.Invoice is not None: + return self.Invoice + + if self.MasterCardAction is not None: + return self.MasterCardAction + + if self.MonetaryAccountBank is not None: + return self.MonetaryAccountBank + + if self.Payment is not None: + return self.Payment + + if self.PaymentBatch is not None: + return self.PaymentBatch + + if self.RequestInquiry is not None: + return self.RequestInquiry + + if self.RequestInquiryBatch is not None: + return self.RequestInquiryBatch + + if self.RequestResponse is not None: + return self.RequestResponse + + if self.ShareInviteBankInquiry is not None: + return self.ShareInviteBankInquiry + + if self.ShareInviteBankResponse is not None: + return self.ShareInviteBankResponse + + if self.ScheduledPayment is not None: + return self.ScheduledPayment + + if self.ScheduledInstance is not None: + return self.ScheduledInstance + + if self.TabResultInquiry is not None: + return self.TabResultInquiry + + if self.TabResultResponse is not None: + return self.TabResultResponse + + if self.UserPerson is not None: + return self.UserPerson + + if self.UserCompany is not None: + return self.UserCompany + + raise exception.BunqException(self._ERROR_NULL_FIELDS) class TaxResident(core.BunqModel): @@ -901,6 +1193,19 @@ def __init__(self, country, tax_number): self.tax_number = tax_number +class Ubo(core.BunqModel): + """ + :type name: str + :type date_of_birth: str + :type nationality: str + """ + + def __init__(self): + self.name = None + self.date_of_birth = None + self.nationality = None + + class MonetaryAccountReference(core.BunqModel): """ :type pointer: Pointer diff --git a/setup.py b/setup.py index 94a1778..5bfbbfb 100644 --- a/setup.py +++ b/setup.py @@ -24,7 +24,7 @@ # Versions should comply with PEP440. For a discussion on single-sourcing # the version across setup.py and the project code, see # https://packaging.python.org/en/latest/single_source_version.html - version='0.12.2', + version='0.12.3', description='bunq Python SDK', long_description=long_description, diff --git a/tests/assets/NotficationUrlJsons/BunqMeTab.json b/tests/assets/NotficationUrlJsons/BunqMeTab.json new file mode 100644 index 0000000..6b3fc92 --- /dev/null +++ b/tests/assets/NotficationUrlJsons/BunqMeTab.json @@ -0,0 +1,77 @@ +{ + "NotificationUrl": { + "target_url": "nope", + "category": "BUNQME_TAB", + "event_type": "BUNQME_TAB_CREATED", + "object": { + "BunqMeTab": { + "id": 8, + "created": "2017-11-09 11:05:42.364451", + "updated": "2017-11-09 11:05:42.364451", + "time_expiry": "2017-12-09 11:05:42.361442", + "monetary_account_id": 32, + "status": "WAITING_FOR_PAYMENT", + "bunqme_tab_share_url": "https:\/\/bunq.me\/t\/4da1167c-01bc-4a91-a1e1-44a83e4fef2e", + "bunqme_tab_entry": { + "uuid": "4da1167c-01bc-4a91-a1e1-44a83e4fef2e", + "created": "2017-11-09 11:05:42.450462", + "updated": "2017-11-09 11:05:42.450462", + "amount_inquired": { + "currency": "EUR", + "value": "5.00" + }, + "status": "WAITING_FOR_PAYMENT", + "description": "Thank you for building this awesome feature!", + "alias": { + "iban": "NL18BUNQ2025104340", + "is_light": false, + "display_name": "B.O. Varb", + "avatar": { + "uuid": "b0005448-e385-4d6c-baef-244c295b524f", + "image": [ + { + "attachment_public_uuid": "0c872c0e-1c98-4eea-ba75-a36c6d0a40c7", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "353f4064-96bd-49d7-ac69-f87513726c80", + "display_name": "B.O. Varb", + "country": "NL", + "avatar": { + "uuid": "ec2dc709-c8dd-4868-b3e7-601338d88881", + "image": [ + { + "attachment_public_uuid": "7444998c-ff1d-4708-afe3-7b56e33c6f89", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "353f4064-96bd-49d7-ac69-f87513726c80" + }, + "public_nick_name": "Bravo O (nickname)" + }, + "country": "NL" + }, + "redirect_url": null, + "merchant_available": [ + { + "merchant_type": "IDEAL", + "available": true + }, + { + "merchant_type": "SOFORT", + "available": true + } + ] + }, + "result_inquiries": [] + } + } + } +} diff --git a/tests/assets/NotficationUrlJsons/ChatMessageAnnouncement.json b/tests/assets/NotficationUrlJsons/ChatMessageAnnouncement.json new file mode 100644 index 0000000..58ae5aa --- /dev/null +++ b/tests/assets/NotficationUrlJsons/ChatMessageAnnouncement.json @@ -0,0 +1,21 @@ +{ + "NotificationUrl": { + "target_url": "nope", + "category": "BUNQME_TAB", + "event_type": "BUNQME_TAB_CREATED", + "object": { + "ChatMessageAnnouncement": { + "id": 30, + "created": "2017-09-05 12:00:00.912674", + "updated": "2017-09-05 12:00:00.912674", + "conversation_id": 3, + "content": { + "ChatMessageContentText": { + "text": "Hey! You have failed to pay more than five direct debits over the past 30 days. Although such things can happen, please keep in mind that we might be forced to take measures if we get a lot of complaints about it. To help prevent this we summarised some information which might prove useful.\n\nRead more here. https:\/\/www.bunq.com\/en\/direct-debits\/\n\nPlease let us know if you have any further questions, we would love to help you out!" + } + }, + "client_message_uuid": null + } + } + } +} diff --git a/tests/assets/NotficationUrlJsons/DraftPayment.json b/tests/assets/NotficationUrlJsons/DraftPayment.json new file mode 100644 index 0000000..8e73937 --- /dev/null +++ b/tests/assets/NotficationUrlJsons/DraftPayment.json @@ -0,0 +1,203 @@ +{ + "NotificationUrl": { + "target_url": "nope", + "category": "DRAFT_PAYMENT", + "event_type": "DRAFT_PAYMENT_ACCEPTED", + "object": { + "DraftPayment": { + "id": 1, + "created": "2017-07-13 21:44:31.314437", + "updated": "2017-07-13 21:44:31.314437", + "monetary_account_id": 42, + "status": "PENDING", + "type": "BUNQ", + "user_alias_created": { + "uuid": "fbff5c27-e5c1-44c6-be6f-ddd2c6615bf5", + "display_name": "G. Mason", + "country": "NL", + "avatar": { + "uuid": "4605580d-014c-42f1-a4d4-7b398f3b37e5", + "image": [ + { + "attachment_public_uuid": "d6b930f4-1fd0-4b29-8455-e900ed0aced5", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "fbff5c27-e5c1-44c6-be6f-ddd2c6615bf5" + }, + "public_nick_name": "Griffin (nickname)" + }, + "responses": null, + "entries": [ + { + "amount": { + "currency": "EUR", + "value": "46.26" + }, + "alias": { + "iban": "NL16BUNQ2025103794", + "is_light": false, + "display_name": "G. Mason", + "avatar": { + "uuid": "e3bc865a-83a8-4788-af62-4f0c38df8f0d", + "image": [ + { + "attachment_public_uuid": "62c88a57-3cd9-49f7-81dc-8f1a4fcc80ac", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "fbff5c27-e5c1-44c6-be6f-ddd2c6615bf5", + "display_name": "G. Mason", + "country": "NL", + "avatar": { + "uuid": "4605580d-014c-42f1-a4d4-7b398f3b37e5", + "image": [ + { + "attachment_public_uuid": "d6b930f4-1fd0-4b29-8455-e900ed0aced5", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "fbff5c27-e5c1-44c6-be6f-ddd2c6615bf5" + }, + "public_nick_name": "Griffin (nickname)" + }, + "country": "NL" + }, + "counterparty_alias": { + "iban": "NL49BUNQ2025104073", + "is_light": false, + "display_name": "Echo (nickname)", + "avatar": { + "uuid": "11ec9a66-3c18-4711-8586-36f32e262830", + "image": [ + { + "attachment_public_uuid": "63eb3676-058a-45f0-b81d-8b26ee2e4f21", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "688e4bdc-ec27-4d8e-942b-3aee7b5d15e9", + "display_name": "Echo (nickname)", + "country": "NL", + "avatar": { + "uuid": "3da21898-1535-43c9-9023-83333e776b8b", + "image": [ + { + "attachment_public_uuid": "6bb2b5d6-faee-4d5d-8284-af026bde3640", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "688e4bdc-ec27-4d8e-942b-3aee7b5d15e9" + }, + "public_nick_name": "Echo (nickname)" + }, + "country": "NL" + }, + "description": "Test payment to NL49BUNQ2025104073", + "type": "BUNQ", + "attachment": [], + "merchant_reference": null + }, + { + "amount": { + "currency": "EUR", + "value": "2.56" + }, + "alias": { + "iban": "NL16BUNQ2025103794", + "is_light": false, + "display_name": "G. Mason", + "avatar": { + "uuid": "e3bc865a-83a8-4788-af62-4f0c38df8f0d", + "image": [ + { + "attachment_public_uuid": "62c88a57-3cd9-49f7-81dc-8f1a4fcc80ac", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "fbff5c27-e5c1-44c6-be6f-ddd2c6615bf5", + "display_name": "G. Mason", + "country": "NL", + "avatar": { + "uuid": "4605580d-014c-42f1-a4d4-7b398f3b37e5", + "image": [ + { + "attachment_public_uuid": "d6b930f4-1fd0-4b29-8455-e900ed0aced5", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "fbff5c27-e5c1-44c6-be6f-ddd2c6615bf5" + }, + "public_nick_name": "Griffin (nickname)" + }, + "country": "NL" + }, + "counterparty_alias": { + "iban": "NL32BUNQ2025103506", + "is_light": false, + "display_name": "Niels (nickname)", + "avatar": { + "uuid": "e47f5214-2198-4605-886c-9950714476f3", + "image": [ + { + "attachment_public_uuid": "3c7d4d11-d203-4ed4-b471-5b5e24079bf6", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "398e4411-6d98-40b9-bb48-9b33a4cb82da", + "display_name": "Niels (nickname)", + "country": "NL", + "avatar": { + "uuid": "ad92c001-a4ec-4344-89ad-bf6a6b0e5628", + "image": [ + { + "attachment_public_uuid": "2b7bc30e-d6af-4440-90ba-a801cba3d8d7", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "398e4411-6d98-40b9-bb48-9b33a4cb82da" + }, + "public_nick_name": "Niels (nickname)" + }, + "country": "NL" + }, + "description": "Test payment to NL32BUNQ2025103506", + "type": "BUNQ", + "attachment": [], + "merchant_reference": null + } + ], + "object": null + } + } + } +} diff --git a/tests/assets/NotficationUrlJsons/MasterCardAction.json b/tests/assets/NotficationUrlJsons/MasterCardAction.json new file mode 100644 index 0000000..c39513d --- /dev/null +++ b/tests/assets/NotficationUrlJsons/MasterCardAction.json @@ -0,0 +1,137 @@ +{ + "NotificationUrl": { + "target_url": "nope", + "category": "DRAFT_PAYMENT", + "event_type": "DRAFT_PAYMENT_ACCEPTED", + "object": { + "MasterCardAction": { + "id": 1, + "created": "2017-07-10 06:33:10.497530", + "updated": "2017-07-10 06:33:10.676651", + "monetary_account_id": 31, + "card_id": 2, + "amount_local": { + "currency": "EUR", + "value": "2.00" + }, + "amount_billing": { + "currency": "EUR", + "value": "2.00" + }, + "amount_original_local": { + "currency": "EUR", + "value": "2.00" + }, + "amount_original_billing": { + "currency": "EUR", + "value": "2.00" + }, + "amount_fee": { + "currency": "EUR", + "value": "0.00" + }, + "decision": "COUNTRY_NOT_PERMITTED", + "decision_description": "Card transaction was denied, because the country was not permitted in card settings.", + "decision_description_translated": "Card transaction was denied, because the country was not permitted in card settings.", + "description": "Spar city Sloterdijk Amsterdam, NL", + "authorisation_status": "BLOCKED", + "authorisation_type": "NORMAL_AUTHORISATION", + "city": "Amsterdam", + "alias": { + "iban": "NL88BUNQ2025103565", + "is_light": false, + "display_name": "B.O. Varb", + "avatar": { + "uuid": "0c245e21-e3bc-4bab-8880-7ca6d09691b5", + "image": [ + { + "attachment_public_uuid": "1441cea4-3f24-43d4-9f35-2dfd8ff7bc8c", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "353f4064-96bd-49d7-ac69-f87513726c80", + "display_name": "B.O. Varb", + "country": "NL", + "avatar": { + "uuid": "ec2dc709-c8dd-4868-b3e7-601338d88881", + "image": [ + { + "attachment_public_uuid": "7444998c-ff1d-4708-afe3-7b56e33c6f89", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "353f4064-96bd-49d7-ac69-f87513726c80" + }, + "public_nick_name": "Bravo O (nickname)" + }, + "country": "NL" + }, + "counterparty_alias": { + "iban": null, + "is_light": null, + "display_name": "Spar city Sloterdijk", + "avatar": { + "uuid": "ed91da5e-6100-42ab-a5b1-bcbeab62cb96", + "image": [ + { + "attachment_public_uuid": "58b3df6c-bfa4-4a42-91b3-db0e7f2ac64e", + "height": 640, + "width": 640, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": null, + "display_name": "Spar city Sloterdijk", + "country": "NL", + "avatar": null, + "public_nick_name": "Spar city Sloterdijk" + }, + "country": "NL", + "merchant_category_code": "5411" + }, + "label_card": { + "uuid": "c3b99cac-3677-4311-841c-4a7bba7397f2", + "type": "MAESTRO", + "second_line": "Pets", + "expiry_date": "2021-07-31", + "status": "ACTIVE", + "label_user": { + "uuid": "353f4064-96bd-49d7-ac69-f87513726c80", + "display_name": "B.O. Varb", + "country": "NL", + "avatar": { + "uuid": "ec2dc709-c8dd-4868-b3e7-601338d88881", + "image": [ + { + "attachment_public_uuid": "7444998c-ff1d-4708-afe3-7b56e33c6f89", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "353f4064-96bd-49d7-ac69-f87513726c80" + }, + "public_nick_name": "Bravo O (nickname)" + } + }, + "token_status": null, + "reservation_expiry_time": null, + "applied_limit": null, + "conversation": null, + "allow_chat": true, + "pan_entry_mode_user": "ICC", + "eligible_whitelist_id": null + } + } + } +} diff --git a/tests/assets/NotficationUrlJsons/MonetaryAccountBank.json b/tests/assets/NotficationUrlJsons/MonetaryAccountBank.json new file mode 100644 index 0000000..84e603c --- /dev/null +++ b/tests/assets/NotficationUrlJsons/MonetaryAccountBank.json @@ -0,0 +1,57 @@ +{ + "NotificationUrl": { + "target_url": "nope", + "category": "DRAFT_PAYMENT", + "event_type": "DRAFT_PAYMENT_ACCEPTED", + "object": { + "MonetaryAccountBank": { + "id": 21, + "created": "2017-07-08 00:42:33.951277", + "updated": "2017-07-08 00:42:33.951277", + "alias": [ + { + "type": "IBAN", + "value": "NL18BUNQ2025104049", + "name": "bunq" + } + ], + "avatar": { + "uuid": "246519c2-1280-4fd8-a864-ed9d313ceeba", + "image": [ + { + "attachment_public_uuid": "52613480-7bd1-4da4-be8a-4a15f78c085d", + "height": 126, + "width": 200, + "content_type|": "image\/jpeg" + } + ], + "anchor_uuid": "45631547-6bdb-479e-859b-192273964ed4" + }, + "balance": null, + "country": "NL", + "currency": "EUR", + "daily_limit": { + "currency": "EUR", + "value": "10000.00" + }, + "daily_spent": { + "currency": "EUR", + "value": "0.00" + }, + "description": "sofort", + "public_uuid": "45631547-6bdb-479e-859b-192273964ed4", + "status": "ACTIVE", + "sub_status": "NONE", + "timezone": "europe\/amsterdam", + "user_id": 214, + "monetary_account_profile": null, + "notification_filters": [], + "setting": null, + "overdraft_limit": { + "currency": "EUR", + "value": "0.00" + } + } + } + } +} diff --git a/tests/assets/NotficationUrlJsons/Mutation.json b/tests/assets/NotficationUrlJsons/Mutation.json new file mode 100644 index 0000000..7a1e333 --- /dev/null +++ b/tests/assets/NotficationUrlJsons/Mutation.json @@ -0,0 +1,86 @@ +{ + "NotificationUrl": { + "target_url": "nope", + "category": "MUTATION", + "event_type": "MUTATION_CREATED", + "object": { + "Payment": { + "id": 108864, + "created": "2017-11-08 11:20:03.950184", + "updated": "2017-11-08 11:20:03.950184", + "monetary_account_id": 213, + "amount": { + "currency": "EUR", + "value": "-24.95" + }, + "description": "73d6df4a 680498 Your order #1234567", + "type": "IDEAL", + "merchant_reference": null, + "maturity_date": "2017-11-08", + "alias": { + "iban": "NL86BUNQ2025105541", + "is_light": false, + "display_name": "D. Howard", + "avatar": { + "uuid": "cd028f6d-52f3-4b55-be76-56223b7adeec", + "image": [ + { + "attachment_public_uuid": "54b3fbaa-a427-4115-a04d-08372f706a42", + "height": 1023, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "0f4540c4-e81d-4aca-ad12-144fb73635a1", + "display_name": "D. Howard", + "country": "NL", + "avatar": { + "uuid": "514aaa28-c2da-42ce-aa76-7b6fd6f528cc", + "image": [ + { + "attachment_public_uuid": "14847000-40da-4f63-9137-817683acd980", + "height": 456, + "width": 456, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "0f4540c4-e81d-4aca-ad12-144fb73635a1" + }, + "public_nick_name": "Dominic (nick) premium \u2728" + }, + "country": "NL" + }, + "counterparty_alias": { + "iban": null, + "is_light": null, + "display_name": "BoekenGigant", + "label_user": { + "uuid": null, + "display_name": "BoekenGigant", + "country": "NL", + "avatar": null, + "public_nick_name": "BoekenGigant" + }, + "avatar": null, + "country": "NL" + }, + "attachment": [], + "geolocation": { + "latitude": 52.387862883215, + "longitude": 4.8333778222355, + "altitude": 0, + "radius": 65 + }, + "batch_id": null, + "conversation": null, + "allow_chat": true, + "scheduled_id": null, + "address_billing": null, + "address_shipping": null + } + } + } +} diff --git a/tests/assets/NotficationUrlJsons/PaymentBatch.json b/tests/assets/NotficationUrlJsons/PaymentBatch.json new file mode 100644 index 0000000..f0ffd9a --- /dev/null +++ b/tests/assets/NotficationUrlJsons/PaymentBatch.json @@ -0,0 +1,247 @@ +{ + "NotificationUrl": { + "target_url": "nope", + "category": "PAYMENT", + "event_type": "PAYMENT_BATCH_CREATED", + "object": { + "PaymentBatch": { + "id": 1, + "created": "2017-07-13 01:57:39.399256", + "updated": "2017-07-13 01:57:39.399256", + "payments": [ + { + "id": 108864, + "created": "2017-11-08 11:20:03.950184", + "updated": "2017-11-08 11:20:03.950184", + "monetary_account_id": 213, + "amount": { + "currency": "EUR", + "value": "-24.95" + }, + "description": "73d6df4a 680498 Your order #1234567", + "type": "IDEAL", + "merchant_reference": null, + "maturity_date": "2017-11-08", + "alias": { + "iban": "NL86BUNQ2025105541", + "is_light": false, + "display_name": "D. Howard", + "avatar": { + "uuid": "cd028f6d-52f3-4b55-be76-56223b7adeec", + "image": [ + { + "attachment_public_uuid": "54b3fbaa-a427-4115-a04d-08372f706a42", + "height": 1023, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "0f4540c4-e81d-4aca-ad12-144fb73635a1", + "display_name": "D. Howard", + "country": "NL", + "avatar": { + "uuid": "514aaa28-c2da-42ce-aa76-7b6fd6f528cc", + "image": [ + { + "attachment_public_uuid": "14847000-40da-4f63-9137-817683acd980", + "height": 456, + "width": 456, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "0f4540c4-e81d-4aca-ad12-144fb73635a1" + }, + "public_nick_name": "Dominic (nick) premium \u2728" + }, + "country": "NL" + }, + "counterparty_alias": { + "iban": null, + "is_light": null, + "display_name": "BoekenGigant", + "label_user": { + "uuid": null, + "display_name": "BoekenGigant", + "country": "NL", + "avatar": null, + "public_nick_name": "BoekenGigant" + }, + "avatar": null, + "country": "NL" + }, + "attachment": [], + "geolocation": { + "latitude": 52.387862883215, + "longitude": 4.8333778222355, + "altitude": 0, + "radius": 65 + }, + "batch_id": null, + "conversation": null, + "allow_chat": true, + "scheduled_id": null, + "address_billing": null, + "address_shipping": null + }, + { + "id": 108864, + "created": "2017-11-08 11:20:03.950184", + "updated": "2017-11-08 11:20:03.950184", + "monetary_account_id": 213, + "amount": { + "currency": "EUR", + "value": "-24.95" + }, + "description": "73d6df4a 680498 Your order #1234567", + "type": "IDEAL", + "merchant_reference": null, + "maturity_date": "2017-11-08", + "alias": { + "iban": "NL86BUNQ2025105541", + "is_light": false, + "display_name": "D. Howard", + "avatar": { + "uuid": "cd028f6d-52f3-4b55-be76-56223b7adeec", + "image": [ + { + "attachment_public_uuid": "54b3fbaa-a427-4115-a04d-08372f706a42", + "height": 1023, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "0f4540c4-e81d-4aca-ad12-144fb73635a1", + "display_name": "D. Howard", + "country": "NL", + "avatar": { + "uuid": "514aaa28-c2da-42ce-aa76-7b6fd6f528cc", + "image": [ + { + "attachment_public_uuid": "14847000-40da-4f63-9137-817683acd980", + "height": 456, + "width": 456, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "0f4540c4-e81d-4aca-ad12-144fb73635a1" + }, + "public_nick_name": "Dominic (nick) premium \u2728" + }, + "country": "NL" + }, + "counterparty_alias": { + "iban": null, + "is_light": null, + "display_name": "BoekenGigant", + "label_user": { + "uuid": null, + "display_name": "BoekenGigant", + "country": "NL", + "avatar": null, + "public_nick_name": "BoekenGigant" + }, + "avatar": null, + "country": "NL" + }, + "attachment": [], + "geolocation": { + "latitude": 52.387862883215, + "longitude": 4.8333778222355, + "altitude": 0, + "radius": 65 + }, + "batch_id": null, + "conversation": null, + "allow_chat": true, + "scheduled_id": null, + "address_billing": null, + "address_shipping": null + }, + { + "id": 108864, + "created": "2017-11-08 11:20:03.950184", + "updated": "2017-11-08 11:20:03.950184", + "monetary_account_id": 213, + "amount": { + "currency": "EUR", + "value": "-24.95" + }, + "description": "73d6df4a 680498 Your order #1234567", + "type": "IDEAL", + "merchant_reference": null, + "maturity_date": "2017-11-08", + "alias": { + "iban": "NL86BUNQ2025105541", + "is_light": false, + "display_name": "D. Howard", + "avatar": { + "uuid": "cd028f6d-52f3-4b55-be76-56223b7adeec", + "image": [ + { + "attachment_public_uuid": "54b3fbaa-a427-4115-a04d-08372f706a42", + "height": 1023, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "0f4540c4-e81d-4aca-ad12-144fb73635a1", + "display_name": "D. Howard", + "country": "NL", + "avatar": { + "uuid": "514aaa28-c2da-42ce-aa76-7b6fd6f528cc", + "image": [ + { + "attachment_public_uuid": "14847000-40da-4f63-9137-817683acd980", + "height": 456, + "width": 456, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "0f4540c4-e81d-4aca-ad12-144fb73635a1" + }, + "public_nick_name": "Dominic (nick) premium \u2728" + }, + "country": "NL" + }, + "counterparty_alias": { + "iban": null, + "is_light": null, + "display_name": "BoekenGigant", + "label_user": { + "uuid": null, + "display_name": "BoekenGigant", + "country": "NL", + "avatar": null, + "public_nick_name": "BoekenGigant" + }, + "avatar": null, + "country": "NL" + }, + "attachment": [], + "geolocation": { + "latitude": 52.387862883215, + "longitude": 4.8333778222355, + "altitude": 0, + "radius": 65 + }, + "batch_id": null, + "conversation": null, + "allow_chat": true, + "scheduled_id": null, + "address_billing": null, + "address_shipping": null + } + ] + } + } + } +} diff --git a/tests/assets/NotficationUrlJsons/RequestInquiry.json b/tests/assets/NotficationUrlJsons/RequestInquiry.json new file mode 100644 index 0000000..af57b48 --- /dev/null +++ b/tests/assets/NotficationUrlJsons/RequestInquiry.json @@ -0,0 +1,128 @@ +{ + "NotificationUrl": { + "target_url": "nope", + "category": "REQUEST", + "event_type": "REQUEST_INQUIRY_ACCEPTED", + "object": { + "RequestInquiry": { + "id": 21, + "created": "2017-07-16 01:58:10.359035", + "updated": "2017-07-22 23:37:35.925263", + "time_responded": "2017-07-22 23:37:35.889673", + "time_expiry": null, + "monetary_account_id": 43, + "amount_inquired": { + "currency": "EUR", + "value": "8.77" + }, + "amount_responded": null, + "status": "REVOKED", + "description": "Test request inquiry to NL60BUNQ2025103972", + "merchant_reference": null, + "user_alias_created": { + "iban": "NL32BUNQ2025103506", + "is_light": false, + "display_name": "N. Garland", + "avatar": { + "uuid": "e47f5214-2198-4605-886c-9950714476f3", + "image": [ + { + "attachment_public_uuid": "3c7d4d11-d203-4ed4-b471-5b5e24079bf6", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "398e4411-6d98-40b9-bb48-9b33a4cb82da", + "display_name": "N. Garland", + "country": "NL", + "avatar": { + "uuid": "ad92c001-a4ec-4344-89ad-bf6a6b0e5628", + "image": [ + { + "attachment_public_uuid": "2b7bc30e-d6af-4440-90ba-a801cba3d8d7", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "398e4411-6d98-40b9-bb48-9b33a4cb82da" + }, + "public_nick_name": "Niels (nickname)" + }, + "country": "NL" + }, + "user_alias_revoked": { + "uuid": "398e4411-6d98-40b9-bb48-9b33a4cb82da", + "display_name": "N. Garland", + "country": "NL", + "avatar": { + "uuid": "ad92c001-a4ec-4344-89ad-bf6a6b0e5628", + "image": [ + { + "attachment_public_uuid": "2b7bc30e-d6af-4440-90ba-a801cba3d8d7", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "398e4411-6d98-40b9-bb48-9b33a4cb82da" + }, + "public_nick_name": "Niels (nickname)" + }, + "counterparty_alias": { + "iban": "NL60BUNQ2025103972", + "is_light": false, + "display_name": "Charlie CH Arl (nickname)", + "avatar": { + "uuid": "5188b2d7-5cf9-49ca-ba47-625fee317e79", + "image": [ + { + "attachment_public_uuid": "f427ccd8-81e7-46a7-a9bc-9c52e66f15ae", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "3f4973b4-7503-4317-bf4c-bc63e4f6a858", + "display_name": "Charlie CH Arl (nickname)", + "country": "NL", + "avatar": { + "uuid": "cf4eedd8-afea-4374-9505-7ea5af898091", + "image": [ + { + "attachment_public_uuid": "e6f69b18-0aba-4001-98d6-968d464b706c", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "3f4973b4-7503-4317-bf4c-bc63e4f6a858" + }, + "public_nick_name": "Charlie CH Arl (nickname)" + }, + "country": "NL" + }, + "attachment": [], + "minimum_age": null, + "require_address": null, + "geolocation": null, + "type": "INTERNAL", + "sub_type": "NONE", + "bunqme_share_url": null, + "batch_id": null, + "scheduled_id": null, + "address_billing": null, + "address_shipping": null, + "conversation": null, + "allow_chat": true + } + } + } +} diff --git a/tests/assets/NotficationUrlJsons/RequestResponse.json b/tests/assets/NotficationUrlJsons/RequestResponse.json new file mode 100644 index 0000000..d0b0ced --- /dev/null +++ b/tests/assets/NotficationUrlJsons/RequestResponse.json @@ -0,0 +1,108 @@ +{ + "NotificationUrl": { + "target_url": "nope", + "category": "REQUEST", + "event_type": "REQUEST_INQUIRY_ACCEPTED", + "object": { + "RequestResponse": { + "id": 2, + "created": "2017-07-13 21:44:31.840439", + "updated": "2017-07-13 21:44:31.840439", + "time_responded": null, + "time_expiry": null, + "monetary_account_id": 36, + "amount_inquired": { + "currency": "EUR", + "value": "3.31" + }, + "amount_responded": null, + "status": "PENDING", + "description": "Test request inquiry to NL15BUNQ2025104200", + "alias": { + "iban": "NL15BUNQ2025104200", + "is_light": false, + "display_name": "Delta \u0644\u0623\u0628\u062c\u062f\u064a\u0629 \u0627 \u0639\u0631\u0628\u064a\u0629 (nickname)", + "avatar": { + "uuid": "11ab9e94-a90e-4334-9e70-b81ad7c4dc0a", + "image": [ + { + "attachment_public_uuid": "423b6870-a938-41d4-812b-f9b090e03d07", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "e3281b2c-d552-49b4-b575-33b87cfee463", + "display_name": "Delta \u0644\u0623\u0628\u062c\u062f\u064a\u0629 \u0627 \u0639\u0631\u0628\u064a\u0629 (nickname)", + "country": "NL", + "avatar": { + "uuid": "a94240e9-360f-4097-9caa-7974946de533", + "image": [ + { + "attachment_public_uuid": "4f25125b-ce8b-43e9-b726-317c9eb0fd46", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "e3281b2c-d552-49b4-b575-33b87cfee463" + }, + "public_nick_name": "Delta \u0644\u0623\u0628\u062c\u062f\u064a\u0629 \u0627 \u0639\u0631\u0628\u064a\u0629 (nickname)" + }, + "country": "NL" + }, + "counterparty_alias": { + "iban": "NL59BUNQ2025104669", + "is_light": false, + "display_name": "Alpha Corp.", + "avatar": { + "uuid": "26789d97-ec34-4fe8-9a71-ca145a23ba7a", + "image": [ + { + "attachment_public_uuid": "3965b302-7a77-4813-8b00-ad3f9b84f439", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid|": "2711664e-885e-4b5c-bf2c-581ba39061d3", + "display_name": "Alpha Corp.", + "country": "NL", + "avatar": { + "uuid": "829fee85-ffa6-473b-ac5b-b464c7b0a3a9", + "image": [ + { + "attachment_public_uuid": "89347f1e-fd96-4c28-b9f5-bc9ec1f4443a", + "height": 640, + "width": 640, + "content_type": "image\/png" + } + ], + "anchor_uuid": "2711664e-885e-4b5c-bf2c-581ba39061d3" + }, + "public_nick_name": "Alpha Corp." + }, + "country": "NL" + }, + "attachment": null, + "minimum_age": null, + "require_address": null, + "geolocation": null, + "type": "INTERNAL", + "sub_type": "NONE", + "redirect_url": null, + "address_billing": null, + "address_shipping": null, + "conversation": null, + "allow_chat": true, + "eligible_whitelist_id": null + } + } + } +} diff --git a/tests/assets/NotficationUrlJsons/ScheduledInstance.json b/tests/assets/NotficationUrlJsons/ScheduledInstance.json new file mode 100644 index 0000000..fd57d46 --- /dev/null +++ b/tests/assets/NotficationUrlJsons/ScheduledInstance.json @@ -0,0 +1,231 @@ +{ + "NotificationUrl": { + "target_url": "nope", + "category": "SCHEDULE_STATUS", + "event_type": "SCHEDULE_INSTANCE_PAYMENT_BATCH_SUCCEEDED", + "object": { + "ScheduledInstance": { + "id": 2, + "created": "2017-07-16 21:02:06.511789", + "updated": "2017-07-16 21:02:06.625282", + "state": "FINISHED_SUCCESSFULLY", + "error_message": null, + "time_start": "2017-07-15 21:02:06.022814", + "time_end": "2017-07-16 21:02:06.022814", + "scheduled_object": { + "ScheduledPayment": { + "id": 1, + "created": "2017-07-11 21:02:06.384325", + "updated": "2017-07-16 21:02:06.630454", + "monetary_account_id": 42, + "schedule": { + "time_start": "2017-07-15 21:02:06.022814", + "time_next": null, + "time_end": "2017-07-16 21:02:06.022814", + "recurrence_unit": "DAILY", + "recurrence_size": 1 + }, + "status": "FINISHED", + "label_schedule_user_create": { + "uuid": "fbff5c27-e5c1-44c6-be6f-ddd2c6615bf5", + "display_name": "G. Mason", + "country": "NL", + "avatar": { + "uuid": "4605580d-014c-42f1-a4d4-7b398f3b37e5", + "image": [ + { + "attachment_public_uuid": "d6b930f4-1fd0-4b29-8455-e900ed0aced5", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "fbff5c27-e5c1-44c6-be6f-ddd2c6615bf5" + }, + "public_nick_name": "Griffin (nickname)" + }, + "label_schedule_user_canceled": null, + "payment": { + "amount": { + "currency": "EUR", + "value": "-34.42" + }, + "alias": { + "iban": "NL16BUNQ2025103794", + "is_light": false, + "display_name": "G. Mason", + "avatar": { + "uuid": "e3bc865a-83a8-4788-af62-4f0c38df8f0d", + "image": [ + { + "attachment_public_uuid": "62c88a57-3cd9-49f7-81dc-8f1a4fcc80ac", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "fbff5c27-e5c1-44c6-be6f-ddd2c6615bf5", + "display_name": "G. Mason", + "country": "NL", + "avatar": { + "uuid": "4605580d-014c-42f1-a4d4-7b398f3b37e5", + "image": [ + { + "attachment_public_uuid": "d6b930f4-1fd0-4b29-8455-e900ed0aced5", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "fbff5c27-e5c1-44c6-be6f-ddd2c6615bf5" + }, + "public_nick_name": "Griffin (nickname)" + }, + "country": "NL" + }, + "counterparty_aliasl": { + "iba": "NL60BUNQ2025103972", + "is_light": false, + "display_name": "Charlie CH Arl (nickname)", + "avatar": { + "uuid": "5188b2d7-5cf9-49ca-ba47-625fee317e79", + "image": [ + { + "attachment_public_uuid": "f427ccd8-81e7-46a7-a9bc-9c52e66f15ae", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "3f4973b4-7503-4317-bf4c-bc63e4f6a858", + "display_name": "Charlie CH Arl (nickname)", + "country": "NL", + "avatar": { + "uuid": "cf4eedd8-afea-4374-9505-7ea5af898091", + "image": [ + { + "attachment_public_uuid": "e6f69b18-0aba-4001-98d6-968d464b706c", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "3f4973b4-7503-4317-bf4c-bc63e4f6a858" + }, + "public_nick_name": "Charlie CH Arl (nickname)" + }, + "country": "NL" + }, + "description": "Test payment to NL60BUNQ2025103972", + "merchant_reference": null, + "type": "BUNQ", + "sub_type": "PAYMENT" + } + } + }, + "result_object": { + "Payment": { + "id": 133, + "created": "2017-07-16 21:02:06.579658", + "updated": "2017-07-16 21:02:06.579658", + "monetary_account_id": 42, + "amount": { + "currency": "EUR", + "value": "-34.42" + }, + "description": "Test payment to NL60BUNQ2025103972", + "type": "BUNQ", + "merchant_reference": null, + "maturity_date": "2017-07-16", + "alias": { + "iban": "NL16BUNQ2025103794", + "is_light": false, + "display_name": "G. Mason", + "avatar": { + "uuid": "e3bc865a-83a8-4788-af62-4f0c38df8f0d", + "image": [ + { + "attachment_public_uuid": "62c88a57-3cd9-49f7-81dc-8f1a4fcc80ac", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "fbff5c27-e5c1-44c6-be6f-ddd2c6615bf5", + "display_name": "G. Mason", + "country": "NL", + "avatar": { + "uuid": "4605580d-014c-42f1-a4d4-7b398f3b37e5", + "image": [ + { + "attachment_public_uuid": "d6b930f4-1fd0-4b29-8455-e900ed0aced5", + "heigh": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "fbff5c27-e5c1-44c6-be6f-ddd2c6615bf5" + }, + "public_nick_name": "Griffin (nickname)" + }, + "country": "NL" + }, + "counterparty_alias": { + "iban": "NL60BUNQ2025103972", + "is_light": false, + "display_name": "Charlie CH Arl (nickname)", + "avatar": { + "uuid": "5188b2d7-5cf9-49ca-ba47-625fee317e79", + "image": [ + { + "attachment_public_uuid": "f427ccd8-81e7-46a7-a9bc-9c52e66f15ae", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "3f4973b4-7503-4317-bf4c-bc63e4f6a858", + "display_name": "Charlie CH Arl (nickname)", + "country": "NL", + "avatar": { + "uuid": "cf4eedd8-afea-4374-9505-7ea5af898091", + "image": [ + { + "attachment_public_uuid": "e6f69b18-0aba-4001-98d6-968d464b706c", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "3f4973b4-7503-4317-bf4c-bc63e4f6a858" + }, + "public_nick_name": "Charlie CH Arl (nickname)" + }, + "country": "NL" + }, + "attachment": [], + "geolocation": null, + "batch_id": null, + "conversation": null, + "allow_chat": true, + "scheduled_id": 2, + "address_billing": null, + "address_shipping": null + } + } + } + } + } +} diff --git a/tests/assets/NotficationUrlJsons/ScheduledPayment.json b/tests/assets/NotficationUrlJsons/ScheduledPayment.json new file mode 100644 index 0000000..458f1e5 --- /dev/null +++ b/tests/assets/NotficationUrlJsons/ScheduledPayment.json @@ -0,0 +1,124 @@ +{ + "NotificationUrl": { + "target_url": "nope", + "category": "SCHEDULE_RESULT", + "event_type": "SCHEDULE_DEFINITION_PAYMENT_BATCH_CANCELLED", + "object": { + "ScheduledPayment": { + "id": 2, + "created": "2017-07-11 22:56:20.737255", + "updated": "2017-07-11 22:56:20.737255", + "monetary_account_id": 44, + "schedule": { + "time_start": "2017-07-25 22:56:20.571271", + "time_next": "2018-07-25 22:56:20.000000", + "time_end": "2018-07-25 22:56:20.571271", + "recurrence_unit": "YEARLY", + "recurrence_size": 1 + }, + "status": "ACTIVE", + "label_schedule_user_created": { + "uuid": "407b2959-3df2-4c72-8c44-c90d8f00855f", + "display_name": "J. Barrett", + "country": "NL", + "avatar": { + "uuid": "3872244f-82c5-4131-82d9-ba878f7e4cb6", + "image": [ + { + "attachment_public_uuid": "abca51a8-af0f-4ab5-b329-645809781615", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "407b2959-3df2-4c72-8c44-c90d8f00855f" + }, + "public_nick_name": "Jodi (nickname)" + }, + "label_schedule_user_canceled": null, + "payment": { + "amount": { + "currency": "EUR", + "value": "-8.89" + }, + "alias": { + "iban": "NL71BUNQ2025104162", + "is_light": false, + "display_name": "J. Barrett", + "avatar": { + "uuid": "8418f60a-2f89-443e-94ab-5f4cc10a1a1f", + "image": [ + { + "attachment_public_uuid": "c00867c4-8bbe-4dd7-ac72-85798a2969cb", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "407b2959-3df2-4c72-8c44-c90d8f00855f", + "display_name": "J. Barrett", + "country": "NL", + "avatar": { + "uuid": "3872244f-82c5-4131-82d9-ba878f7e4cb6", + "image": [ + { + "attachment_public_uuid": "abca51a8-af0f-4ab5-b329-645809781615", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "407b2959-3df2-4c72-8c44-c90d8f00855f" + }, + "public_nick_name": "Jodi (nickname)" + }, + "country": "NL" + }, + "counterparty_alias": { + "iban": "NL59BUNQ2025104669", + "is_light": false, + "display_name": "Alpha Corp.", + "avatar": { + "uuid": "26789d97-ec34-4fe8-9a71-ca145a23ba7a", + "image": [ + { + "attachment_public_uuid": "3965b302-7a77-4813-8b00-ad3f9b84f439", + "height": 1024, + "width|": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "2711664e-885e-4b5c-bf2c-581ba39061d3", + "display_name": "Alpha Corp.", + "country": "NL", + "avatar": { + "uuid": "829fee85-ffa6-473b-ac5b-b464c7b0a3a9", + "image": [ + { + "attachment_public_uuid": "89347f1e-fd96-4c28-b9f5-bc9ec1f4443a", + "height": 640, + "width": 640, + "content_type": "image\/png" + } + ], + "anchor_uuid": "2711664e-885e-4b5c-bf2c-581ba39061d3" + }, + "public_nick_name": "Alpha Corp." + }, + "country": "NL" + }, + "description": "Test payment to NL59BUNQ2025104669", + "merchant_reference": null, + "type": "BUNQ", + "sub_type": "PAYMENT" + } + } + } + } +} diff --git a/tests/assets/NotficationUrlJsons/ShareInviteBankInquiry.json b/tests/assets/NotficationUrlJsons/ShareInviteBankInquiry.json new file mode 100644 index 0000000..7c8211b --- /dev/null +++ b/tests/assets/NotficationUrlJsons/ShareInviteBankInquiry.json @@ -0,0 +1,102 @@ +{ + "NotificationUrl": { + "target_url": "nope", + "category": "SHARE", + "event_type": "SHARE_INVITE_BANK_INQUIRY_ACCEPTED", + "object": { + "ShareInviteBankInquiry": { + "id": 1, + "created": "2017-07-20 02:32:32.074527", + "updated": "2017-07-20 02:32:32.074527", + "alias": { + "iban": "NL59BUNQ2025104669", + "is_light": false, + "display_name": "Alpha Corp.", + "avatar": { + "uuid": "26789d97-ec34-4fe8-9a71-ca145a23ba7a", + "image": [ + { + "attachment_public_uuid": "3965b302-7a77-4813-8b00-ad3f9b84f439", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "2711664e-885e-4b5c-bf2c-581ba39061d3", + "display_name": "Alpha Corp.", + "country": "NL", + "avatar": { + "uuid": "829fee85-ffa6-473b-ac5b-b464c7b0a3a9", + "image": [ + { + "attachment_public_uuid": "89347f1e-fd96-4c28-b9f5-bc9ec1f4443a", + "height": 640, + "width": 640, + "content_type": "image\/png" + } + ], + "anchor_uuid": "2711664e-885e-4b5c-bf2c-581ba39061d3" + }, + "public_nick_name": "Alpha Corp." + }, + "country": "NL" + }, + "user_alias_created": { + "uuid": "2711664e-885e-4b5c-bf2c-581ba39061d3", + "display_name": "Alpha Corp.", + "country": "NL", + "avatar": { + "uuid": "829fee85-ffa6-473b-ac5b-b464c7b0a3a9", + "image": [ + { + "attachment_public_uuid": "89347f1e-fd96-4c28-b9f5-bc9ec1f4443a", + "height": 640, + "width": 640, + "content_type": "image\/png" + } + ], + "anchor_uuid": "2711664e-885e-4b5c-bf2c-581ba39061d3" + }, + "public_nick_name": "Alpha Corp." + }, + "user_alias_revoked": null, + "counter_user_alias": { + "uuid": "688e4bdc-ec27-4d8e-942b-3aee7b5d15e9", + "display_name": "Echo (nickname)", + "country": "000", + "avatar": { + "uuid": "3da21898-1535-43c9-9023-83333e776b8b", + "image": [ + { + "attachment_public_uuid": "6bb2b5d6-faee-4d5d-8284-af026bde3640", + "height": 480, + "width": 480, + "content_type": "image\/jpeg" + } + ], + "anchor_uuid": "688e4bdc-ec27-4d8e-942b-3aee7b5d15e9" + }, + "public_nick_name": "Echo (nickname)" + }, + "monetary_account_id": 46, + "draft_share_invite_bank_id": null, + "share_type": "STANDARD", + "status": "PENDING", + "share_detail": { + "ShareDetailPayment": { + "view_balance": true, + "view_old_events": true, + "view_new_events": true, + "budget": null, + "make_payments": true + } + }, + "start_date": "2017-07-20 02:34:05.864029", + "end_date": "2017-11-11 02:34:05.864029" + } + } + } +} diff --git a/tests/assets/NotficationUrlJsons/ShareInviteBankResponse.json b/tests/assets/NotficationUrlJsons/ShareInviteBankResponse.json new file mode 100644 index 0000000..41c30f2 --- /dev/null +++ b/tests/assets/NotficationUrlJsons/ShareInviteBankResponse.json @@ -0,0 +1,67 @@ +{ + "NotificationUrl": { + "target_url": "nope", + "category": "SHARE", + "event_type": "SHARE_INVITE_BANK_INQUIRY_ACCEPTED", + "object": { + "ShareInviteBankResponse": { + "id": 2, + "created": "2017-07-20 02:32:32.114297", + "updated": "2017-07-20 02:32:32.114297", + "monetary_account_id": null, + "draft_share_invite_bank_id": null, + "counter_alias": { + "iban": "NL59BUNQ2025104669", + "is_light": false, + "display_name": "Alpha Corp.", + "avatar": { + "uuid": "26789d97-ec34-4fe8-9a71-ca145a23ba7a", + "image": [ + { + "attachment_public_uuid": "3965b302-7a77-4813-8b00-ad3f9b84f439", + "height": 1024, + "width": 1024, + "content_type": "image\/png" + } + ], + "anchor_uuid": null + }, + "label_user": { + "uuid": "2711664e-885e-4b5c-bf2c-581ba39061d3", + "display_name": "Alpha Corp.", + "country": "NL", + "avatar": { + "uuid": "829fee85-ffa6-473b-ac5b-b464c7b0a3a9", + "image": [ + { + "attachment_public_uuid": "89347f1e-fd96-4c28-b9f5-bc9ec1f4443a", + "height": 640, + "width": 640, + "content_type": "image\/png" + } + ], + "anchor_uuid": "2711664e-885e-4b5c-bf2c-581ba39061d3" + }, + "public_nick_name": "Alpha Corp." + }, + "country": "NL" + }, + "user_alias_cancelled": null, + "description": "bunq account", + "share_type": "STANDARD", + "status": "PENDING", + "share_detail": { + "ShareDetailPayment": { + "view_balance": true, + "view_old_events": true, + "view_new_events": true, + "budget": null, + "make_payments": true + } + }, + "start_date": "2017-07-20 02:34:05.864029", + "end_date": "2017-11-11 02:34:05.864029" + } + } + } +} diff --git a/tests/bunq_test.py b/tests/bunq_test.py index 32b1adf..6283542 100644 --- a/tests/bunq_test.py +++ b/tests/bunq_test.py @@ -1,14 +1,13 @@ import os import unittest -from tests.config import Config -from bunq.sdk.context import ApiContext -from bunq.sdk.context import ApiEnvironmentType +from tests import config +from bunq.sdk import context class BunqSdkTestCase(unittest.TestCase): # Config values - _API_KEY = Config.get_api_key() + _API_KEY = config.Config.get_api_key() # Name of bunq config file _FILENAME_BUNQ_CONFIG = "/bunq-test.conf" @@ -20,21 +19,21 @@ class BunqSdkTestCase(unittest.TestCase): def _get_api_context(cls): """ Calls IsSessionActive to check if the session token is still active - and returns the ApiContext. + and returns the context.ApiContext. Catches ApiException if the session is inactive. Catches BunqException if the conf file does not exist. - :rtype: ApiContext + :rtype: context.ApiContext """ filename_bunq_config_full = (cls._get_directory_test_root() + cls._FILENAME_BUNQ_CONFIG) try: - api_context = ApiContext.restore(filename_bunq_config_full) + api_context = context.ApiContext.restore(filename_bunq_config_full) except FileNotFoundError: - api_context = ApiContext(ApiEnvironmentType.SANDBOX, cls._API_KEY, + api_context = context.ApiContext(context.ApiEnvironmentType.SANDBOX, cls._API_KEY, cls._DEVICE_DESCRIPTION, []) else: api_context.ensure_session_active() diff --git a/tests/config.py b/tests/config.py index 25419fe..bae74e8 100644 --- a/tests/config.py +++ b/tests/config.py @@ -1,7 +1,7 @@ import json import os -from bunq.sdk.model.generated.object_ import Pointer +from bunq.sdk.model.generated import object_ class Config: @@ -104,7 +104,7 @@ def get_pointer_counter_party_self(cls): alias = cls._get_config_file()[cls._FIELD_COUNTER_PARTY_SELF][ cls._FIELD_ALIAS] - return Pointer(type_, alias) + return object_.Pointer(type_, alias) @classmethod def get_pointer_counter_party_other(cls): @@ -117,7 +117,7 @@ def get_pointer_counter_party_other(cls): alias = cls._get_config_file()[cls._FIELD_COUNTER_PARTY_OTHER][ cls._FIELD_ALIAS] - return Pointer(type_, alias) + return object_.Pointer(type_, alias) @classmethod def get_permitted_ips(cls): diff --git a/tests/model/generated/object/__init__.py b/tests/model/generated/object/__init__.py new file mode 100644 index 0000000..e69de29 diff --git a/tests/model/generated/object/test_notification_url.py b/tests/model/generated/object/test_notification_url.py new file mode 100644 index 0000000..7f5d72c --- /dev/null +++ b/tests/model/generated/object/test_notification_url.py @@ -0,0 +1,238 @@ +import json +import os + +from bunq.sdk.json.converter import json_to_class +from bunq.sdk.model import core +from bunq.sdk.model.generated import endpoint +from bunq.sdk.model.generated import object_ +from tests import bunq_test + + +class TestNotificationUrl(bunq_test.BunqSdkTestCase): + # Getter string constants + _GETTER_PAYMENT = 'Payment' + _GETTER_BUNQ_ME_TAB = 'BunqMeTab' + _GETTER_CHAT_MESSAGE_ANNOUNCEMENT = 'ChatMessageAnnouncement' + _GETTER_DRAFT_PAYMENT = 'DraftPayment' + _GETTER_MASTER_CARD_ACTION = 'MasterCardAction' + _GETTER_MONETARY_ACCOUNT_BANK = 'MonetaryAccountBank' + _GETTER_PAYMENT_BATCH = 'PaymentBatch' + _GETTER_REQUEST_INQUIRY = 'RequestInquiry' + _GETTER_REQUEST_RESPONSE = 'RequestResponse' + _GETTER_SCHEDULE_PAYMENT = 'ScheduledPayment' + _GETTER_SCHEDULE_INSTANCE = 'ScheduledInstance' + _GETTER_SHARE_INVITE_BANK_INQUIRY = 'ShareInviteBankInquiry' + _GETTER_SHARE_INVITE_BANK_RESPONSE = 'ShareInviteBankResponse' + + # Model json paths constants. + BASE_PATH_JSON_MODEL = '../../../assets/NotficationUrlJsons' + JSON_PATH_MUTATION_MODEL = BASE_PATH_JSON_MODEL + '/Mutation.json' + JSON_PATH_BUNQ_ME_TAB_MODEL = BASE_PATH_JSON_MODEL + '/BunqMeTab.json' + JSON_PATH_CHAT_MESSAGE_ANNOUNCEMENT_MODEL = \ + BASE_PATH_JSON_MODEL + '/ChatMessageAnnouncement.json' + JSON_PATH_DRAFT_PAYMENT_MODEL = BASE_PATH_JSON_MODEL + '/DraftPayment.json' + JSON_PATH_MASTER_CARD_ACTION_MODEL = \ + BASE_PATH_JSON_MODEL + '/MasterCardAction.json' + JSON_PATH_MONETARY_ACCOUNT_BANK_MODEL = \ + BASE_PATH_JSON_MODEL + '/MonetaryAccountBank.json' + JSON_PATH_PAYMENT_BATCH_MODEL = \ + BASE_PATH_JSON_MODEL + '/PaymentBatch.json' + JSON_PATH_REQUEST_INQUIRY_MODEL = \ + BASE_PATH_JSON_MODEL + '/RequestInquiry.json' + JSON_PATH_REQUEST_RESPONSE_MODEL = \ + BASE_PATH_JSON_MODEL + '/RequestResponse.json' + JSON_PATH_SCHEDULE_PAYMENT_MODEL = \ + BASE_PATH_JSON_MODEL + '/ScheduledPayment.json' + JSON_PATH_SCHEDULE_INSTANCE_MODEL = \ + BASE_PATH_JSON_MODEL + '/ScheduledInstance.json' + JSON_PATH_SHARE_INVITE_BANK_INQUIRY_MODEL = \ + BASE_PATH_JSON_MODEL + '/ShareInviteBankInquiry.json' + JSON_PATH_SHARE_INVITE_BANK_RESPONSE_MODEL = \ + BASE_PATH_JSON_MODEL + '/ShareInviteBankResponse.json' + + # Model root key. + _KEY_NOTIFICATION_URL_MODEL = 'NotificationUrl' + + # Model modules constants. + _MODEL_MODULES = [ + object_, + endpoint, + ] + + # File mode constants. + _FILE_MODE_READ = 'r' + + def execute_notification_url_test(self, + file_path, + class_name, + getter_name): + """ + :type file_path: str + :type class_name: str + :type getter_name: str + + :return: None + """ + + notification_url = self.getNotificationUrl(file_path) + self.assertIsNotNone(notification_url) + self.assertIsNotNone(notification_url.object_) + + expected_model = getattr(notification_url.object_, getter_name) + referenced_model = notification_url.object_.get_referenced_object() + + self.assertIsNotNone(expected_model) + self.assertIsNotNone(referenced_model) + self.assertTrue( + self.isModelReference( + referenced_model, + class_name + ) + ) + + @classmethod + def isModelReference(cls, referenced_model, class_name): + """ + :type referenced_model: core.BunqModel + :type class_name: str + + :rtype: bool + """ + + model_type = cls.getModelTypeOrNone(class_name) + + if model_type is None: + return False + + return isinstance(referenced_model, model_type) + + @classmethod + def getModelTypeOrNone(cls, class_name): + """ + :type class_name: str + + :rtype: type|None + """ + + for module_ in cls._MODEL_MODULES: + if hasattr(module_, class_name): + return getattr(module_, class_name) + + return None + + def getNotificationUrl(self, file_path): + """ + :type file_path: str + + :rtype: object_.NotificationUrl + """ + + base_path = os.path.dirname(__file__) + file_path = os.path.abspath(os.path.join(base_path, file_path)) + + with open(file_path, self._FILE_MODE_READ) as f: + json_string = f.read() + json_object = json.loads(json_string) + json_string = json.dumps( + json_object[self._KEY_NOTIFICATION_URL_MODEL] + ) + + self.assertTrue( + self._KEY_NOTIFICATION_URL_MODEL in json_object + ) + + return json_to_class( + object_.NotificationUrl, + json_string + ) + + def test_mutation_model(self): + self.execute_notification_url_test( + self.JSON_PATH_MUTATION_MODEL, + endpoint.Payment.__name__, + self._GETTER_PAYMENT + ) + + def test_bunq_me_tab_model(self): + self.execute_notification_url_test( + self.JSON_PATH_BUNQ_ME_TAB_MODEL, + endpoint.BunqMeTab.__name__, + self._GETTER_BUNQ_ME_TAB + ) + + def test_chat_message_announcement_model(self): + self.execute_notification_url_test( + self.JSON_PATH_CHAT_MESSAGE_ANNOUNCEMENT_MODEL, + endpoint.ChatMessageAnnouncement.__name__, + self._GETTER_CHAT_MESSAGE_ANNOUNCEMENT + ) + + def test_draft_payment_model(self): + self.execute_notification_url_test( + self.JSON_PATH_DRAFT_PAYMENT_MODEL, + endpoint.DraftPayment.__name__, + self._GETTER_DRAFT_PAYMENT + ) + + def test_mastercard_action(self): + self.execute_notification_url_test( + self.JSON_PATH_MASTER_CARD_ACTION_MODEL, + endpoint.MasterCardAction.__name__, + self._GETTER_MASTER_CARD_ACTION + ) + + def test_monetary_account_bank_model(self): + self.execute_notification_url_test( + self.JSON_PATH_MONETARY_ACCOUNT_BANK_MODEL, + endpoint.MonetaryAccountBank.__name__, + self._GETTER_MONETARY_ACCOUNT_BANK + ) + + def test_payment_batch_model(self): + self.execute_notification_url_test( + self.JSON_PATH_PAYMENT_BATCH_MODEL, + endpoint.PaymentBatch.__name__, + self._GETTER_PAYMENT_BATCH + ) + + def test_request_inquiry_model(self): + self.execute_notification_url_test( + self.JSON_PATH_REQUEST_INQUIRY_MODEL, + endpoint.RequestInquiry.__name__, + self._GETTER_REQUEST_INQUIRY + ) + + def test_request_response_model(self): + self.execute_notification_url_test( + self.JSON_PATH_REQUEST_RESPONSE_MODEL, + endpoint.RequestResponse.__name__, + self._GETTER_REQUEST_RESPONSE + ) + + def test_scheduled_payment_model(self): + self.execute_notification_url_test( + self.JSON_PATH_SCHEDULE_PAYMENT_MODEL, + endpoint.SchedulePayment.__name__, + self._GETTER_SCHEDULE_PAYMENT + ) + + def test_scheduled_instance_model(self): + self.execute_notification_url_test( + self.JSON_PATH_SCHEDULE_INSTANCE_MODEL, + endpoint.ScheduleInstance.__name__, + self._GETTER_SCHEDULE_INSTANCE + ) + + def test_share_invite_bank_inquiry(self): + self.execute_notification_url_test( + self.JSON_PATH_SHARE_INVITE_BANK_INQUIRY_MODEL, + endpoint.ShareInviteBankInquiry.__name__, + self._GETTER_SHARE_INVITE_BANK_INQUIRY + ) + + def test_share_invite_bank_response(self): + self.execute_notification_url_test( + self.JSON_PATH_SHARE_INVITE_BANK_RESPONSE_MODEL, + endpoint.ShareInviteBankResponse.__name__, + self._GETTER_SHARE_INVITE_BANK_RESPONSE + ) diff --git a/tests/test_pagination_scenario.py b/tests/test_pagination_scenario.py index 7bd61f6..7f1c350 100644 --- a/tests/test_pagination_scenario.py +++ b/tests/test_pagination_scenario.py @@ -3,7 +3,7 @@ from bunq.sdk.model.generated import endpoint from bunq.sdk.model.generated import object_ from tests.bunq_test import BunqSdkTestCase -from tests.bunq_test import Config +from tests.config import Config class TestPaginationScenario(BunqSdkTestCase):