Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
PUT | /bookings/{Id}/approve | Approve a booking that is reserved and awaiting approval | Updates an existing booking with approved status if you are authorized to do so. |
---|
"use strict";
/** @typedef {number} */
export var BookingStatusEnum;
(function (BookingStatusEnum) {
BookingStatusEnum[BookingStatusEnum["Booked"] = 1] = "Booked"
BookingStatusEnum[BookingStatusEnum["Unbooked"] = 2] = "Unbooked"
BookingStatusEnum[BookingStatusEnum["Reserved"] = 3] = "Reserved"
BookingStatusEnum[BookingStatusEnum["Canceled"] = 4] = "Canceled"
BookingStatusEnum[BookingStatusEnum["AwaitingPayment"] = 5] = "AwaitingPayment"
BookingStatusEnum[BookingStatusEnum["AwaitingPaymentNoTimeLimit"] = 6] = "AwaitingPaymentNoTimeLimit"
BookingStatusEnum[BookingStatusEnum["Payed"] = 7] = "Payed"
BookingStatusEnum[BookingStatusEnum["AwaitingPaymentRequestFromAdmin"] = 8] = "AwaitingPaymentRequestFromAdmin"
BookingStatusEnum[BookingStatusEnum["AwaitingPaymentFromProvider"] = 9] = "AwaitingPaymentFromProvider"
BookingStatusEnum[BookingStatusEnum["Invoiced"] = 10] = "Invoiced"
})(BookingStatusEnum || (BookingStatusEnum = {}));
export class BookingStatusQueryResponse {
/** @param {{Id?:number,Name?:string,Description?:string,Icon?:string,Color?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
Id;
/** @type {string} */
Name;
/** @type {string} */
Description;
/** @type {string} */
Icon;
/** @type {string} */
Color;
}
export class CustomFieldValueResponse {
/** @param {{Value?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
Value;
}
export class CustomFieldConfigData {
/** @param {{Id?:number,Name?:string,Description?:string,Width?:number,DataType?:string,DefaultValue?:string,IsMandatory?:boolean,MandatoryErrorMessage?:string,MaxLength?:number,MultipleLineText?:boolean,RegEx?:string,RegExErrorMessage?:string,Values?:CustomFieldValueResponse[]}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {number}
* @description Custom field id */
Id;
/**
* @type {string}
* @description Configuration name. Example: 'Number of persons'. */
Name;
/**
* @type {string}
* @description Custom field description. Example: 'For how many persons is this booking?' */
Description;
/**
* @type {?number}
* @description Field width. Example: 20 for 20px */
Width;
/**
* @type {string}
* @description Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox' */
DataType;
/**
* @type {string}
* @description Default value of the field. Example: '3' */
DefaultValue;
/**
* @type {boolean}
* @description Determines if the field is required to have a value or not */
IsMandatory;
/**
* @type {string}
* @description Error message shown to the user if the field data is required but not entered */
MandatoryErrorMessage;
/**
* @type {number}
* @description Max lenght of the field */
MaxLength;
/**
* @type {boolean}
* @description If the field should have multiple lines */
MultipleLineText;
/**
* @type {string}
* @description Regular expression used for validation of the field */
RegEx;
/**
* @type {string}
* @description Error message shown if the regular expression validation failed */
RegExErrorMessage;
/**
* @type {CustomFieldValueResponse[]}
* @description The values to select from if Datatype is DropDown for this custom field */
Values;
}
export class CustomFieldDataResponse {
/** @param {{Id?:number,Column?:string,Name?:string,Description?:string,Value?:string,DataType?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
Id;
/** @type {string} */
Column;
/** @type {string} */
Name;
/** @type {string} */
Description;
/** @type {string} */
Value;
/**
* @type {string}
* @description Data field of custom field. Valid values are: TextBox, ... Example: 'TextBox' */
DataType;
}
export class BookedResource {
/** @param {{Id?:number,Name?:string,Color?:string,ImageUrl?:string,Email?:string,MobilePhone?:string,AccessGroup?:string,EmailNotification?:boolean,SMSNotification?:boolean,EmailReminder?:boolean,SMSReminder?:boolean}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
Id;
/** @type {string} */
Name;
/** @type {string} */
Color;
/** @type {string} */
ImageUrl;
/** @type {string} */
Email;
/** @type {string} */
MobilePhone;
/** @type {string} */
AccessGroup;
/** @type {boolean} */
EmailNotification;
/** @type {boolean} */
SMSNotification;
/** @type {boolean} */
EmailReminder;
/** @type {boolean} */
SMSReminder;
}
export class BookedResourceType {
/** @param {{Id?:number,Name?:string,Resources?:BookedResource[]}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {number}
* @description The resource type id */
Id;
/**
* @type {string}
* @description The resource type name */
Name;
/**
* @type {BookedResource[]}
* @description The resources inside resource type */
Resources;
}
export class BookedCompany {
/** @param {{Id?:string,Name?:string,LogoType?:string,Category?:string,Street1?:string,Street2?:string,ZipCode?:string,City?:string,CountryId?:string,Longitude?:string,Latitude?:string,Phone?:string,Email?:string,HomePage?:string,SitePath?:string,IsFavorite?:boolean,PaymentProviderId?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
Id;
/** @type {string} */
Name;
/** @type {string} */
LogoType;
/** @type {string} */
Category;
/** @type {string} */
Street1;
/** @type {string} */
Street2;
/** @type {string} */
ZipCode;
/** @type {string} */
City;
/** @type {string} */
CountryId;
/** @type {string} */
Longitude;
/** @type {string} */
Latitude;
/** @type {string} */
Phone;
/** @type {string} */
Email;
/** @type {string} */
HomePage;
/** @type {string} */
SitePath;
/** @type {boolean} */
IsFavorite;
/** @type {?number} */
PaymentProviderId;
}
export class BookedCustomer {
/** @param {{Id?:string,Firstname?:string,Lastname?:string,Email?:string,Phone?:string,FacebookUserName?:string,ImageUrl?:string,CorporateIdentityNumber?:string,InvoiceAddress1?:string,InvoiceAddress2?:string,InvoiceCity?:string,InvoicePostalCode?:string,InvoiceCountryCode?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
Id;
/** @type {string} */
Firstname;
/** @type {string} */
Lastname;
/** @type {string} */
Email;
/** @type {string} */
Phone;
/** @type {string} */
FacebookUserName;
/** @type {string} */
ImageUrl;
/** @type {string} */
CorporateIdentityNumber;
/** @type {string} */
InvoiceAddress1;
/** @type {string} */
InvoiceAddress2;
/** @type {string} */
InvoiceCity;
/** @type {string} */
InvoicePostalCode;
/** @type {string} */
InvoiceCountryCode;
}
export class BookedQuantity {
/** @param {{Id?:number,Quantity?:number,Price?:number,PriceBeforeRebate?:number,CurrencyId?:string,PriceSign?:string,Category?:string,VAT?:number,PriceText?:string,OccupiesSpot?:boolean}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {number}
* @description The quantity Id */
Id;
/**
* @type {number}
* @description The quantity for booked on this price category */
Quantity;
/**
* @type {?number}
* @description The price */
Price;
/**
* @type {?number}
* @description The price bofore rebate codes */
PriceBeforeRebate;
/**
* @type {string}
* @description The price currency */
CurrencyId;
/**
* @type {string}
* @description The price sign */
PriceSign;
/**
* @type {string}
* @description The price category */
Category;
/**
* @type {?number}
* @description The price VAT in percent */
VAT;
/**
* @type {string}
* @description The price text to display */
PriceText;
/**
* @type {boolean}
* @description If the quantity you add should occupy a spot. Default is true. If no it will only be a row that includes price information. */
OccupiesSpot;
}
export class GroupBookingSettings {
/** @param {{Active?:boolean,Min?:number,Max?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {boolean} */
Active;
/** @type {number} */
Min;
/** @type {number} */
Max;
}
export class MultipleResourceSettings {
/** @param {{Active?:boolean,Min?:number,Max?:number}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {boolean} */
Active;
/** @type {number} */
Min;
/** @type {number} */
Max;
}
export class ServiceInfoResponse {
/** @param {{Id?:number,Name?:string,Description?:string,ImageUrl?:string,LengthInMinutes?:number,MaxNumberOfSpotsPerBooking?:number,MinNumberOfSpotsPerBooking?:number,GroupBooking?:GroupBookingSettings,MultipleResource?:MultipleResourceSettings,IsGroupBooking?:boolean,IsPaymentEnabled?:boolean}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
Id;
/** @type {string} */
Name;
/** @type {string} */
Description;
/** @type {string} */
ImageUrl;
/** @type {?number} */
LengthInMinutes;
/** @type {number} */
MaxNumberOfSpotsPerBooking;
/** @type {number} */
MinNumberOfSpotsPerBooking;
/** @type {GroupBookingSettings} */
GroupBooking;
/** @type {MultipleResourceSettings} */
MultipleResource;
/** @type {boolean} */
IsGroupBooking;
/** @type {boolean} */
IsPaymentEnabled;
}
export class BookingLogEventTypeResponse {
/** @param {{Id?:number,Name?:string,Description?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {number}
* @description The event type id */
Id;
/**
* @type {string}
* @description The event type name */
Name;
/**
* @type {string}
* @description The event type description */
Description;
}
export class BookingLogQueryResponse {
/** @param {{Id?:number,BookingId?:number,EventTypeId?:number,EventType?:BookingLogEventTypeResponse,Comments?:string,UserName?:string,Created?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {number}
* @description The booking log id */
Id;
/**
* @type {number}
* @description The booking id */
BookingId;
/**
* @type {number}
* @description The type of event */
EventTypeId;
/**
* @type {BookingLogEventTypeResponse}
* @description The type of event */
EventType;
/**
* @type {string}
* @description Comments that could be added to the event log item */
Comments;
/**
* @type {string}
* @description The user created the event */
UserName;
/**
* @type {string}
* @description Then date when the event occured */
Created;
}
export class CurrencyInfoResponse {
/** @param {{Id?:string,Name?:string,CurrencySign?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {string}
* @description The currency id */
Id;
/**
* @type {string}
* @description The currency id */
Name;
/**
* @type {string}
* @description The currency id */
CurrencySign;
}
export class BookingPaymentLogQueryResponse {
/** @param {{Id?:number,BookingId?:number,PaymentReferenceId?:string,OrderItemReferenceId?:string,PaymentProviderId?:number,Amount?:number,VAT?:number,AmountCredited?:number,CurrencyId?:string,CurrencyInfo?:CurrencyInfoResponse,Comments?:string,Created?:string,Updated?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {number}
* @description The booking payment log id */
Id;
/**
* @type {number}
* @description The booking id */
BookingId;
/**
* @type {string}
* @description The payment reference id */
PaymentReferenceId;
/**
* @type {string}
* @description The payment order item reference id */
OrderItemReferenceId;
/**
* @type {?number}
* @description The payment reference id */
PaymentProviderId;
/**
* @type {number}
* @description The payment amount */
Amount;
/**
* @type {number}
* @description The payment VAT in percent */
VAT;
/**
* @type {number}
* @description The payment amount that is credited */
AmountCredited;
/**
* @type {string}
* @description The payment currency id */
CurrencyId;
/**
* @type {CurrencyInfoResponse}
* @description The payment currency info */
CurrencyInfo;
/**
* @type {string}
* @description Comments that could be added to the event log item */
Comments;
/**
* @type {string}
* @description The date when the payment items was created */
Created;
/**
* @type {string}
* @description The date when the payment items was update */
Updated;
}
export class BookingCheckoutQueryResponse {
/** @param {{Id?:string,BookingId?:number,PurchaseId?:number,ExpirationTime?:string,Snippet?:string,Status?:string,Message?:string,Created?:string,Updated?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {string}
* @description The checkout id */
Id;
/**
* @type {number}
* @description The booking id */
BookingId;
/**
* @type {?number}
* @description The purchase id */
PurchaseId;
/**
* @type {?string}
* @description The payment checkout expiration datetime */
ExpirationTime;
/**
* @type {string}
* @description The payment snippet code */
Snippet;
/**
* @type {string}
* @description The payment status */
Status;
/**
* @type {string}
* @description Log message */
Message;
/**
* @type {string}
* @description When the checkout log item was created */
Created;
/**
* @type {string}
* @description When the checkout log item was updated */
Updated;
}
export class ExternalReferenceResponse {
/** @param {{CompanyId?:string,Id?:string,OwnerId?:string,ReferenceType?:string,ExternalData?:string,CreatedBy?:string,Updated?:string,Created?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
CompanyId;
/** @type {string} */
Id;
/** @type {string} */
OwnerId;
/** @type {string} */
ReferenceType;
/** @type {string} */
ExternalData;
/** @type {string} */
CreatedBy;
/** @type {string} */
Updated;
/** @type {string} */
Created;
}
export class BookingCalendarExportStatus {
/** @param {{CalendarId?:string,BookingId?:number,Synced?:boolean}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {string} */
CalendarId;
/** @type {number} */
BookingId;
/** @type {?boolean} */
Synced;
}
export class BookingQueryResponse {
/** @param {{Id?:number,CompanyId?:string,From?:string,To?:string,Status?:BookingStatusEnum,StatusId?:number,StatusName?:string,StatusInfo?:BookingStatusQueryResponse,SendEmailReminder?:boolean,SendSmsReminder?:boolean,SendSmsConfirmation?:boolean,SendEmailConfirmation?:boolean,LastTimeToUnBook?:string,CustomFields?:CustomFieldConfigData[],CustomFieldValues?:CustomFieldDataResponse[],BookedResourceTypes?:BookedResourceType[],Company?:BookedCompany,Customer?:BookedCustomer,Quantities?:BookedQuantity[],Service?:ServiceInfoResponse,PaymentExpiration?:string,Log?:BookingLogQueryResponse[],PaymentLog?:BookingPaymentLogQueryResponse[],CheckoutLog?:BookingCheckoutQueryResponse[],ExternalReference?:ExternalReferenceResponse[],ResponseStatus?:ResponseStatus,CalendarExportStatus?:BookingCalendarExportStatus,LengthInMinutes?:number,BookedBy?:string,BookedComments?:string,UnbookedComments?:string,CommentsToCustomer?:string,CreatedDate?:string,UpdatedDate?:string,UnbookedOn?:string,CancellationCode?:string,RatingCode?:string}} [init] */
constructor(init) { Object.assign(this, init) }
/** @type {number} */
Id;
/** @type {string} */
CompanyId;
/** @type {string} */
From;
/** @type {string} */
To;
/** @type {BookingStatusEnum} */
Status;
/** @type {number} */
StatusId;
/** @type {string} */
StatusName;
/** @type {BookingStatusQueryResponse} */
StatusInfo;
/** @type {boolean} */
SendEmailReminder;
/** @type {boolean} */
SendSmsReminder;
/** @type {boolean} */
SendSmsConfirmation;
/** @type {boolean} */
SendEmailConfirmation;
/** @type {?string} */
LastTimeToUnBook;
/** @type {CustomFieldConfigData[]} */
CustomFields;
/** @type {CustomFieldDataResponse[]} */
CustomFieldValues;
/** @type {BookedResourceType[]} */
BookedResourceTypes;
/** @type {BookedCompany} */
Company;
/** @type {BookedCustomer} */
Customer;
/** @type {BookedQuantity[]} */
Quantities;
/** @type {ServiceInfoResponse} */
Service;
/** @type {?string} */
PaymentExpiration;
/** @type {BookingLogQueryResponse[]} */
Log;
/** @type {BookingPaymentLogQueryResponse[]} */
PaymentLog;
/** @type {BookingCheckoutQueryResponse[]} */
CheckoutLog;
/** @type {ExternalReferenceResponse[]} */
ExternalReference;
/** @type {ResponseStatus} */
ResponseStatus;
/** @type {BookingCalendarExportStatus} */
CalendarExportStatus;
/** @type {?number} */
LengthInMinutes;
/** @type {string} */
BookedBy;
/** @type {string} */
BookedComments;
/** @type {string} */
UnbookedComments;
/** @type {string} */
CommentsToCustomer;
/** @type {string} */
CreatedDate;
/** @type {string} */
UpdatedDate;
/** @type {?string} */
UnbookedOn;
/** @type {string} */
CancellationCode;
/** @type {string} */
RatingCode;
}
/** @typedef {'DefaultSetting'|'BookWithoutPayment'|'BookWithPaymentMessageToCustomer'|'BookWithManualPayment'} */
export var PaymentOptions;
(function (PaymentOptions) {
PaymentOptions["DefaultSetting"] = "DefaultSetting"
PaymentOptions["BookWithoutPayment"] = "BookWithoutPayment"
PaymentOptions["BookWithPaymentMessageToCustomer"] = "BookWithPaymentMessageToCustomer"
PaymentOptions["BookWithManualPayment"] = "BookWithManualPayment"
})(PaymentOptions || (PaymentOptions = {}));
export class ApproveBooking {
/** @param {{CompanyId?:string,Id?:number,PaymentOption?:PaymentOptions,Comment?:string,Message?:string,SendSmsConfirmation?:boolean,SendEmailConfirmation?:boolean}} [init] */
constructor(init) { Object.assign(this, init) }
/**
* @type {?string}
* @description The company id, if empty will use the company id for the user you are logged in with. */
CompanyId;
/**
* @type {number}
* @description Id of the booking */
Id;
/**
* @type {PaymentOptions}
* @description If payment is enabled, optional to choose payment option, if blank then the default settings will be used */
PaymentOption;
/**
* @type {string}
* @description Any comment logged to the booking history and sent to user if SendSmsConfirmation or SendEmailConfirmation */
Comment;
/**
* @type {string}
* @description Any comment sent to user if SendSmsConfirmation or SendEmailConfirmation */
Message;
/**
* @type {?boolean}
* @description If you want to send SMS confirmation. If null, it will take the default value of the bookings SendSMSConfirmation. */
SendSmsConfirmation;
/**
* @type {?boolean}
* @description If you want to send Email confirmation. If null, it will take the default value of the bookings SendEmailConfirmation. */
SendEmailConfirmation;
}
JavaScript ApproveBooking DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PUT /bookings/{Id}/approve HTTP/1.1
Host: api.bokamera.se
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
CompanyId: 00000000-0000-0000-0000-000000000000,
Id: 0,
PaymentOption: DefaultSetting,
Comment: String,
Message: String,
SendSmsConfirmation: False,
SendEmailConfirmation: False
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { Id: 0, Status: Booked, StatusId: 0, StatusName: String, StatusInfo: { Id: 0, Name: String, Description: String, Icon: String, Color: String }, SendEmailReminder: False, SendSmsReminder: False, SendSmsConfirmation: False, SendEmailConfirmation: False, LastTimeToUnBook: "0001-01-01T00:00:00", CustomFields: [ { "Id": 0, "Name": "String", "Description": "String", "Width": 0, "DataType": "String", "DefaultValue": "String", "IsMandatory": false, "MandatoryErrorMessage": "String", "MaxLength": 0, "MultipleLineText": false, "RegEx": "String", "RegExErrorMessage": "String", "Values": [ { "Value": "String" } ] } ], CustomFieldValues: [ { Id: 0, Column: String, Name: String, Description: String, Value: String, DataType: String } ], BookedResourceTypes: [ { Id: 0, Name: String, Resources: [ { Id: 0, Name: String, Color: String, Email: String, MobilePhone: String, AccessGroup: String, EmailNotification: False, SMSNotification: False, EmailReminder: False, SMSReminder: False } ] } ], Company: { Name: String, Category: String, Street1: String, Street2: String, ZipCode: String, City: String, CountryId: String, Longitude: String, Latitude: String, Phone: String, Email: String, HomePage: String, SitePath: String, IsFavorite: False, PaymentProviderId: 0 }, Customer: { Firstname: String, Lastname: String, Email: String, Phone: String, FacebookUserName: String, ImageUrl: String, CorporateIdentityNumber: String, InvoiceAddress1: String, InvoiceAddress2: String, InvoiceCity: String, InvoicePostalCode: String, InvoiceCountryCode: String }, Quantities: [ { Id: 0, Quantity: 0, Price: 0, PriceBeforeRebate: 0, CurrencyId: String, PriceSign: String, Category: String, VAT: 0, PriceText: String, OccupiesSpot: False } ], Service: { Id: 0, Name: String, Description: String, LengthInMinutes: 0, MaxNumberOfSpotsPerBooking: 0, MinNumberOfSpotsPerBooking: 0, GroupBooking: { Active: False, Min: 0, Max: 0 }, MultipleResource: { Active: False, Min: 0, Max: 0 }, IsGroupBooking: False, IsPaymentEnabled: False }, PaymentExpiration: "0001-01-01T00:00:00", Log: [ { Id: 0, BookingId: 0, EventTypeId: 0, EventType: { Id: 0, Name: String, Description: String }, Comments: String, UserName: String } ], PaymentLog: [ { Id: 0, BookingId: 0, PaymentReferenceId: String, OrderItemReferenceId: String, PaymentProviderId: 0, Amount: 0, VAT: 0, AmountCredited: 0, CurrencyId: String, CurrencyInfo: { Id: String, Name: String, CurrencySign: String }, Comments: String } ], CheckoutLog: [ { BookingId: 0, PurchaseId: 0, ExpirationTime: "0001-01-01T00:00:00", Snippet: String, Status: String, Message: String } ], ExternalReference: [ { ReferenceType: String, ExternalData: String, CreatedBy: String } ], ResponseStatus: { ErrorCode: String, Message: String, StackTrace: String, Errors: [ { ErrorCode: String, FieldName: String, Message: String, Meta: { String: String } } ], Meta: { String: String } }, CalendarExportStatus: { CalendarId: String, BookingId: 0, Synced: False }, LengthInMinutes: 0, BookedBy: String, BookedComments: String, UnbookedComments: String, CommentsToCustomer: String, UnbookedOn: "0001-01-01T00:00:00", CancellationCode: String, RatingCode: String }