POST | /api/purchaseorders | Create a new PurchaseOrder |
---|
export class PurchaseOrderItem
{
public id?: number;
// @References("typeof(Hmx.Accounts.Models.PurchaseOrder)")
public purchaseOrderId?: number;
// @References("typeof(Hmx.Accounts.Models.Product)")
public productId?: string;
public productName?: string;
public quantity?: number;
public price?: number;
public discountDescription?: string;
public discountSource?: string;
public discount?: number;
public createdDate?: string;
public constructor(init?: Partial<PurchaseOrderItem>) { (Object as any).assign(this, init); }
}
export class PurchaseOrderDto
{
public id?: number;
public userId?: string;
public createdDate?: string;
public paymentType?: string;
public void?: boolean;
public paid?: boolean;
public transactionIdentifier?: string;
public couponCode?: string;
public orderItems?: PurchaseOrderItem[];
public payer?: string;
public billingAddressLine1?: string;
public billingAddressCity?: string;
public billingAddressState?: string;
public billingAddressPostalCode?: string;
public billingAddressCountryCode?: string;
public constructor(init?: Partial<PurchaseOrderDto>) { (Object as any).assign(this, init); }
}
export class Details
{
public code?: string;
public field?: string;
public issue?: string;
public constructor(init?: Partial<Details>) { (Object as any).assign(this, init); }
}
export class CreatePurchaseOrderResponse
{
public message?: string;
public status?: HttpStatusCode;
public purchaseOrder?: PurchaseOrderDto;
public details?: Details[];
public constructor(init?: Partial<CreatePurchaseOrderResponse>) { (Object as any).assign(this, init); }
}
export class PurchaseOrderItemDto
{
public id?: number;
public purchaseOrderId?: number;
public productId?: string;
public productName?: string;
public quantity?: number;
public price?: number;
public discountDescription?: string;
public discountSource?: string;
public discount?: number;
public createdDate?: string;
public constructor(init?: Partial<PurchaseOrderItemDto>) { (Object as any).assign(this, init); }
}
export class BillingInformationDto
{
public cardNumber?: string;
public cardType?: string;
public expireMonth?: number;
public expireYear?: number;
public cvv2?: string;
public firstName?: string;
public lastName?: string;
public city?: string;
public countryCode?: string;
public line1?: string;
public postalCode?: string;
public state?: string;
public constructor(init?: Partial<BillingInformationDto>) { (Object as any).assign(this, init); }
}
export class CreatePurchaseOrder
{
public userId?: string;
public userEmail?: string;
public createdDate?: string;
public void?: boolean;
public couponCode?: string;
public orderItems?: PurchaseOrderItemDto[];
public paymentType?: string;
public billingInformationDto?: BillingInformationDto;
public constructor(init?: Partial<CreatePurchaseOrder>) { (Object as any).assign(this, init); }
}
TypeScript CreatePurchaseOrder DTOs
To override the Content-type in your clients, use the HTTP Accept Header, append the .xml suffix or ?format=xml
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/xml
Content-Type: application/xml
Content-Length: length
<CreatePurchaseOrder xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Hmx.Accounts.ServiceModels">
<BillingInformationDto>
<CardNumber>String</CardNumber>
<CardType>String</CardType>
<City>String</City>
<CountryCode>String</CountryCode>
<Cvv2>String</Cvv2>
<ExpireMonth>0</ExpireMonth>
<ExpireYear>0</ExpireYear>
<FirstName>String</FirstName>
<LastName>String</LastName>
<Line1>String</Line1>
<PostalCode>String</PostalCode>
<State>String</State>
</BillingInformationDto>
<CouponCode>String</CouponCode>
<CreatedDate>0001-01-01T00:00:00</CreatedDate>
<OrderItems>
<PurchaseOrderItemDto>
<CreatedDate>0001-01-01T00:00:00</CreatedDate>
<Discount>0</Discount>
<DiscountDescription>String</DiscountDescription>
<DiscountSource>String</DiscountSource>
<Id>0</Id>
<Price>0</Price>
<ProductId>String</ProductId>
<ProductName>String</ProductName>
<PurchaseOrderId>0</PurchaseOrderId>
<Quantity>0</Quantity>
</PurchaseOrderItemDto>
</OrderItems>
<PaymentType>String</PaymentType>
<UserEmail>String</UserEmail>
<UserId>String</UserId>
<Void>false</Void>
</CreatePurchaseOrder>
HTTP/1.1 200 OK Content-Type: application/xml Content-Length: length <CreatePurchaseOrderResponse xmlns:i="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://schemas.datacontract.org/2004/07/Hmx.Accounts.ServiceModels"> <Details> <Details> <Code>String</Code> <Field>String</Field> <Issue>String</Issue> </Details> </Details> <Message>String</Message> <PurchaseOrder> <BillingAddressCity>String</BillingAddressCity> <BillingAddressCountryCode>String</BillingAddressCountryCode> <BillingAddressLine1>String</BillingAddressLine1> <BillingAddressPostalCode>String</BillingAddressPostalCode> <BillingAddressState>String</BillingAddressState> <CouponCode>String</CouponCode> <CreatedDate>0001-01-01T00:00:00</CreatedDate> <Id>0</Id> <OrderItems xmlns:d3p1="http://schemas.datacontract.org/2004/07/Hmx.Accounts.Models"> <d3p1:PurchaseOrderItem> <d3p1:CreatedDate>0001-01-01T00:00:00</d3p1:CreatedDate> <d3p1:Discount>0</d3p1:Discount> <d3p1:DiscountDescription>String</d3p1:DiscountDescription> <d3p1:DiscountSource>String</d3p1:DiscountSource> <d3p1:Id>0</d3p1:Id> <d3p1:Price>0</d3p1:Price> <d3p1:ProductId>String</d3p1:ProductId> <d3p1:ProductName>String</d3p1:ProductName> <d3p1:PurchaseOrderId>0</d3p1:PurchaseOrderId> <d3p1:Quantity>0</d3p1:Quantity> </d3p1:PurchaseOrderItem> </OrderItems> <Paid>false</Paid> <Payer>String</Payer> <PaymentType>String</PaymentType> <TransactionIdentifier>String</TransactionIdentifier> <UserId>String</UserId> <Void>false</Void> </PurchaseOrder> <Status>Continue</Status> </CreatePurchaseOrderResponse>