Skip to content

Commit

Permalink
Release v0.3.7
Browse files Browse the repository at this point in the history
  • Loading branch information
fern-api[bot] committed Dec 19, 2023
1 parent b4d7a7a commit 4f04d90
Show file tree
Hide file tree
Showing 5 changed files with 80 additions and 4 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 = "0.3.6"
version = "v0.3.7"
description = ""
readme = "README.md"
authors = []
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": "0.3.6",
"X-Fern-SDK-Version": "v0.3.7",
}
headers["Authorization"] = f"Bearer {self._get_token()}"
return headers
Expand Down
72 changes: 72 additions & 0 deletions src/mercoa/resources/entity/client.py
Original file line number Diff line number Diff line change
Expand Up @@ -422,6 +422,42 @@ def get_token(self, entity_id: EntityId, *, request: TokenGenerationOptions) ->
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

def plaid_link_token(self, entity_id: EntityId) -> str:
"""
Get a Plaid link token for an entity. This token can be used to add a bank account to the entity using Plaid Link.
Parameters:
- entity_id: EntityId.
"""
_response = self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/plaidLinkToken"),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(str, _response_json) # type: ignore
if "errorName" in _response_json:
if _response_json["errorName"] == "TokenGenerationFailed":
raise TokenGenerationFailed(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
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 @@ -895,6 +931,42 @@ async def get_token(self, entity_id: EntityId, *, request: TokenGenerationOption
raise Unimplemented(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
raise ApiError(status_code=_response.status_code, body=_response_json)

async def plaid_link_token(self, entity_id: EntityId) -> str:
"""
Get a Plaid link token for an entity. This token can be used to add a bank account to the entity using Plaid Link.
Parameters:
- entity_id: EntityId.
"""
_response = await self._client_wrapper.httpx_client.request(
"GET",
urllib.parse.urljoin(f"{self._client_wrapper.get_base_url()}/", f"entity/{entity_id}/plaidLinkToken"),
headers=self._client_wrapper.get_headers(),
timeout=60,
)
try:
_response_json = _response.json()
except JSONDecodeError:
raise ApiError(status_code=_response.status_code, body=_response.text)
if 200 <= _response.status_code < 300:
return pydantic.parse_obj_as(str, _response_json) # type: ignore
if "errorName" in _response_json:
if _response_json["errorName"] == "TokenGenerationFailed":
raise TokenGenerationFailed(pydantic.parse_obj_as(str, _response_json["content"])) # type: ignore
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
Original file line number Diff line number Diff line change
Expand Up @@ -199,6 +199,8 @@ def update(

def delete(self, entity_id: EntityId, payment_method_id: PaymentMethodId) -> None:
"""
Mark a payment method as inactive. This will not remove the payment method from the system, but will prevent it from being used in the future.
Parameters:
- entity_id: EntityId.
Expand Down Expand Up @@ -491,6 +493,8 @@ async def update(

async def delete(self, entity_id: EntityId, payment_method_id: PaymentMethodId) -> None:
"""
Mark a payment method as inactive. This will not remove the payment method from the system, but will prevent it from being used in the future.
Parameters:
- entity_id: EntityId.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -16,11 +16,11 @@ class InvoiceLineItemRequest(pydantic.BaseModel):
id: typing.Optional[str] = pydantic.Field(
description="If provided, will overwrite line item on the invoice with this ID. If not provided, will create a new line item."
)
amount: typing.Optional[float] = pydantic.Field(
amount: float = pydantic.Field(
description="Total amount of line item in major units. If the entered amount has more decimal places than the currency supports, trailing decimals will be truncated."
)
currency: typing.Optional[CurrencyCode]
description: typing.Optional[str]
description: str
name: typing.Optional[str]
quantity: typing.Optional[int]
unit_price: typing.Optional[float] = pydantic.Field(
Expand Down

0 comments on commit 4f04d90

Please sign in to comment.