| GET | /eaccounting/summarizedinvoice/preview | Preview eligible bookings for summarized invoicing | Returns the customers and booking counts that would be included in a summarized invoice run, without actually creating anything. |
|---|
<?php namespace dtos;
use DateTime;
use Exception;
use DateInterval;
use JsonSerializable;
use ServiceStack\{IReturn,IReturnVoid,IGet,IPost,IPut,IDelete,IPatch,IMeta,IHasSessionId,IHasBearerToken,IHasVersion};
use ServiceStack\{ICrud,ICreateDb,IUpdateDb,IPatchDb,IDeleteDb,ISaveDb,AuditBase,QueryDb,QueryDb2,QueryData,QueryData2,QueryResponse};
use ServiceStack\{ResponseStatus,ResponseError,EmptyResponse,IdResponse,ArrayList,KeyValuePair2,StringResponse,StringsResponse,Tuple2,Tuple3,ByteArray};
use ServiceStack\{JsonConverters,Returns,TypeContext};
class PreviewCustomerGroup implements JsonSerializable
{
public function __construct(
/** @var string */
public string $CustomerId='',
/** @var string */
public string $CustomerName='',
/** @var string|null */
public ?string $Email=null,
/** @var int */
public int $BookingCount=0,
/** @var array<int>|null */
public ?array $BookingIds=null,
/** @var bool|null */
public ?bool $MissingInvoiceAddress=null,
/** @var bool|null */
public ?bool $MissingEmail=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
if (isset($o['CustomerName'])) $this->CustomerName = $o['CustomerName'];
if (isset($o['Email'])) $this->Email = $o['Email'];
if (isset($o['BookingCount'])) $this->BookingCount = $o['BookingCount'];
if (isset($o['BookingIds'])) $this->BookingIds = JsonConverters::fromArray('int', $o['BookingIds']);
if (isset($o['MissingInvoiceAddress'])) $this->MissingInvoiceAddress = $o['MissingInvoiceAddress'];
if (isset($o['MissingEmail'])) $this->MissingEmail = $o['MissingEmail'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
if (isset($this->CustomerName)) $o['CustomerName'] = $this->CustomerName;
if (isset($this->Email)) $o['Email'] = $this->Email;
if (isset($this->BookingCount)) $o['BookingCount'] = $this->BookingCount;
if (isset($this->BookingIds)) $o['BookingIds'] = JsonConverters::toArray('int', $this->BookingIds);
if (isset($this->MissingInvoiceAddress)) $o['MissingInvoiceAddress'] = $this->MissingInvoiceAddress;
if (isset($this->MissingEmail)) $o['MissingEmail'] = $this->MissingEmail;
return empty($o) ? new class(){} : $o;
}
}
class PreviewSummarizedInvoiceResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $TotalCustomers=0,
/** @var int */
public int $TotalBookings=0,
/** @var array<PreviewCustomerGroup>|null */
public ?array $Customers=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $ResponseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['TotalCustomers'])) $this->TotalCustomers = $o['TotalCustomers'];
if (isset($o['TotalBookings'])) $this->TotalBookings = $o['TotalBookings'];
if (isset($o['Customers'])) $this->Customers = JsonConverters::fromArray('PreviewCustomerGroup', $o['Customers']);
if (isset($o['ResponseStatus'])) $this->ResponseStatus = JsonConverters::from('ResponseStatus', $o['ResponseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->TotalCustomers)) $o['TotalCustomers'] = $this->TotalCustomers;
if (isset($this->TotalBookings)) $o['TotalBookings'] = $this->TotalBookings;
if (isset($this->Customers)) $o['Customers'] = JsonConverters::toArray('PreviewCustomerGroup', $this->Customers);
if (isset($this->ResponseStatus)) $o['ResponseStatus'] = JsonConverters::to('ResponseStatus', $this->ResponseStatus);
return empty($o) ? new class(){} : $o;
}
}
enum EAccountingInvoiceSendTypes : string
{
case None = 'None';
case AutoInvoiceElectronic = 'AutoInvoiceElectronic';
case AutoInvoicePrint = 'AutoInvoicePrint';
case AutoInvoiceB2C = 'AutoInvoiceB2C';
}
// @ValidateRequest(Validator="IsAuthenticated")
class PreviewSummarizedInvoice implements ICompany, JsonSerializable
{
public function __construct(
/** @description 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.")
/** @var string|null */
public ?string $CompanyId=null,
/** @description Start date for the booking range to include. */
// @ApiMember(Description="Start date for the booking range to include.", IsRequired=true)
/** @var DateTime */
public DateTime $DateFrom=new DateTime(),
/** @description End date for the booking range to include. */
// @ApiMember(Description="End date for the booking range to include.", IsRequired=true)
/** @var DateTime */
public DateTime $DateTo=new DateTime(),
/** @description Optional customer id filter. */
// @ApiMember(Description="Optional customer id filter.")
/** @var string|null */
public ?string $CustomerId=null,
/** @description Optional service/event id filter. */
// @ApiMember(Description="Optional service/event id filter.")
/** @var int|null */
public ?int $ServiceId=null,
/** @description 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.")
/** @var array<int>|null */
public ?array $BookingStatusIds=null,
/** @description 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.")
/** @var EAccountingInvoiceSendTypes|null */
public ?EAccountingInvoiceSendTypes $SendType=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
if (isset($o['DateFrom'])) $this->DateFrom = JsonConverters::from('DateTime', $o['DateFrom']);
if (isset($o['DateTo'])) $this->DateTo = JsonConverters::from('DateTime', $o['DateTo']);
if (isset($o['CustomerId'])) $this->CustomerId = $o['CustomerId'];
if (isset($o['ServiceId'])) $this->ServiceId = $o['ServiceId'];
if (isset($o['BookingStatusIds'])) $this->BookingStatusIds = JsonConverters::fromArray('int', $o['BookingStatusIds']);
if (isset($o['SendType'])) $this->SendType = JsonConverters::from('EAccountingInvoiceSendTypes', $o['SendType']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
if (isset($this->DateFrom)) $o['DateFrom'] = JsonConverters::to('DateTime', $this->DateFrom);
if (isset($this->DateTo)) $o['DateTo'] = JsonConverters::to('DateTime', $this->DateTo);
if (isset($this->CustomerId)) $o['CustomerId'] = $this->CustomerId;
if (isset($this->ServiceId)) $o['ServiceId'] = $this->ServiceId;
if (isset($this->BookingStatusIds)) $o['BookingStatusIds'] = JsonConverters::toArray('int', $this->BookingStatusIds);
if (isset($this->SendType)) $o['SendType'] = JsonConverters::to('EAccountingInvoiceSendTypes', $this->SendType);
return empty($o) ? new class(){} : $o;
}
}
PHP PreviewSummarizedInvoice DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .other suffix or ?format=other
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/jsonl
HTTP/1.1 200 OK
Content-Type: text/jsonl
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"}}}