diff --git a/openapi.json b/openapi.json index b502a8b..e6a9514 100755 --- a/openapi.json +++ b/openapi.json @@ -3330,325 +3330,6 @@ ] } }, - "/v1.1/merchants/{merchant_code}/bank-accounts": { - "get": { - "operationId": "ListBankAccountsV11", - "summary": "List bank accounts", - "description": "Retrieves bank accounts of the merchant.", - "parameters": [ - { - "name": "merchant_code", - "in": "path", - "required": true, - "schema": { - "type": "string", - "example": "MC0X0ABC" - } - }, - { - "name": "primary", - "in": "query", - "description": "If true only the primary bank account (the one used for payouts) will be returned.", - "required": false, - "schema": { - "type": "boolean" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/BankAccount" - } - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "Invalid_Token": { - "description": "The access token is invalid or has expired.", - "value": { - "error_message": "invalid access token", - "error_code": "NOT_AUTHORIZED" - } - }, - "Not_Authorized_Token": { - "description": "The access token is valid but the application is not authorized.", - "value": { - "error_message": "NOT_AUTHORIZED", - "error_code": "NOT_AUTHORIZED" - } - }, - "Missing_Token": { - "description": "No access token is provided.", - "value": { - "message": "access token required", - "error_code": "NOT_AUTHORIZED" - } - } - } - } - } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorForbidden" - }, - "examples": { - "Forbidden": { - "description": "You do not have required scopes for making this request.", - "value": { - "error_message": "request_not_allowed", - "error_code": "FORBIDDEN", - "status_code": "403" - } - } - } - } - } - } - }, - "security": [ - { - "apiKey": [] - }, - { - "oauth2": [ - "user.payout-settings", - "user.profile", - "user.profile_readonly" - ] - } - ], - "tags": [ - "Merchant" - ], - "x-codegen": { - "method_name": "list_bank_accounts" - }, - "x-scopes": [ - "user.payout-settings", - "user.profile", - "user.profile_readonly" - ] - } - }, - "/v0.1/me/merchant-profile/bank-accounts": { - "get": { - "operationId": "ListBankAccounts", - "summary": "List bank accounts", - "description": "Retrieves bank accounts of the merchant.", - "parameters": [ - { - "name": "primary", - "in": "query", - "description": "If true only the primary bank account (the one used for payouts) will be returned.", - "required": false, - "schema": { - "type": "boolean" - } - } - ], - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/BankAccount" - } - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "Invalid_Token": { - "description": "The access token is invalid or has expired.", - "value": { - "error_message": "invalid access token", - "error_code": "NOT_AUTHORIZED" - } - }, - "Not_Authorized_Token": { - "description": "The access token is valid but the application is not authorized.", - "value": { - "error_message": "NOT_AUTHORIZED", - "error_code": "NOT_AUTHORIZED" - } - }, - "Missing_Token": { - "description": "No access token is provided.", - "value": { - "message": "access token required", - "error_code": "NOT_AUTHORIZED" - } - } - } - } - } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorForbidden" - }, - "examples": { - "Forbidden": { - "description": "You do not have required scopes for making this request.", - "value": { - "error_message": "request_not_allowed", - "error_code": "FORBIDDEN", - "status_code": "403" - } - } - } - } - } - } - }, - "deprecated": true, - "security": [ - { - "apiKey": [] - }, - { - "oauth2": [ - "user.payout-settings", - "user.profile", - "user.profile_readonly" - ] - } - ], - "tags": [ - "Merchant" - ], - "x-codegen": { - "method_name": "list_bank_accounts_deprecated" - }, - "x-scopes": [ - "user.payout-settings", - "user.profile", - "user.profile_readonly" - ] - } - }, - "/v0.1/me/merchant-profile/settings": { - "get": { - "operationId": "GetSettings", - "summary": "Get settings", - "description": "Retrieves merchant settings.", - "responses": { - "200": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/MerchantSettings" - } - } - } - }, - "401": { - "description": "Unauthorized", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/Error" - }, - "examples": { - "Invalid_Token": { - "description": "The access token is invalid or has expired.", - "value": { - "error_message": "invalid access token", - "error_code": "NOT_AUTHORIZED" - } - }, - "Not_Authorized_Token": { - "description": "The access token is valid but the application is not authorized.", - "value": { - "error_message": "NOT_AUTHORIZED", - "error_code": "NOT_AUTHORIZED" - } - }, - "Missing_Token": { - "description": "No access token is provided.", - "value": { - "message": "access token required", - "error_code": "NOT_AUTHORIZED" - } - } - } - } - } - }, - "403": { - "description": "Forbidden", - "content": { - "application/json": { - "schema": { - "$ref": "#/components/schemas/ErrorForbidden" - }, - "examples": { - "Forbidden": { - "description": "You do not have required scopes for making this request.", - "value": { - "error_message": "request_not_allowed", - "error_code": "FORBIDDEN", - "status_code": "403" - } - } - } - } - } - } - }, - "security": [ - { - "apiKey": [] - }, - { - "oauth2": [ - "user.payout-settings" - ] - } - ], - "tags": [ - "Merchant" - ], - "x-codegen": { - "method_name": "get_settings" - }, - "x-scopes": [ - "user.payout-settings" - ] - } - }, "/v1.1/receipts/{id}": { "get": { "operationId": "GetReceipt", @@ -5213,8 +4894,7 @@ { "oauth2": [ "user.profile", - "user.profile_readonly", - "merchant.read" + "user.profile_readonly" ] } ], @@ -5229,8 +4909,7 @@ ], "x-scopes": [ "user.profile", - "user.profile_readonly", - "merchant.read" + "user.profile_readonly" ] } }, @@ -5335,8 +5014,7 @@ { "oauth2": [ "user.profile", - "user.profile_readonly", - "merchant.read" + "user.profile_readonly" ] } ], @@ -5351,8 +5029,7 @@ ], "x-scopes": [ "user.profile", - "user.profile_readonly", - "merchant.read" + "user.profile_readonly" ] } }, @@ -5471,8 +5148,7 @@ { "oauth2": [ "user.profile", - "user.profile_readonly", - "merchant.read" + "user.profile_readonly" ] } ], @@ -5487,8 +5163,7 @@ ], "x-scopes": [ "user.profile", - "user.profile_readonly", - "merchant.read" + "user.profile_readonly" ] } }, @@ -11056,19 +10731,6 @@ } }, "responses": { - "BankAccounts": { - "description": "OK", - "content": { - "application/json": { - "schema": { - "type": "array", - "items": { - "$ref": "#/components/schemas/BankAccount" - } - } - } - } - }, "Checkout": { "description": "Created", "content": { @@ -11807,8 +11469,7 @@ { "$ref": "#/components/schemas/Reader" } - ], - "x-beta": true + ] } ] } \ No newline at end of file diff --git a/openapi.yaml b/openapi.yaml index afa6de7..3f808fa 100644 --- a/openapi.yaml +++ b/openapi.yaml @@ -2234,210 +2234,6 @@ paths: x-scopes: - user.profile - user.profile_readonly - '/v1.1/merchants/{merchant_code}/bank-accounts': - get: - operationId: ListBankAccountsV11 - summary: List bank accounts - description: Retrieves bank accounts of the merchant. - parameters: - - name: merchant_code - in: path - required: true - schema: - type: string - example: MC0X0ABC - - name: primary - in: query - description: If true only the primary bank account (the one used for payouts) will be returned. - required: false - schema: - type: boolean - responses: - '200': - description: OK - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/BankAccount' - '401': - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - Invalid_Token: - description: The access token is invalid or has expired. - value: - error_message: invalid access token - error_code: NOT_AUTHORIZED - Not_Authorized_Token: - description: The access token is valid but the application is not authorized. - value: - error_message: NOT_AUTHORIZED - error_code: NOT_AUTHORIZED - Missing_Token: - description: No access token is provided. - value: - message: access token required - error_code: NOT_AUTHORIZED - '403': - description: Forbidden - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorForbidden' - examples: - Forbidden: - description: You do not have required scopes for making this request. - value: - error_message: request_not_allowed - error_code: FORBIDDEN - status_code: '403' - security: - - apiKey: [] - - oauth2: - - user.payout-settings - - user.profile - - user.profile_readonly - tags: - - Merchant - x-codegen: - method_name: list_bank_accounts - x-scopes: - - user.payout-settings - - user.profile - - user.profile_readonly - /v0.1/me/merchant-profile/bank-accounts: - get: - operationId: ListBankAccounts - summary: List bank accounts - description: Retrieves bank accounts of the merchant. - parameters: - - name: primary - in: query - description: If true only the primary bank account (the one used for payouts) will be returned. - required: false - schema: - type: boolean - responses: - '200': - description: OK - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/BankAccount' - '401': - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - Invalid_Token: - description: The access token is invalid or has expired. - value: - error_message: invalid access token - error_code: NOT_AUTHORIZED - Not_Authorized_Token: - description: The access token is valid but the application is not authorized. - value: - error_message: NOT_AUTHORIZED - error_code: NOT_AUTHORIZED - Missing_Token: - description: No access token is provided. - value: - message: access token required - error_code: NOT_AUTHORIZED - '403': - description: Forbidden - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorForbidden' - examples: - Forbidden: - description: You do not have required scopes for making this request. - value: - error_message: request_not_allowed - error_code: FORBIDDEN - status_code: '403' - deprecated: true - security: - - apiKey: [] - - oauth2: - - user.payout-settings - - user.profile - - user.profile_readonly - tags: - - Merchant - x-codegen: - method_name: list_bank_accounts_deprecated - x-scopes: - - user.payout-settings - - user.profile - - user.profile_readonly - /v0.1/me/merchant-profile/settings: - get: - operationId: GetSettings - summary: Get settings - description: Retrieves merchant settings. - responses: - '200': - description: OK - content: - application/json: - schema: - $ref: '#/components/schemas/MerchantSettings' - '401': - description: Unauthorized - content: - application/json: - schema: - $ref: '#/components/schemas/Error' - examples: - Invalid_Token: - description: The access token is invalid or has expired. - value: - error_message: invalid access token - error_code: NOT_AUTHORIZED - Not_Authorized_Token: - description: The access token is valid but the application is not authorized. - value: - error_message: NOT_AUTHORIZED - error_code: NOT_AUTHORIZED - Missing_Token: - description: No access token is provided. - value: - message: access token required - error_code: NOT_AUTHORIZED - '403': - description: Forbidden - content: - application/json: - schema: - $ref: '#/components/schemas/ErrorForbidden' - examples: - Forbidden: - description: You do not have required scopes for making this request. - value: - error_message: request_not_allowed - error_code: FORBIDDEN - status_code: '403' - security: - - apiKey: [] - - oauth2: - - user.payout-settings - tags: - - Merchant - x-codegen: - method_name: get_settings - x-scopes: - - user.payout-settings '/v1.1/receipts/{id}': get: operationId: GetReceipt @@ -3450,7 +3246,6 @@ paths: - oauth2: - user.profile - user.profile_readonly - - merchant.read tags: - Merchants x-codegen: @@ -3460,7 +3255,6 @@ paths: x-scopes: - user.profile - user.profile_readonly - - merchant.read '/v1/merchants/{merchant_code}/persons': get: operationId: ListPersons @@ -3525,7 +3319,6 @@ paths: - oauth2: - user.profile - user.profile_readonly - - merchant.read tags: - Merchants x-codegen: @@ -3535,7 +3328,6 @@ paths: x-scopes: - user.profile - user.profile_readonly - - merchant.read '/v1/merchants/{merchant_code}/persons/{person_id}': get: operationId: GetPerson @@ -3610,7 +3402,6 @@ paths: - oauth2: - user.profile - user.profile_readonly - - merchant.read tags: - Merchants x-codegen: @@ -3620,7 +3411,6 @@ paths: x-scopes: - user.profile - user.profile_readonly - - merchant.read '/v0.1/merchants/{merchant_code}/readers': get: operationId: ListReaders @@ -7871,14 +7661,6 @@ components: type: number format: float responses: - BankAccounts: - description: OK - content: - application/json: - schema: - type: array - items: - $ref: '#/components/schemas/BankAccount' Checkout: description: Created content: @@ -8402,4 +8184,3 @@ tags: description: A reader represents a device that accepts payments. You can use the SumUp Solo to accept in-person payments. x-core-objects: - $ref: '#/components/schemas/Reader' - x-beta: true diff --git a/sumup/merchant/__init__.py b/sumup/merchant/__init__.py index 7d9ff3d..439d9fb 100755 --- a/sumup/merchant/__init__.py +++ b/sumup/merchant/__init__.py @@ -3,8 +3,6 @@ MerchantResource, AsyncMerchantResource, GetAccountParams, - ListBankAccountsV11Params, - ListBankAccountsParams, ) from .types import ( AccountLegacy, @@ -31,8 +29,6 @@ "MerchantResource", "AsyncMerchantResource", "GetAccountParams", - "ListBankAccountsV11Params", - "ListBankAccountsParams", "AccountLegacy", "AddressWithDetails", "AppSettings", diff --git a/sumup/merchant/resource.py b/sumup/merchant/resource.py index 75008f1..90a9945 100755 --- a/sumup/merchant/resource.py +++ b/sumup/merchant/resource.py @@ -2,11 +2,9 @@ from .._service import Resource, AsyncResource, HeaderTypes from .._exceptions import APIError from .types import ( - BankAccount, DoingBusinessAsLegacy, MerchantAccount, MerchantProfileLegacy, - MerchantSettings, PersonalProfileLegacy, ) import httpx @@ -27,33 +25,6 @@ class GetAccountParams(pydantic.BaseModel): ) -class ListBankAccountsV11Params(pydantic.BaseModel): - """ - ListBankAccountsV11Params: query parameters for ListBankAccountsV11 - """ - - primary: typing.Optional[bool] = None - - -class ListBankAccountsParams(pydantic.BaseModel): - """ - ListBankAccountsParams: query parameters for ListBankAccounts - """ - - primary: typing.Optional[bool] = None - - -ListBankAccountsV11200Response = list[BankAccount] -""" -ListBankAccountsV11200Response is a schema definition. -""" - -ListBankAccounts200Response = list[BankAccount] -""" -ListBankAccounts200Response is a schema definition. -""" - - class MerchantResource(Resource): def __init__(self, client: httpx.Client): super().__init__(client) @@ -151,75 +122,6 @@ def get_doing_business_as( else: raise APIError("Unexpected response", status=resp.status_code, body=resp.text) - def list_bank_accounts( - self, - merchant_code: str, - params: typing.Optional[ListBankAccountsV11Params] = None, - headers: typing.Optional[HeaderTypes] = None, - ) -> ListBankAccountsV11200Response: - """ - List bank accounts - - Retrieves bank accounts of the merchant. - """ - resp = self._client.get( - f"/v1.1/merchants/{merchant_code}/bank-accounts", - params=params.model_dump(by_alias=True, exclude_none=True) if params else None, - headers=headers, - ) - if resp.status_code == 200: - return pydantic.TypeAdapter(ListBankAccountsV11200Response).validate_python(resp.json()) - elif resp.status_code == 401: - raise APIError("Unauthorized", status=resp.status_code, body=resp.text) - elif resp.status_code == 403: - raise APIError("Forbidden", status=resp.status_code, body=resp.text) - else: - raise APIError("Unexpected response", status=resp.status_code, body=resp.text) - - @typing_extensions.deprecated("This method is deprecated") - def list_bank_accounts_deprecated( - self, - params: typing.Optional[ListBankAccountsParams] = None, - headers: typing.Optional[HeaderTypes] = None, - ) -> ListBankAccounts200Response: - """ - List bank accounts - - Retrieves bank accounts of the merchant. - """ - resp = self._client.get( - "/v0.1/me/merchant-profile/bank-accounts", - params=params.model_dump(by_alias=True, exclude_none=True) if params else None, - headers=headers, - ) - if resp.status_code == 200: - return pydantic.TypeAdapter(ListBankAccounts200Response).validate_python(resp.json()) - elif resp.status_code == 401: - raise APIError("Unauthorized", status=resp.status_code, body=resp.text) - elif resp.status_code == 403: - raise APIError("Forbidden", status=resp.status_code, body=resp.text) - else: - raise APIError("Unexpected response", status=resp.status_code, body=resp.text) - - def get_settings(self, headers: typing.Optional[HeaderTypes] = None) -> MerchantSettings: - """ - Get settings - - Retrieves merchant settings. - """ - resp = self._client.get( - "/v0.1/me/merchant-profile/settings", - headers=headers, - ) - if resp.status_code == 200: - return pydantic.TypeAdapter(MerchantSettings).validate_python(resp.json()) - elif resp.status_code == 401: - raise APIError("Unauthorized", status=resp.status_code, body=resp.text) - elif resp.status_code == 403: - raise APIError("Forbidden", status=resp.status_code, body=resp.text) - else: - raise APIError("Unexpected response", status=resp.status_code, body=resp.text) - class AsyncMerchantResource(AsyncResource): def __init__(self, client: httpx.AsyncClient): @@ -317,72 +219,3 @@ async def get_doing_business_as( raise APIError("Unauthorized", status=resp.status_code, body=resp.text) else: raise APIError("Unexpected response", status=resp.status_code, body=resp.text) - - async def list_bank_accounts( - self, - merchant_code: str, - params: typing.Optional[ListBankAccountsV11Params] = None, - headers: typing.Optional[HeaderTypes] = None, - ) -> ListBankAccountsV11200Response: - """ - List bank accounts - - Retrieves bank accounts of the merchant. - """ - resp = await self._client.get( - f"/v1.1/merchants/{merchant_code}/bank-accounts", - params=params.model_dump(by_alias=True, exclude_none=True) if params else None, - headers=headers, - ) - if resp.status_code == 200: - return pydantic.TypeAdapter(ListBankAccountsV11200Response).validate_python(resp.json()) - elif resp.status_code == 401: - raise APIError("Unauthorized", status=resp.status_code, body=resp.text) - elif resp.status_code == 403: - raise APIError("Forbidden", status=resp.status_code, body=resp.text) - else: - raise APIError("Unexpected response", status=resp.status_code, body=resp.text) - - @typing_extensions.deprecated("This method is deprecated") - async def list_bank_accounts_deprecated( - self, - params: typing.Optional[ListBankAccountsParams] = None, - headers: typing.Optional[HeaderTypes] = None, - ) -> ListBankAccounts200Response: - """ - List bank accounts - - Retrieves bank accounts of the merchant. - """ - resp = await self._client.get( - "/v0.1/me/merchant-profile/bank-accounts", - params=params.model_dump(by_alias=True, exclude_none=True) if params else None, - headers=headers, - ) - if resp.status_code == 200: - return pydantic.TypeAdapter(ListBankAccounts200Response).validate_python(resp.json()) - elif resp.status_code == 401: - raise APIError("Unauthorized", status=resp.status_code, body=resp.text) - elif resp.status_code == 403: - raise APIError("Forbidden", status=resp.status_code, body=resp.text) - else: - raise APIError("Unexpected response", status=resp.status_code, body=resp.text) - - async def get_settings(self, headers: typing.Optional[HeaderTypes] = None) -> MerchantSettings: - """ - Get settings - - Retrieves merchant settings. - """ - resp = await self._client.get( - "/v0.1/me/merchant-profile/settings", - headers=headers, - ) - if resp.status_code == 200: - return pydantic.TypeAdapter(MerchantSettings).validate_python(resp.json()) - elif resp.status_code == 401: - raise APIError("Unauthorized", status=resp.status_code, body=resp.text) - elif resp.status_code == 403: - raise APIError("Forbidden", status=resp.status_code, body=resp.text) - else: - raise APIError("Unexpected response", status=resp.status_code, body=resp.text)