Billhighway Cloud API

<back to all web services

InvoiceCollection

The following routes are available for this service:
POST/invoices/misc
import 'package:servicestack/servicestack.dart';

class InvoiceReply implements IConvertible
{
    String? UniqueId;
    int? ErrorCode;
    String? ErrorMessage;
    int? InvBatchNo;
    double? InvAmount;

    InvoiceReply({this.UniqueId,this.ErrorCode,this.ErrorMessage,this.InvBatchNo,this.InvAmount});
    InvoiceReply.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        UniqueId = json['UniqueId'];
        ErrorCode = json['ErrorCode'];
        ErrorMessage = json['ErrorMessage'];
        InvBatchNo = json['InvBatchNo'];
        InvAmount = JsonConverters.toDouble(json['InvAmount']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'UniqueId': UniqueId,
        'ErrorCode': ErrorCode,
        'ErrorMessage': ErrorMessage,
        'InvBatchNo': InvBatchNo,
        'InvAmount': InvAmount
    };

    getTypeName() => "InvoiceReply";
    TypeContext? context = _ctx;
}

class InvoiceCollectionReply implements IHaveErrorField, IConvertible
{
    List<InvoiceReply>? InvoiceReply;
    bool? IsError;

    InvoiceCollectionReply({this.InvoiceReply,this.IsError});
    InvoiceCollectionReply.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        InvoiceReply = JsonConverters.fromJson(json['InvoiceReply'],'List<InvoiceReply>',context!);
        IsError = json['IsError'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'InvoiceReply': JsonConverters.toJson(InvoiceReply,'List<InvoiceReply>',context!),
        'IsError': IsError
    };

    getTypeName() => "InvoiceCollectionReply";
    TypeContext? context = _ctx;
}

class InvoiceItem implements IInvoiceItemValidation, IConvertible
{
    String? UniqueId;
    String? ProductName;
    double? AmountDue;
    String? ProductType;
    int? ActPatternTypeID;
    DateTime? TermStartDate;
    DateTime? TermEndDate;
    int? RecognitionPeriod;
    String? RevenueAccount;
    String? AccountsReceivableAccount;
    String? LiabilityAccount;
    String? CreditExpenseAccount;
    String? InvoiceClearingAccount;
    String? CostCenter;
    String? Region;

    InvoiceItem({this.UniqueId,this.ProductName,this.AmountDue,this.ProductType,this.ActPatternTypeID,this.TermStartDate,this.TermEndDate,this.RecognitionPeriod,this.RevenueAccount,this.AccountsReceivableAccount,this.LiabilityAccount,this.CreditExpenseAccount,this.InvoiceClearingAccount,this.CostCenter,this.Region});
    InvoiceItem.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        UniqueId = json['UniqueId'];
        ProductName = json['ProductName'];
        AmountDue = JsonConverters.toDouble(json['AmountDue']);
        ProductType = json['ProductType'];
        ActPatternTypeID = json['ActPatternTypeID'];
        TermStartDate = JsonConverters.fromJson(json['TermStartDate'],'DateTime',context!);
        TermEndDate = JsonConverters.fromJson(json['TermEndDate'],'DateTime',context!);
        RecognitionPeriod = json['RecognitionPeriod'];
        RevenueAccount = json['RevenueAccount'];
        AccountsReceivableAccount = json['AccountsReceivableAccount'];
        LiabilityAccount = json['LiabilityAccount'];
        CreditExpenseAccount = json['CreditExpenseAccount'];
        InvoiceClearingAccount = json['InvoiceClearingAccount'];
        CostCenter = json['CostCenter'];
        Region = json['Region'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'UniqueId': UniqueId,
        'ProductName': ProductName,
        'AmountDue': AmountDue,
        'ProductType': ProductType,
        'ActPatternTypeID': ActPatternTypeID,
        'TermStartDate': JsonConverters.toJson(TermStartDate,'DateTime',context!),
        'TermEndDate': JsonConverters.toJson(TermEndDate,'DateTime',context!),
        'RecognitionPeriod': RecognitionPeriod,
        'RevenueAccount': RevenueAccount,
        'AccountsReceivableAccount': AccountsReceivableAccount,
        'LiabilityAccount': LiabilityAccount,
        'CreditExpenseAccount': CreditExpenseAccount,
        'InvoiceClearingAccount': InvoiceClearingAccount,
        'CostCenter': CostCenter,
        'Region': Region
    };

    getTypeName() => "InvoiceItem";
    TypeContext? context = _ctx;
}

class Invoice implements IInvoiceValidation, IConvertible
{
    String? UniqueId;
    int? ClientId;
    String? GroupId;
    String? Description;
    String? OpportunityId;
    int? Installments;
    int? Frequency;
    DateTime? InvoiceDueDate;
    bool? Deliver;
    String? UserId;
    int? BhUserId;
    String? CurrencyType;
    List<InvoiceItem>? InvoiceItems;
    int? InvoiceNo;
    double? InvoiceAmt;
    String? ExternalInvBatchNo;
    bool? ExemptFromLateFee;

    Invoice({this.UniqueId,this.ClientId,this.GroupId,this.Description,this.OpportunityId,this.Installments,this.Frequency,this.InvoiceDueDate,this.Deliver,this.UserId,this.BhUserId,this.CurrencyType,this.InvoiceItems,this.InvoiceNo,this.InvoiceAmt,this.ExternalInvBatchNo,this.ExemptFromLateFee});
    Invoice.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        UniqueId = json['UniqueId'];
        ClientId = json['ClientId'];
        GroupId = json['GroupId'];
        Description = json['Description'];
        OpportunityId = json['OpportunityId'];
        Installments = json['Installments'];
        Frequency = json['Frequency'];
        InvoiceDueDate = JsonConverters.fromJson(json['InvoiceDueDate'],'DateTime',context!);
        Deliver = json['Deliver'];
        UserId = json['UserId'];
        BhUserId = json['BhUserId'];
        CurrencyType = json['CurrencyType'];
        InvoiceItems = JsonConverters.fromJson(json['InvoiceItems'],'List<InvoiceItem>',context!);
        InvoiceNo = json['InvoiceNo'];
        InvoiceAmt = JsonConverters.toDouble(json['InvoiceAmt']);
        ExternalInvBatchNo = json['ExternalInvBatchNo'];
        ExemptFromLateFee = json['ExemptFromLateFee'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'UniqueId': UniqueId,
        'ClientId': ClientId,
        'GroupId': GroupId,
        'Description': Description,
        'OpportunityId': OpportunityId,
        'Installments': Installments,
        'Frequency': Frequency,
        'InvoiceDueDate': JsonConverters.toJson(InvoiceDueDate,'DateTime',context!),
        'Deliver': Deliver,
        'UserId': UserId,
        'BhUserId': BhUserId,
        'CurrencyType': CurrencyType,
        'InvoiceItems': JsonConverters.toJson(InvoiceItems,'List<InvoiceItem>',context!),
        'InvoiceNo': InvoiceNo,
        'InvoiceAmt': InvoiceAmt,
        'ExternalInvBatchNo': ExternalInvBatchNo,
        'ExemptFromLateFee': ExemptFromLateFee
    };

    getTypeName() => "Invoice";
    TypeContext? context = _ctx;
}

class InvoiceCollection implements IConvertible
{
    List<Invoice>? InvoiceList;

    InvoiceCollection({this.InvoiceList});
    InvoiceCollection.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        InvoiceList = JsonConverters.fromJson(json['InvoiceList'],'List<Invoice>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'InvoiceList': JsonConverters.toJson(InvoiceList,'List<Invoice>',context!)
    };

    getTypeName() => "InvoiceCollection";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'devapi.billhighway.com', types: <String, TypeInfo> {
    'InvoiceReply': TypeInfo(TypeOf.Class, create:() => InvoiceReply()),
    'InvoiceCollectionReply': TypeInfo(TypeOf.Class, create:() => InvoiceCollectionReply()),
    'List<InvoiceReply>': TypeInfo(TypeOf.Class, create:() => <InvoiceReply>[]),
    'InvoiceItem': TypeInfo(TypeOf.Class, create:() => InvoiceItem()),
    'Invoice': TypeInfo(TypeOf.Class, create:() => Invoice()),
    'List<InvoiceItem>': TypeInfo(TypeOf.Class, create:() => <InvoiceItem>[]),
    'InvoiceCollection': TypeInfo(TypeOf.Class, create:() => InvoiceCollection()),
    'List<Invoice>': TypeInfo(TypeOf.Class, create:() => <Invoice>[]),
});

Dart InvoiceCollection 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.

POST /invoices/misc HTTP/1.1 
Host: devapi.billhighway.com 
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length

{
	InvoiceList: 
	[
		{
			UniqueId: String,
			ClientId: 0,
			GroupId: String,
			UserId: String,
			OpportunityId: String,
			InvoiceDueDate: 0001-01-01,
			Installments: 0,
			Frequency: 0,
			BhUserId: 0,
			Description: String,
			Deliver: False,
			CurrencyType: String,
			InvoiceItems: 
			[
				{
					ProductName: String,
					AmountDue: String,
					RevenueAccount: String
				}
			],
			InvoiceNo: 0,
			InvoiceAmt: 0,
			ExternalInvBatchNo: String,
			ExemptFromLateFee: False
		}
	]
}
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	InvoiceReply: 
	[
		{
			UniqueId: String,
			ErrorCode: 0,
			ErrorMessage: String,
			InvBatchNo: 0,
			InvAmount: 0
		}
	],
	IsError: False
}