POST | /api/purchaseorders | Create a new PurchaseOrder |
---|
Imports System
Imports System.Collections
Imports System.Collections.Generic
Imports System.Runtime.Serialization
Imports ServiceStack
Imports ServiceStack.DataAnnotations
Imports Hmx.Accounts.ServiceModels
Imports Hmx.Accounts.Models
Namespace Global
Namespace Hmx.Accounts.Models
Public Partial Class PurchaseOrderItem
Public Overridable Property Id As Integer
<References(GetType(PurchaseOrder))>
Public Overridable Property PurchaseOrderId As Integer
<References(GetType(Product))>
Public Overridable Property ProductId As String
Public Overridable Property ProductName As String
Public Overridable Property Quantity As Integer
Public Overridable Property Price As Decimal
Public Overridable Property DiscountDescription As String
Public Overridable Property DiscountSource As String
Public Overridable Property Discount As Decimal
Public Overridable Property CreatedDate As Date
End Class
End Namespace
Namespace Hmx.Accounts.ServiceModels
Public Partial Class BillingInformationDto
Public Overridable Property CardNumber As String
Public Overridable Property CardType As String
Public Overridable Property ExpireMonth As Integer
Public Overridable Property ExpireYear As Integer
Public Overridable Property Cvv2 As String
Public Overridable Property FirstName As String
Public Overridable Property LastName As String
Public Overridable Property City As String
Public Overridable Property CountryCode As String
Public Overridable Property Line1 As String
Public Overridable Property PostalCode As String
Public Overridable Property State As String
End Class
Public Partial Class CreatePurchaseOrder
Public Sub New()
OrderItems = New List(Of PurchaseOrderItemDto)
End Sub
Public Overridable Property UserId As String
Public Overridable Property UserEmail As String
Public Overridable Property CreatedDate As Date
Public Overridable Property Void As Boolean
Public Overridable Property CouponCode As String
Public Overridable Property OrderItems As List(Of PurchaseOrderItemDto)
Public Overridable Property PaymentType As String
Public Overridable Property BillingInformationDto As BillingInformationDto
End Class
Public Partial Class CreatePurchaseOrderResponse
Public Sub New()
Details = New List(Of Details)
End Sub
Public Overridable Property Message As String
Public Overridable Property Status As HttpStatusCode
Public Overridable Property PurchaseOrder As PurchaseOrderDto
Public Overridable Property Details As List(Of Details)
End Class
Public Partial Class Details
Public Overridable Property Code As String
Public Overridable Property Field As String
Public Overridable Property Issue As String
End Class
Public Partial Class PurchaseOrderDto
Public Sub New()
OrderItems = New List(Of PurchaseOrderItem)
End Sub
Public Overridable Property Id As Integer
Public Overridable Property UserId As String
Public Overridable Property CreatedDate As Date
Public Overridable Property PaymentType As String
Public Overridable Property Void As Boolean
Public Overridable Property Paid As Boolean
Public Overridable Property TransactionIdentifier As String
Public Overridable Property CouponCode As String
Public Overridable Property OrderItems As List(Of PurchaseOrderItem)
Public Overridable Property Payer As String
Public Overridable Property BillingAddressLine1 As String
Public Overridable Property BillingAddressCity As String
Public Overridable Property BillingAddressState As String
Public Overridable Property BillingAddressPostalCode As String
Public Overridable Property BillingAddressCountryCode As String
End Class
Public Partial Class PurchaseOrderItemDto
Public Overridable Property Id As Integer
Public Overridable Property PurchaseOrderId As Integer
Public Overridable Property ProductId As String
Public Overridable Property ProductName As String
Public Overridable Property Quantity As Integer
Public Overridable Property Price As Decimal
Public Overridable Property DiscountDescription As String
Public Overridable Property DiscountSource As String
Public Overridable Property Discount As Decimal
Public Overridable Property CreatedDate As Date
End Class
End Namespace
End Namespace
VB.NET CreatePurchaseOrder 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
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: application/json
Content-Type: application/json
Content-Length: length
{"userId":"String","userEmail":"String","createdDate":"0001-01-01T00:00:00.0000000","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-01T00:00:00.0000000"}],"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: application/json Content-Length: length {"message":"String","status":"Continue","purchaseOrder":{"id":0,"userId":"String","createdDate":"0001-01-01T00:00:00.0000000","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-01T00:00:00.0000000"}],"payer":"String","billingAddressLine1":"String","billingAddressCity":"String","billingAddressState":"String","billingAddressPostalCode":"String","billingAddressCountryCode":"String"},"details":[{"code":"String","field":"String","issue":"String"}]}