Skip to content

Commit

Permalink
fix(setting): preserve setting keys consistency
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerald Baulig committed Jan 9, 2025
1 parent 0a10f84 commit 9973af0
Show file tree
Hide file tree
Showing 5 changed files with 6 additions and 7 deletions.
2 changes: 1 addition & 1 deletion cfg/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -367,7 +367,7 @@
"shop_invoice_create_enabled": true,
"shop_invoice_render_enabled": true,
"shop_invoice_send_enabled": true,
"shop_order_error_cleanup": true
"shop_order_error_cleanup_enabled": true
}
}
}
2 changes: 1 addition & 1 deletion src/service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -2042,7 +2042,7 @@ export class OrderingService
this.logger?.debug('Cleanup failed orders...');
const failed_order_ids = Object.values(response_map)?.filter(
order => order.status?.code !== 200
&& settings.get(order.status?.id)?.shop_order_error_cleanup
&& settings.get(order.status?.id)?.shop_order_error_cleanup_enabled
).map(
order => order.payload?.id ?? order.status?.id
) ?? [];
Expand Down
4 changes: 2 additions & 2 deletions src/utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -137,7 +137,7 @@ export const DefaultUrns = {
shop_invoice_create_enabled: 'urn:restorecommerce:shop:setting:order:submit:invoice:create:enabled', // Creates invoice on order submit if enabled (default: true)
shop_invoice_render_enabled: 'urn:restorecommerce:shop:setting:order:submit:invoice:render:enabled', // Renders invoice on order submit if enabled, overrides create! (default: true)
shop_invoice_send_enabled: 'urn:restorecommerce:shop:setting:order:submit:invoice:send:enabled', // Sends invoice on order submit if enabled, overrides render! (default: true)
shop_order_error_cleanup: 'urn:restorecommerce:shop:setting:order:error:cleanup:enabled', // Clean up orders on any error of fulfillment or invoice (default: false)
shop_order_error_cleanup_enabled: 'urn:restorecommerce:shop:setting:order:error:cleanup:enabled', // Clean up orders on any error of fulfillment or invoice (default: false)
};
export type KnownUrns = typeof DefaultUrns;

Expand All @@ -146,7 +146,7 @@ export const DefaultSetting = {
shop_invoice_create_enabled: true,
shop_invoice_render_enabled: true,
shop_invoice_send_enabled: true,
shop_order_error_cleanup: true,
shop_order_error_cleanup_enabled: true,
}
export type ResolvedSetting = typeof DefaultSetting;
export type ResolvedSettingMap = Map<string, ResolvedSetting>;
Expand Down
3 changes: 1 addition & 2 deletions src/worker.ts
Original file line number Diff line number Diff line change
Expand Up @@ -43,8 +43,7 @@ registerProtoMeta(
);

export type Handler = (msg: any, context: any, config: any, eventName: string) => any;
export type HandlerMap = { [key: string]: Handler };

export type HandlerMap = Record<string, Handler>;
export class Worker {
private _cfg?: ServiceConfig;
private _offsetStore?: OffsetStore;
Expand Down
2 changes: 1 addition & 1 deletion test/ordering-srv.spec.ts
Original file line number Diff line number Diff line change
Expand Up @@ -104,7 +104,7 @@ describe('The Ordering Service:', () => {
worker?.stop(),
])
).finally(
() => mocking?.forEach(mock => mock?.stop())
() => Promise.allSettled(mocking?.map(mock => mock?.stop()))
);
});

Expand Down

0 comments on commit 9973af0

Please sign in to comment.