Trendsic Platform Service

<back to all web services

CourierCustomerBillingRequest

Requires Authentication
The following routes are available for this service:
PUT/v1/dispatch/courier/customers/{ContactId}/billing
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 CourierTrackBusiness:
    name: Optional[str] = None
    phone: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierBookLevel:
    code: Optional[str] = None
    name: Optional[str] = None
    ready: Optional[str] = None
    within_min: int = 0
    in_by: Optional[str] = None
    surcharge: Decimal = decimal.Decimal(0)
    days: List[int] = field(default_factory=list)
    deadline_min: Optional[int] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class HandoffOptions:
    hand: bool = False
    porch: bool = False
    desk: bool = False
    sig_required: bool = False
    id_required: bool = False
    code_required: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierBookProfile:
    code: Optional[str] = None
    name: Optional[str] = None
    shape: Optional[str] = None
    template: Optional[str] = None
    unit_one: Optional[str] = None
    unit_many: Optional[str] = None
    unit_one_es: Optional[str] = None
    unit_many_es: Optional[str] = None
    facility_noun: Optional[str] = None
    facility_noun_es: Optional[str] = None
    facility_name: Optional[str] = None
    levels: List[CourierBookLevel] = field(default_factory=list)
    asap: bool = False
    recurring: bool = False
    pay_timing: Optional[str] = None
    final_after_count: bool = False
    cancel_fee: Decimal = decimal.Decimal(0)
    missed_fee: Decimal = decimal.Decimal(0)
    missed_wait_min: int = 0
    service_area: List[str] = field(default_factory=list)
    zips: List[str] = field(default_factory=list)
    handoffs: Optional[HandoffOptions] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierBookProfileLink:
    code: Optional[str] = None
    name: Optional[str] = None
    shape: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierBookPageView:
    available: bool = False
    booking_on: bool = False
    business: Optional[CourierTrackBusiness] = None
    profile: Optional[CourierBookProfile] = None
    profiles: List[CourierBookProfileLink] = field(default_factory=list)
    card_enabled: bool = False
    publishable_key: Optional[str] = None
    app_url: Optional[str] = None
    today: Optional[str] = None
    weekday: int = 0
    now_min: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerAppBoot:
    profile: Optional[str] = None
    available: bool = False
    reason: Optional[str] = None
    auth_method: Optional[str] = None
    slug: Optional[str] = None
    page: Optional[CourierBookPageView] = None
    manifest_url: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerAppAddress:
    id: int = 0
    label: Optional[str] = None
    street: Optional[str] = None
    unit: Optional[str] = None
    city: Optional[str] = None
    zip: Optional[str] = None
    lat: Optional[Decimal] = None
    lng: Optional[Decimal] = None
    in_area: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerAppCard:
    id: int = 0
    label: Optional[str] = None
    brand: Optional[str] = None
    last4: Optional[str] = None
    is_default: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerAppNotif:
    texts: bool = False
    push: bool = False
    promos: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerAppStep:
    key: Optional[str] = None
    done: bool = False
    time: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerAppOrder:
    id: int = 0
    code: Optional[str] = None
    status: Optional[str] = None
    state: Optional[str] = None
    active: bool = False
    level_code: Optional[str] = None
    level_name: Optional[str] = None
    units: int = 0
    units_found: Optional[int] = None
    address: Optional[str] = None
    unit: Optional[str] = None
    zip: Optional[str] = None
    drop_address: Optional[str] = None
    recipient_name: Optional[str] = None
    handoff: Optional[str] = None
    is_asap: bool = False
    day_ix: int = 0
    date_text: Optional[str] = None
    start_min: Optional[int] = None
    end_min: Optional[int] = None
    driver_first_name: Optional[str] = None
    eta_min: Optional[int] = None
    promise: Optional[str] = None
    pay_mode: Optional[str] = None
    amount: Decimal = decimal.Decimal(0)
    charged: Optional[Decimal] = None
    tip: Optional[Decimal] = None
    card_last4: Optional[str] = None
    recurrence_id: Optional[int] = None
    steps: List[CustomerAppStep] = field(default_factory=list)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerAppRecurrence:
    id: int = 0
    weekday: int = 0
    start_min: int = 0
    end_min: int = 0
    cadence: Optional[str] = None
    level_code: Optional[str] = None
    units: int = 0
    handoff: Optional[str] = None
    address: Optional[str] = None
    paused: bool = False
    pay_mode: Optional[str] = None
    card_last4: Optional[str] = None
    next_date: Optional[str] = None
    skipped_date: Optional[str] = None
    ahead_days: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerAppInvoice:
    uid: Optional[str] = None
    number: Optional[str] = None
    date_text: Optional[str] = None
    total: Decimal = decimal.Decimal(0)
    balance: Decimal = decimal.Decimal(0)
    paid: bool = False


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerAppMe:
    contact_id: int = 0
    first_name: Optional[str] = None
    last_name: Optional[str] = None
    name: Optional[str] = None
    phone: Optional[str] = None
    needs_name: bool = False
    billing_mode: Optional[str] = None
    account_code: Optional[str] = None
    addresses: List[CustomerAppAddress] = field(default_factory=list)
    cards: List[CustomerAppCard] = field(default_factory=list)
    notif: Optional[CustomerAppNotif] = None
    orders: List[CustomerAppOrder] = field(default_factory=list)
    recurring: List[CustomerAppRecurrence] = field(default_factory=list)
    invoices: List[CustomerAppInvoice] = field(default_factory=list)
    today: Optional[str] = None
    now_min: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierBookOrderResponse:
    done: bool = False
    needs_action: bool = False
    client_secret: Optional[str] = None
    setup_intent_id: Optional[str] = None
    code: Optional[str] = None
    track_url: Optional[str] = None
    ics_url: Optional[str] = None
    window_text: Optional[str] = None
    promise: Optional[str] = None
    total: Decimal = decimal.Decimal(0)
    pay_timing: Optional[str] = None
    card_last4: Optional[str] = None
    repeats: Optional[str] = None
    link_sent_by: Optional[str] = None
    reopen_step: Optional[str] = None
    response_status: Optional[ResponseStatus] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierCustomerRow:
    contact_id: int = 0
    name: Optional[str] = None
    phone: Optional[str] = None
    billing_mode: Optional[str] = None
    account_code: Optional[str] = None
    orders: int = 0
    last_order_at: Optional[datetime.datetime] = None
    unbilled: int = 0
    unbilled_amount: Decimal = decimal.Decimal(0)
    cards: int = 0


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class RunResult:
    invoices: int = 0
    orders: int = 0
    total: Decimal = decimal.Decimal(0)
    skipped: List[str] = field(default_factory=list)


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CustomerAppResponse:
    boot: Optional[CustomerAppBoot] = None
    customer: Optional[CustomerAppMe] = None
    addresses: List[CustomerAppAddress] = field(default_factory=list)
    cards: List[CustomerAppCard] = field(default_factory=list)
    notif: Optional[CustomerAppNotif] = None
    recurring: List[CustomerAppRecurrence] = field(default_factory=list)
    booked: Optional[CourierBookOrderResponse] = None
    sent: bool = False
    token: Optional[str] = None
    needs_name: bool = False
    name: Optional[str] = None
    url: Optional[str] = None
    client_secret: Optional[str] = None
    publishable_key: Optional[str] = None
    message: Optional[str] = None
    reopen_step: Optional[str] = None
    customers: List[CourierCustomerRow] = field(default_factory=list)
    run: Optional[RunResult] = None
    response_status: Optional[ResponseStatus] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CourierCustomerBillingRequest:
    contact_id: int = 0
    mode: Optional[str] = None
    account_code: Optional[str] = None
    q: Optional[str] = None

Python CourierCustomerBillingRequest DTOs

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

HTTP + JSV

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

PUT /v1/dispatch/courier/customers/{ContactId}/billing HTTP/1.1 
Host: api.dev.dynamics.trendsic.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	ContactId: 0,
	Mode: String,
	AccountCode: String,
	Q: String
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	Boot: 
	{
		Profile: String,
		Available: False,
		Reason: String,
		AuthMethod: String,
		Slug: String,
		Page: 
		{
			Available: False,
			BookingOn: False,
			Business: 
			{
				Name: String,
				Phone: String
			},
			Profile: 
			{
				Code: String,
				Name: String,
				Shape: String,
				Template: String,
				UnitOne: String,
				UnitMany: String,
				UnitOneEs: String,
				UnitManyEs: String,
				FacilityNoun: String,
				FacilityNounEs: String,
				FacilityName: String,
				Levels: 
				[
					{
						Code: String,
						Name: String,
						Ready: String,
						WithinMin: 0,
						InBy: String,
						Surcharge: 0,
						Days: 
						[
							0
						],
						DeadlineMin: 0
					}
				],
				Asap: False,
				Recurring: False,
				PayTiming: String,
				FinalAfterCount: False,
				CancelFee: 0,
				MissedFee: 0,
				MissedWaitMin: 0,
				ServiceArea: 
				[
					String
				],
				Zips: 
				[
					String
				],
				Handoffs: 
				{
					Hand: False,
					Porch: False,
					Desk: False,
					SigRequired: False,
					IdRequired: False,
					CodeRequired: False
				}
			},
			Profiles: 
			[
				{
					Code: String,
					Name: String,
					Shape: String
				}
			],
			CardEnabled: False,
			PublishableKey: String,
			AppUrl: String,
			Today: String,
			Weekday: 0,
			NowMin: 0
		},
		ManifestUrl: String
	},
	Customer: 
	{
		ContactId: 0,
		FirstName: String,
		LastName: String,
		Name: String,
		Phone: String,
		NeedsName: False,
		BillingMode: String,
		AccountCode: String,
		Addresses: 
		[
			{
				Id: 0,
				Label: String,
				Street: String,
				Unit: String,
				City: String,
				Zip: String,
				Lat: 0,
				Lng: 0,
				InArea: False
			}
		],
		Cards: 
		[
			{
				Id: 0,
				Label: String,
				Brand: String,
				Last4: String,
				IsDefault: False
			}
		],
		Notif: 
		{
			Texts: False,
			Push: False,
			Promos: False
		},
		Orders: 
		[
			{
				Id: 0,
				Code: String,
				Status: String,
				State: String,
				Active: False,
				LevelCode: String,
				LevelName: String,
				Units: 0,
				UnitsFound: 0,
				Address: String,
				Unit: String,
				Zip: String,
				DropAddress: String,
				RecipientName: String,
				Handoff: String,
				IsAsap: False,
				DayIx: 0,
				DateText: String,
				StartMin: 0,
				EndMin: 0,
				DriverFirstName: String,
				EtaMin: 0,
				Promise: String,
				PayMode: String,
				Amount: 0,
				Charged: 0,
				Tip: 0,
				CardLast4: String,
				RecurrenceId: 0,
				Steps: 
				[
					{
						Key: String,
						Done: False,
						Time: String
					}
				]
			}
		],
		Recurring: 
		[
			{
				Id: 0,
				Weekday: 0,
				StartMin: 0,
				EndMin: 0,
				Cadence: String,
				LevelCode: String,
				Units: 0,
				Handoff: String,
				Address: String,
				Paused: False,
				PayMode: String,
				CardLast4: String,
				NextDate: String,
				SkippedDate: String,
				AheadDays: 0
			}
		],
		Invoices: 
		[
			{
				Uid: 00000000000000000000000000000000,
				Number: String,
				DateText: String,
				Total: 0,
				Balance: 0,
				Paid: False
			}
		],
		Today: String,
		NowMin: 0
	},
	Addresses: 
	[
		{
			Id: 0,
			Label: String,
			Street: String,
			Unit: String,
			City: String,
			Zip: String,
			Lat: 0,
			Lng: 0,
			InArea: False
		}
	],
	Cards: 
	[
		{
			Id: 0,
			Label: String,
			Brand: String,
			Last4: String,
			IsDefault: False
		}
	],
	Notif: 
	{
		Texts: False,
		Push: False,
		Promos: False
	},
	Recurring: 
	[
		{
			Id: 0,
			Weekday: 0,
			StartMin: 0,
			EndMin: 0,
			Cadence: String,
			LevelCode: String,
			Units: 0,
			Handoff: String,
			Address: String,
			Paused: False,
			PayMode: String,
			CardLast4: String,
			NextDate: String,
			SkippedDate: String,
			AheadDays: 0
		}
	],
	Booked: 
	{
		Done: False,
		NeedsAction: False,
		ClientSecret: String,
		SetupIntentId: String,
		Code: String,
		TrackUrl: String,
		IcsUrl: String,
		WindowText: String,
		Promise: String,
		Total: 0,
		PayTiming: String,
		CardLast4: String,
		Repeats: String,
		LinkSentBy: String,
		ReopenStep: String,
		ResponseStatus: 
		{
			ErrorCode: String,
			Message: String,
			StackTrace: String,
			Errors: 
			[
				{
					ErrorCode: String,
					FieldName: String,
					Message: String,
					Meta: 
					{
						String: String
					}
				}
			],
			Meta: 
			{
				String: String
			}
		}
	},
	Sent: False,
	Token: String,
	NeedsName: False,
	Name: String,
	Url: String,
	ClientSecret: String,
	PublishableKey: String,
	Message: String,
	ReopenStep: String,
	Customers: 
	[
		{
			ContactId: 0,
			Name: String,
			Phone: String,
			BillingMode: String,
			AccountCode: String,
			Orders: 0,
			LastOrderAt: 0001-01-01,
			Unbilled: 0,
			UnbilledAmount: 0,
			Cards: 0
		}
	],
	Run: 
	{
		Invoices: 0,
		Orders: 0,
		Total: 0,
		Skipped: 
		[
			String
		]
	},
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}