Skip to content

Commit

Permalink
Release 0.2.15
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Sep 26, 2023
1 parent 15321d4 commit 28a61e6
Show file tree
Hide file tree
Showing 20 changed files with 780 additions and 23 deletions.
2 changes: 1 addition & 1 deletion pyproject.toml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
[tool.poetry]
name = "mercoa"
version = "v0.2.14"
version = "v0.2.15"
description = ""
readme = "README.md"
authors = []
Expand Down
8 changes: 8 additions & 0 deletions src/mercoa/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,8 @@
CommentId,
CommentRequest,
CommentResponse,
CounterpartiesResponse,
CounterpartyNetworkType,
CounterpartyResponse,
CurrencyCode,
CustomPaymentMethodRequest,
Expand All @@ -54,7 +56,9 @@
EmailSenderRequest,
EmailSenderResponse,
EntityAddPayeesRequest,
EntityAddPayorsRequest,
EntityArchivePayeesRequest,
EntityArchivePayorsRequest,
EntityError,
EntityForeignIdAlreadyExists,
EntityId,
Expand Down Expand Up @@ -234,6 +238,8 @@
"CommentId",
"CommentRequest",
"CommentResponse",
"CounterpartiesResponse",
"CounterpartyNetworkType",
"CounterpartyResponse",
"CurrencyCode",
"CustomPaymentMethodRequest",
Expand All @@ -249,7 +255,9 @@
"EmailSenderRequest",
"EmailSenderResponse",
"EntityAddPayeesRequest",
"EntityAddPayorsRequest",
"EntityArchivePayeesRequest",
"EntityArchivePayorsRequest",
"EntityError",
"EntityForeignIdAlreadyExists",
"EntityId",
Expand Down
2 changes: 1 addition & 1 deletion src/mercoa/core/client_wrapper.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ def get_headers(self) -> typing.Dict[str, str]:
headers: typing.Dict[str, str] = {
"X-Fern-Language": "Python",
"X-Fern-SDK-Name": "mercoa",
"X-Fern-SDK-Version": "v0.2.14",
"X-Fern-SDK-Version": "v0.2.15",
}
headers["Authorization"] = f"Bearer {self._get_token()}"
return headers
Expand Down
8 changes: 8 additions & 0 deletions src/mercoa/resources/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -44,10 +44,14 @@
BusinessProfileRequest,
BusinessProfileResponse,
BusinessType,
CounterpartiesResponse,
CounterpartyNetworkType,
CounterpartyResponse,
Ein,
EntityAddPayeesRequest,
EntityAddPayorsRequest,
EntityArchivePayeesRequest,
EntityArchivePayorsRequest,
EntityError,
EntityForeignIdAlreadyExists,
EntityId,
Expand Down Expand Up @@ -238,6 +242,8 @@
"CommentId",
"CommentRequest",
"CommentResponse",
"CounterpartiesResponse",
"CounterpartyNetworkType",
"CounterpartyResponse",
"CurrencyCode",
"CustomPaymentMethodRequest",
Expand All @@ -253,7 +259,9 @@
"EmailSenderRequest",
"EmailSenderResponse",
"EntityAddPayeesRequest",
"EntityAddPayorsRequest",
"EntityArchivePayeesRequest",
"EntityArchivePayorsRequest",
"EntityError",
"EntityForeignIdAlreadyExists",
"EntityId",
Expand Down
150 changes: 150 additions & 0 deletions src/mercoa/resources/entity/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,9 @@
from ..entity_types.errors.invalid_tax_id import InvalidTaxId
from ..entity_types.errors.token_generation_failed import TokenGenerationFailed
from ..entity_types.types.entity_add_payees_request import EntityAddPayeesRequest
from ..entity_types.types.entity_add_payors_request import EntityAddPayorsRequest
from ..entity_types.types.entity_archive_payees_request import EntityArchivePayeesRequest
from ..entity_types.types.entity_archive_payors_request import EntityArchivePayorsRequest
from ..entity_types.types.entity_id import EntityId
from ..entity_types.types.entity_onboarding_link_type import EntityOnboardingLinkType
from ..entity_types.types.entity_request import EntityRequest
Expand Down Expand Up @@ -583,6 +585,80 @@ def archive_payees(self, entity_id: EntityId, *, request: EntityArchivePayeesReq
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

def add_payors(self, entity_id: EntityId, *, request: EntityAddPayorsRequest) -> None:
"""
Create association between Entity and a given list of Payors. If a Payor has previously been archived, unarchives the Payor.
Parameters:
- entity_id: EntityId.
- request: EntityAddPayorsRequest.
"""
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/addPayors"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
if "errorName" in _response_json:
if _response_json["errorName"] == "AuthHeaderMissingError":
raise AuthHeaderMissingError()
if _response_json["errorName"] == "AuthHeaderMalformedError":
raise AuthHeaderMalformedError(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Unauthorized":
raise Unauthorized(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Forbidden":
raise Forbidden(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "NotFound":
raise NotFound(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Unimplemented":
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

def archive_payors(self, entity_id: EntityId, *, request: EntityArchivePayorsRequest) -> None:
"""
Marks Payors as unsearchable by Entity via Counterparty search. Invoices associated with these Payors will still be searchable via Invoice search.
Parameters:
- entity_id: EntityId.
- request: EntityArchivePayorsRequest.
"""
_response = self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/archivePayors"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
if "errorName" in _response_json:
if _response_json["errorName"] == "AuthHeaderMissingError":
raise AuthHeaderMissingError()
if _response_json["errorName"] == "AuthHeaderMalformedError":
raise AuthHeaderMalformedError(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Unauthorized":
raise Unauthorized(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Forbidden":
raise Forbidden(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "NotFound":
raise NotFound(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Unimplemented":
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

def get_onboarding_link(
self,
entity_id: EntityId,
Expand Down Expand Up @@ -1212,6 +1288,80 @@ async def archive_payees(self, entity_id: EntityId, *, request: EntityArchivePay
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

async def add_payors(self, entity_id: EntityId, *, request: EntityAddPayorsRequest) -> None:
"""
Create association between Entity and a given list of Payors. If a Payor has previously been archived, unarchives the Payor.
Parameters:
- entity_id: EntityId.
- request: EntityAddPayorsRequest.
"""
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/addPayors"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
if "errorName" in _response_json:
if _response_json["errorName"] == "AuthHeaderMissingError":
raise AuthHeaderMissingError()
if _response_json["errorName"] == "AuthHeaderMalformedError":
raise AuthHeaderMalformedError(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Unauthorized":
raise Unauthorized(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Forbidden":
raise Forbidden(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "NotFound":
raise NotFound(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Unimplemented":
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

async def archive_payors(self, entity_id: EntityId, *, request: EntityArchivePayorsRequest) -> None:
"""
Marks Payors as unsearchable by Entity via Counterparty search. Invoices associated with these Payors will still be searchable via Invoice search.
Parameters:
- entity_id: EntityId.
- request: EntityArchivePayorsRequest.
"""
_response = await self._client_wrapper.httpx_client.request(
"POST",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/archivePayors"),
json=jsonable_encoder(request),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
if 200 <= _response.status_code < 300:
return
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
if "errorName" in _response_json:
if _response_json["errorName"] == "AuthHeaderMissingError":
raise AuthHeaderMissingError()
if _response_json["errorName"] == "AuthHeaderMalformedError":
raise AuthHeaderMalformedError(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Unauthorized":
raise Unauthorized(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Forbidden":
raise Forbidden(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "NotFound":
raise NotFound(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
if _response_json["errorName"] == "Unimplemented":
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

async def get_onboarding_link(
self,
entity_id: EntityId,
Expand Down
Loading

0 comments on commit 28a61e6

Please sign in to comment.