BokaMera.API.Host

<back to all web services

PreviewSummarizedInvoice

Requires Authentication
The following routes are available for this service:
GET/eaccounting/summarizedinvoice/previewPreview eligible bookings for summarized invoicingReturns the customers and booking counts that would be included in a summarized invoice run, without actually creating anything.
import 'package:servicestack/servicestack.dart';

class PreviewCustomerGroup implements IConvertible
{
    String CustomerId = "";
    String CustomerName = "";
    String? Email;
    int BookingCount = 0;
    List<int> BookingIds = [];
    bool MissingInvoiceAddress;
    bool MissingEmail;

    PreviewCustomerGroup({this.CustomerId,this.CustomerName,this.Email,this.BookingCount,this.BookingIds,this.MissingInvoiceAddress,this.MissingEmail});
    PreviewCustomerGroup.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CustomerId = json['CustomerId'];
        CustomerName = json['CustomerName'];
        Email = json['Email'];
        BookingCount = json['BookingCount'];
        BookingIds = JsonConverters.fromJson(json['BookingIds'],'List<int>',context!);
        MissingInvoiceAddress = json['MissingInvoiceAddress'];
        MissingEmail = json['MissingEmail'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CustomerId': CustomerId,
        'CustomerName': CustomerName,
        'Email': Email,
        'BookingCount': BookingCount,
        'BookingIds': JsonConverters.toJson(BookingIds,'List<int>',context!),
        'MissingInvoiceAddress': MissingInvoiceAddress,
        'MissingEmail': MissingEmail
    };

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

class PreviewSummarizedInvoiceResponse implements IConvertible
{
    int TotalCustomers = 0;
    int TotalBookings = 0;
    List<PreviewCustomerGroup> Customers = [];
    ResponseStatus ResponseStatus;

    PreviewSummarizedInvoiceResponse({this.TotalCustomers,this.TotalBookings,this.Customers,this.ResponseStatus});
    PreviewSummarizedInvoiceResponse.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        TotalCustomers = json['TotalCustomers'];
        TotalBookings = json['TotalBookings'];
        Customers = JsonConverters.fromJson(json['Customers'],'List<PreviewCustomerGroup>',context!);
        ResponseStatus = JsonConverters.fromJson(json['ResponseStatus'],'ResponseStatus',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'TotalCustomers': TotalCustomers,
        'TotalBookings': TotalBookings,
        'Customers': JsonConverters.toJson(Customers,'List<PreviewCustomerGroup>',context!),
        'ResponseStatus': JsonConverters.toJson(ResponseStatus,'ResponseStatus',context!)
    };

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

enum EAccountingInvoiceSendTypes
{
    None,
    AutoInvoiceElectronic,
    AutoInvoicePrint,
    AutoInvoiceB2C,
}

// @ValidateRequest(Validator="IsAuthenticated")
class PreviewSummarizedInvoice implements ICompany, IConvertible
{
    /**
    * The company id, if empty will use the company id for the user you are logged in with.
    */
    // @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
    String? CompanyId;

    /**
    * Start date for the booking range to include.
    */
    // @ApiMember(Description="Start date for the booking range to include.", IsRequired=true)
    DateTime DateFrom = DateTime(0);

    /**
    * End date for the booking range to include.
    */
    // @ApiMember(Description="End date for the booking range to include.", IsRequired=true)
    DateTime DateTo = DateTime(0);

    /**
    * Optional customer id filter.
    */
    // @ApiMember(Description="Optional customer id filter.")
    String? CustomerId;

    /**
    * Optional service/event id filter.
    */
    // @ApiMember(Description="Optional service/event id filter.")
    int? ServiceId;

    /**
    * Optional list of booking status ids to include. If empty, all statuses are included.
    */
    // @ApiMember(Description="Optional list of booking status ids to include. If empty, all statuses are included.")
    List<int>? BookingStatusIds;

    /**
    * Send type for invoices. 0 = None, 1 = AutoInvoiceElectronic, 2 = AutoInvoicePrint, 3 = AutoInvoiceB2C. Used to validate customer addresses for postal delivery.
    */
    // @ApiMember(Description="Send type for invoices. 0 = None, 1 = AutoInvoiceElectronic, 2 = AutoInvoicePrint, 3 = AutoInvoiceB2C. Used to validate customer addresses for postal delivery.")
    EAccountingInvoiceSendTypes? SendType;

    PreviewSummarizedInvoice({this.CompanyId,this.DateFrom,this.DateTo,this.CustomerId,this.ServiceId,this.BookingStatusIds,this.SendType});
    PreviewSummarizedInvoice.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        CompanyId = json['CompanyId'];
        DateFrom = JsonConverters.fromJson(json['DateFrom'],'DateTime',context!);
        DateTo = JsonConverters.fromJson(json['DateTo'],'DateTime',context!);
        CustomerId = json['CustomerId'];
        ServiceId = json['ServiceId'];
        BookingStatusIds = JsonConverters.fromJson(json['BookingStatusIds'],'List<int>',context!);
        SendType = JsonConverters.fromJson(json['SendType'],'EAccountingInvoiceSendTypes',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'CompanyId': CompanyId,
        'DateFrom': JsonConverters.toJson(DateFrom,'DateTime',context!),
        'DateTo': JsonConverters.toJson(DateTo,'DateTime',context!),
        'CustomerId': CustomerId,
        'ServiceId': ServiceId,
        'BookingStatusIds': JsonConverters.toJson(BookingStatusIds,'List<int>',context!),
        'SendType': JsonConverters.toJson(SendType,'EAccountingInvoiceSendTypes',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'api.bokamera.se', types: <String, TypeInfo> {
    'PreviewCustomerGroup': TypeInfo(TypeOf.Class, create:() => PreviewCustomerGroup()),
    'PreviewSummarizedInvoiceResponse': TypeInfo(TypeOf.Class, create:() => PreviewSummarizedInvoiceResponse()),
    'List<PreviewCustomerGroup>': TypeInfo(TypeOf.Class, create:() => <PreviewCustomerGroup>[]),
    'EAccountingInvoiceSendTypes': TypeInfo(TypeOf.Enum, enumValues:EAccountingInvoiceSendTypes.values),
    'PreviewSummarizedInvoice': TypeInfo(TypeOf.Class, create:() => PreviewSummarizedInvoice()),
});

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

GET /eaccounting/summarizedinvoice/preview HTTP/1.1 
Host: api.bokamera.se 
Accept: text/jsv
HTTP/1.1 200 OK
Content-Type: text/jsv
Content-Length: length

{
	TotalCustomers: 0,
	TotalBookings: 0,
	Customers: 
	[
		{
			CustomerName: String,
			Email: String,
			BookingCount: 0,
			BookingIds: 
			[
				0
			],
			MissingInvoiceAddress: False,
			MissingEmail: False
		}
	],
	ResponseStatus: 
	{
		ErrorCode: String,
		Message: String,
		StackTrace: String,
		Errors: 
		[
			{
				ErrorCode: String,
				FieldName: String,
				Message: String,
				Meta: 
				{
					String: String
				}
			}
		],
		Meta: 
		{
			String: String
		}
	}
}