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

HTTP + CSV

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: text/csv
Content-Type: text/csv
Content-Length: length

{"code":"String","eventId":0,"fullPhoneNumber":"String","orderDetails":[{"id":0,"ticketId":0,"eventSeriesTicketType":0,"eventSeriesOwnerTicketType":0,"ticketPrice":0,"totalPrice":0,"count":0,"ticketColor":"String","showUsedTickets":false,"ticketName":"String","ticketDisplayString":"String","ticketDetailsTransferredFrom":0,"teamPassId":0,"isSpecialTicket":false,"specialTicketId":"String","justChangedBySQL":false,"sqlJustChangedTimeStamp":"0001-01-01T00:00:00.0000000","currency":"String","discountCode":"String","totalDiscount":0,"totalAmountBeforeDiscount":0,"ticketPriceBeforeDiscount":0}]}
HTTP/1.1 200 OK
Content-Type: text/csv
Content-Length: length

{"status":"String","reason":"String","message":{"is":"String","en":"String"},"discountCodeId":0,"discountCodeTypeId":0,"discount":{"type":"String","value":0},"lines":[{"ticketTypeId":0,"count":0,"applied":false,"unitBefore":0,"unitAfter":0,"lineBefore":0,"lineAfter":0}],"subtotalBefore":0,"subtotalAfter":0,"totalSavings":0,"currency":"String","statusCode":0}