TicketUserServices

<back to all web services

WebshopOrderPreviewRequest

Requires Authentication
Requires any of the roles:Admin, TeamAdmin, MobileAppRequires the permission:ReadData
The following routes are available for this service:
POST/Webshop/Order/Preview
import 'package:servicestack/servicestack.dart';

class LocalizedMessage implements IConvertible
{
    String? Is;
    String? en;

    LocalizedMessage({this.Is,this.en});
    LocalizedMessage.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        Is = json['is'];
        en = json['en'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'is': Is,
        'en': en
    };

    getTypeName() => "LocalizedMessage";
    TypeContext? context = _ctx;
}

class WebshopPreviewLine implements IConvertible
{
    int? variantId;
    int? productId;
    String? productName;
    String? size;
    String? color;
    int? quantity;
    int? unitBeforeMinor;
    int? unitAfterMinor;
    int? lineBeforeMinor;
    int? lineAfterMinor;
    bool? discounted;

    WebshopPreviewLine({this.variantId,this.productId,this.productName,this.size,this.color,this.quantity,this.unitBeforeMinor,this.unitAfterMinor,this.lineBeforeMinor,this.lineAfterMinor,this.discounted});
    WebshopPreviewLine.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        variantId = json['variantId'];
        productId = json['productId'];
        productName = json['productName'];
        size = json['size'];
        color = json['color'];
        quantity = json['quantity'];
        unitBeforeMinor = json['unitBeforeMinor'];
        unitAfterMinor = json['unitAfterMinor'];
        lineBeforeMinor = json['lineBeforeMinor'];
        lineAfterMinor = json['lineAfterMinor'];
        discounted = json['discounted'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'variantId': variantId,
        'productId': productId,
        'productName': productName,
        'size': size,
        'color': color,
        'quantity': quantity,
        'unitBeforeMinor': unitBeforeMinor,
        'unitAfterMinor': unitAfterMinor,
        'lineBeforeMinor': lineBeforeMinor,
        'lineAfterMinor': lineAfterMinor,
        'discounted': discounted
    };

    getTypeName() => "WebshopPreviewLine";
    TypeContext? context = _ctx;
}

class WebshopPreviewTender implements IConvertible
{
    String? code;
    int? appliedMinor;
    bool? ok;
    String? reason;
    LocalizedMessage? message;

    WebshopPreviewTender({this.code,this.appliedMinor,this.ok,this.reason,this.message});
    WebshopPreviewTender.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        code = json['code'];
        appliedMinor = json['appliedMinor'];
        ok = json['ok'];
        reason = json['reason'];
        message = JsonConverters.fromJson(json['message'],'LocalizedMessage',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'code': code,
        'appliedMinor': appliedMinor,
        'ok': ok,
        'reason': reason,
        'message': JsonConverters.toJson(message,'LocalizedMessage',context!)
    };

    getTypeName() => "WebshopPreviewTender";
    TypeContext? context = _ctx;
}

class DiscountSummary implements IConvertible
{
    String? type;
    double? value;

    DiscountSummary({this.type,this.value});
    DiscountSummary.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        type = json['type'];
        value = JsonConverters.toDouble(json['value']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'type': type,
        'value': value
    };

    getTypeName() => "DiscountSummary";
    TypeContext? context = _ctx;
}

class WebshopOrderPreviewResult implements IConvertible
{
    int? statusCode;
    bool? success;
    LocalizedMessage? message;
    String? reason;
    List<WebshopPreviewLine>? lines;
    int? subtotalMinor;
    int? deliveryFeeMinor;
    int? discountMinor;
    int? giftAppliedMinor;
    int? cardRemainderMinor;
    List<WebshopPreviewTender>? tenders;
    DiscountSummary? discount;

    WebshopOrderPreviewResult({this.statusCode,this.success,this.message,this.reason,this.lines,this.subtotalMinor,this.deliveryFeeMinor,this.discountMinor,this.giftAppliedMinor,this.cardRemainderMinor,this.tenders,this.discount});
    WebshopOrderPreviewResult.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        statusCode = json['statusCode'];
        success = json['success'];
        message = JsonConverters.fromJson(json['message'],'LocalizedMessage',context!);
        reason = json['reason'];
        lines = JsonConverters.fromJson(json['lines'],'List<WebshopPreviewLine>',context!);
        subtotalMinor = json['subtotalMinor'];
        deliveryFeeMinor = json['deliveryFeeMinor'];
        discountMinor = json['discountMinor'];
        giftAppliedMinor = json['giftAppliedMinor'];
        cardRemainderMinor = json['cardRemainderMinor'];
        tenders = JsonConverters.fromJson(json['tenders'],'List<WebshopPreviewTender>',context!);
        discount = JsonConverters.fromJson(json['discount'],'DiscountSummary',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'statusCode': statusCode,
        'success': success,
        'message': JsonConverters.toJson(message,'LocalizedMessage',context!),
        'reason': reason,
        'lines': JsonConverters.toJson(lines,'List<WebshopPreviewLine>',context!),
        'subtotalMinor': subtotalMinor,
        'deliveryFeeMinor': deliveryFeeMinor,
        'discountMinor': discountMinor,
        'giftAppliedMinor': giftAppliedMinor,
        'cardRemainderMinor': cardRemainderMinor,
        'tenders': JsonConverters.toJson(tenders,'List<WebshopPreviewTender>',context!),
        'discount': JsonConverters.toJson(discount,'DiscountSummary',context!)
    };

    getTypeName() => "WebshopOrderPreviewResult";
    TypeContext? context = _ctx;
}

class WebshopPurchaseLine implements IConvertible
{
    int? variantId;
    int? quantity;

    WebshopPurchaseLine({this.variantId,this.quantity});
    WebshopPurchaseLine.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        variantId = json['variantId'];
        quantity = json['quantity'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'variantId': variantId,
        'quantity': quantity
    };

    getTypeName() => "WebshopPurchaseLine";
    TypeContext? context = _ctx;
}

class OrderTender implements IConvertible
{
    String? kind;
    String? code;
    int? amountMinor;
    String? idempotencyKey;
    int? holdId;
    int? appliedMinor;

    OrderTender({this.kind,this.code,this.amountMinor,this.idempotencyKey,this.holdId,this.appliedMinor});
    OrderTender.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        kind = json['kind'];
        code = json['code'];
        amountMinor = json['amountMinor'];
        idempotencyKey = json['idempotencyKey'];
        holdId = json['holdId'];
        appliedMinor = json['appliedMinor'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'kind': kind,
        'code': code,
        'amountMinor': amountMinor,
        'idempotencyKey': idempotencyKey,
        'holdId': holdId,
        'appliedMinor': appliedMinor
    };

    getTypeName() => "OrderTender";
    TypeContext? context = _ctx;
}

class WebshopOrderPreviewRequest implements IConvertible
{
    int? ownerId;
    String? externalId;
    List<WebshopPurchaseLine>? lines;
    String? deliveryType;
    String? discountCode;
    String? buyerPhone;
    List<OrderTender>? tenders;

    WebshopOrderPreviewRequest({this.ownerId,this.externalId,this.lines,this.deliveryType,this.discountCode,this.buyerPhone,this.tenders});
    WebshopOrderPreviewRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ownerId = json['ownerId'];
        externalId = json['externalId'];
        lines = JsonConverters.fromJson(json['lines'],'List<WebshopPurchaseLine>',context!);
        deliveryType = json['deliveryType'];
        discountCode = json['discountCode'];
        buyerPhone = json['buyerPhone'];
        tenders = JsonConverters.fromJson(json['tenders'],'List<OrderTender>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ownerId': ownerId,
        'externalId': externalId,
        'lines': JsonConverters.toJson(lines,'List<WebshopPurchaseLine>',context!),
        'deliveryType': deliveryType,
        'discountCode': discountCode,
        'buyerPhone': buyerPhone,
        'tenders': JsonConverters.toJson(tenders,'List<OrderTender>',context!)
    };

    getTypeName() => "WebshopOrderPreviewRequest";
    TypeContext? context = _ctx;
}

TypeContext _ctx = TypeContext(library: 'stubbur_app.azurewebsites.net', types: <String, TypeInfo> {
    'LocalizedMessage': TypeInfo(TypeOf.Class, create:() => LocalizedMessage()),
    'WebshopPreviewLine': TypeInfo(TypeOf.Class, create:() => WebshopPreviewLine()),
    'WebshopPreviewTender': TypeInfo(TypeOf.Class, create:() => WebshopPreviewTender()),
    'DiscountSummary': TypeInfo(TypeOf.Class, create:() => DiscountSummary()),
    'WebshopOrderPreviewResult': TypeInfo(TypeOf.Class, create:() => WebshopOrderPreviewResult()),
    'List<WebshopPreviewLine>': TypeInfo(TypeOf.Class, create:() => <WebshopPreviewLine>[]),
    'List<WebshopPreviewTender>': TypeInfo(TypeOf.Class, create:() => <WebshopPreviewTender>[]),
    'WebshopPurchaseLine': TypeInfo(TypeOf.Class, create:() => WebshopPurchaseLine()),
    'OrderTender': TypeInfo(TypeOf.Class, create:() => OrderTender()),
    'WebshopOrderPreviewRequest': TypeInfo(TypeOf.Class, create:() => WebshopOrderPreviewRequest()),
    'List<WebshopPurchaseLine>': TypeInfo(TypeOf.Class, create:() => <WebshopPurchaseLine>[]),
    'List<OrderTender>': TypeInfo(TypeOf.Class, create:() => <OrderTender>[]),
});

Dart WebshopOrderPreviewRequest 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.

POST /Webshop/Order/Preview HTTP/1.1 
Host: stubbur-app.azurewebsites.net 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<WebshopOrderPreviewRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TicketUserServices.ServiceModel">
  <BuyerPhone>String</BuyerPhone>
  <DeliveryType>String</DeliveryType>
  <DiscountCode>String</DiscountCode>
  <ExternalId>String</ExternalId>
  <Lines>
    <WebshopPurchaseLine>
      <Quantity>0</Quantity>
      <VariantId>0</VariantId>
    </WebshopPurchaseLine>
  </Lines>
  <OwnerId>0</OwnerId>
  <Tenders>
    <OrderTender>
      <AmountMinor>0</AmountMinor>
      <AppliedMinor>0</AppliedMinor>
      <Code>String</Code>
      <HoldId>0</HoldId>
      <IdempotencyKey>String</IdempotencyKey>
      <Kind>String</Kind>
    </OrderTender>
  </Tenders>
</WebshopOrderPreviewRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<WebshopOrderPreviewResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TicketUserServices.ServiceModel">
  <CardRemainderMinor>0</CardRemainderMinor>
  <DeliveryFeeMinor>0</DeliveryFeeMinor>
  <Discount>
    <Type>String</Type>
    <Value>0</Value>
  </Discount>
  <DiscountMinor>0</DiscountMinor>
  <GiftAppliedMinor>0</GiftAppliedMinor>
  <Lines>
    <WebshopPreviewLine>
      <Color>String</Color>
      <Discounted>false</Discounted>
      <LineAfterMinor>0</LineAfterMinor>
      <LineBeforeMinor>0</LineBeforeMinor>
      <ProductId>0</ProductId>
      <ProductName>String</ProductName>
      <Quantity>0</Quantity>
      <Size>String</Size>
      <UnitAfterMinor>0</UnitAfterMinor>
      <UnitBeforeMinor>0</UnitBeforeMinor>
      <VariantId>0</VariantId>
    </WebshopPreviewLine>
  </Lines>
  <Message>
    <En>String</En>
    <Is>String</Is>
  </Message>
  <Reason>String</Reason>
  <StatusCode>0</StatusCode>
  <SubtotalMinor>0</SubtotalMinor>
  <Success>false</Success>
  <Tenders>
    <WebshopPreviewTender>
      <AppliedMinor>0</AppliedMinor>
      <Code>String</Code>
      <Message>
        <En>String</En>
        <Is>String</Is>
      </Message>
      <Ok>false</Ok>
      <Reason>String</Reason>
    </WebshopPreviewTender>
  </Tenders>
</WebshopOrderPreviewResult>