POST | /api/purchaseorders | Create a new PurchaseOrder |
---|
import java.math.*
import java.util.*
import net.servicestack.client.*
import com.google.gson.annotations.*
import com.google.gson.reflect.*
open class CreatePurchaseOrder
{
var userId:String? = null
var userEmail:String? = null
var createdDate:Date? = null
@SerializedName("void") var Void:Boolean? = null
var couponCode:String? = null
var orderItems:ArrayList<PurchaseOrderItemDto> = ArrayList<PurchaseOrderItemDto>()
var paymentType:String? = null
var billingInformationDto:BillingInformationDto? = null
}
open class PurchaseOrderItemDto
{
var id:Int? = null
var purchaseOrderId:Int? = null
var productId:String? = null
var productName:String? = null
var quantity:Int? = null
var price:BigDecimal? = null
var discountDescription:String? = null
var discountSource:String? = null
var discount:BigDecimal? = null
var createdDate:Date? = null
}
open class BillingInformationDto
{
var cardNumber:String? = null
var cardType:String? = null
var expireMonth:Int? = null
var expireYear:Int? = null
var cvv2:String? = null
var firstName:String? = null
var lastName:String? = null
var city:String? = null
var countryCode:String? = null
var line1:String? = null
var postalCode:String? = null
var state:String? = null
}
open class CreatePurchaseOrderResponse
{
var message:String? = null
var status:HttpStatusCode? = null
var purchaseOrder:PurchaseOrderDto? = null
var details:ArrayList<Details> = ArrayList<Details>()
}
open class PurchaseOrderDto
{
var id:Int? = null
var userId:String? = null
var createdDate:Date? = null
var paymentType:String? = null
@SerializedName("void") var Void:Boolean? = null
var paid:Boolean? = null
var transactionIdentifier:String? = null
var couponCode:String? = null
var orderItems:ArrayList<PurchaseOrderItem> = ArrayList<PurchaseOrderItem>()
var payer:String? = null
var billingAddressLine1:String? = null
var billingAddressCity:String? = null
var billingAddressState:String? = null
var billingAddressPostalCode:String? = null
var billingAddressCountryCode:String? = null
}
open class PurchaseOrderItem
{
var id:Int? = null
@References(PurchaseOrder.class)
var purchaseOrderId:Int? = null
@References(Product.class)
var productId:String? = null
var productName:String? = null
var quantity:Int? = null
var price:BigDecimal? = null
var discountDescription:String? = null
var discountSource:String? = null
var discount:BigDecimal? = null
var createdDate:Date? = null
}
open class Details
{
var code:String? = null
var field:String? = null
var issue:String? = null
}
Kotlin CreatePurchaseOrder DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .jsv suffix or ?format=jsv
The following are sample HTTP requests and responses. The placeholders shown need to be replaced with actual values.
POST /api/purchaseorders HTTP/1.1
Host: accounts.dev.healthmonix.com
Accept: text/jsv
Content-Type: text/jsv
Content-Length: length
{
userId: String,
userEmail: String,
createdDate: 0001-01-01,
void: False,
couponCode: String,
orderItems:
[
{
id: 0,
purchaseOrderId: 0,
productId: String,
productName: String,
quantity: 0,
price: 0,
discountDescription: String,
discountSource: String,
discount: 0,
createdDate: 0001-01-01
}
],
paymentType: String,
billingInformationDto:
{
cardNumber: String,
cardType: String,
expireMonth: 0,
expireYear: 0,
cvv2: String,
firstName: String,
lastName: String,
city: String,
countryCode: String,
line1: String,
postalCode: String,
state: String
}
}
HTTP/1.1 200 OK Content-Type: text/jsv Content-Length: length { message: String, status: Continue, purchaseOrder: { id: 0, userId: String, createdDate: 0001-01-01, paymentType: String, void: False, paid: False, transactionIdentifier: String, couponCode: String, orderItems: [ { id: 0, purchaseOrderId: 0, productId: String, productName: String, quantity: 0, price: 0, discountDescription: String, discountSource: String, discount: 0, createdDate: 0001-01-01 } ], payer: String, billingAddressLine1: String, billingAddressCity: String, billingAddressState: String, billingAddressPostalCode: String, billingAddressCountryCode: String }, details: [ { code: String, field: String, issue: String } ] }