Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
20,648 changes: 10,163 additions & 10,485 deletions openapi.json

Large diffs are not rendered by default.

2 changes: 2 additions & 0 deletions sumup/checkouts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
CheckoutAccepted,
CheckoutCreateRequest,
CheckoutSuccess,
CheckoutUpdateRequest,
Currency,
DetailsError,
EntryMode,
Expand Down Expand Up @@ -46,6 +47,7 @@
"CheckoutAccepted",
"CheckoutCreateRequest",
"CheckoutSuccess",
"CheckoutUpdateRequest",
"Currency",
"DetailsError",
"EntryMode",
Expand Down
169 changes: 169 additions & 0 deletions sumup/checkouts/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
CheckoutAccepted,
CheckoutCreateRequest,
CheckoutSuccess,
CheckoutUpdateRequest,
Currency,
DetailsError,
EntryMode,
Expand All @@ -58,6 +59,7 @@
CardInput,
CardTypeInput,
CheckoutCreateRequestInput,
CheckoutUpdateRequestInput,
CurrencyInput,
HostedCheckoutInput,
MandatePayloadInput,
Expand Down Expand Up @@ -165,6 +167,61 @@ class CreateCheckoutBodyInput(typing_extensions.TypedDict, total=False):
]


class UpdateCheckoutBodyInput(typing_extensions.TypedDict, total=False):
"""
Request body for updating an existing checkout. Include only the fields that should be changed.
"""

amount: typing_extensions.NotRequired[
typing_extensions.Annotated[
float,
typing_extensions.Doc(
"Updated amount to be charged to the payer, expressed in major units."
),
]
]
checkout_reference: typing_extensions.NotRequired[
typing_extensions.Annotated[
str,
typing_extensions.Doc(
"Updated merchant-defined reference for the checkout.\nMax length: 90"
),
]
]
currency: typing_extensions.NotRequired[
typing_extensions.Annotated[
CurrencyInput,
typing_extensions.Doc(
"Three-letter [ISO4217](https://en.wikipedia.org/wiki/ISO_4217) code of the currency for the amount. Currently supportedcurrency values are enumerated above."
),
]
]
customer_id: typing_extensions.NotRequired[
typing_extensions.Annotated[
str,
typing_extensions.Doc(
"Updated merchant-scoped customer identifier associated with the checkout."
),
]
]
description: typing_extensions.NotRequired[
typing_extensions.Annotated[
str,
typing_extensions.Doc(
"Updated short merchant-defined description shown in SumUp tools and reporting."
),
]
]
valid_until: typing_extensions.NotRequired[
typing_extensions.Annotated[
datetime.datetime,
typing_extensions.Doc(
"Updated expiration timestamp. The checkout must be processed before this moment, otherwise it becomes unusable."
),
]
]


ProcessCheckoutBodyPaymentTypeInput = typing.Union[
typing.Literal["apple_pay", "bancontact", "blik", "boleto", "card", "google_pay", "ideal"], str
]
Expand Down Expand Up @@ -508,6 +565,62 @@ def get(
else:
raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text)

def update(
self,
checkout_id: str,
*,
amount: typing.Union[float, None, NotGivenType] = NOT_GIVEN,
currency: typing.Union[CurrencyInput, None, NotGivenType] = NOT_GIVEN,
description: typing.Union[str, None, NotGivenType] = NOT_GIVEN,
checkout_reference: typing.Union[str, None, NotGivenType] = NOT_GIVEN,
valid_until: typing.Union[datetime.datetime, None, NotGivenType] = NOT_GIVEN,
customer_id: typing.Union[str, None, NotGivenType] = NOT_GIVEN,
headers: typing.Optional[HeaderTypes] = None,
) -> Checkout:
"""
Update a checkout

Updates an identified checkout resource.


Raises:
APIError: Raised when the API returns one of the documented error responses:
401: The request is not authorized.
404: The requested resource does not exist.
Unexpected response statuses also raise this exception.
"""
body_data: dict[str, typing.Any] = {}
if not isinstance(amount, NotGivenType):
body_data["amount"] = amount
if not isinstance(currency, NotGivenType):
body_data["currency"] = currency
if not isinstance(description, NotGivenType):
body_data["description"] = description
if not isinstance(checkout_reference, NotGivenType):
body_data["checkout_reference"] = checkout_reference
if not isinstance(valid_until, NotGivenType):
body_data["valid_until"] = valid_until
if not isinstance(customer_id, NotGivenType):
body_data["customer_id"] = customer_id

resp = self._client.patch(
f"/v0.1/checkouts/{checkout_id}",
json=serialize_request_data(body_data),
headers=headers,
)
if resp.status_code == 200:
return pydantic.TypeAdapter(Checkout).validate_python(resp.json())
elif resp.status_code == 401:
raise APIError(
"The request is not authorized.", status=resp.status_code, body=resp.text
)
elif resp.status_code == 404:
raise APIError(
"The requested resource does not exist.", status=resp.status_code, body=resp.text
)
else:
raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text)

def process(
self,
checkout_id: str,
Expand Down Expand Up @@ -875,6 +988,62 @@ async def get(
else:
raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text)

async def update(
self,
checkout_id: str,
*,
amount: typing.Union[float, None, NotGivenType] = NOT_GIVEN,
currency: typing.Union[CurrencyInput, None, NotGivenType] = NOT_GIVEN,
description: typing.Union[str, None, NotGivenType] = NOT_GIVEN,
checkout_reference: typing.Union[str, None, NotGivenType] = NOT_GIVEN,
valid_until: typing.Union[datetime.datetime, None, NotGivenType] = NOT_GIVEN,
customer_id: typing.Union[str, None, NotGivenType] = NOT_GIVEN,
headers: typing.Optional[HeaderTypes] = None,
) -> Checkout:
"""
Update a checkout

Updates an identified checkout resource.


Raises:
APIError: Raised when the API returns one of the documented error responses:
401: The request is not authorized.
404: The requested resource does not exist.
Unexpected response statuses also raise this exception.
"""
body_data: dict[str, typing.Any] = {}
if not isinstance(amount, NotGivenType):
body_data["amount"] = amount
if not isinstance(currency, NotGivenType):
body_data["currency"] = currency
if not isinstance(description, NotGivenType):
body_data["description"] = description
if not isinstance(checkout_reference, NotGivenType):
body_data["checkout_reference"] = checkout_reference
if not isinstance(valid_until, NotGivenType):
body_data["valid_until"] = valid_until
if not isinstance(customer_id, NotGivenType):
body_data["customer_id"] = customer_id

resp = await self._client.patch(
f"/v0.1/checkouts/{checkout_id}",
json=serialize_request_data(body_data),
headers=headers,
)
if resp.status_code == 200:
return pydantic.TypeAdapter(Checkout).validate_python(resp.json())
elif resp.status_code == 401:
raise APIError(
"The request is not authorized.", status=resp.status_code, body=resp.text
)
elif resp.status_code == 404:
raise APIError(
"The requested resource does not exist.", status=resp.status_code, body=resp.text
)
else:
raise APIError(f"Unexpected response", status=resp.status_code, body=resp.text)

async def process(
self,
checkout_id: str,
Expand Down
18 changes: 13 additions & 5 deletions sumup/members/resource.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,13 +42,16 @@ class CreateMerchantMemberBodyInput(typing_extensions.TypedDict, total=False):

email: typing_extensions.Required[
typing_extensions.Annotated[
str, typing_extensions.Doc("Email address of the member to add.\nFormat: email")
str,
typing_extensions.Doc(
"Email address of the member to add.\nFormat: email\nMax length: 256"
),
]
]
roles: typing_extensions.Required[
typing_extensions.Annotated[
typing.Sequence[str],
typing_extensions.Doc("List of roles to assign to the new member."),
typing_extensions.Doc("List of roles to assign to the new member.\nMax items: 124"),
]
]
attributes: typing_extensions.NotRequired[
Expand Down Expand Up @@ -79,7 +82,7 @@ class CreateMerchantMemberBodyInput(typing_extensions.TypedDict, total=False):
typing_extensions.Annotated[
str,
typing_extensions.Doc(
"Nickname of the member to add. Only used if `is_managed_user` is true. Used for display purposes only."
"Nickname of the member to add. Only used if `is_managed_user` is true. Used for display purposes only.\nMax length: 64"
),
]
]
Expand All @@ -100,7 +103,10 @@ class UpdateMerchantMemberBodyUserInput(typing_extensions.TypedDict, total=False

nickname: typing_extensions.NotRequired[
typing_extensions.Annotated[
str, typing_extensions.Doc("User's nickname. Used for display purposes only.")
str,
typing_extensions.Doc(
"User's nickname. Used for display purposes only.\nMax length: 64"
),
]
]
password: typing_extensions.NotRequired[
Expand Down Expand Up @@ -134,7 +140,9 @@ class UpdateMerchantMemberBodyInput(typing_extensions.TypedDict, total=False):
),
]
]
roles: typing_extensions.NotRequired[typing.Sequence[str]]
roles: typing_extensions.NotRequired[
typing_extensions.Annotated[typing.Sequence[str], typing_extensions.Doc("Max items: 124")]
]
user: typing_extensions.NotRequired[
typing_extensions.Annotated[
UpdateMerchantMemberBodyUserInput,
Expand Down
22 changes: 11 additions & 11 deletions sumup/merchants/resource.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Code generated by `py-sdk-gen`. DO NOT EDIT.
# ruff: noqa: F401, F541
"""
Merchant account represents a single business entity at SumUp.
A Merchant represents a single business which can use SumUp products like payment processing.
"""

from __future__ import annotations
Expand Down Expand Up @@ -61,9 +61,9 @@ def get(
headers: typing.Optional[HeaderTypes] = None,
) -> Merchant:
"""
Retrieve a Merchant
Get Merchant

Retrieve a merchant.
Returns a Merchant for a valid Merchant code.

Merchant documentation: https://developer.sumup.com/tools/models/merchant

Expand Down Expand Up @@ -101,7 +101,7 @@ def list_persons(
"""
List Persons

Returns a list of persons related to the merchant.
Returns the Persons related to a Merchant.

Persons documentation: https://developer.sumup.com/tools/models/merchant#persons

Expand Down Expand Up @@ -138,9 +138,9 @@ def get_person(
headers: typing.Optional[HeaderTypes] = None,
) -> Person:
"""
Retrieve a Person
Get Person

Returns a single person related to the merchant.
Returns a single Person related to a Merchant.

Persons documentation: https://developer.sumup.com/tools/models/merchant#persons

Expand Down Expand Up @@ -183,9 +183,9 @@ async def get(
headers: typing.Optional[HeaderTypes] = None,
) -> Merchant:
"""
Retrieve a Merchant
Get Merchant

Retrieve a merchant.
Returns a Merchant for a valid Merchant code.

Merchant documentation: https://developer.sumup.com/tools/models/merchant

Expand Down Expand Up @@ -223,7 +223,7 @@ async def list_persons(
"""
List Persons

Returns a list of persons related to the merchant.
Returns the Persons related to a Merchant.

Persons documentation: https://developer.sumup.com/tools/models/merchant#persons

Expand Down Expand Up @@ -260,9 +260,9 @@ async def get_person(
headers: typing.Optional[HeaderTypes] = None,
) -> Person:
"""
Retrieve a Person
Get Person

Returns a single person related to the merchant.
Returns a single Person related to a Merchant.

Persons documentation: https://developer.sumup.com/tools/models/merchant#persons

Expand Down
12 changes: 6 additions & 6 deletions sumup/receipts/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,16 +5,16 @@
)
from ..types import (
Error,
EventId,
EventStatus,
EventType,
Problem,
Receipt,
ReceiptCard,
ReceiptEvent,
ReceiptMerchantData,
ReceiptReader,
ReceiptTransaction,
TransactionEventId,
TransactionEventStatus,
TransactionEventType,
TransactionId,
)

Expand All @@ -23,15 +23,15 @@
"ReceiptsResource",
"AsyncReceiptsResource",
"Error",
"EventId",
"EventStatus",
"EventType",
"Problem",
"Receipt",
"ReceiptCard",
"ReceiptEvent",
"ReceiptMerchantData",
"ReceiptReader",
"ReceiptTransaction",
"TransactionEventId",
"TransactionEventStatus",
"TransactionEventType",
"TransactionId",
]
Loading
Loading