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 .json suffix or ?format=json

To embed the response in a jsonp callback, append ?callback=myCallback

HTTP + JSON

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/json
Content-Type: application/json
Content-Length: length

{"ownerId":0,"externalId":"String","lines":[{"variantId":0,"quantity":0}],"deliveryType":"String","discountCode":"String","buyerPhone":"String","tenders":[{"kind":"String","code":"String","amountMinor":0,"idempotencyKey":"String","holdId":0,"appliedMinor":0}]}
HTTP/1.1 200 OK
Content-Type: application/json
Content-Length: length

{"statusCode":0,"success":false,"message":{"is":"String","en":"String"},"reason":"String","lines":[{"variantId":0,"productId":0,"productName":"String","size":"String","color":"String","quantity":0,"unitBeforeMinor":0,"unitAfterMinor":0,"lineBeforeMinor":0,"lineAfterMinor":0,"discounted":false}],"subtotalMinor":0,"deliveryFeeMinor":0,"discountMinor":0,"giftAppliedMinor":0,"cardRemainderMinor":0,"tenders":[{"code":"String","appliedMinor":0,"ok":false,"reason":"String","message":{"is":"String","en":"String"}}],"discount":{"type":"String","value":0}}