Appearance
getMedia ​
Definition ​
Basic usage ​
ts
const {
order,
status,
total,
subtotal,
shippingCosts,
shippingAddress,
billingAddress,
personalDetails,
paymentUrl,
shippingMethod,
paymentMethod,
getMediaFile,
getDocumentFile,
hasDocuments,
documents,
loadOrderDetails,
handlePayment,
cancel,
changePaymentMethod
} = useOrderDetails(orderId, associations);
Properties ​
| Name | Type | Description |
|---|---|---|
| order | ComputedRef< | undefined | null> | {@link Schemas['Order']} object |
| status | ComputedRef<string | undefined> | Order status (e.g. 'open', 'cancelled') |
| total | ComputedRef<number | undefined> | Order total price |
| subtotal | ComputedRef<number | undefined> | Order subtotal price for all items |
| shippingCosts | ComputedRef<number | undefined> | Order shipping costs |
| shippingAddress | ComputedRef< | undefined> | Shipping address |
| billingAddress | ComputedRef< | undefined> | Billing address |
| personalDetails | ComputedRef<{
email: string | undefined;
firstName: string | undefined;
lastName: string | undefined;
}> | Basic personal details |
| paymentUrl | Ref< | string> | Payment URL for external payment methods (e.g. async payment in external payment gateway) |
| shippingMethod | ComputedRef< | undefined | null> | Selected shipping method |
| paymentMethod | ComputedRef< | undefined | null> | Selected payment method |
| getMediaFile | (downloadId: string) => Promise<Blob> | Get media content |
| getDocumentFile | (
documentId: string,
deepLinkCode: string,
) => Promise<Schemas["Document"]> | Get order documents |
| hasDocuments | ComputedRef<boolean> | Check if order has documents |
| documents | ComputedRef<Array<>> | Get order documents |
Methods ​
| Name | Type | Description |
|---|---|---|
| loadOrderDetails | Promise<void> | Get order object including additional associations.useDefaults describes what order object should look like. |
| handlePayment | void | Handle payment for existing error.Pass custom success and error URLs (optionally). |
| cancel | Promise<void> | Cancel an order.Action cannot be reverted. |
| changePaymentMethod | Promise<void> | Changes the payment method for current cart. |