TicketUserServices

<back to all web services

PreviewDiscountRequest

Requires Authentication
Requires any of the roles:Admin, TeamAdmin, MobileAppRequires the permission:ReadData
The following routes are available for this service:
POST/ticketOrder/previewDiscount
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 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 DiscountLineResult implements IConvertible
{
    int? ticketTypeId;
    int? count;
    bool? applied;
    double? unitBefore;
    double? unitAfter;
    double? lineBefore;
    double? lineAfter;

    DiscountLineResult({this.ticketTypeId,this.count,this.applied,this.unitBefore,this.unitAfter,this.lineBefore,this.lineAfter});
    DiscountLineResult.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        ticketTypeId = json['ticketTypeId'];
        count = json['count'];
        applied = json['applied'];
        unitBefore = JsonConverters.toDouble(json['unitBefore']);
        unitAfter = JsonConverters.toDouble(json['unitAfter']);
        lineBefore = JsonConverters.toDouble(json['lineBefore']);
        lineAfter = JsonConverters.toDouble(json['lineAfter']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'ticketTypeId': ticketTypeId,
        'count': count,
        'applied': applied,
        'unitBefore': unitBefore,
        'unitAfter': unitAfter,
        'lineBefore': lineBefore,
        'lineAfter': lineAfter
    };

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

class PreviewDiscountResult implements IConvertible
{
    String? status;
    String? reason;
    LocalizedMessage? message;
    int? discountCodeId;
    int? discountCodeTypeId;
    DiscountSummary? discount;
    List<DiscountLineResult>? lines;
    double? subtotalBefore;
    double? subtotalAfter;
    double? totalSavings;
    String? currency;
    int? statusCode;

    PreviewDiscountResult({this.status,this.reason,this.message,this.discountCodeId,this.discountCodeTypeId,this.discount,this.lines,this.subtotalBefore,this.subtotalAfter,this.totalSavings,this.currency,this.statusCode});
    PreviewDiscountResult.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        status = json['status'];
        reason = json['reason'];
        message = JsonConverters.fromJson(json['message'],'LocalizedMessage',context!);
        discountCodeId = json['discountCodeId'];
        discountCodeTypeId = json['discountCodeTypeId'];
        discount = JsonConverters.fromJson(json['discount'],'DiscountSummary',context!);
        lines = JsonConverters.fromJson(json['lines'],'List<DiscountLineResult>',context!);
        subtotalBefore = JsonConverters.toDouble(json['subtotalBefore']);
        subtotalAfter = JsonConverters.toDouble(json['subtotalAfter']);
        totalSavings = JsonConverters.toDouble(json['totalSavings']);
        currency = json['currency'];
        statusCode = json['statusCode'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'status': status,
        'reason': reason,
        'message': JsonConverters.toJson(message,'LocalizedMessage',context!),
        'discountCodeId': discountCodeId,
        'discountCodeTypeId': discountCodeTypeId,
        'discount': JsonConverters.toJson(discount,'DiscountSummary',context!),
        'lines': JsonConverters.toJson(lines,'List<DiscountLineResult>',context!),
        'subtotalBefore': subtotalBefore,
        'subtotalAfter': subtotalAfter,
        'totalSavings': totalSavings,
        'currency': currency,
        'statusCode': statusCode
    };

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

class TicketDetails implements IConvertible
{
    int? id;
    int? ticketId;
    int? eventSeriesTicketType;
    int? eventSeriesOwnerTicketType;
    double? ticketPrice;
    double? totalPrice;
    int? count;
    String? ticketColor;
    bool? showUsedTickets;
    String? ticketName;
    String? ticketDisplayString;
    int? ticketDetailsTransferredFrom;
    int? teamPassId;
    bool? isSpecialTicket;
    String? specialTicketId;
    bool? justChangedBySQL;
    DateTime? sqlJustChangedTimeStamp;
    String? currency;
    String? discountCode;
    double? totalDiscount;
    double? totalAmountBeforeDiscount;
    double? ticketPriceBeforeDiscount;

    TicketDetails({this.id,this.ticketId,this.eventSeriesTicketType,this.eventSeriesOwnerTicketType,this.ticketPrice,this.totalPrice,this.count,this.ticketColor,this.showUsedTickets,this.ticketName,this.ticketDisplayString,this.ticketDetailsTransferredFrom,this.teamPassId,this.isSpecialTicket,this.specialTicketId,this.justChangedBySQL,this.sqlJustChangedTimeStamp,this.currency,this.discountCode,this.totalDiscount,this.totalAmountBeforeDiscount,this.ticketPriceBeforeDiscount});
    TicketDetails.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        ticketId = json['ticketId'];
        eventSeriesTicketType = json['eventSeriesTicketType'];
        eventSeriesOwnerTicketType = json['eventSeriesOwnerTicketType'];
        ticketPrice = JsonConverters.toDouble(json['ticketPrice']);
        totalPrice = JsonConverters.toDouble(json['totalPrice']);
        count = json['count'];
        ticketColor = json['ticketColor'];
        showUsedTickets = json['showUsedTickets'];
        ticketName = json['ticketName'];
        ticketDisplayString = json['ticketDisplayString'];
        ticketDetailsTransferredFrom = json['ticketDetailsTransferredFrom'];
        teamPassId = json['teamPassId'];
        isSpecialTicket = json['isSpecialTicket'];
        specialTicketId = json['specialTicketId'];
        justChangedBySQL = json['justChangedBySQL'];
        sqlJustChangedTimeStamp = JsonConverters.fromJson(json['sqlJustChangedTimeStamp'],'DateTime',context!);
        currency = json['currency'];
        discountCode = json['discountCode'];
        totalDiscount = JsonConverters.toDouble(json['totalDiscount']);
        totalAmountBeforeDiscount = JsonConverters.toDouble(json['totalAmountBeforeDiscount']);
        ticketPriceBeforeDiscount = JsonConverters.toDouble(json['ticketPriceBeforeDiscount']);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'ticketId': ticketId,
        'eventSeriesTicketType': eventSeriesTicketType,
        'eventSeriesOwnerTicketType': eventSeriesOwnerTicketType,
        'ticketPrice': ticketPrice,
        'totalPrice': totalPrice,
        'count': count,
        'ticketColor': ticketColor,
        'showUsedTickets': showUsedTickets,
        'ticketName': ticketName,
        'ticketDisplayString': ticketDisplayString,
        'ticketDetailsTransferredFrom': ticketDetailsTransferredFrom,
        'teamPassId': teamPassId,
        'isSpecialTicket': isSpecialTicket,
        'specialTicketId': specialTicketId,
        'justChangedBySQL': justChangedBySQL,
        'sqlJustChangedTimeStamp': JsonConverters.toJson(sqlJustChangedTimeStamp,'DateTime',context!),
        'currency': currency,
        'discountCode': discountCode,
        'totalDiscount': totalDiscount,
        'totalAmountBeforeDiscount': totalAmountBeforeDiscount,
        'ticketPriceBeforeDiscount': ticketPriceBeforeDiscount
    };

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

class PreviewDiscountRequest implements IConvertible
{
    String? code;
    int? eventId;
    String? fullPhoneNumber;
    List<TicketDetails>? orderDetails;

    PreviewDiscountRequest({this.code,this.eventId,this.fullPhoneNumber,this.orderDetails});
    PreviewDiscountRequest.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        code = json['code'];
        eventId = json['eventId'];
        fullPhoneNumber = json['fullPhoneNumber'];
        orderDetails = JsonConverters.fromJson(json['orderDetails'],'List<TicketDetails>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'code': code,
        'eventId': eventId,
        'fullPhoneNumber': fullPhoneNumber,
        'orderDetails': JsonConverters.toJson(orderDetails,'List<TicketDetails>',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'stubbur_app.azurewebsites.net', types: <String, TypeInfo> {
    'LocalizedMessage': TypeInfo(TypeOf.Class, create:() => LocalizedMessage()),
    'DiscountSummary': TypeInfo(TypeOf.Class, create:() => DiscountSummary()),
    'DiscountLineResult': TypeInfo(TypeOf.Class, create:() => DiscountLineResult()),
    'PreviewDiscountResult': TypeInfo(TypeOf.Class, create:() => PreviewDiscountResult()),
    'List<DiscountLineResult>': TypeInfo(TypeOf.Class, create:() => <DiscountLineResult>[]),
    'TicketDetails': TypeInfo(TypeOf.Class, create:() => TicketDetails()),
    'PreviewDiscountRequest': TypeInfo(TypeOf.Class, create:() => PreviewDiscountRequest()),
    'List<TicketDetails>': TypeInfo(TypeOf.Class, create:() => <TicketDetails>[]),
});

Dart PreviewDiscountRequest 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 /ticketOrder/previewDiscount HTTP/1.1 
Host: stubbur-app.azurewebsites.net 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<PreviewDiscountRequest xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TicketUserServices.ServiceModel">
  <Code>String</Code>
  <EventId>0</EventId>
  <FullPhoneNumber>String</FullPhoneNumber>
  <OrderDetails xmlns:d2p1="http://schemas.datacontract.org/2004/07/TicketUserServices.ServiceModel.Types">
    <d2p1:TicketDetails>
      <d2p1:Count>0</d2p1:Count>
      <d2p1:Currency>String</d2p1:Currency>
      <d2p1:DiscountCode>String</d2p1:DiscountCode>
      <d2p1:EventSeriesOwnerTicketType>0</d2p1:EventSeriesOwnerTicketType>
      <d2p1:EventSeriesTicketType>0</d2p1:EventSeriesTicketType>
      <d2p1:ID>0</d2p1:ID>
      <d2p1:IsSpecialTicket>false</d2p1:IsSpecialTicket>
      <d2p1:JustChangedBySQL>false</d2p1:JustChangedBySQL>
      <d2p1:SQLJustChangedTimeStamp>0001-01-01T00:00:00</d2p1:SQLJustChangedTimeStamp>
      <d2p1:ShowUsedTickets>false</d2p1:ShowUsedTickets>
      <d2p1:SpecialTicketId>String</d2p1:SpecialTicketId>
      <d2p1:TeamPassId>0</d2p1:TeamPassId>
      <d2p1:TicketColor>String</d2p1:TicketColor>
      <d2p1:TicketDetailsTransferredFrom>0</d2p1:TicketDetailsTransferredFrom>
      <d2p1:TicketDisplayString>String</d2p1:TicketDisplayString>
      <d2p1:TicketId>0</d2p1:TicketId>
      <d2p1:TicketName>String</d2p1:TicketName>
      <d2p1:TicketPrice>0</d2p1:TicketPrice>
      <d2p1:TicketPriceBeforeDiscount>0</d2p1:TicketPriceBeforeDiscount>
      <d2p1:TotalAmountBeforeDiscount>0</d2p1:TotalAmountBeforeDiscount>
      <d2p1:TotalDiscount>0</d2p1:TotalDiscount>
      <d2p1:TotalPrice>0</d2p1:TotalPrice>
    </d2p1:TicketDetails>
  </OrderDetails>
</PreviewDiscountRequest>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<PreviewDiscountResult xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/TicketUserServices.ServiceModel">
  <Currency>String</Currency>
  <Discount>
    <Type>String</Type>
    <Value>0</Value>
  </Discount>
  <DiscountCodeId>0</DiscountCodeId>
  <DiscountCodeTypeId>0</DiscountCodeTypeId>
  <Lines>
    <DiscountLineResult>
      <Applied>false</Applied>
      <Count>0</Count>
      <LineAfter>0</LineAfter>
      <LineBefore>0</LineBefore>
      <TicketTypeId>0</TicketTypeId>
      <UnitAfter>0</UnitAfter>
      <UnitBefore>0</UnitBefore>
    </DiscountLineResult>
  </Lines>
  <Message>
    <En>String</En>
    <Is>String</Is>
  </Message>
  <Reason>String</Reason>
  <Status>String</Status>
  <StatusCode>0</StatusCode>
  <SubtotalAfter>0</SubtotalAfter>
  <SubtotalBefore>0</SubtotalBefore>
  <TotalSavings>0</TotalSavings>
</PreviewDiscountResult>