ServiceStack Home (Live)

<back to all web services

ViewOrder

Requires Authentication
The following routes are available for this service:
All Verbs/account/orders/{Id}
GET/ViewOrder
GET/ViewOrder/{Id}
import 'package:servicestack/servicestack.dart';

class ViewOrder implements IConvertible
{
    int? id;

    ViewOrder({this.id});
    ViewOrder.fromJson(Map<String, dynamic> json) { fromMap(json); }

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

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

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

enum SkuType
{
    Product,
    PerDev,
    PerCore,
    Site,
    Support,
    Training,
    Register,
    Payment,
}

class OrderDetail implements IConvertible
{
    int? id;
    int? orderId;
    int? skuId;
    SkuType? skuType;
    int? price;
    String? description;
    int? quantity;
    int? total;

    OrderDetail({this.id,this.orderId,this.skuId,this.skuType,this.price,this.description,this.quantity,this.total});
    OrderDetail.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        orderId = json['orderId'];
        skuId = json['skuId'];
        skuType = JsonConverters.fromJson(json['skuType'],'SkuType',context!);
        price = json['price'];
        description = json['description'];
        quantity = json['quantity'];
        total = json['total'];
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'orderId': orderId,
        'skuId': skuId,
        'skuType': JsonConverters.toJson(skuType,'SkuType',context!),
        'price': price,
        'description': description,
        'quantity': quantity,
        'total': total
    };

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

class Order implements IAddress, IConvertible
{
    int? id;
    int? customerId;
    String? productName;
    String? firstName;
    String? lastName;
    String? email;
    String? company;
    String? phoneNumber;
    String? addressLine1;
    String? addressLine2;
    String? addressCity;
    String? addressZip;
    String? addressState;
    String? addressCountry;
    bool? agreeTerms;
    String? notes;
    String? last4;
    int? subTotal;
    String? couponId;
    int? discount;
    int? tax;
    int? total;
    int? itemQuantity;
    int? authorizedQuantity;
    int? subscriptionId;
    String? licenseRef;
    int? paymentId;
    int? emailId;
    bool? paid;
    DateTime? createdDate;
    DateTime? modifiedDate;
    String? modifiedBy;
    DateTime? cancelledDate;
    String? cancelledReason;
    String? ipAddress;
    List<OrderDetail>? orderDetails;

    Order({this.id,this.customerId,this.productName,this.firstName,this.lastName,this.email,this.company,this.phoneNumber,this.addressLine1,this.addressLine2,this.addressCity,this.addressZip,this.addressState,this.addressCountry,this.agreeTerms,this.notes,this.last4,this.subTotal,this.couponId,this.discount,this.tax,this.total,this.itemQuantity,this.authorizedQuantity,this.subscriptionId,this.licenseRef,this.paymentId,this.emailId,this.paid,this.createdDate,this.modifiedDate,this.modifiedBy,this.cancelledDate,this.cancelledReason,this.ipAddress,this.orderDetails});
    Order.fromJson(Map<String, dynamic> json) { fromMap(json); }

    fromMap(Map<String, dynamic> json) {
        id = json['id'];
        customerId = json['customerId'];
        productName = json['productName'];
        firstName = json['firstName'];
        lastName = json['lastName'];
        email = json['email'];
        company = json['company'];
        phoneNumber = json['phoneNumber'];
        addressLine1 = json['addressLine1'];
        addressLine2 = json['addressLine2'];
        addressCity = json['addressCity'];
        addressZip = json['addressZip'];
        addressState = json['addressState'];
        addressCountry = json['addressCountry'];
        agreeTerms = json['agreeTerms'];
        notes = json['notes'];
        last4 = json['last4'];
        subTotal = json['subTotal'];
        couponId = json['couponId'];
        discount = json['discount'];
        tax = json['tax'];
        total = json['total'];
        itemQuantity = json['itemQuantity'];
        authorizedQuantity = json['authorizedQuantity'];
        subscriptionId = json['subscriptionId'];
        licenseRef = json['licenseRef'];
        paymentId = json['paymentId'];
        emailId = json['emailId'];
        paid = json['paid'];
        createdDate = JsonConverters.fromJson(json['createdDate'],'DateTime',context!);
        modifiedDate = JsonConverters.fromJson(json['modifiedDate'],'DateTime',context!);
        modifiedBy = json['modifiedBy'];
        cancelledDate = JsonConverters.fromJson(json['cancelledDate'],'DateTime',context!);
        cancelledReason = json['cancelledReason'];
        ipAddress = json['ipAddress'];
        orderDetails = JsonConverters.fromJson(json['orderDetails'],'List<OrderDetail>',context!);
        return this;
    }

    Map<String, dynamic> toJson() => {
        'id': id,
        'customerId': customerId,
        'productName': productName,
        'firstName': firstName,
        'lastName': lastName,
        'email': email,
        'company': company,
        'phoneNumber': phoneNumber,
        'addressLine1': addressLine1,
        'addressLine2': addressLine2,
        'addressCity': addressCity,
        'addressZip': addressZip,
        'addressState': addressState,
        'addressCountry': addressCountry,
        'agreeTerms': agreeTerms,
        'notes': notes,
        'last4': last4,
        'subTotal': subTotal,
        'couponId': couponId,
        'discount': discount,
        'tax': tax,
        'total': total,
        'itemQuantity': itemQuantity,
        'authorizedQuantity': authorizedQuantity,
        'subscriptionId': subscriptionId,
        'licenseRef': licenseRef,
        'paymentId': paymentId,
        'emailId': emailId,
        'paid': paid,
        'createdDate': JsonConverters.toJson(createdDate,'DateTime',context!),
        'modifiedDate': JsonConverters.toJson(modifiedDate,'DateTime',context!),
        'modifiedBy': modifiedBy,
        'cancelledDate': JsonConverters.toJson(cancelledDate,'DateTime',context!),
        'cancelledReason': cancelledReason,
        'ipAddress': ipAddress,
        'orderDetails': JsonConverters.toJson(orderDetails,'List<OrderDetail>',context!)
    };

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

TypeContext _ctx = TypeContext(library: 'account.servicestack.net', types: <String, TypeInfo> {
    'ViewOrder': TypeInfo(TypeOf.Class, create:() => ViewOrder()),
    'SkuType': TypeInfo(TypeOf.Enum, enumValues:SkuType.values),
    'OrderDetail': TypeInfo(TypeOf.Class, create:() => OrderDetail()),
    'Order': TypeInfo(TypeOf.Class, create:() => Order()),
    'List<OrderDetail>': TypeInfo(TypeOf.Class, create:() => <OrderDetail>[]),
});

Dart ViewOrder 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 /account/orders/{Id} HTTP/1.1 
Host: account.servicestack.net 
Accept: application/xml
Content-Type: application/xml
Content-Length: length

<ViewOrder xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MyApp.ServiceModel">
  <Id>0</Id>
</ViewOrder>
HTTP/1.1 200 OK
Content-Type: application/xml
Content-Length: length

<Order xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/MyApp.ServiceModel">
  <AddressCity>String</AddressCity>
  <AddressCountry>String</AddressCountry>
  <AddressLine1>String</AddressLine1>
  <AddressLine2>String</AddressLine2>
  <AddressState>String</AddressState>
  <AddressZip>String</AddressZip>
  <AgreeTerms>false</AgreeTerms>
  <AuthorizedQuantity>0</AuthorizedQuantity>
  <CancelledDate>0001-01-01T00:00:00</CancelledDate>
  <CancelledReason>String</CancelledReason>
  <Company>String</Company>
  <CouponId>String</CouponId>
  <CreatedDate>0001-01-01T00:00:00</CreatedDate>
  <CustomerId>0</CustomerId>
  <Discount>0</Discount>
  <Email>String</Email>
  <EmailId>0</EmailId>
  <FirstName>String</FirstName>
  <Id>0</Id>
  <IpAddress>String</IpAddress>
  <ItemQuantity>0</ItemQuantity>
  <Last4>String</Last4>
  <LastName>String</LastName>
  <LicenseRef>String</LicenseRef>
  <ModifiedBy>String</ModifiedBy>
  <ModifiedDate>0001-01-01T00:00:00</ModifiedDate>
  <Notes>String</Notes>
  <OrderDetails>
    <OrderDetail>
      <Description>String</Description>
      <Id>0</Id>
      <OrderId>0</OrderId>
      <Price>0</Price>
      <Quantity>0</Quantity>
      <SkuId>0</SkuId>
      <SkuType>Product</SkuType>
      <Total>0</Total>
    </OrderDetail>
  </OrderDetails>
  <Paid>false</Paid>
  <PaymentId>0</PaymentId>
  <PhoneNumber>String</PhoneNumber>
  <ProductName>String</ProductName>
  <SubTotal>0</SubTotal>
  <SubscriptionId>0</SubscriptionId>
  <Tax>0</Tax>
  <Total>0</Total>
</Order>