Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 | 16x 16x 16x 16x 16x 16x 1x 1x 1x 1x 1x | import ABatchNode from '@orchesty/nodejs-sdk/dist/lib/Batch/ABatchNode';
import ResponseDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/ResponseDto';
import { HttpMethods } from '@orchesty/nodejs-sdk/dist/lib/Transport/HttpMethods';
import BatchProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/BatchProcessDto';
import { API_VERSION } from '../ABaseShopify';
export const NAME = 'shopify-get-fulfillments';
export default class ShopifyGetFulfillments extends ABatchNode {
public getName(): string {
return NAME;
}
public async processAction(dto: BatchProcessDto<IInput>): Promise<BatchProcessDto> {
const { id } = dto.getJsonData();
const req = await this.getApplication().getRequestDto(
dto,
await this.getApplicationInstallFromProcess(dto, null),
HttpMethods.GET,
`admin/api/${API_VERSION}/orders/${id}/fulfillment_orders.json`,
);
const resp = await this.getSender().send<IOutput>(req);
return this.setItemList(dto, resp);
}
protected setItemList(dto: BatchProcessDto, resp: ResponseDto<IOutput>): BatchProcessDto {
return dto.setItemList(resp.getJsonBody().fulfillment_orders);
}
}
export interface IInput {
id: string;
}
/* eslint-disable @typescript-eslint/naming-convention */
export interface IOutput {
fulfillment_orders: {
id: number;
shop_id: number;
order_id: number;
assigned_location_id: number;
request_status: string;
status: string;
supported_actions: string[];
destination: {
id: number;
address1: string;
address2: string;
city: string;
company?: unknown;
country: string;
email: string;
first_name: string;
last_name: string;
phone: string;
province: string;
zip: string;
};
line_items: {
id: number;
shop_id: number;
fulfillment_order_id: number;
quantity: number;
line_item_id: number;
inventory_item_id: number;
fulfillable_quantity: number;
variant_id: number;
}[];
fulfillment_service_handle: string;
assigned_location: {
address1?: unknown;
address2?: unknown;
city?: unknown;
country_code: string;
location_id: number;
name: string;
phone?: unknown;
province?: unknown;
zip?: unknown;
};
merchant_requests: unknown[];
}[];
}
/* eslint-enable @typescript-eslint/naming-convention */
|