ClubReady Api

<back to all web services

CalculatePaymentPlanRequest

The following routes are available for this service:
GET/sales/packages/{PackageId}/installments/calculate/{InstallmentPlanId}Get customer's billing status
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 ApiDtoBase:
    api_key: Optional[str] = None
    store_id: Optional[int] = None
    chain_id: Optional[int] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CalculatePaymentPlanRequestDto(ApiDtoBase):
    installment_plan_id: int = 0
    package_id: int = 0
    start_date: Optional[datetime.datetime] = None
    promo_code: Optional[str] = None


class RestrictedResourceType(str, Enum):
    STORE = 'Store'
    CHAIN = 'Chain'
    USER = 'User'
    UNDEFINED = 'Undefined'


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CalculatePaymentPlanRequest(CalculatePaymentPlanRequestDto, IRestrictedApiRequest):
    # @ApiMember(DataType="string", Description="Api Key - grants access to resources", IsRequired=true, Name="ApiKey", ParameterType="query")
    api_key: Optional[str] = None
    """
    Api Key - grants access to resources
    """


    # @ApiMember(DataType="integer", Description="ID # of store to calculate plan for", IsRequired=true, Name="StoreId", ParameterType="query")
    store_id: Optional[int] = None
    """
    ID # of store to calculate plan for
    """


    # @ApiMember(DataType="integer", Description="Installment Plan to calculate a scheduel for", IsRequired=true, Name="InstallmentPlanId", ParameterType="path")
    installment_plan_id: int = 0
    """
    Installment Plan to calculate a scheduel for
    """


    # @ApiMember(DataType="integer", Description="The package to calculate for", IsRequired=true, Name="PackageId", ParameterType="path")
    package_id: int = 0
    """
    The package to calculate for
    """


    # @ApiMember(DataType="datetime", Description="Date to calculate schedule from. If not provided, will use today.", Name="StartDate", ParameterType="query")
    start_date: Optional[datetime.datetime] = None
    """
    Date to calculate schedule from. If not provided, will use today.
    """


    # @ApiMember(DataType="string", Description="Promo code to apply a discount.", Name="PromoCode", ParameterType="query")
    promo_code: Optional[str] = None
    """
    Promo code to apply a discount.
    """


    restricted_id: Optional[int] = None
    restricted_resource_type: Optional[RestrictedResourceType] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class PaymentPlanInstallment:
    pay_today: bool = False
    amount: Decimal = decimal.Decimal(0)
    taxed: bool = False
    tax_rate: Optional[float] = None
    tax_amount: Optional[Decimal] = None
    fee_name: Optional[str] = None
    due_date: datetime.datetime = datetime.datetime(1, 1, 1)
    total: Optional[str] = None
    setup_fee_id: Optional[int] = None


@dataclass_json(letter_case=LetterCase.CAMEL, undefined=Undefined.EXCLUDE)
@dataclass
class CalculatePaymentPlanResultDto:
    plan_total: Optional[str] = None
    sub_total: Optional[str] = None
    tax_rate: Optional[float] = None
    enhancement_fee: Optional[str] = None
    enhancement_fee_tax_amount: Optional[str] = None
    tax_enh_fee: bool = False
    tax: Optional[str] = None
    total_due_today: Optional[str] = None
    payments: Optional[List[PaymentPlanInstallment]] = None
    fees: Optional[List[PaymentPlanInstallment]] = None
    is_evergreen: bool = False
    require_payment_profile: bool = False

Python CalculatePaymentPlanRequest DTOs

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

HTTP + CSV

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

GET /sales/packages/{PackageId}/installments/calculate/{InstallmentPlanId} HTTP/1.1 
Host: clubready.com 
Accept: text/csv
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{Unable to show example output for type 'CalculatePaymentPlanResultDto' using the custom 'csv' filter}One or more errors occurred.