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 | 12x 12x 12x 12x 12x 12x 12x 12x 12x 4x 4x 4x 4x 4x 1x | import ResponseDto from '@orchesty/nodejs-sdk/dist/lib/Transport/Curl/ResponseDto';
import BatchProcessDto from '@orchesty/nodejs-sdk/dist/lib/Utils/BatchProcessDto';
import ResultCode from '@orchesty/nodejs-sdk/dist/lib/Utils/ResultCode';
import ShoptetPremiumApplication from '../ShoptetPremiumApplication';
import AShoptetList, { IPaging } from './AShoptetList';
export const NAME = 'shoptet-get-order-changes-list';
export default class ShoptetGetOrderChangesList extends AShoptetList<IResponseJson> {
public endpoint = 'api/orders/changes';
public lastRunKey = 'lastRunListOrderChanges';
public fromParamKey = 'from';
public getName(): string {
return NAME;
}
protected processResult(responseDto: ResponseDto<IResponseJson>, batchProcessDto: BatchProcessDto): IPaging {
const body = responseDto.getJsonBody().data;
if (body.changes.length) {
this.setItemsListToDto(batchProcessDto, body.changes);
} else E{
batchProcessDto.setStopProcess(ResultCode.DO_NOT_CONTINUE, 'No changes since last import.');
}
return body.paginator;
}
protected setItemsListToDto(dto: BatchProcessDto, responseBody: IOutputJson[]): void {
dto.setItemList(responseBody);
}
protected getDefaultLastRun(): string {
return ShoptetPremiumApplication.shoptetDateISO(new Date(), -1 * 30 * 24);
}
}
export interface IResponseJson {
data: {
changes: IOutputJson[];
paginator: IPaging;
};
}
export interface IOutputJson {
changeType: string;
changeTime: string;
code: string;
}
|