|
@@ -10,6 +10,7 @@ import {
|
|
|
} from '../../../../shared/generated-types';
|
|
} from '../../../../shared/generated-types';
|
|
|
import { omit } from '../../../../shared/omit';
|
|
import { omit } from '../../../../shared/omit';
|
|
|
import { ID, PaginatedList } from '../../../../shared/shared-types';
|
|
import { ID, PaginatedList } from '../../../../shared/shared-types';
|
|
|
|
|
+import { configurableDefToOperation } from '../../common/configurable-operation';
|
|
|
import { EntityNotFoundError, UserInputError } from '../../common/error/errors';
|
|
import { EntityNotFoundError, UserInputError } from '../../common/error/errors';
|
|
|
import { ListQueryOptions } from '../../common/types/common-types';
|
|
import { ListQueryOptions } from '../../common/types/common-types';
|
|
|
import { assertFound } from '../../common/utils';
|
|
import { assertFound } from '../../common/utils';
|
|
@@ -97,25 +98,17 @@ export class ShippingMethodService {
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getShippingEligibilityCheckers(): ConfigurableOperation[] {
|
|
getShippingEligibilityCheckers(): ConfigurableOperation[] {
|
|
|
- return this.shippingEligibilityCheckers.map(this.toAdjustmentOperation);
|
|
|
|
|
|
|
+ return this.shippingEligibilityCheckers.map(configurableDefToOperation);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getShippingCalculators(): ConfigurableOperation[] {
|
|
getShippingCalculators(): ConfigurableOperation[] {
|
|
|
- return this.shippingCalculators.map(this.toAdjustmentOperation);
|
|
|
|
|
|
|
+ return this.shippingCalculators.map(configurableDefToOperation);
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
getActiveShippingMethods(channel: Channel): ShippingMethod[] {
|
|
getActiveShippingMethods(channel: Channel): ShippingMethod[] {
|
|
|
return this.activeShippingMethods.filter(sm => sm.channels.find(c => c.id === channel.id));
|
|
return this.activeShippingMethods.filter(sm => sm.channels.find(c => c.id === channel.id));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- private toAdjustmentOperation(source: ShippingCalculator | ShippingEligibilityChecker) {
|
|
|
|
|
- return {
|
|
|
|
|
- code: source.code,
|
|
|
|
|
- description: source.description,
|
|
|
|
|
- args: Object.entries(source.args).map(([name, type]) => ({ name, type })),
|
|
|
|
|
- };
|
|
|
|
|
- }
|
|
|
|
|
-
|
|
|
|
|
/**
|
|
/**
|
|
|
* Converts the input values of the "create" and "update" mutations into the format expected by the ShippingMethod entity.
|
|
* Converts the input values of the "create" and "update" mutations into the format expected by the ShippingMethod entity.
|
|
|
*/
|
|
*/
|