BokaMera.API.Host

<back to all web services

PaymentSettingsQuery

Requires Authentication
Requires any of the roles:bookingsupplier-administrator-write, bookingsupplier-administrator-read, superadmin
The following routes are available for this service:
GET/payment/settingsGet payson payment settingsGet payson payment settings for the logged in company
<?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 AdminPaymentOptionsResponse implements JsonSerializable
{
    public function __construct(
        /** @description The payment options id */
        // @ApiMember(Description="The payment options id")
        /** @var int */
        public int $Id=0,

        /** @description The payment options name */
        // @ApiMember(Description="The payment options name")
        /** @var string|null */
        public ?string $Name=null,

        /** @description The payment options description */
        // @ApiMember(Description="The payment options description")
        /** @var string|null */
        public ?string $Description=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        return empty($o) ? new class(){} : $o;
    }
}

class PaymentProviderOptionsResponse implements JsonSerializable
{
    public function __construct(
        /** @description The payment provider id */
        // @ApiMember(Description="The payment provider id")
        /** @var int */
        public int $Id=0,

        /** @description The payment provider name */
        // @ApiMember(Description="The payment provider name")
        /** @var string|null */
        public ?string $Name=null,

        /** @description The payment provider description */
        // @ApiMember(Description="The payment provider description")
        /** @var string|null */
        public ?string $Description=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['Id'])) $this->Id = $o['Id'];
        if (isset($o['Name'])) $this->Name = $o['Name'];
        if (isset($o['Description'])) $this->Description = $o['Description'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->Id)) $o['Id'] = $this->Id;
        if (isset($this->Name)) $o['Name'] = $this->Name;
        if (isset($this->Description)) $o['Description'] = $this->Description;
        return empty($o) ? new class(){} : $o;
    }
}

class PaymentSettingsQueryResponse implements JsonSerializable
{
    public function __construct(
        /** @description The company id */
        // @ApiMember(Description="The company id")
        /** @var string */
        public string $CompanyId='',

        /** @description The payment is enabled */
        // @ApiMember(Description="The payment is enabled")
        /** @var bool|null */
        public ?bool $Enabled=null,

        /** @description If there should be any fee added when customer selected invoice payment method */
        // @ApiMember(Description="If there should be any fee added when customer selected invoice payment method")
        /** @var int */
        public int $InvoiceFee=0,

        /** @description If allow credit card payment */
        // @ApiMember(Description="If allow credit card payment")
        /** @var bool|null */
        public ?bool $AllowCreditCardPayment=null,

        /** @description If allow invoice payment */
        // @ApiMember(Description="If allow invoice payment")
        /** @var bool|null */
        public ?bool $AllowInvoicePayment=null,

        /** @description If allow bank payment */
        // @ApiMember(Description="If allow bank payment")
        /** @var bool|null */
        public ?bool $AllowBankPayment=null,

        /** @description Automatically refund customer on canceled booking */
        // @ApiMember(Description="Automatically refund customer on canceled booking")
        /** @var bool|null */
        public ?bool $RefundOnCancelBooking=null,

        /** @description The default option when admin creates a new booking */
        // @ApiMember(Description="The default option when admin creates a new booking")
        /** @var int|null */
        public ?int $DefaultPaymentOptionId=null,

        /** @description What payment provider to use */
        // @ApiMember(Description="What payment provider to use")
        /** @var int */
        public int $PaymentProviderId=0,

        /** @description If you want to include the admin payment options to select from */
        // @ApiMember(DataType="boolean", Description="If you want to include the admin payment options to select from", ParameterType="query")
        /** @var array<AdminPaymentOptionsResponse>|null */
        public ?array $AdminPaymentOptions=null,

        /** @description If you want to include the payment provider options to select from */
        // @ApiMember(DataType="boolean", Description="If you want to include the payment provider options to select from", ParameterType="query")
        /** @var array<PaymentProviderOptionsResponse>|null */
        public ?array $PaymentProviderOptions=null,

        /** @description SendPaymentRequestDirectly */
        // @ApiMember(Description="SendPaymentRequestDirectly")
        /** @var bool|null */
        public ?bool $SendPaymentRequestDirectly=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['Enabled'])) $this->Enabled = $o['Enabled'];
        if (isset($o['InvoiceFee'])) $this->InvoiceFee = $o['InvoiceFee'];
        if (isset($o['AllowCreditCardPayment'])) $this->AllowCreditCardPayment = $o['AllowCreditCardPayment'];
        if (isset($o['AllowInvoicePayment'])) $this->AllowInvoicePayment = $o['AllowInvoicePayment'];
        if (isset($o['AllowBankPayment'])) $this->AllowBankPayment = $o['AllowBankPayment'];
        if (isset($o['RefundOnCancelBooking'])) $this->RefundOnCancelBooking = $o['RefundOnCancelBooking'];
        if (isset($o['DefaultPaymentOptionId'])) $this->DefaultPaymentOptionId = $o['DefaultPaymentOptionId'];
        if (isset($o['PaymentProviderId'])) $this->PaymentProviderId = $o['PaymentProviderId'];
        if (isset($o['AdminPaymentOptions'])) $this->AdminPaymentOptions = JsonConverters::fromArray('AdminPaymentOptionsResponse', $o['AdminPaymentOptions']);
        if (isset($o['PaymentProviderOptions'])) $this->PaymentProviderOptions = JsonConverters::fromArray('PaymentProviderOptionsResponse', $o['PaymentProviderOptions']);
        if (isset($o['SendPaymentRequestDirectly'])) $this->SendPaymentRequestDirectly = $o['SendPaymentRequestDirectly'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->Enabled)) $o['Enabled'] = $this->Enabled;
        if (isset($this->InvoiceFee)) $o['InvoiceFee'] = $this->InvoiceFee;
        if (isset($this->AllowCreditCardPayment)) $o['AllowCreditCardPayment'] = $this->AllowCreditCardPayment;
        if (isset($this->AllowInvoicePayment)) $o['AllowInvoicePayment'] = $this->AllowInvoicePayment;
        if (isset($this->AllowBankPayment)) $o['AllowBankPayment'] = $this->AllowBankPayment;
        if (isset($this->RefundOnCancelBooking)) $o['RefundOnCancelBooking'] = $this->RefundOnCancelBooking;
        if (isset($this->DefaultPaymentOptionId)) $o['DefaultPaymentOptionId'] = $this->DefaultPaymentOptionId;
        if (isset($this->PaymentProviderId)) $o['PaymentProviderId'] = $this->PaymentProviderId;
        if (isset($this->AdminPaymentOptions)) $o['AdminPaymentOptions'] = JsonConverters::toArray('AdminPaymentOptionsResponse', $this->AdminPaymentOptions);
        if (isset($this->PaymentProviderOptions)) $o['PaymentProviderOptions'] = JsonConverters::toArray('PaymentProviderOptionsResponse', $this->PaymentProviderOptions);
        if (isset($this->SendPaymentRequestDirectly)) $o['SendPaymentRequestDirectly'] = $this->SendPaymentRequestDirectly;
        return empty($o) ? new class(){} : $o;
    }
}

// @ValidateRequest(Validator="IsAuthenticated")
class PaymentSettingsQuery 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 If you want to include the admin payment options to select from */
        // @ApiMember(DataType="boolean", Description="If you want to include the admin payment options to select from")
        /** @var bool|null */
        public ?bool $IncludeAdminPaymentOptions=null,

        /** @description If you want to include the payment provider options to select from */
        // @ApiMember(DataType="boolean", Description="If you want to include the payment provider options to select from")
        /** @var bool|null */
        public ?bool $IncludePaymentProviderOptions=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['CompanyId'])) $this->CompanyId = $o['CompanyId'];
        if (isset($o['IncludeAdminPaymentOptions'])) $this->IncludeAdminPaymentOptions = $o['IncludeAdminPaymentOptions'];
        if (isset($o['IncludePaymentProviderOptions'])) $this->IncludePaymentProviderOptions = $o['IncludePaymentProviderOptions'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->CompanyId)) $o['CompanyId'] = $this->CompanyId;
        if (isset($this->IncludeAdminPaymentOptions)) $o['IncludeAdminPaymentOptions'] = $this->IncludeAdminPaymentOptions;
        if (isset($this->IncludePaymentProviderOptions)) $o['IncludePaymentProviderOptions'] = $this->IncludePaymentProviderOptions;
        return empty($o) ? new class(){} : $o;
    }
}

PHP PaymentSettingsQuery DTOs

To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml

HTTP + XML

The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.

GET /payment/settings HTTP/1.1 
Host: api.bokamera.se 
Accept: application/xml
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<PaymentSettingsQueryResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
  <AdminPaymentOptions>
    <AdminPaymentOptionsResponse>
      <Description>String</Description>
      <Id>0</Id>
      <Name>String</Name>
    </AdminPaymentOptionsResponse>
  </AdminPaymentOptions>
  <AllowBankPayment>false</AllowBankPayment>
  <AllowCreditCardPayment>false</AllowCreditCardPayment>
  <AllowInvoicePayment>false</AllowInvoicePayment>
  <CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
  <DefaultPaymentOptionId>0</DefaultPaymentOptionId>
  <Enabled>false</Enabled>
  <InvoiceFee>0</InvoiceFee>
  <PaymentProviderId>0</PaymentProviderId>
  <PaymentProviderOptions>
    <PaymentProviderOptionsResponse>
      <Description>String</Description>
      <Id>0</Id>
      <Name>String</Name>
    </PaymentProviderOptionsResponse>
  </PaymentProviderOptions>
  <RefundOnCancelBooking>false</RefundOnCancelBooking>
  <SendPaymentRequestDirectly>false</SendPaymentRequestDirectly>
</PaymentSettingsQueryResponse>