Skip to content

Commit

Permalink
fix(find): filter fulfillmentProducts for start and dest zones
Browse files Browse the repository at this point in the history
  • Loading branch information
Gerald Baulig committed Oct 23, 2024
1 parent 4301dde commit 0ad6c4e
Show file tree
Hide file tree
Showing 5 changed files with 238 additions and 136 deletions.
11 changes: 8 additions & 3 deletions cfg/config.json
Original file line number Diff line number Diff line change
Expand Up @@ -340,9 +340,14 @@
]
}
},
"preDefinedIds": {
"legalAddressTypeId": "legal",
"shippingAddressTypeId": "shipping"
"tech_user": {
"id": "root_tech_user",
"token": "1a4c6789-6435-487a-9308-64d06384acf9"
},
"contact_point_type_ids": {
"legal": "legal",
"shipping": "shipping",
"billing": "billing"
},
"stubs": {
"DHLSoap": {
Expand Down
15 changes: 11 additions & 4 deletions src/services/fulfillment.ts
Original file line number Diff line number Diff line change
Expand Up @@ -173,7 +173,6 @@ export class FulfillmentService
};

protected readonly emitters: any;
protected readonly legal_address_type_id: string;
protected readonly customer_service: Client<CustomerServiceDefinition>;
protected readonly shop_service: Client<ShopServiceDefinition>;
protected readonly organization_service: Client<OrganizationServiceDefinition>;
Expand All @@ -182,6 +181,11 @@ export class FulfillmentService
protected readonly country_service: Client<CountryServiceDefinition>;
protected readonly tax_service: Client<TaxServiceDefinition>;
protected readonly credential_service: Client<CredentialServiceDefinition>;
protected readonly contact_point_type_ids = {
legal: 'legal',
shipping: 'shipping',
billing: 'billing',
};

constructor(
readonly fulfillmentCourierSrv: FulfillmentCourierService,
Expand Down Expand Up @@ -217,7 +221,10 @@ export class FulfillmentService
};

this.emitters = cfg.get('events:emitters');
this.legal_address_type_id = this.cfg.get('preDefinedIds:legalAddressTypeId');
this.contact_point_type_ids = {
...this.contact_point_type_ids,
...cfg.get('contactPointTypeIds')
};

this.customer_service = createClient(
{
Expand Down Expand Up @@ -690,7 +697,7 @@ export class FulfillmentService
).then(
cpts => cpts.find(
cpt => cpt.payload?.contact_point_type_ids.includes(
this.legal_address_type_id
this.contact_point_type_ids.legal
)
) ?? throwStatusCode<ContactPointResponse>(
typeof (item),
Expand Down Expand Up @@ -728,7 +735,7 @@ export class FulfillmentService
).then(
cps => cps.find(
cp => cp.payload?.contact_point_type_ids.includes(
this.legal_address_type_id
this.contact_point_type_ids.legal
)
) ?? throwStatusCode<ContactPointResponse>(
typeof (item),
Expand Down
Loading

0 comments on commit 0ad6c4e

Please sign in to comment.