mollie-api-py 1.1.1__py3-none-any.whl → 1.1.3__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -0,0 +1,40 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from mollie.types import BaseModel
5
+ from mollie.utils import FieldMetadata, HeaderMetadata, PathParamMetadata
6
+ import pydantic
7
+ from typing import Optional
8
+ from typing_extensions import Annotated, NotRequired, TypedDict
9
+
10
+
11
+ class PaymentGetRouteRequestTypedDict(TypedDict):
12
+ payment_id: str
13
+ r"""Provide the ID of the related payment."""
14
+ route_id: str
15
+ r"""Provide the ID of the route."""
16
+ idempotency_key: NotRequired[str]
17
+ r"""A unique key to ensure idempotent requests. This key should be a UUID v4 string."""
18
+
19
+
20
+ class PaymentGetRouteRequest(BaseModel):
21
+ payment_id: Annotated[
22
+ str,
23
+ pydantic.Field(alias="paymentId"),
24
+ FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
25
+ ]
26
+ r"""Provide the ID of the related payment."""
27
+
28
+ route_id: Annotated[
29
+ str,
30
+ pydantic.Field(alias="routeId"),
31
+ FieldMetadata(path=PathParamMetadata(style="simple", explode=False)),
32
+ ]
33
+ r"""Provide the ID of the route."""
34
+
35
+ idempotency_key: Annotated[
36
+ Optional[str],
37
+ pydantic.Field(alias="idempotency-key"),
38
+ FieldMetadata(header=HeaderMetadata(style="simple", explode=False)),
39
+ ] = None
40
+ r"""A unique key to ensure idempotent requests. This key should be a UUID v4 string."""
@@ -0,0 +1,50 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .amount import Amount, AmountTypedDict
5
+ from .route_destination_type import RouteDestinationType
6
+ from mollie.types import BaseModel
7
+ import pydantic
8
+ from typing import Optional
9
+ from typing_extensions import Annotated, NotRequired, TypedDict
10
+
11
+
12
+ class RouteCreateRequestDestinationTypedDict(TypedDict):
13
+ r"""The destination of the route."""
14
+
15
+ type: RouteDestinationType
16
+ r"""The type of destination. Currently only the destination type `organization` is supported."""
17
+ organization_id: str
18
+
19
+
20
+ class RouteCreateRequestDestination(BaseModel):
21
+ r"""The destination of the route."""
22
+
23
+ type: RouteDestinationType
24
+ r"""The type of destination. Currently only the destination type `organization` is supported."""
25
+
26
+ organization_id: Annotated[str, pydantic.Field(alias="organizationId")]
27
+
28
+
29
+ class RouteCreateRequestTypedDict(TypedDict):
30
+ r"""Payload to create a new delayed route for a payment."""
31
+
32
+ amount: AmountTypedDict
33
+ r"""In v2 endpoints, monetary amounts are represented as objects with a `currency` and `value` field."""
34
+ destination: RouteCreateRequestDestinationTypedDict
35
+ r"""The destination of the route."""
36
+ description: NotRequired[str]
37
+ r"""Description shown in reports."""
38
+
39
+
40
+ class RouteCreateRequest(BaseModel):
41
+ r"""Payload to create a new delayed route for a payment."""
42
+
43
+ amount: Amount
44
+ r"""In v2 endpoints, monetary amounts are represented as objects with a `currency` and `value` field."""
45
+
46
+ destination: RouteCreateRequestDestination
47
+ r"""The destination of the route."""
48
+
49
+ description: Optional[str] = None
50
+ r"""Description shown in reports."""
@@ -8,7 +8,8 @@ from mollie.types import BaseModel
8
8
  from mollie.utils import validate_open_enum
9
9
  import pydantic
10
10
  from pydantic.functional_validators import PlainValidator
11
- from typing_extensions import Annotated, TypedDict
11
+ from typing import Optional
12
+ from typing_extensions import Annotated, NotRequired, TypedDict
12
13
 
13
14
 
14
15
  class RouteCreateResponseDestinationTypedDict(TypedDict):
@@ -37,6 +38,8 @@ class RouteCreateResponseLinksTypedDict(TypedDict):
37
38
  r"""In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field."""
38
39
  documentation: URLTypedDict
39
40
  r"""In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field."""
41
+ payment: URLTypedDict
42
+ r"""In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field."""
40
43
 
41
44
 
42
45
  class RouteCreateResponseLinks(BaseModel):
@@ -48,6 +51,9 @@ class RouteCreateResponseLinks(BaseModel):
48
51
  documentation: URL
49
52
  r"""In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field."""
50
53
 
54
+ payment: URL
55
+ r"""In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field."""
56
+
51
57
 
52
58
  class RouteCreateResponseTypedDict(TypedDict):
53
59
  resource: str
@@ -62,12 +68,14 @@ class RouteCreateResponseTypedDict(TypedDict):
62
68
  """
63
69
  amount: AmountTypedDict
64
70
  r"""In v2 endpoints, monetary amounts are represented as objects with a `currency` and `value` field."""
65
- description: str
66
- r"""The description of the route. This description is shown in the reports."""
67
71
  destination: RouteCreateResponseDestinationTypedDict
68
72
  r"""The destination of the route."""
73
+ created_at: str
74
+ r"""The entity's date and time of creation, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format."""
69
75
  links: RouteCreateResponseLinksTypedDict
70
76
  r"""An object with several relevant URLs. Every URL object will contain an `href` and a `type` field."""
77
+ description: NotRequired[str]
78
+ r"""The description of the route. This description is shown in the reports."""
71
79
 
72
80
 
73
81
  class RouteCreateResponse(BaseModel):
@@ -87,11 +95,14 @@ class RouteCreateResponse(BaseModel):
87
95
  amount: Amount
88
96
  r"""In v2 endpoints, monetary amounts are represented as objects with a `currency` and `value` field."""
89
97
 
90
- description: str
91
- r"""The description of the route. This description is shown in the reports."""
92
-
93
98
  destination: RouteCreateResponseDestination
94
99
  r"""The destination of the route."""
95
100
 
101
+ created_at: Annotated[str, pydantic.Field(alias="createdAt")]
102
+ r"""The entity's date and time of creation, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format."""
103
+
96
104
  links: Annotated[RouteCreateResponseLinks, pydantic.Field(alias="_links")]
97
105
  r"""An object with several relevant URLs. Every URL object will contain an `href` and a `type` field."""
106
+
107
+ description: Optional[str] = None
108
+ r"""The description of the route. This description is shown in the reports."""
@@ -0,0 +1,107 @@
1
+ """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
+
3
+ from __future__ import annotations
4
+ from .amount import Amount, AmountTypedDict
5
+ from .route_destination_type_response import RouteDestinationTypeResponse
6
+ from .url import URL, URLTypedDict
7
+ from mollie.types import BaseModel
8
+ from mollie.utils import validate_open_enum
9
+ import pydantic
10
+ from pydantic.functional_validators import PlainValidator
11
+ from typing_extensions import Annotated, TypedDict
12
+
13
+
14
+ class RouteGetResponseDestinationTypedDict(TypedDict):
15
+ r"""The destination of the route."""
16
+
17
+ type: RouteDestinationTypeResponse
18
+ r"""The type of destination. Currently only the destination type `organization` is supported."""
19
+ organization_id: str
20
+
21
+
22
+ class RouteGetResponseDestination(BaseModel):
23
+ r"""The destination of the route."""
24
+
25
+ type: Annotated[
26
+ RouteDestinationTypeResponse, PlainValidator(validate_open_enum(False))
27
+ ]
28
+ r"""The type of destination. Currently only the destination type `organization` is supported."""
29
+
30
+ organization_id: Annotated[str, pydantic.Field(alias="organizationId")]
31
+
32
+
33
+ class RouteGetResponseLinksTypedDict(TypedDict):
34
+ r"""An object with several relevant URLs. Every URL object will contain an `href` and a `type` field."""
35
+
36
+ self_: URLTypedDict
37
+ r"""In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field."""
38
+ documentation: URLTypedDict
39
+ r"""In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field."""
40
+ payment: URLTypedDict
41
+ r"""In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field."""
42
+
43
+
44
+ class RouteGetResponseLinks(BaseModel):
45
+ r"""An object with several relevant URLs. Every URL object will contain an `href` and a `type` field."""
46
+
47
+ self_: Annotated[URL, pydantic.Field(alias="self")]
48
+ r"""In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field."""
49
+
50
+ documentation: URL
51
+ r"""In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field."""
52
+
53
+ payment: URL
54
+ r"""In v2 endpoints, URLs are commonly represented as objects with an `href` and `type` field."""
55
+
56
+
57
+ class RouteGetResponseTypedDict(TypedDict):
58
+ resource: str
59
+ r"""Indicates the response contains a route object. Will always contain the string `route` for this endpoint."""
60
+ id: str
61
+ r"""The identifier uniquely referring to this route. Mollie assigns this identifier at route creation time. Mollie
62
+ will always refer to the route by this ID. Example: `crt_dyARQ3JzCgtPDhU2Pbq3J`.
63
+ """
64
+ payment_id: str
65
+ r"""The unique identifier of the payment. For example: `tr_5B8cwPMGnU6qLbRvo7qEZo`.
66
+ The full payment object can be retrieved via the payment URL in the `_links` object.
67
+ """
68
+ amount: AmountTypedDict
69
+ r"""In v2 endpoints, monetary amounts are represented as objects with a `currency` and `value` field."""
70
+ description: str
71
+ r"""The description of the route. This description is shown in the reports."""
72
+ destination: RouteGetResponseDestinationTypedDict
73
+ r"""The destination of the route."""
74
+ created_at: str
75
+ r"""The entity's date and time of creation, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format."""
76
+ links: RouteGetResponseLinksTypedDict
77
+ r"""An object with several relevant URLs. Every URL object will contain an `href` and a `type` field."""
78
+
79
+
80
+ class RouteGetResponse(BaseModel):
81
+ resource: str
82
+ r"""Indicates the response contains a route object. Will always contain the string `route` for this endpoint."""
83
+
84
+ id: str
85
+ r"""The identifier uniquely referring to this route. Mollie assigns this identifier at route creation time. Mollie
86
+ will always refer to the route by this ID. Example: `crt_dyARQ3JzCgtPDhU2Pbq3J`.
87
+ """
88
+
89
+ payment_id: Annotated[str, pydantic.Field(alias="paymentId")]
90
+ r"""The unique identifier of the payment. For example: `tr_5B8cwPMGnU6qLbRvo7qEZo`.
91
+ The full payment object can be retrieved via the payment URL in the `_links` object.
92
+ """
93
+
94
+ amount: Amount
95
+ r"""In v2 endpoints, monetary amounts are represented as objects with a `currency` and `value` field."""
96
+
97
+ description: str
98
+ r"""The description of the route. This description is shown in the reports."""
99
+
100
+ destination: RouteGetResponseDestination
101
+ r"""The destination of the route."""
102
+
103
+ created_at: Annotated[str, pydantic.Field(alias="createdAt")]
104
+ r"""The entity's date and time of creation, in [ISO 8601](https://en.wikipedia.org/wiki/ISO_8601) format."""
105
+
106
+ links: Annotated[RouteGetResponseLinks, pydantic.Field(alias="_links")]
107
+ r"""An object with several relevant URLs. Every URL object will contain an `href` and a `type` field."""
@@ -1,25 +1,105 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from .entity_customer import EntityCustomer, EntityCustomerTypedDict
5
- from mollie.types import BaseModel
4
+ from .locale_response import LocaleResponse
5
+ from .metadata import Metadata, MetadataTypedDict
6
+ from mollie.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
6
7
  from mollie.utils import (
7
8
  FieldMetadata,
8
9
  HeaderMetadata,
9
10
  PathParamMetadata,
10
11
  RequestMetadata,
12
+ validate_open_enum,
11
13
  )
12
14
  import pydantic
15
+ from pydantic import model_serializer
16
+ from pydantic.functional_validators import PlainValidator
13
17
  from typing import Optional
14
18
  from typing_extensions import Annotated, NotRequired, TypedDict
15
19
 
16
20
 
21
+ class UpdateCustomerRequestBodyTypedDict(TypedDict):
22
+ name: NotRequired[Nullable[str]]
23
+ r"""The full name of the customer."""
24
+ email: NotRequired[Nullable[str]]
25
+ r"""The email address of the customer."""
26
+ locale: NotRequired[Nullable[LocaleResponse]]
27
+ r"""Allows you to preset the language to be used."""
28
+ metadata: NotRequired[Nullable[MetadataTypedDict]]
29
+ r"""Provide any data you like, for example a string or a JSON object. We will save the data alongside the entity. Whenever
30
+ you fetch the entity with our API, we will also include the metadata. You can use up to approximately 1kB.
31
+ """
32
+ testmode: NotRequired[bool]
33
+ r"""Whether the entity was created in test mode or live mode. This field does not update the mode of the entity.
34
+
35
+ Most API credentials are specifically created for either live mode or test mode, in which case this parameter can be
36
+ omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting
37
+ `testmode` to `true`.
38
+ """
39
+
40
+
41
+ class UpdateCustomerRequestBody(BaseModel):
42
+ name: OptionalNullable[str] = UNSET
43
+ r"""The full name of the customer."""
44
+
45
+ email: OptionalNullable[str] = UNSET
46
+ r"""The email address of the customer."""
47
+
48
+ locale: Annotated[
49
+ OptionalNullable[LocaleResponse], PlainValidator(validate_open_enum(False))
50
+ ] = UNSET
51
+ r"""Allows you to preset the language to be used."""
52
+
53
+ metadata: OptionalNullable[Metadata] = UNSET
54
+ r"""Provide any data you like, for example a string or a JSON object. We will save the data alongside the entity. Whenever
55
+ you fetch the entity with our API, we will also include the metadata. You can use up to approximately 1kB.
56
+ """
57
+
58
+ testmode: Optional[bool] = None
59
+ r"""Whether the entity was created in test mode or live mode. This field does not update the mode of the entity.
60
+
61
+ Most API credentials are specifically created for either live mode or test mode, in which case this parameter can be
62
+ omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting
63
+ `testmode` to `true`.
64
+ """
65
+
66
+ @model_serializer(mode="wrap")
67
+ def serialize_model(self, handler):
68
+ optional_fields = ["name", "email", "locale", "metadata", "testmode"]
69
+ nullable_fields = ["name", "email", "locale", "metadata"]
70
+ null_default_fields = []
71
+
72
+ serialized = handler(self)
73
+
74
+ m = {}
75
+
76
+ for n, f in type(self).model_fields.items():
77
+ k = f.alias or n
78
+ val = serialized.get(k)
79
+ serialized.pop(k, None)
80
+
81
+ optional_nullable = k in optional_fields and k in nullable_fields
82
+ is_set = (
83
+ self.__pydantic_fields_set__.intersection({n})
84
+ or k in null_default_fields
85
+ ) # pylint: disable=no-member
86
+
87
+ if val is not None and val != UNSET_SENTINEL:
88
+ m[k] = val
89
+ elif val != UNSET_SENTINEL and (
90
+ not k in optional_fields or (optional_nullable and is_set)
91
+ ):
92
+ m[k] = val
93
+
94
+ return m
95
+
96
+
17
97
  class UpdateCustomerRequestTypedDict(TypedDict):
18
98
  customer_id: str
19
99
  r"""Provide the ID of the related customer."""
20
100
  idempotency_key: NotRequired[str]
21
101
  r"""A unique key to ensure idempotent requests. This key should be a UUID v4 string."""
22
- entity_customer: NotRequired[EntityCustomerTypedDict]
102
+ request_body: NotRequired[UpdateCustomerRequestBodyTypedDict]
23
103
 
24
104
 
25
105
  class UpdateCustomerRequest(BaseModel):
@@ -37,7 +117,7 @@ class UpdateCustomerRequest(BaseModel):
37
117
  ] = None
38
118
  r"""A unique key to ensure idempotent requests. This key should be a UUID v4 string."""
39
119
 
40
- entity_customer: Annotated[
41
- Optional[EntityCustomer],
120
+ request_body: Annotated[
121
+ Optional[UpdateCustomerRequestBody],
42
122
  FieldMetadata(request=RequestMetadata(media_type="application/json")),
43
123
  ] = None
@@ -45,11 +45,12 @@ class UpdatePaymentLinkRequestBodyTypedDict(TypedDict):
45
45
  """
46
46
  billing_address: NotRequired[PaymentAddressTypedDict]
47
47
  shipping_address: NotRequired[PaymentAddressTypedDict]
48
- testmode: NotRequired[Nullable[bool]]
49
- r"""Most API credentials are specifically created for either live mode or test mode. For organization-level credentials
50
- such as OAuth access tokens, you can enable test mode by setting `testmode` to `true`.
48
+ testmode: NotRequired[bool]
49
+ r"""Whether the entity was created in test mode or live mode. This field does not update the mode of the entity.
51
50
 
52
- Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
51
+ Most API credentials are specifically created for either live mode or test mode, in which case this parameter can be
52
+ omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting
53
+ `testmode` to `true`.
53
54
  """
54
55
 
55
56
 
@@ -96,11 +97,12 @@ class UpdatePaymentLinkRequestBody(BaseModel):
96
97
  Optional[PaymentAddress], pydantic.Field(alias="shippingAddress")
97
98
  ] = None
98
99
 
99
- testmode: OptionalNullable[bool] = UNSET
100
- r"""Most API credentials are specifically created for either live mode or test mode. For organization-level credentials
101
- such as OAuth access tokens, you can enable test mode by setting `testmode` to `true`.
100
+ testmode: Optional[bool] = None
101
+ r"""Whether the entity was created in test mode or live mode. This field does not update the mode of the entity.
102
102
 
103
- Test entities cannot be retrieved when the endpoint is set to live mode, and vice versa.
103
+ Most API credentials are specifically created for either live mode or test mode, in which case this parameter can be
104
+ omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting
105
+ `testmode` to `true`.
104
106
  """
105
107
 
106
108
  @model_serializer(mode="wrap")
@@ -115,7 +117,7 @@ class UpdatePaymentLinkRequestBody(BaseModel):
115
117
  "shippingAddress",
116
118
  "testmode",
117
119
  ]
118
- nullable_fields = ["allowedMethods", "lines", "testmode"]
120
+ nullable_fields = ["allowedMethods", "lines"]
119
121
  null_default_fields = []
120
122
 
121
123
  serialized = handler(self)
@@ -84,8 +84,8 @@ class UpdatePaymentRequestBodyTypedDict(TypedDict):
84
84
 
85
85
  The field expects a country code in ISO 3166-1 alpha-2 format, for example `NL`.
86
86
  """
87
- testmode: NotRequired[Nullable[bool]]
88
- r"""Whether to create the entity in test mode or live mode.
87
+ testmode: NotRequired[bool]
88
+ r"""Whether the entity was created in test mode or live mode. This field does not update the mode of the entity.
89
89
 
90
90
  Most API credentials are specifically created for either live mode or test mode, in which case this parameter can be
91
91
  omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting
@@ -203,8 +203,8 @@ class UpdatePaymentRequestBody(BaseModel):
203
203
  The field expects a country code in ISO 3166-1 alpha-2 format, for example `NL`.
204
204
  """
205
205
 
206
- testmode: OptionalNullable[bool] = UNSET
207
- r"""Whether to create the entity in test mode or live mode.
206
+ testmode: Optional[bool] = None
207
+ r"""Whether the entity was created in test mode or live mode. This field does not update the mode of the entity.
208
208
 
209
209
  Most API credentials are specifically created for either live mode or test mode, in which case this parameter can be
210
210
  omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting
@@ -273,7 +273,6 @@ class UpdatePaymentRequestBody(BaseModel):
273
273
  "method",
274
274
  "locale",
275
275
  "restrictPaymentMethodsToCountry",
276
- "testmode",
277
276
  "issuer",
278
277
  ]
279
278
  null_default_fields = []
@@ -1,11 +1,23 @@
1
1
  """Code generated by Speakeasy (https://speakeasy.com). DO NOT EDIT."""
2
2
 
3
3
  from __future__ import annotations
4
- from .update_values_sales_invoice import (
5
- UpdateValuesSalesInvoice,
6
- UpdateValuesSalesInvoiceTypedDict,
4
+ from .sales_invoice_discount import SalesInvoiceDiscount, SalesInvoiceDiscountTypedDict
5
+ from .sales_invoice_email_details import (
6
+ SalesInvoiceEmailDetails,
7
+ SalesInvoiceEmailDetailsTypedDict,
7
8
  )
8
- from mollie.types import BaseModel
9
+ from .sales_invoice_line_item import SalesInvoiceLineItem, SalesInvoiceLineItemTypedDict
10
+ from .sales_invoice_payment_details import (
11
+ SalesInvoicePaymentDetails,
12
+ SalesInvoicePaymentDetailsTypedDict,
13
+ )
14
+ from .sales_invoice_payment_term import SalesInvoicePaymentTerm
15
+ from .sales_invoice_recipient import (
16
+ SalesInvoiceRecipient,
17
+ SalesInvoiceRecipientTypedDict,
18
+ )
19
+ from .sales_invoice_status import SalesInvoiceStatus
20
+ from mollie.types import BaseModel, Nullable, OptionalNullable, UNSET, UNSET_SENTINEL
9
21
  from mollie.utils import (
10
22
  FieldMetadata,
11
23
  HeaderMetadata,
@@ -13,16 +25,170 @@ from mollie.utils import (
13
25
  RequestMetadata,
14
26
  )
15
27
  import pydantic
16
- from typing import Optional
28
+ from pydantic import model_serializer
29
+ from typing import List, Optional
17
30
  from typing_extensions import Annotated, NotRequired, TypedDict
18
31
 
19
32
 
33
+ class UpdateSalesInvoiceRequestBodyTypedDict(TypedDict):
34
+ testmode: NotRequired[bool]
35
+ r"""Whether the entity was created in test mode or live mode. This field does not update the mode of the entity.
36
+
37
+ Most API credentials are specifically created for either live mode or test mode, in which case this parameter can be
38
+ omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting
39
+ `testmode` to `true`.
40
+ """
41
+ status: NotRequired[SalesInvoiceStatus]
42
+ r"""The status for the invoice to end up in.
43
+
44
+ A `draft` invoice is not paid or not sent and can be updated after creation. Setting it to `issued` sends it to
45
+ the recipient so they may then pay through our payment system. To skip our payment process, set this to `paid` to
46
+ mark it as paid. It can then subsequently be sent as well, same as with `issued`.
47
+
48
+ A status value that cannot be set but can be returned is `canceled`, for invoices which were
49
+ issued, but then canceled. Currently this can only be done for invoices created in the dashboard.
50
+
51
+ Dependent parameters:
52
+ - `paymentDetails` is required if invoice should be set directly to `paid`
53
+ - `customerId` and `mandateId` are required if a recurring payment should be used to set the invoice to `paid`
54
+ - `emailDetails` optional for `issued` and `paid` to send the invoice by email
55
+ """
56
+ memo: NotRequired[Nullable[str]]
57
+ r"""A free-form memo you can set on the invoice, and will be shown on the invoice PDF."""
58
+ payment_term: NotRequired[Nullable[SalesInvoicePaymentTerm]]
59
+ r"""The payment term to be set on the invoice."""
60
+ payment_details: NotRequired[SalesInvoicePaymentDetailsTypedDict]
61
+ email_details: NotRequired[Nullable[SalesInvoiceEmailDetailsTypedDict]]
62
+ recipient_identifier: NotRequired[str]
63
+ r"""An identifier tied to the recipient data. This should be a unique value based on data your system contains,
64
+ so that both you and us know who we're referring to. It is a value you provide to us so that recipient management
65
+ is not required to send a first invoice to a recipient.
66
+ """
67
+ recipient: NotRequired[Nullable[SalesInvoiceRecipientTypedDict]]
68
+ lines: NotRequired[Nullable[List[SalesInvoiceLineItemTypedDict]]]
69
+ r"""Provide the line items for the invoice. Each line contains details such as a description of the item
70
+ ordered and its price.
71
+
72
+ All lines must have the same currency as the invoice.
73
+ """
74
+ discount: NotRequired[Nullable[SalesInvoiceDiscountTypedDict]]
75
+
76
+
77
+ class UpdateSalesInvoiceRequestBody(BaseModel):
78
+ testmode: Optional[bool] = None
79
+ r"""Whether the entity was created in test mode or live mode. This field does not update the mode of the entity.
80
+
81
+ Most API credentials are specifically created for either live mode or test mode, in which case this parameter can be
82
+ omitted. For organization-level credentials such as OAuth access tokens, you can enable test mode by setting
83
+ `testmode` to `true`.
84
+ """
85
+
86
+ status: Optional[SalesInvoiceStatus] = None
87
+ r"""The status for the invoice to end up in.
88
+
89
+ A `draft` invoice is not paid or not sent and can be updated after creation. Setting it to `issued` sends it to
90
+ the recipient so they may then pay through our payment system. To skip our payment process, set this to `paid` to
91
+ mark it as paid. It can then subsequently be sent as well, same as with `issued`.
92
+
93
+ A status value that cannot be set but can be returned is `canceled`, for invoices which were
94
+ issued, but then canceled. Currently this can only be done for invoices created in the dashboard.
95
+
96
+ Dependent parameters:
97
+ - `paymentDetails` is required if invoice should be set directly to `paid`
98
+ - `customerId` and `mandateId` are required if a recurring payment should be used to set the invoice to `paid`
99
+ - `emailDetails` optional for `issued` and `paid` to send the invoice by email
100
+ """
101
+
102
+ memo: OptionalNullable[str] = UNSET
103
+ r"""A free-form memo you can set on the invoice, and will be shown on the invoice PDF."""
104
+
105
+ payment_term: Annotated[
106
+ OptionalNullable[SalesInvoicePaymentTerm], pydantic.Field(alias="paymentTerm")
107
+ ] = UNSET
108
+ r"""The payment term to be set on the invoice."""
109
+
110
+ payment_details: Annotated[
111
+ Optional[SalesInvoicePaymentDetails], pydantic.Field(alias="paymentDetails")
112
+ ] = None
113
+
114
+ email_details: Annotated[
115
+ OptionalNullable[SalesInvoiceEmailDetails], pydantic.Field(alias="emailDetails")
116
+ ] = UNSET
117
+
118
+ recipient_identifier: Annotated[
119
+ Optional[str], pydantic.Field(alias="recipientIdentifier")
120
+ ] = None
121
+ r"""An identifier tied to the recipient data. This should be a unique value based on data your system contains,
122
+ so that both you and us know who we're referring to. It is a value you provide to us so that recipient management
123
+ is not required to send a first invoice to a recipient.
124
+ """
125
+
126
+ recipient: OptionalNullable[SalesInvoiceRecipient] = UNSET
127
+
128
+ lines: OptionalNullable[List[SalesInvoiceLineItem]] = UNSET
129
+ r"""Provide the line items for the invoice. Each line contains details such as a description of the item
130
+ ordered and its price.
131
+
132
+ All lines must have the same currency as the invoice.
133
+ """
134
+
135
+ discount: OptionalNullable[SalesInvoiceDiscount] = UNSET
136
+
137
+ @model_serializer(mode="wrap")
138
+ def serialize_model(self, handler):
139
+ optional_fields = [
140
+ "testmode",
141
+ "status",
142
+ "memo",
143
+ "paymentTerm",
144
+ "paymentDetails",
145
+ "emailDetails",
146
+ "recipientIdentifier",
147
+ "recipient",
148
+ "lines",
149
+ "discount",
150
+ ]
151
+ nullable_fields = [
152
+ "memo",
153
+ "paymentTerm",
154
+ "emailDetails",
155
+ "recipient",
156
+ "lines",
157
+ "discount",
158
+ ]
159
+ null_default_fields = []
160
+
161
+ serialized = handler(self)
162
+
163
+ m = {}
164
+
165
+ for n, f in type(self).model_fields.items():
166
+ k = f.alias or n
167
+ val = serialized.get(k)
168
+ serialized.pop(k, None)
169
+
170
+ optional_nullable = k in optional_fields and k in nullable_fields
171
+ is_set = (
172
+ self.__pydantic_fields_set__.intersection({n})
173
+ or k in null_default_fields
174
+ ) # pylint: disable=no-member
175
+
176
+ if val is not None and val != UNSET_SENTINEL:
177
+ m[k] = val
178
+ elif val != UNSET_SENTINEL and (
179
+ not k in optional_fields or (optional_nullable and is_set)
180
+ ):
181
+ m[k] = val
182
+
183
+ return m
184
+
185
+
20
186
  class UpdateSalesInvoiceRequestTypedDict(TypedDict):
21
187
  sales_invoice_id: str
22
188
  r"""Provide the ID of the related sales invoice."""
23
189
  idempotency_key: NotRequired[str]
24
190
  r"""A unique key to ensure idempotent requests. This key should be a UUID v4 string."""
25
- update_values_sales_invoice: NotRequired[UpdateValuesSalesInvoiceTypedDict]
191
+ request_body: NotRequired[UpdateSalesInvoiceRequestBodyTypedDict]
26
192
 
27
193
 
28
194
  class UpdateSalesInvoiceRequest(BaseModel):
@@ -40,7 +206,7 @@ class UpdateSalesInvoiceRequest(BaseModel):
40
206
  ] = None
41
207
  r"""A unique key to ensure idempotent requests. This key should be a UUID v4 string."""
42
208
 
43
- update_values_sales_invoice: Annotated[
44
- Optional[UpdateValuesSalesInvoice],
209
+ request_body: Annotated[
210
+ Optional[UpdateSalesInvoiceRequestBody],
45
211
  FieldMetadata(request=RequestMetadata(media_type="application/json")),
46
212
  ] = None