ServiceStack Home (Live)

<back to all web services

PurchaseSubscription

The following routes are available for this service:
POST/PurchaseSubscription
<?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 Subscriptions implements JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $section=null,
        /** @var bool|null */
        public ?bool $success=null,
        /** @var bool|null */
        public ?bool $activated=null,
        /** @var int|null */
        public ?int $purchasedOrderId=null
    ) {
    }

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

class PurchaseSubscription implements ICardInfo, IAddress, JsonSerializable
{
    public function __construct(
        /** @var string|null */
        public ?string $code=null,
        /** @var string|null */
        public ?string $coupon=null,
        /** @var string|null */
        public ?string $renewalRef=null,
        /** @var string|null */
        public ?string $upgradeRef=null,
        /** @var int */
        public int $quantity=0,
        /** @var string|null */
        public ?string $userAuthId=null,
        /** @var int */
        public int $skuId=0,
        /** @var bool|null */
        public ?bool $isSmallCompany=null,
        /** @var bool|null */
        public ?bool $isNonProfit=null,
        /** @var bool|null */
        public ?bool $agreeTerms=null,
        /** @var string|null */
        public ?string $firstName=null,
        /** @var string|null */
        public ?string $lastName=null,
        /** @var string|null */
        public ?string $email=null,
        /** @var string|null */
        public ?string $password=null,
        /** @var string|null */
        public ?string $company=null,
        /** @var string|null */
        public ?string $phoneNumber=null,
        /** @var string|null */
        public ?string $addressLine1=null,
        /** @var string|null */
        public ?string $addressLine2=null,
        /** @var string|null */
        public ?string $addressCity=null,
        /** @var string|null */
        public ?string $addressZip=null,
        /** @var string|null */
        public ?string $addressState=null,
        /** @var string|null */
        public ?string $addressCountry=null,
        /** @var string|null */
        public ?string $licenseName=null,
        /** @var string|null */
        public ?string $licenseEmail=null,
        /** @var string|null */
        public ?string $licenseAddress=null,
        /** @var string|null */
        public ?string $cardNumber=null,
        /** @var string|null */
        public ?string $cvc=null,
        /** @var int */
        public int $expMonth=0,
        /** @var int */
        public int $expYear=0,
        /** @var string|null */
        public ?string $notes=null
    ) {
    }

    /** @throws Exception */
    public function fromMap($o): void {
        if (isset($o['code'])) $this->code = $o['code'];
        if (isset($o['coupon'])) $this->coupon = $o['coupon'];
        if (isset($o['renewalRef'])) $this->renewalRef = $o['renewalRef'];
        if (isset($o['upgradeRef'])) $this->upgradeRef = $o['upgradeRef'];
        if (isset($o['quantity'])) $this->quantity = $o['quantity'];
        if (isset($o['userAuthId'])) $this->userAuthId = $o['userAuthId'];
        if (isset($o['skuId'])) $this->skuId = $o['skuId'];
        if (isset($o['isSmallCompany'])) $this->isSmallCompany = $o['isSmallCompany'];
        if (isset($o['isNonProfit'])) $this->isNonProfit = $o['isNonProfit'];
        if (isset($o['agreeTerms'])) $this->agreeTerms = $o['agreeTerms'];
        if (isset($o['firstName'])) $this->firstName = $o['firstName'];
        if (isset($o['lastName'])) $this->lastName = $o['lastName'];
        if (isset($o['email'])) $this->email = $o['email'];
        if (isset($o['password'])) $this->password = $o['password'];
        if (isset($o['company'])) $this->company = $o['company'];
        if (isset($o['phoneNumber'])) $this->phoneNumber = $o['phoneNumber'];
        if (isset($o['addressLine1'])) $this->addressLine1 = $o['addressLine1'];
        if (isset($o['addressLine2'])) $this->addressLine2 = $o['addressLine2'];
        if (isset($o['addressCity'])) $this->addressCity = $o['addressCity'];
        if (isset($o['addressZip'])) $this->addressZip = $o['addressZip'];
        if (isset($o['addressState'])) $this->addressState = $o['addressState'];
        if (isset($o['addressCountry'])) $this->addressCountry = $o['addressCountry'];
        if (isset($o['licenseName'])) $this->licenseName = $o['licenseName'];
        if (isset($o['licenseEmail'])) $this->licenseEmail = $o['licenseEmail'];
        if (isset($o['licenseAddress'])) $this->licenseAddress = $o['licenseAddress'];
        if (isset($o['cardNumber'])) $this->cardNumber = $o['cardNumber'];
        if (isset($o['cvc'])) $this->cvc = $o['cvc'];
        if (isset($o['expMonth'])) $this->expMonth = $o['expMonth'];
        if (isset($o['expYear'])) $this->expYear = $o['expYear'];
        if (isset($o['notes'])) $this->notes = $o['notes'];
    }
    
    /** @throws Exception */
    public function jsonSerialize(): mixed
    {
        $o = [];
        if (isset($this->code)) $o['code'] = $this->code;
        if (isset($this->coupon)) $o['coupon'] = $this->coupon;
        if (isset($this->renewalRef)) $o['renewalRef'] = $this->renewalRef;
        if (isset($this->upgradeRef)) $o['upgradeRef'] = $this->upgradeRef;
        if (isset($this->quantity)) $o['quantity'] = $this->quantity;
        if (isset($this->userAuthId)) $o['userAuthId'] = $this->userAuthId;
        if (isset($this->skuId)) $o['skuId'] = $this->skuId;
        if (isset($this->isSmallCompany)) $o['isSmallCompany'] = $this->isSmallCompany;
        if (isset($this->isNonProfit)) $o['isNonProfit'] = $this->isNonProfit;
        if (isset($this->agreeTerms)) $o['agreeTerms'] = $this->agreeTerms;
        if (isset($this->firstName)) $o['firstName'] = $this->firstName;
        if (isset($this->lastName)) $o['lastName'] = $this->lastName;
        if (isset($this->email)) $o['email'] = $this->email;
        if (isset($this->password)) $o['password'] = $this->password;
        if (isset($this->company)) $o['company'] = $this->company;
        if (isset($this->phoneNumber)) $o['phoneNumber'] = $this->phoneNumber;
        if (isset($this->addressLine1)) $o['addressLine1'] = $this->addressLine1;
        if (isset($this->addressLine2)) $o['addressLine2'] = $this->addressLine2;
        if (isset($this->addressCity)) $o['addressCity'] = $this->addressCity;
        if (isset($this->addressZip)) $o['addressZip'] = $this->addressZip;
        if (isset($this->addressState)) $o['addressState'] = $this->addressState;
        if (isset($this->addressCountry)) $o['addressCountry'] = $this->addressCountry;
        if (isset($this->licenseName)) $o['licenseName'] = $this->licenseName;
        if (isset($this->licenseEmail)) $o['licenseEmail'] = $this->licenseEmail;
        if (isset($this->licenseAddress)) $o['licenseAddress'] = $this->licenseAddress;
        if (isset($this->cardNumber)) $o['cardNumber'] = $this->cardNumber;
        if (isset($this->cvc)) $o['cvc'] = $this->cvc;
        if (isset($this->expMonth)) $o['expMonth'] = $this->expMonth;
        if (isset($this->expYear)) $o['expYear'] = $this->expYear;
        if (isset($this->notes)) $o['notes'] = $this->notes;
        return empty($o) ? new class(){} : $o;
    }
}

PHP PurchaseSubscription DTOs

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

HTTP + OTHER

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

POST /PurchaseSubscription HTTP/1.1 
Host: account.servicestack.net 
Accept: text/jsonl
Content-Type: text/jsonl
Content-Length: length

{"code":"String","coupon":"String","renewalRef":"String","upgradeRef":"String","quantity":0,"userAuthId":"String","skuId":0,"isSmallCompany":false,"isNonProfit":false,"agreeTerms":false,"firstName":"String","lastName":"String","email":"String","password":"String","company":"String","phoneNumber":"String","addressLine1":"String","addressLine2":"String","addressCity":"String","addressZip":"String","addressState":"String","addressCountry":"String","licenseName":"String","licenseEmail":"String","licenseAddress":"String","cardNumber":"String","cvc":"String","expMonth":0,"expYear":0,"notes":"String"}
HTTP/1.1 200 OK
Content-Type: text/jsonl
Content-Length: length

{"section":"String","success":false,"activated":false,"purchasedOrderId":0}