33from __future__ import annotations
44
55from typing import Union , Iterable , Optional
6- from datetime import datetime
6+ from datetime import date , datetime
77from typing_extensions import Literal
88
99import httpx
@@ -47,7 +47,9 @@ def create(
4747 * ,
4848 line_items : Iterable [credit_note_create_params .LineItem ],
4949 reason : Literal ["duplicate" , "fraudulent" , "order_change" , "product_unsatisfactory" ],
50+ end_date : Union [str , date , None ] | NotGiven = NOT_GIVEN ,
5051 memo : Optional [str ] | NotGiven = NOT_GIVEN ,
52+ start_date : Union [str , date , None ] | NotGiven = NOT_GIVEN ,
5153 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
5254 # The extra values given here take precedence over values defined on the client or passed to this method.
5355 extra_headers : Headers | None = None ,
@@ -60,11 +62,46 @@ def create(
6062 This endpoint is used to create a single
6163 [`Credit Note`](/invoicing/credit-notes).
6264
65+ The credit note service period configuration supports two explicit modes:
66+
67+ 1. Global service periods: Specify start_date and end_date at the credit note
68+ level. These dates will be applied to all line items uniformly.
69+
70+ 2. Individual service periods: Specify start_date and end_date for each line
71+ item. When using this mode, ALL line items must have individual periods
72+ specified.
73+
74+ 3. Default behavior: If no service periods are specified (neither global nor
75+ individual), the original invoice line item service periods will be used.
76+
77+ Note: Mixing global and individual service periods in the same request is not
78+ allowed to prevent confusion.
79+
80+ Service period dates are normalized to the start of the day in the customer's
81+ timezone to ensure consistent handling across different timezones.
82+
83+ Date Format: Use start_date and end_date with format "YYYY-MM-DD" (e.g.,
84+ "2023-09-22") to match other Orb APIs like /v1/invoice_line_items.
85+
86+ Note: Both start_date and end_date are inclusive - the service period will cover
87+ both the start date and end date completely (from start of start_date to end of
88+ end_date).
89+
6390 Args:
6491 reason: An optional reason for the credit note.
6592
93+ end_date: A date string to specify the global credit note service period end date in the
94+ customer's timezone. This will be applied to all line items that don't have
95+ their own individual service periods specified. If not provided, line items will
96+ use their original invoice line item service periods. This date is inclusive.
97+
6698 memo: An optional memo to attach to the credit note.
6799
100+ start_date: A date string to specify the global credit note service period start date in the
101+ customer's timezone. This will be applied to all line items that don't have
102+ their own individual service periods specified. If not provided, line items will
103+ use their original invoice line item service periods. This date is inclusive.
104+
68105 extra_headers: Send extra headers
69106
70107 extra_query: Add additional query parameters to the request
@@ -81,7 +118,9 @@ def create(
81118 {
82119 "line_items" : line_items ,
83120 "reason" : reason ,
121+ "end_date" : end_date ,
84122 "memo" : memo ,
123+ "start_date" : start_date ,
85124 },
86125 credit_note_create_params .CreditNoteCreateParams ,
87126 ),
@@ -214,7 +253,9 @@ async def create(
214253 * ,
215254 line_items : Iterable [credit_note_create_params .LineItem ],
216255 reason : Literal ["duplicate" , "fraudulent" , "order_change" , "product_unsatisfactory" ],
256+ end_date : Union [str , date , None ] | NotGiven = NOT_GIVEN ,
217257 memo : Optional [str ] | NotGiven = NOT_GIVEN ,
258+ start_date : Union [str , date , None ] | NotGiven = NOT_GIVEN ,
218259 # Use the following arguments if you need to pass additional parameters to the API that aren't available via kwargs.
219260 # The extra values given here take precedence over values defined on the client or passed to this method.
220261 extra_headers : Headers | None = None ,
@@ -227,11 +268,46 @@ async def create(
227268 This endpoint is used to create a single
228269 [`Credit Note`](/invoicing/credit-notes).
229270
271+ The credit note service period configuration supports two explicit modes:
272+
273+ 1. Global service periods: Specify start_date and end_date at the credit note
274+ level. These dates will be applied to all line items uniformly.
275+
276+ 2. Individual service periods: Specify start_date and end_date for each line
277+ item. When using this mode, ALL line items must have individual periods
278+ specified.
279+
280+ 3. Default behavior: If no service periods are specified (neither global nor
281+ individual), the original invoice line item service periods will be used.
282+
283+ Note: Mixing global and individual service periods in the same request is not
284+ allowed to prevent confusion.
285+
286+ Service period dates are normalized to the start of the day in the customer's
287+ timezone to ensure consistent handling across different timezones.
288+
289+ Date Format: Use start_date and end_date with format "YYYY-MM-DD" (e.g.,
290+ "2023-09-22") to match other Orb APIs like /v1/invoice_line_items.
291+
292+ Note: Both start_date and end_date are inclusive - the service period will cover
293+ both the start date and end date completely (from start of start_date to end of
294+ end_date).
295+
230296 Args:
231297 reason: An optional reason for the credit note.
232298
299+ end_date: A date string to specify the global credit note service period end date in the
300+ customer's timezone. This will be applied to all line items that don't have
301+ their own individual service periods specified. If not provided, line items will
302+ use their original invoice line item service periods. This date is inclusive.
303+
233304 memo: An optional memo to attach to the credit note.
234305
306+ start_date: A date string to specify the global credit note service period start date in the
307+ customer's timezone. This will be applied to all line items that don't have
308+ their own individual service periods specified. If not provided, line items will
309+ use their original invoice line item service periods. This date is inclusive.
310+
235311 extra_headers: Send extra headers
236312
237313 extra_query: Add additional query parameters to the request
@@ -248,7 +324,9 @@ async def create(
248324 {
249325 "line_items" : line_items ,
250326 "reason" : reason ,
327+ "end_date" : end_date ,
251328 "memo" : memo ,
329+ "start_date" : start_date ,
252330 },
253331 credit_note_create_params .CreditNoteCreateParams ,
254332 ),
0 commit comments