| POST,OPTIONS | /v1/dispatch/settlements/{SettlementId}/status |
|---|
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 DispatchSettlementDeductionView:
deduction_id: int = 0
kind: Optional[str] = None
label: Optional[str] = None
amount: Decimal = decimal.Decimal(0)
note: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchLoadStageView:
stage: Optional[str] = None
at_utc: datetime.datetime = datetime.datetime(1, 1, 1)
note: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchLoadView:
load_id: int = 0
code: Optional[str] = None
module: Optional[str] = None
truck_label: Optional[str] = None
driver_label: Optional[str] = None
carrier_label: Optional[str] = None
source_label: Optional[str] = None
destination_label: Optional[str] = None
qty: Optional[Decimal] = None
unit: Optional[str] = None
qty_text: Optional[str] = None
ticket_code: Optional[str] = None
rate_applied: Optional[Decimal] = None
rate_basis: Optional[str] = None
revenue: Optional[Decimal] = None
pay_plan_label: Optional[str] = None
pay: Optional[Decimal] = None
status: Optional[str] = None
opened_utc: datetime.datetime = datetime.datetime(1, 1, 1)
closed_utc: Optional[datetime.datetime] = None
photos: int = 0
stages: List[DispatchLoadStageView] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchSettlementView:
settlement_id: int = 0
code: Optional[str] = None
vendor_i_d: int = 0
vendor_name: Optional[str] = None
period_start: datetime.datetime = datetime.datetime(1, 1, 1)
period_end: datetime.datetime = datetime.datetime(1, 1, 1)
load_count: int = 0
gross_revenue: Decimal = decimal.Decimal(0)
split_pct: Decimal = decimal.Decimal(0)
carrier_share: Decimal = decimal.Decimal(0)
deductions_total: Decimal = decimal.Decimal(0)
net: Decimal = decimal.Decimal(0)
status: Optional[str] = None
notes: Optional[str] = None
generated_utc: datetime.datetime = datetime.datetime(1, 1, 1)
sent_utc: Optional[datetime.datetime] = None
approved_utc: Optional[datetime.datetime] = None
approved_by: Optional[str] = None
paid_utc: Optional[datetime.datetime] = None
paid_ref: Optional[str] = None
contact_count: int = 0
deductions: List[DispatchSettlementDeductionView] = field(default_factory=list)
loads: List[DispatchLoadView] = field(default_factory=list)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchSettlementSuggestView:
vendor_i_d: int = 0
vendor_name: Optional[str] = None
split_pct: Decimal = decimal.Decimal(0)
terms: Optional[str] = None
w9_on_file: bool = False
coi_expires: Optional[datetime.datetime] = None
period_start: datetime.datetime = datetime.datetime(1, 1, 1)
period_end: datetime.datetime = datetime.datetime(1, 1, 1)
unsettled_loads: int = 0
unpriced_loads: int = 0
unsettled_pay: Decimal = decimal.Decimal(0)
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchSettlementsResponse:
settlements: List[DispatchSettlementView] = field(default_factory=list)
settlement: Optional[DispatchSettlementView] = None
suggestions: List[DispatchSettlementSuggestView] = field(default_factory=list)
response_status: Optional[ResponseStatus] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class DispatchSettlementStatusRequest:
settlement_id: int = 0
status: Optional[str] = None
paid_ref: Optional[str] = None
Python DispatchSettlementStatusRequest 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/dispatch/settlements/{SettlementId}/status HTTP/1.1
Host: api.dev.dynamics.trendsic.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
SettlementId: 0,
Status: String,
PaidRef: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length
{
Settlements:
[
{
SettlementId: 0,
Code: String,
VendorID: 0,
VendorName: String,
PeriodStart: 0001-01-01,
PeriodEnd: 0001-01-01,
LoadCount: 0,
GrossRevenue: 0,
SplitPct: 0,
CarrierShare: 0,
DeductionsTotal: 0,
Net: 0,
Status: String,
Notes: String,
GeneratedUtc: 0001-01-01,
SentUtc: 0001-01-01,
ApprovedUtc: 0001-01-01,
ApprovedBy: String,
PaidUtc: 0001-01-01,
PaidRef: String,
ContactCount: 0,
Deductions:
[
{
DeductionId: 0,
Kind: String,
Label: String,
Amount: 0,
Note: String
}
],
Loads:
[
{
LoadId: 0,
Code: String,
Module: String,
TruckLabel: String,
DriverLabel: String,
CarrierLabel: String,
SourceLabel: String,
DestinationLabel: String,
Qty: 0,
Unit: String,
QtyText: String,
TicketCode: String,
RateApplied: 0,
RateBasis: String,
Revenue: 0,
PayPlanLabel: String,
Pay: 0,
Status: String,
OpenedUtc: 0001-01-01,
ClosedUtc: 0001-01-01,
Photos: 0,
Stages:
[
{
Stage: String,
AtUtc: 0001-01-01,
Note: String
}
]
}
]
}
],
Settlement:
{
SettlementId: 0,
Code: String,
VendorID: 0,
VendorName: String,
PeriodStart: 0001-01-01,
PeriodEnd: 0001-01-01,
LoadCount: 0,
GrossRevenue: 0,
SplitPct: 0,
CarrierShare: 0,
DeductionsTotal: 0,
Net: 0,
Status: String,
Notes: String,
GeneratedUtc: 0001-01-01,
SentUtc: 0001-01-01,
ApprovedUtc: 0001-01-01,
ApprovedBy: String,
PaidUtc: 0001-01-01,
PaidRef: String,
ContactCount: 0,
Deductions:
[
{
DeductionId: 0,
Kind: String,
Label: String,
Amount: 0,
Note: String
}
],
Loads:
[
{
LoadId: 0,
Code: String,
Module: String,
TruckLabel: String,
DriverLabel: String,
CarrierLabel: String,
SourceLabel: String,
DestinationLabel: String,
Qty: 0,
Unit: String,
QtyText: String,
TicketCode: String,
RateApplied: 0,
RateBasis: String,
Revenue: 0,
PayPlanLabel: String,
Pay: 0,
Status: String,
OpenedUtc: 0001-01-01,
ClosedUtc: 0001-01-01,
Photos: 0,
Stages:
[
{
Stage: String,
AtUtc: 0001-01-01,
Note: String
}
]
}
]
},
Suggestions:
[
{
VendorID: 0,
VendorName: String,
SplitPct: 0,
Terms: String,
W9OnFile: False,
CoiExpires: 0001-01-01,
PeriodStart: 0001-01-01,
PeriodEnd: 0001-01-01,
UnsettledLoads: 0,
UnpricedLoads: 0,
UnsettledPay: 0
}
],
ResponseStatus:
{
ErrorCode: String,
Message: String,
StackTrace: String,
Errors:
[
{
ErrorCode: String,
FieldName: String,
Message: String,
Meta:
{
String: String
}
}
],
Meta:
{
String: String
}
}
}