Requires the role: | manager |
POST | /packages/{Id}/adjustments |
---|
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 PostOperationUnTenanted(Generic[TResponse], IReturn[TResponse], IPost):
@staticmethod
def response_type(): return TResponse
TResponse = TypeVar('TResponse')
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PostOperationTenanted(Generic[TResponse], PostOperationUnTenanted[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 AddAdjustmentResponse:
response_status: Optional[ResponseStatus] = None
salary_package: Optional[SalaryPackage] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AddAdjustmentRequest(PostOperationTenanted[AddAdjustmentResponse]):
id: Optional[str] = None
amount: Optional[Decimal] = None
gst: Optional[Decimal] = None
budget_category: Optional[str] = None
description: Optional[str] = None
received: Optional[datetime.datetime] = None
Python AddAdjustmentRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .csv suffix or ?format=csv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /packages/{Id}/adjustments HTTP/1.1
Host: staging-api.billiecart.com.au
Accept: text/csv
Content-Type: text/csv
Content-Length: length
{"id":"String","amount":0,"gst":0,"budgetCategory":"String","description":"String","organisationId":"String"}
HTTP/1.1 200 OK Content-Type: text/csv Content-Length: length {"responseStatus":{"errorCode":"String","message":"String","stackTrace":"String","errors":[{"errorCode":"String","fieldName":"String","message":"String","meta":{"String":"String"}}],"meta":{"String":"String"}},"salaryPackage":{"customerId":"String","customerFirstName":"String","customerLastName":"String","status":"String","notes":"String","budgetBreakdown":{"leaseAmount":0,"administrationFee":0,"fuel":0,"servicing":0,"tyres":0,"insurance":0,"carWash":0,"registration":0,"roadSideAssistance":0,"anythingExtra":0},"employment":{"payrollCycle":"String","employerId":"String","employerName":"String"},"vehicle":{"make":"String","model":"String","colour":"String","bodyShape":"String","licensePlate":"String","transmission":"String","manufactureYear":0},"leaseDetails":{"term":0,"startDate":null,"amountFinanced":0,"paymentAmount":0,"financeProvider":"String","residualValue":0,"yearlyKmsTravelled":0,"fringeBenefitTaxValue":0,"fringeBenefitTaxMethod":"String","fringeBenefitTaxBusinessUse":0,"preTaxDeduction":0,"postTaxDeduction":0,"gstOnPostTaxDeduction":0,"luxuryVehicleCharge":0,"onRoadCost":0,"leaseProviderBankAccount":{"bsbNumber":"String","accountNumber":"String"}},"budgetBalances":{"leaseAmount":0,"administrationFee":0,"fuel":0,"servicing":0,"tyres":0,"insurance":0,"carWash":0,"registration":0,"roadSideAssistance":0,"anythingExtra":0},"currentBalance":0,"forecastedSalarySacrifices":[{"amount":0,"matched":{"salarySacrificeBreakdown":{"leaseAmount":0,"administrationFee":0,"fuel":0,"servicing":0,"tyres":0,"insurance":0,"carWash":0,"registration":0,"roadSideAssistance":0,"anythingExtra":0},"preTaxDeduction":0,"postTaxDeduction":0,"contributionId":"String"}}],"forecastedOutgoingPayments":[{"amount":0,"budgetCategory":"String","matched":{"budgetCategory":"String","amount":0,"gst":0}}],"adjustments":[{"budgetCategory":"String","amount":0,"gst":0,"description":"String","id":"String"}],"transactions":[{"budgetCategory":"String","amount":0,"gst":0,"description":"String","type":"String"}],"id":"String"}}