| Requires any of the roles: | bookingsupplier-administrator-write, superadmin |
| PUT | /payment/settings/ | Update payment settings | Update payment settings for the logged in company |
|---|
import datetime
import decimal
from marshmallow.fields import *
from servicestack import *
from typing import *
from dataclasses import dataclass, field
from dataclasses_json import dataclass_json, LetterCase, Undefined, config
from enum import Enum, IntEnum
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class AdminPaymentOptionsResponse:
# @ApiMember(Description="The payment options id")
id: int = 0
"""
The payment options id
"""
# @ApiMember(Description="The payment options name")
name: Optional[str] = None
"""
The payment options name
"""
# @ApiMember(Description="The payment options description")
description: Optional[str] = None
"""
The payment options description
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PaymentProviderOptionsResponse:
# @ApiMember(Description="The payment provider id")
id: int = 0
"""
The payment provider id
"""
# @ApiMember(Description="The payment provider name")
name: Optional[str] = None
"""
The payment provider name
"""
# @ApiMember(Description="The payment provider description")
description: Optional[str] = None
"""
The payment provider description
"""
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PaymentSettingsQueryResponse:
# @ApiMember(Description="The company id")
company_id: Optional[str] = None
"""
The company id
"""
# @ApiMember(Description="The payment is enabled")
enabled: bool = False
"""
The payment is enabled
"""
# @ApiMember(Description="Automatically refund customer on canceled booking")
refund_on_cancel_booking: bool = False
"""
Automatically refund customer on canceled booking
"""
# @ApiMember(Description="The default option when admin creates a new booking")
default_payment_option_id: Optional[int] = None
"""
The default option when admin creates a new booking
"""
# @ApiMember(Description="What payment provider to use")
payment_provider_id: int = 0
"""
What payment provider to use
"""
# @ApiMember(DataType="boolean", Description="If you want to include the admin payment options to select from", ParameterType="query")
admin_payment_options: List[AdminPaymentOptionsResponse] = field(default_factory=list)
"""
If you want to include the admin payment options to select from
"""
# @ApiMember(DataType="boolean", Description="If you want to include the payment provider options to select from", ParameterType="query")
payment_provider_options: List[PaymentProviderOptionsResponse] = field(default_factory=list)
"""
If you want to include the payment provider options to select from
"""
# @ValidateRequest(Validator="IsAuthenticated")
@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class UpdatePaymentSettings(ICompany):
# @ApiMember(Description="The company id, if empty will use the company id for the user you are logged in with.")
company_id: Optional[str] = None
"""
The company id, if empty will use the company id for the user you are logged in with.
"""
# @ApiMember(Description="The payment is enabled")
enabled: Optional[bool] = None
"""
The payment is enabled
"""
# @ApiMember(Description="Automatically refund customer on canceled booking")
refund_on_cancel_booking: Optional[bool] = None
"""
Automatically refund customer on canceled booking
"""
# @ApiMember(Description="The default option when admin creates a new booking")
default_payment_option_id: Optional[int] = None
"""
The default option when admin creates a new booking
"""
# @ApiMember(Description="What payment provider to use")
payment_provider_id: Optional[int] = None
"""
What payment provider to use
"""
Python UpdatePaymentSettings DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
PUT /payment/settings/ HTTP/1.1
Host: api.bokamera.se
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<UpdatePaymentSettings xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/BokaMera.API.ServiceModel.Dtos">
<CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
<DefaultPaymentOptionId>0</DefaultPaymentOptionId>
<Enabled>false</Enabled>
<PaymentProviderId>0</PaymentProviderId>
<RefundOnCancelBooking>false</RefundOnCancelBooking>
</UpdatePaymentSettings>
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>
<CompanyId>00000000-0000-0000-0000-000000000000</CompanyId>
<DefaultPaymentOptionId>0</DefaultPaymentOptionId>
<Enabled>false</Enabled>
<PaymentProviderId>0</PaymentProviderId>
<PaymentProviderOptions>
<PaymentProviderOptionsResponse>
<Description>String</Description>
<Id>0</Id>
<Name>String</Name>
</PaymentProviderOptionsResponse>
</PaymentProviderOptions>
<RefundOnCancelBooking>false</RefundOnCancelBooking>
</PaymentSettingsQueryResponse>