| Requires any of the roles: | Agent, Administrator |
| POST,OPTIONS | /v1/invoice/workchanges/{ProjectUID}/decide |
|---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoiceWorkChange:
source_type: Optional[str] = None
source_i_d: int = 0
job_i_d: Optional[int] = None
work_date: Optional[datetime.datetime] = None
work_day: Optional[str] = None
display_day: Optional[str] = None
label: Optional[str] = None
job_name: Optional[str] = None
display_date: Optional[datetime.datetime] = None
unit: Optional[str] = None
billed: Decimal = decimal.Decimal(0)
now_quantity: Decimal = decimal.Decimal(0)
over_billed: Decimal = decimal.Decimal(0)
unit_factor: Decimal = decimal.Decimal(0)
price: Decimal = decimal.Decimal(0)
amount: Decimal = decimal.Decimal(0)
line_type: Optional[str] = None
is_taxable: bool = False
invoice_i_d: int = 0
invoice_u_i_d: Optional[str] = None
invoice_number: Optional[str] = None
invoice_total: Decimal = decimal.Decimal(0)
invoice_is_locked: bool = False
invoice_is_paid: bool = False
state: Optional[str] = None
remembered: Optional[str] = None
decided_by_name: Optional[str] = None
decided_at: Optional[datetime.datetime] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoiceWorkChangesResponse:
response_status: Optional[ResponseStatus] = None
success: bool = False
changes: List[InvoiceWorkChange] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoiceWorkChangeKey:
source_type: Optional[str] = None
source_i_d: int = 0
job_i_d: Optional[int] = None
work_day: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoiceWorkChangesDecideRequest:
project_u_i_d: Optional[str] = None
invoice_i_d: int = 0
decision: Optional[str] = None
remember: bool = False
sources: List[InvoiceWorkChangeKey] = field(default_factory=list)
Python InvoiceWorkChangesDecideRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /v1/invoice/workchanges/{ProjectUID}/decide HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
ProjectUID: 00000000000000000000000000000000,
InvoiceID: 0,
Decision: String,
Remember: False,
Sources:
[
{
SourceType: String,
SourceID: 0,
JobID: 0,
WorkDay: String
}
]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
},
Success: False,
Changes:
[
{
SourceType: String,
SourceID: 0,
JobID: 0,
WorkDate: 0001-01-01,
WorkDay: String,
DisplayDay: String,
Label: String,
JobName: String,
DisplayDate: 0001-01-01,
Unit: String,
Billed: 0,
NowQuantity: 0,
OverBilled: 0,
UnitFactor: 0,
Price: 0,
Amount: 0,
LineType: String,
IsTaxable: False,
InvoiceID: 0,
InvoiceUID: 00000000000000000000000000000000,
InvoiceNumber: String,
InvoiceTotal: 0,
InvoiceIsLocked: False,
InvoiceIsPaid: False,
State: String,
Remembered: String,
DecidedByName: String,
DecidedAt: 0001-01-01
}
]
}