GET | /api/InvoiceDetail |
---|
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 BaseRequest:
# @ApiMember(DataType="string", Description="This is your AIM API Key provided by Tri-Tech", IsRequired=true, Name="ApiKey", ParameterType="header")
api_key: Optional[str] = None
"""
This is your AIM API Key provided by Tri-Tech
"""
# @ApiMember(DataType="string", Name="OAuthToken", ParameterType="header")
o_auth_token: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseSecureRequest(BaseRequest):
# @ApiMember(DataType="string", Description="", Name="Token", ParameterType="Header")
token: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="DeviceId", ParameterType="Header")
device_id: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", IsRequired=true, Name="AppId", ParameterType="Header")
app_id: Optional[str] = None
"""
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseResponseResult:
# @ApiMember(DataType="string", Description="", Name="StatusCode", ParameterType="body")
status_code: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="Login", ParameterType="body")
login: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorCode", ParameterType="body")
error_code: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorDisplayText", ParameterType="body")
error_display_text: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", Name="ErrorMessage", ParameterType="body")
error_message: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="DomainName", ParameterType="body")
domain_name: Optional[str] = None
"""
"""
# @ApiMember(DataType="string", Description="", ExcludeInSchema=true, Name="IPAddress", ParameterType="body")
ip_address: Optional[str] = None
"""
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class BaseResponse:
# @ApiMember(DataType="BaseResponseResult", Description="", Name="Status", ParameterType="body")
status: Optional[BaseResponseResult] = None
"""
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoiceLineItem:
quantity: Decimal = decimal.Decimal(0)
sku: Optional[str] = None
description: Optional[str] = None
price_each: Decimal = decimal.Decimal(0)
extended: Decimal = decimal.Decimal(0)
discount: Decimal = decimal.Decimal(0)
total: Decimal = decimal.Decimal(0)
original_ref: Optional[str] = None
notes: Optional[str] = None
source: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoicePaymentItem:
pay_ref: Optional[str] = None
date_time: datetime.datetime = datetime.datetime(1, 1, 1)
amount: Decimal = decimal.Decimal(0)
notes: Optional[str] = None
source: Optional[str] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoiceInfo:
invoice_number: Optional[str] = None
date_time: datetime.datetime = datetime.datetime(1, 1, 1)
sold_to_acct: int = 0
sold_to_name: Optional[str] = None
bill_to_acct: int = 0
bill_to_name: Optional[str] = None
type: Optional[str] = None
po: Optional[str] = None
original_amount: Decimal = decimal.Decimal(0)
balance: Decimal = decimal.Decimal(0)
location: Optional[str] = None
ship_to_name: Optional[str] = None
ship_to_address: Optional[str] = None
ship_to_id: Optional[int] = None
line_items: Optional[List[InvoiceLineItem]] = None
payments: Optional[List[InvoicePaymentItem]] = None
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoiceDetailResponse(BaseResponse):
invoices: Optional[List[InvoiceInfo]] = None
remaining_records: int = 0
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class InvoiceDetailRequest(BaseSecureRequest):
"""
InvoiceDetailRequires active-e Customer Service.
"""
acct: Optional[int] = None
invoice_start_date: Optional[datetime.datetime] = None
invoice_end_date: Optional[datetime.datetime] = None
# @ApiMember(DataType="integer", Description="The Starting Offset. Defaults to 0 if not sent.", Format="int64", Name="StartOffset")
start_offset: Optional[int] = None
"""
The Starting Offset. Defaults to 0 if not sent.
"""
# @ApiMember(DataType="integer", Description="The # of records to be returned. Defaults to 100 if not sent.", Format="int64", Name="RecordCount")
record_count: Optional[int] = None
"""
The # of records to be returned. Defaults to 100 if not sent.
"""
# @ApiMember(DataType="string", Description="The Invoice Ref# to be looked up. If sent, do not send WebRef, Acct, InvoiceStartDate, InvoiceEndDate, StartOffset, or RecordCount", Name="AIMRef")
aim_ref: Optional[str] = None
"""
The Invoice Ref# to be looked up. If sent, do not send WebRef, Acct, InvoiceStartDate, InvoiceEndDate, StartOffset, or RecordCount
"""
# @ApiMember(DataType="string", Description="The WebRef to be looked up. If sent, do not send AIMRef, Acct, InvoiceStartDate, InvoiceEndDate, StartOffset, or RecordCount", Name="WebRef")
web_ref: Optional[str] = None
"""
The WebRef to be looked up. If sent, do not send AIMRef, Acct, InvoiceStartDate, InvoiceEndDate, StartOffset, or RecordCount
"""
Python InvoiceDetailRequest DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
GET /api/InvoiceDetail HTTP/1.1 Host: active-ewebservice.biz Accept: application/xml
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <InvoiceDetailResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/AIM.WebService"> <Status> <DomainName>String</DomainName> <ErrorCode>String</ErrorCode> <ErrorDisplayText>String</ErrorDisplayText> <ErrorMessage>String</ErrorMessage> <IpAddress>String</IpAddress> <Login>String</Login> <StatusCode>String</StatusCode> </Status> <Invoices> <InvoiceInfo> <Balance>0</Balance> <BillToAcct>0</BillToAcct> <BillToName>String</BillToName> <DateTime>0001-01-01T00:00:00</DateTime> <InvoiceNumber>String</InvoiceNumber> <LineItems> <InvoiceLineItem> <Description>String</Description> <Discount>0</Discount> <Extended>0</Extended> <Notes>String</Notes> <OriginalRef>String</OriginalRef> <PriceEach>0</PriceEach> <Quantity>0</Quantity> <Sku>String</Sku> <Source>String</Source> <Total>0</Total> </InvoiceLineItem> </LineItems> <Location>String</Location> <OriginalAmount>0</OriginalAmount> <PO>String</PO> <Payments> <InvoicePaymentItem> <Amount>0</Amount> <DateTime>0001-01-01T00:00:00</DateTime> <Notes>String</Notes> <PayRef>String</PayRef> <Source>String</Source> </InvoicePaymentItem> </Payments> <ShipToAddress>String</ShipToAddress> <ShipToId>0</ShipToId> <ShipToName>String</ShipToName> <SoldToAcct>0</SoldToAcct> <SoldToName>String</SoldToName> <Type>String</Type> </InvoiceInfo> </Invoices> <RemainingRecords>0</RemainingRecords> </InvoiceDetailResponse>