Skip to content

Commit

Permalink
feat(commons): describe Order interface (#533)
Browse files Browse the repository at this point in the history
  • Loading branch information
mkucmus authored Mar 22, 2020
1 parent 38b431e commit eef6062
Show file tree
Hide file tree
Showing 2 changed files with 136 additions and 1 deletion.
109 changes: 108 additions & 1 deletion packages/commons/interfaces/models/checkout/order/Order.ts
Original file line number Diff line number Diff line change
@@ -1 +1,108 @@
export interface Order {}
import { CustomerAddress } from "@shopware-pwa/commons/interfaces/models/checkout/customer/CustomerAddress";
import { OrderLineItem } from "@shopware-pwa/commons/interfaces/models/checkout/order/OrderLineItem";
import { StateMachineState } from "@shopware-pwa/commons/interfaces/models/system/state-machine/StateMachineState";
import { OrderTransaction } from "./OrderTransaction";
import { Tag } from "@shopware-pwa/commons/interfaces/models/system/tag/Tag";
import { Currency } from "@shopware-pwa/commons/interfaces/models/system/currency/Currency";
import { Language } from "@shopware-pwa/commons/interfaces/models/framework/language/Language";
import { SalesChannel } from "@shopware-pwa/commons/interfaces/models/system/sales-channel/SalesChannel";
import { CustomFields } from "@shopware-pwa/commons/interfaces/models/common/CustomField";

interface CalculatedTax {
tax: number;
taxRate: number;
price: number;
extensions: any[];
}
interface TaxRule {
taxRate: number;
percentage: number;
extensions: any[];
}
interface Price {
netPrice: number;
totalPrice: number;
calculatedTaxes: CalculatedTax[];
taxRules: TaxRule[];
positionPrice: number;
taxStatus: string;
extensions: any[];
}

interface ShippingCost {
unitPrice: number;
quantity: number;
totalPrice: number;
calculatedTaxes: CalculatedTax[];
taxRules: TaxRule[];
referencePrice: number | null;
listPrice: number | null;
extensions: any[];
}

interface OrderCustomer {
email: string;
orderId: string;
salutationId: string;
firstName: string;
lastName: string;
title: null;
company: null;
customerNumber: number;
customerId: string;
customer: null;
salutation: null;
order: null;
customFields: null;
remoteAddress: string;
_uniqueIdentifier: string;
versionId: string;
translated: [];
createdAt: Date;
updatedAt: null;
extensions: any;
id: string;
orderVersionId: string;
}

export interface Order {
orderNumber: number;
currencyId: string;
currencyFactor: number;
salesChannelId: string;
billingAddressId: string;
orderDateTime: Date;
orderDate: Date;
price: Price;
amountTotal: number;
amountNet: number;
positionPrice: number;
taxStatus: string;
shippingCosts: ShippingCost;
shippingTotal: number;
orderCustomer: OrderCustomer;
currency: Currency | null;
languageId: string;
language: Language | null;
salesChannel: SalesChannel | null;
addresses: CustomerAddress[];
deliveries: null;
lineItems: OrderLineItem[] | null;
transactions: OrderTransaction[] | null;
deepLinkCode: string;
stateMachineState: StateMachineState;
stateId: string;
customFields: CustomFields;
documents: null;
tags: Tag[] | null;
affiliateCode: string | null;
campaignCode: string | null;
_uniqueIdentifier: string;
versionId: string;
translated: any[];
createdAt: Date;
updatedAt: Date | null;
extensions: any;
id: string;
billingAddressVersionId: string;
}
28 changes: 28 additions & 0 deletions packages/commons/interfaces/request/CreateGuestOrderParams.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
interface BillingAddress {
countryId: string;
salutationId: string;
street: string;
zipcode: string;
city: string;
title?: string;
additionalAddressLine1?: string;
additionalAddressLine2?: string;
phoneNumber?: string;
}

interface ShippingAddress extends BillingAddress {
firstName: string;
lastName: string;
}

export interface CreateGuestOrderParams {
email: string;
salutationId: string;
firstName: string;
lastName: string;
billingAddress: BillingAddress;
shippingAddress: ShippingAddress;
affiliateCode?: string;
campaignCode?: string;
phoneNumber?: string;
}

0 comments on commit eef6062

Please sign in to comment.