Trendsic Platform Service

<back to all web services

DispatchSettlementGenerateRequest

Requires Authentication
The following routes are available for this service:
POST,OPTIONS/v1/dispatch/settlements/generate
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 DispatchSettlementGenerateRequest:
    vendor_i_d: int = 0
    period_start: datetime.datetime = datetime.datetime(1, 1, 1)
    period_end: datetime.datetime = datetime.datetime(1, 1, 1)

Python DispatchSettlementGenerateRequest DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

POST /v1/dispatch/settlements/generate HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<DispatchSettlementGenerateRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <PeriodEnd>0001-01-01T00:00:00</PeriodEnd>
  <PeriodStart>0001-01-01T00:00:00</PeriodStart>
  <VendorID>0</VendorID>
</DispatchSettlementGenerateRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<DispatchSettlementsResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/CRM.AgencyPlatform.API.Internal">
  <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types">
    <d2p1:ErrorCode>String</d2p1:ErrorCode>
    <d2p1:Message>String</d2p1:Message>
    <d2p1:StackTrace>String</d2p1:StackTrace>
    <d2p1:Errors>
      <d2p1:ResponseError>
        <d2p1:ErrorCode>String</d2p1:ErrorCode>
        <d2p1:FieldName>String</d2p1:FieldName>
        <d2p1:Message>String</d2p1:Message>
        <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
          <d5p1:KeyValueOfstringstring>
            <d5p1:Key>String</d5p1:Key>
            <d5p1:Value>String</d5p1:Value>
          </d5p1:KeyValueOfstringstring>
        </d2p1:Meta>
      </d2p1:ResponseError>
    </d2p1:Errors>
    <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays">
      <d3p1:KeyValueOfstringstring>
        <d3p1:Key>String</d3p1:Key>
        <d3p1:Value>String</d3p1:Value>
      </d3p1:KeyValueOfstringstring>
    </d2p1:Meta>
  </ResponseStatus>
  <Settlement>
    <ApprovedBy>String</ApprovedBy>
    <ApprovedUtc>0001-01-01T00:00:00</ApprovedUtc>
    <CarrierShare>0</CarrierShare>
    <Code>String</Code>
    <ContactCount>0</ContactCount>
    <Deductions>
      <DispatchSettlementDeductionView>
        <Amount>0</Amount>
        <DeductionId>0</DeductionId>
        <Kind>String</Kind>
        <Label>String</Label>
        <Note>String</Note>
      </DispatchSettlementDeductionView>
    </Deductions>
    <DeductionsTotal>0</DeductionsTotal>
    <GeneratedUtc>0001-01-01T00:00:00</GeneratedUtc>
    <GrossRevenue>0</GrossRevenue>
    <LoadCount>0</LoadCount>
    <Loads>
      <DispatchLoadView>
        <CarrierLabel>String</CarrierLabel>
        <ClosedUtc>0001-01-01T00:00:00</ClosedUtc>
        <Code>String</Code>
        <DestinationLabel>String</DestinationLabel>
        <DriverLabel>String</DriverLabel>
        <LoadId>0</LoadId>
        <Module>String</Module>
        <OpenedUtc>0001-01-01T00:00:00</OpenedUtc>
        <Pay>0</Pay>
        <PayPlanLabel>String</PayPlanLabel>
        <Photos>0</Photos>
        <Qty>0</Qty>
        <QtyText>String</QtyText>
        <RateApplied>0</RateApplied>
        <RateBasis>String</RateBasis>
        <Revenue>0</Revenue>
        <SourceLabel>String</SourceLabel>
        <Stages>
          <DispatchLoadStageView>
            <AtUtc>0001-01-01T00:00:00</AtUtc>
            <Note>String</Note>
            <Stage>String</Stage>
          </DispatchLoadStageView>
        </Stages>
        <Status>String</Status>
        <TicketCode>String</TicketCode>
        <TruckLabel>String</TruckLabel>
        <Unit>String</Unit>
      </DispatchLoadView>
    </Loads>
    <Net>0</Net>
    <Notes>String</Notes>
    <PaidRef>String</PaidRef>
    <PaidUtc>0001-01-01T00:00:00</PaidUtc>
    <PeriodEnd>0001-01-01T00:00:00</PeriodEnd>
    <PeriodStart>0001-01-01T00:00:00</PeriodStart>
    <SentUtc>0001-01-01T00:00:00</SentUtc>
    <SettlementId>0</SettlementId>
    <SplitPct>0</SplitPct>
    <Status>String</Status>
    <VendorID>0</VendorID>
    <VendorName>String</VendorName>
  </Settlement>
  <Settlements>
    <DispatchSettlementView>
      <ApprovedBy>String</ApprovedBy>
      <ApprovedUtc>0001-01-01T00:00:00</ApprovedUtc>
      <CarrierShare>0</CarrierShare>
      <Code>String</Code>
      <ContactCount>0</ContactCount>
      <Deductions>
        <DispatchSettlementDeductionView>
          <Amount>0</Amount>
          <DeductionId>0</DeductionId>
          <Kind>String</Kind>
          <Label>String</Label>
          <Note>String</Note>
        </DispatchSettlementDeductionView>
      </Deductions>
      <DeductionsTotal>0</DeductionsTotal>
      <GeneratedUtc>0001-01-01T00:00:00</GeneratedUtc>
      <GrossRevenue>0</GrossRevenue>
      <LoadCount>0</LoadCount>
      <Loads>
        <DispatchLoadView>
          <CarrierLabel>String</CarrierLabel>
          <ClosedUtc>0001-01-01T00:00:00</ClosedUtc>
          <Code>String</Code>
          <DestinationLabel>String</DestinationLabel>
          <DriverLabel>String</DriverLabel>
          <LoadId>0</LoadId>
          <Module>String</Module>
          <OpenedUtc>0001-01-01T00:00:00</OpenedUtc>
          <Pay>0</Pay>
          <PayPlanLabel>String</PayPlanLabel>
          <Photos>0</Photos>
          <Qty>0</Qty>
          <QtyText>String</QtyText>
          <RateApplied>0</RateApplied>
          <RateBasis>String</RateBasis>
          <Revenue>0</Revenue>
          <SourceLabel>String</SourceLabel>
          <Stages>
            <DispatchLoadStageView>
              <AtUtc>0001-01-01T00:00:00</AtUtc>
              <Note>String</Note>
              <Stage>String</Stage>
            </DispatchLoadStageView>
          </Stages>
          <Status>String</Status>
          <TicketCode>String</TicketCode>
          <TruckLabel>String</TruckLabel>
          <Unit>String</Unit>
        </DispatchLoadView>
      </Loads>
      <Net>0</Net>
      <Notes>String</Notes>
      <PaidRef>String</PaidRef>
      <PaidUtc>0001-01-01T00:00:00</PaidUtc>
      <PeriodEnd>0001-01-01T00:00:00</PeriodEnd>
      <PeriodStart>0001-01-01T00:00:00</PeriodStart>
      <SentUtc>0001-01-01T00:00:00</SentUtc>
      <SettlementId>0</SettlementId>
      <SplitPct>0</SplitPct>
      <Status>String</Status>
      <VendorID>0</VendorID>
      <VendorName>String</VendorName>
    </DispatchSettlementView>
  </Settlements>
  <Suggestions>
    <DispatchSettlementSuggestView>
      <CoiExpires>0001-01-01T00:00:00</CoiExpires>
      <PeriodEnd>0001-01-01T00:00:00</PeriodEnd>
      <PeriodStart>0001-01-01T00:00:00</PeriodStart>
      <SplitPct>0</SplitPct>
      <Terms>String</Terms>
      <UnpricedLoads>0</UnpricedLoads>
      <UnsettledLoads>0</UnsettledLoads>
      <UnsettledPay>0</UnsettledPay>
      <VendorID>0</VendorID>
      <VendorName>String</VendorName>
      <W9OnFile>false</W9OnFile>
    </DispatchSettlementSuggestView>
  </Suggestions>
</DispatchSettlementsResponse>