All Verbs | /quote/{Id}/{Quantity} | ||
---|---|---|---|
All Verbs | /quote/{Id}/{Quantity}/{Coupon} | ||
GET | /GetQuote | ||
GET | /GetQuote/{Id} |
<?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 QuoteResponse implements JsonSerializable
{
public function __construct(
/** @var int */
public int $skuId=0,
/** @var string|null */
public ?string $code=null,
/** @var int|null */
public ?int $customerId=null,
/** @var bool|null */
public ?bool $modifyingExistingSubscription=null,
/** @var bool|null */
public ?bool $changingSubscriptions=null,
/** @var bool|null */
public ?bool $switchingLicensingModels=null,
/** @var bool|null */
public ?bool $replacesExistingQuantity=null,
/** @var int|null */
public ?int $existingSubscriptionQuantity=null,
/** @var int|null */
public ?int $newSubscriptionQuantity=null,
/** @var string|null */
public ?string $unusedAmount=null,
/** @var bool|null */
public ?bool $manualProrating=null,
/** @var int */
public int $unusedDays=0,
/** @var int */
public int $quantity=0,
/** @var int */
public int $minQuantity=0,
/** @var int|null */
public ?int $maxQuantity=null,
/** @var string|null */
public ?string $subtotal=null,
/** @var string|null */
public ?string $discountDescription=null,
/** @var string|null */
public ?string $discountReceived=null,
/** @var string|null */
public ?string $discount=null,
/** @var string|null */
public ?string $total=null,
/** @var string|null */
public ?string $expiryDate=null,
/** @var string|null */
public ?string $renewalDate=null,
/** @var bool|null */
public ?bool $isReferrer=null,
/** @var ResponseStatus|null */
public ?ResponseStatus $responseStatus=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['skuId'])) $this->skuId = $o['skuId'];
if (isset($o['code'])) $this->code = $o['code'];
if (isset($o['customerId'])) $this->customerId = $o['customerId'];
if (isset($o['modifyingExistingSubscription'])) $this->modifyingExistingSubscription = $o['modifyingExistingSubscription'];
if (isset($o['changingSubscriptions'])) $this->changingSubscriptions = $o['changingSubscriptions'];
if (isset($o['switchingLicensingModels'])) $this->switchingLicensingModels = $o['switchingLicensingModels'];
if (isset($o['replacesExistingQuantity'])) $this->replacesExistingQuantity = $o['replacesExistingQuantity'];
if (isset($o['existingSubscriptionQuantity'])) $this->existingSubscriptionQuantity = $o['existingSubscriptionQuantity'];
if (isset($o['newSubscriptionQuantity'])) $this->newSubscriptionQuantity = $o['newSubscriptionQuantity'];
if (isset($o['unusedAmount'])) $this->unusedAmount = $o['unusedAmount'];
if (isset($o['manualProrating'])) $this->manualProrating = $o['manualProrating'];
if (isset($o['unusedDays'])) $this->unusedDays = $o['unusedDays'];
if (isset($o['quantity'])) $this->quantity = $o['quantity'];
if (isset($o['minQuantity'])) $this->minQuantity = $o['minQuantity'];
if (isset($o['maxQuantity'])) $this->maxQuantity = $o['maxQuantity'];
if (isset($o['subtotal'])) $this->subtotal = $o['subtotal'];
if (isset($o['discountDescription'])) $this->discountDescription = $o['discountDescription'];
if (isset($o['discountReceived'])) $this->discountReceived = $o['discountReceived'];
if (isset($o['discount'])) $this->discount = $o['discount'];
if (isset($o['total'])) $this->total = $o['total'];
if (isset($o['expiryDate'])) $this->expiryDate = $o['expiryDate'];
if (isset($o['renewalDate'])) $this->renewalDate = $o['renewalDate'];
if (isset($o['isReferrer'])) $this->isReferrer = $o['isReferrer'];
if (isset($o['responseStatus'])) $this->responseStatus = JsonConverters::from('ResponseStatus', $o['responseStatus']);
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->skuId)) $o['skuId'] = $this->skuId;
if (isset($this->code)) $o['code'] = $this->code;
if (isset($this->customerId)) $o['customerId'] = $this->customerId;
if (isset($this->modifyingExistingSubscription)) $o['modifyingExistingSubscription'] = $this->modifyingExistingSubscription;
if (isset($this->changingSubscriptions)) $o['changingSubscriptions'] = $this->changingSubscriptions;
if (isset($this->switchingLicensingModels)) $o['switchingLicensingModels'] = $this->switchingLicensingModels;
if (isset($this->replacesExistingQuantity)) $o['replacesExistingQuantity'] = $this->replacesExistingQuantity;
if (isset($this->existingSubscriptionQuantity)) $o['existingSubscriptionQuantity'] = $this->existingSubscriptionQuantity;
if (isset($this->newSubscriptionQuantity)) $o['newSubscriptionQuantity'] = $this->newSubscriptionQuantity;
if (isset($this->unusedAmount)) $o['unusedAmount'] = $this->unusedAmount;
if (isset($this->manualProrating)) $o['manualProrating'] = $this->manualProrating;
if (isset($this->unusedDays)) $o['unusedDays'] = $this->unusedDays;
if (isset($this->quantity)) $o['quantity'] = $this->quantity;
if (isset($this->minQuantity)) $o['minQuantity'] = $this->minQuantity;
if (isset($this->maxQuantity)) $o['maxQuantity'] = $this->maxQuantity;
if (isset($this->subtotal)) $o['subtotal'] = $this->subtotal;
if (isset($this->discountDescription)) $o['discountDescription'] = $this->discountDescription;
if (isset($this->discountReceived)) $o['discountReceived'] = $this->discountReceived;
if (isset($this->discount)) $o['discount'] = $this->discount;
if (isset($this->total)) $o['total'] = $this->total;
if (isset($this->expiryDate)) $o['expiryDate'] = $this->expiryDate;
if (isset($this->renewalDate)) $o['renewalDate'] = $this->renewalDate;
if (isset($this->isReferrer)) $o['isReferrer'] = $this->isReferrer;
if (isset($this->responseStatus)) $o['responseStatus'] = JsonConverters::to('ResponseStatus', $this->responseStatus);
return empty($o) ? new class(){} : $o;
}
}
class GetQuote implements IGet, JsonSerializable
{
public function __construct(
/** @var int */
public int $id=0,
/** @var int */
public int $quantity=0,
/** @var string|null */
public ?string $coupon=null,
/** @var string|null */
public ?string $renewalRef=null,
/** @var string|null */
public ?string $upgradeRef=null
) {
}
/** @throws Exception */
public function fromMap($o): void {
if (isset($o['id'])) $this->id = $o['id'];
if (isset($o['quantity'])) $this->quantity = $o['quantity'];
if (isset($o['coupon'])) $this->coupon = $o['coupon'];
if (isset($o['renewalRef'])) $this->renewalRef = $o['renewalRef'];
if (isset($o['upgradeRef'])) $this->upgradeRef = $o['upgradeRef'];
}
/** @throws Exception */
public function jsonSerialize(): mixed
{
$o = [];
if (isset($this->id)) $o['id'] = $this->id;
if (isset($this->quantity)) $o['quantity'] = $this->quantity;
if (isset($this->coupon)) $o['coupon'] = $this->coupon;
if (isset($this->renewalRef)) $o['renewalRef'] = $this->renewalRef;
if (isset($this->upgradeRef)) $o['upgradeRef'] = $this->upgradeRef;
return empty($o) ? new class(){} : $o;
}
}
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.
POST /quote/{Id}/{Quantity} HTTP/1.1
Host: account.servicestack.net
Accept: application/xml
Content-Type: application/xml
Content-Length: length
<GetQuote xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MyApp.ServiceModel">
<Coupon>String</Coupon>
<Id>0</Id>
<Quantity>0</Quantity>
<RenewalRef>String</RenewalRef>
<UpgradeRef>String</UpgradeRef>
</GetQuote>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <QuoteResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MyApp.ServiceModel"> <ChangingSubscriptions>false</ChangingSubscriptions> <Code>String</Code> <CustomerId>0</CustomerId> <Discount>String</Discount> <DiscountDescription>String</DiscountDescription> <DiscountReceived>String</DiscountReceived> <ExistingSubscriptionQuantity>0</ExistingSubscriptionQuantity> <ExpiryDate>String</ExpiryDate> <IsReferrer>false</IsReferrer> <ManualProrating>false</ManualProrating> <MaxQuantity>0</MaxQuantity> <MinQuantity>0</MinQuantity> <ModifyingExistingSubscription>false</ModifyingExistingSubscription> <NewSubscriptionQuantity>0</NewSubscriptionQuantity> <Quantity>0</Quantity> <RenewalDate>String</RenewalDate> <ReplacesExistingQuantity>false</ReplacesExistingQuantity> <ResponseStatus xmlns:d2p1="http://schemas.servicestack.net/types"> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:Message>String</d2p1:Message> <d2p1:StackTrace>String</d2p1:StackTrace> <d2p1:Errors> <d2p1:ResponseError> <d2p1:ErrorCode>String</d2p1:ErrorCode> <d2p1:FieldName>String</d2p1:FieldName> <d2p1:Message>String</d2p1:Message> <d2p1:Meta xmlns:d5p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d5p1:KeyValueOfstringstring> <d5p1:Key>String</d5p1:Key> <d5p1:Value>String</d5p1:Value> </d5p1:KeyValueOfstringstring> </d2p1:Meta> </d2p1:ResponseError> </d2p1:Errors> <d2p1:Meta xmlns:d3p1="http://schemas.microsoft.com/2003/10/Serialization/Arrays"> <d3p1:KeyValueOfstringstring> <d3p1:Key>String</d3p1:Key> <d3p1:Value>String</d3p1:Value> </d3p1:KeyValueOfstringstring> </d2p1:Meta> </ResponseStatus> <SkuId>0</SkuId> <Subtotal>String</Subtotal> <SwitchingLicensingModels>false</SwitchingLicensingModels> <Total>String</Total> <UnusedAmount>String</UnusedAmount> <UnusedDays>0</UnusedDays> </QuoteResponse>