Billiecart API

<back to all web services

ForecastRequest

Requires Authentication
Requires the role:manager
The following routes are available for this service:
PUT/packages/{id}/forecast
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


TResponse = TypeVar('TResponse')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PutOperationUnTenanted(Generic[TResponse], IReturn[TResponse], IPut):
    @staticmethod
    def response_type(): return TResponse


TResponse = TypeVar('TResponse')


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PutOperationTenanted(Generic[TResponse], PutOperationUnTenanted[TResponse], ITenantedRequest):
    organisation_id: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BudgetBreakdown:
    lease_amount: Optional[Decimal] = None
    administration_fee: Optional[Decimal] = None
    fuel: Optional[Decimal] = None
    servicing: Optional[Decimal] = None
    tyres: Optional[Decimal] = None
    insurance: Optional[Decimal] = None
    car_wash: Optional[Decimal] = None
    registration: Optional[Decimal] = None
    road_side_assistance: Optional[Decimal] = None
    anything_extra: Optional[Decimal] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Employment:
    payroll_cycle: Optional[str] = None
    first_pay_date: Optional[datetime.datetime] = None
    employer_id: Optional[str] = None
    employer_name: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Vehicle:
    make: Optional[str] = None
    model: Optional[str] = None
    colour: Optional[str] = None
    body_shape: Optional[str] = None
    license_plate: Optional[str] = None
    transmission: Optional[str] = None
    manufacture_year: Optional[int] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BankAccount:
    bsb_number: Optional[str] = None
    account_number: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class LeaseDetails:
    term: Optional[int] = None
    start_date: Optional[datetime.datetime] = None
    amount_financed: Optional[Decimal] = None
    payment_amount: Optional[Decimal] = None
    finance_provider: Optional[str] = None
    residual_value: Optional[Decimal] = None
    yearly_kms_travelled: Optional[int] = None
    fringe_benefit_tax_value: Optional[Decimal] = None
    fringe_benefit_tax_method: Optional[str] = None
    fringe_benefit_tax_business_use: Optional[int] = None
    fringe_benefit_tax_start_date: Optional[datetime.datetime] = None
    pre_tax_deduction: Optional[Decimal] = None
    post_tax_deduction: Optional[Decimal] = None
    gst_on_post_tax_deduction: Optional[Decimal] = None
    luxury_vehicle_charge: Optional[Decimal] = None
    on_road_cost: Optional[Decimal] = None
    registration_due_date: Optional[datetime.datetime] = None
    insurance_due_date: Optional[datetime.datetime] = None
    lease_provider_bank_account: Optional[BankAccount] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BudgetBalances:
    lease_amount: Optional[Decimal] = None
    administration_fee: Optional[Decimal] = None
    fuel: Optional[Decimal] = None
    servicing: Optional[Decimal] = None
    tyres: Optional[Decimal] = None
    insurance: Optional[Decimal] = None
    car_wash: Optional[Decimal] = None
    registration: Optional[Decimal] = None
    road_side_assistance: Optional[Decimal] = None
    anything_extra: Optional[Decimal] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SalarySacrificeBreakdown:
    lease_amount: Optional[Decimal] = None
    administration_fee: Optional[Decimal] = None
    fuel: Optional[Decimal] = None
    servicing: Optional[Decimal] = None
    tyres: Optional[Decimal] = None
    insurance: Optional[Decimal] = None
    car_wash: Optional[Decimal] = None
    registration: Optional[Decimal] = None
    road_side_assistance: Optional[Decimal] = None
    anything_extra: Optional[Decimal] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SalarySacrifice:
    payment_date: Optional[datetime.datetime] = None
    salary_sacrifice_breakdown: Optional[SalarySacrificeBreakdown] = None
    pre_tax_deduction: Optional[Decimal] = None
    post_tax_deduction: Optional[Decimal] = None
    contribution_id: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ForecastedSalarySacrifice:
    payment_date: Optional[datetime.datetime] = None
    amount: Optional[Decimal] = None
    matched: Optional[SalarySacrifice] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Expense:
    budget_category: Optional[str] = None
    amount: Optional[Decimal] = None
    gst: Optional[Decimal] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ForecastedOutgoingPayment:
    scheduled: Optional[datetime.datetime] = None
    amount: Optional[Decimal] = None
    budget_category: Optional[str] = None
    matched: Optional[Expense] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Adjustment(IIdentifiableResource):
    budget_category: Optional[str] = None
    amount: Optional[Decimal] = None
    gst: Optional[Decimal] = None
    description: Optional[str] = None
    received: Optional[datetime.datetime] = None
    id: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class Transaction:
    received: Optional[datetime.datetime] = None
    budget_category: Optional[str] = None
    amount: Optional[Decimal] = None
    gst: Optional[Decimal] = None
    description: Optional[str] = None
    type: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class SalaryPackage(IIdentifiableResource):
    customer_id: Optional[str] = None
    customer_first_name: Optional[str] = None
    customer_last_name: Optional[str] = None
    status: Optional[str] = None
    notes: Optional[str] = None
    budget_breakdown: Optional[BudgetBreakdown] = None
    employment: Optional[Employment] = None
    vehicle: Optional[Vehicle] = None
    lease_details: Optional[LeaseDetails] = None
    budget_balances: Optional[BudgetBalances] = None
    current_balance: Optional[Decimal] = None
    forecasted_salary_sacrifices: Optional[List[ForecastedSalarySacrifice]] = None
    forecasted_outgoing_payments: Optional[List[ForecastedOutgoingPayment]] = None
    adjustments: Optional[List[Adjustment]] = None
    transactions: Optional[List[Transaction]] = None
    id: Optional[str] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ForecastResponse:
    response_status: Optional[ResponseStatus] = None
    salary_package: Optional[SalaryPackage] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class ForecastRequest(PutOperationTenanted[ForecastResponse]):
    id: Optional[str] = None

Python ForecastRequest 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.

PUT /packages/{id}/forecast HTTP/1.1 
Host: staging-api.billiecart.com.au 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<ForecastRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Infrastructure.Api.Interfaces.ServiceOperations.SalaryPackages">
  <OrganisationId xmlns="http://schemas.datacontract.org/2004/07/Infrastructure.Api.Interfaces.ServiceOperations">String</OrganisationId>
  <Id>String</Id>
</ForecastRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<ForecastResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Infrastructure.Api.Interfaces.ServiceOperations.SalaryPackages">
  <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>
  <SalaryPackage xmlns:d2p1="http://schemas.datacontract.org/2004/07/Application.Interfaces.Resources">
    <d2p1:Adjustments>
      <d2p1:Adjustment>
        <d2p1:Amount>0</d2p1:Amount>
        <d2p1:BudgetCategory>String</d2p1:BudgetCategory>
        <d2p1:Description>String</d2p1:Description>
        <d2p1:Gst>0</d2p1:Gst>
        <d2p1:Id>String</d2p1:Id>
        <d2p1:Received>0001-01-01T00:00:00</d2p1:Received>
      </d2p1:Adjustment>
    </d2p1:Adjustments>
    <d2p1:BudgetBalances>
      <d2p1:AdministrationFee>0</d2p1:AdministrationFee>
      <d2p1:AnythingExtra>0</d2p1:AnythingExtra>
      <d2p1:CarWash>0</d2p1:CarWash>
      <d2p1:Fuel>0</d2p1:Fuel>
      <d2p1:Insurance>0</d2p1:Insurance>
      <d2p1:LeaseAmount>0</d2p1:LeaseAmount>
      <d2p1:Registration>0</d2p1:Registration>
      <d2p1:RoadSideAssistance>0</d2p1:RoadSideAssistance>
      <d2p1:Servicing>0</d2p1:Servicing>
      <d2p1:Tyres>0</d2p1:Tyres>
    </d2p1:BudgetBalances>
    <d2p1:BudgetBreakdown>
      <d2p1:AdministrationFee>0</d2p1:AdministrationFee>
      <d2p1:AnythingExtra>0</d2p1:AnythingExtra>
      <d2p1:CarWash>0</d2p1:CarWash>
      <d2p1:Fuel>0</d2p1:Fuel>
      <d2p1:Insurance>0</d2p1:Insurance>
      <d2p1:LeaseAmount>0</d2p1:LeaseAmount>
      <d2p1:Registration>0</d2p1:Registration>
      <d2p1:RoadSideAssistance>0</d2p1:RoadSideAssistance>
      <d2p1:Servicing>0</d2p1:Servicing>
      <d2p1:Tyres>0</d2p1:Tyres>
    </d2p1:BudgetBreakdown>
    <d2p1:CurrentBalance>0</d2p1:CurrentBalance>
    <d2p1:CustomerFirstName>String</d2p1:CustomerFirstName>
    <d2p1:CustomerId>String</d2p1:CustomerId>
    <d2p1:CustomerLastName>String</d2p1:CustomerLastName>
    <d2p1:Employment>
      <d2p1:EmployerId>String</d2p1:EmployerId>
      <d2p1:EmployerName>String</d2p1:EmployerName>
      <d2p1:FirstPayDate>0001-01-01T00:00:00</d2p1:FirstPayDate>
      <d2p1:PayrollCycle>String</d2p1:PayrollCycle>
    </d2p1:Employment>
    <d2p1:ForecastedOutgoingPayments>
      <d2p1:ForecastedOutgoingPayment>
        <d2p1:Amount>0</d2p1:Amount>
        <d2p1:BudgetCategory>String</d2p1:BudgetCategory>
        <d2p1:Matched>
          <d2p1:Amount>0</d2p1:Amount>
          <d2p1:BudgetCategory>String</d2p1:BudgetCategory>
          <d2p1:Gst>0</d2p1:Gst>
        </d2p1:Matched>
        <d2p1:Scheduled>0001-01-01T00:00:00</d2p1:Scheduled>
      </d2p1:ForecastedOutgoingPayment>
    </d2p1:ForecastedOutgoingPayments>
    <d2p1:ForecastedSalarySacrifices>
      <d2p1:ForecastedSalarySacrifice>
        <d2p1:Amount>0</d2p1:Amount>
        <d2p1:Matched>
          <d2p1:ContributionId>String</d2p1:ContributionId>
          <d2p1:PaymentDate>0001-01-01T00:00:00</d2p1:PaymentDate>
          <d2p1:PostTaxDeduction>0</d2p1:PostTaxDeduction>
          <d2p1:PreTaxDeduction>0</d2p1:PreTaxDeduction>
          <d2p1:SalarySacrificeBreakdown>
            <d2p1:AdministrationFee>0</d2p1:AdministrationFee>
            <d2p1:AnythingExtra>0</d2p1:AnythingExtra>
            <d2p1:CarWash>0</d2p1:CarWash>
            <d2p1:Fuel>0</d2p1:Fuel>
            <d2p1:Insurance>0</d2p1:Insurance>
            <d2p1:LeaseAmount>0</d2p1:LeaseAmount>
            <d2p1:Registration>0</d2p1:Registration>
            <d2p1:RoadSideAssistance>0</d2p1:RoadSideAssistance>
            <d2p1:Servicing>0</d2p1:Servicing>
            <d2p1:Tyres>0</d2p1:Tyres>
          </d2p1:SalarySacrificeBreakdown>
        </d2p1:Matched>
        <d2p1:PaymentDate>0001-01-01T00:00:00</d2p1:PaymentDate>
      </d2p1:ForecastedSalarySacrifice>
    </d2p1:ForecastedSalarySacrifices>
    <d2p1:Id>String</d2p1:Id>
    <d2p1:LeaseDetails>
      <d2p1:AmountFinanced>0</d2p1:AmountFinanced>
      <d2p1:FinanceProvider>String</d2p1:FinanceProvider>
      <d2p1:FringeBenefitTaxBusinessUse>0</d2p1:FringeBenefitTaxBusinessUse>
      <d2p1:FringeBenefitTaxMethod>String</d2p1:FringeBenefitTaxMethod>
      <d2p1:FringeBenefitTaxStartDate>0001-01-01T00:00:00</d2p1:FringeBenefitTaxStartDate>
      <d2p1:FringeBenefitTaxValue>0</d2p1:FringeBenefitTaxValue>
      <d2p1:GstOnPostTaxDeduction>0</d2p1:GstOnPostTaxDeduction>
      <d2p1:InsuranceDueDate>0001-01-01T00:00:00</d2p1:InsuranceDueDate>
      <d2p1:LeaseProviderBankAccount>
        <d2p1:AccountNumber>String</d2p1:AccountNumber>
        <d2p1:BsbNumber>String</d2p1:BsbNumber>
      </d2p1:LeaseProviderBankAccount>
      <d2p1:LuxuryVehicleCharge>0</d2p1:LuxuryVehicleCharge>
      <d2p1:OnRoadCost>0</d2p1:OnRoadCost>
      <d2p1:PaymentAmount>0</d2p1:PaymentAmount>
      <d2p1:PostTaxDeduction>0</d2p1:PostTaxDeduction>
      <d2p1:PreTaxDeduction>0</d2p1:PreTaxDeduction>
      <d2p1:RegistrationDueDate>0001-01-01T00:00:00</d2p1:RegistrationDueDate>
      <d2p1:ResidualValue>0</d2p1:ResidualValue>
      <d2p1:StartDate>0001-01-01T00:00:00</d2p1:StartDate>
      <d2p1:Term>0</d2p1:Term>
      <d2p1:YearlyKmsTravelled>0</d2p1:YearlyKmsTravelled>
    </d2p1:LeaseDetails>
    <d2p1:Notes>String</d2p1:Notes>
    <d2p1:Status>String</d2p1:Status>
    <d2p1:Transactions>
      <d2p1:Transaction>
        <d2p1:Amount>0</d2p1:Amount>
        <d2p1:BudgetCategory>String</d2p1:BudgetCategory>
        <d2p1:Description>String</d2p1:Description>
        <d2p1:Gst>0</d2p1:Gst>
        <d2p1:Received>0001-01-01T00:00:00</d2p1:Received>
        <d2p1:Type>String</d2p1:Type>
      </d2p1:Transaction>
    </d2p1:Transactions>
    <d2p1:Vehicle>
      <d2p1:BodyShape>String</d2p1:BodyShape>
      <d2p1:Colour>String</d2p1:Colour>
      <d2p1:LicensePlate>String</d2p1:LicensePlate>
      <d2p1:Make>String</d2p1:Make>
      <d2p1:ManufactureYear>0</d2p1:ManufactureYear>
      <d2p1:Model>String</d2p1:Model>
      <d2p1:Transmission>String</d2p1:Transmission>
    </d2p1:Vehicle>
  </SalaryPackage>
</ForecastResponse>