Skip to content

Commit

Permalink
Merge branch 'main' of github.com:labd/commercetools-node-mock into f…
Browse files Browse the repository at this point in the history
…eat/add-product-search
  • Loading branch information
borisvankatwijk committed Aug 26, 2024
2 parents 77e09b5 + a4a76cc commit 5f4f55f
Show file tree
Hide file tree
Showing 3 changed files with 41 additions and 1 deletion.
6 changes: 6 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,11 @@
## 2.23.1

## 2.29.1

### Patch Changes

- [#207](https://github.com/labd/commercetools-node-mock/pull/207) [`28bca80`](https://github.com/labd/commercetools-node-mock/commit/28bca80473015efaae94e918f4c998f6ddd06629) Thanks [@demeyerthom](https://github.com/demeyerthom)! - Added additional options to project settings

## 2.29.0

### Minor Changes
Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "@labdigital/commercetools-mock",
"version": "2.29.0",
"version": "2.29.1",
"license": "MIT",
"author": "Michael van Tellingen",
"type": "module",
Expand Down
34 changes: 34 additions & 0 deletions src/repositories/project.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import type {
Project,
ProjectChangeBusinessUnitStatusOnCreationAction,
ProjectChangeCartsConfigurationAction,
ProjectChangeCountriesAction,
ProjectChangeCountryTaxRateFallbackEnabledAction,
Expand All @@ -13,6 +14,7 @@ import type {
ProjectSetShippingRateInputTypeAction,
ProjectUpdateAction,
} from "@commercetools/platform-sdk";
import { ProjectSetBusinessUnitAssociateRoleOnCreationAction } from "@commercetools/platform-sdk/dist/declarations/src/generated/models/project";
import { maskSecretValue } from "../lib/masking";
import { AbstractStorage } from "../storage/abstract";
import type { Writable } from "../types";
Expand Down Expand Up @@ -111,6 +113,20 @@ class ProjectUpdateHandler
messagesConfiguration.deleteDaysAfterCreation;
}

changeMyBusinessUnitStatusOnCreation(
context: RepositoryContext,
resource: Writable<Project>,
{ status }: ProjectChangeBusinessUnitStatusOnCreationAction,
) {
if (resource.businessUnits === undefined) {
resource.businessUnits = {
myBusinessUnitStatusOnCreation: "Inactive",
};
}

resource.businessUnits.myBusinessUnitStatusOnCreation = status;
}

changeName(
context: RepositoryContext,
resource: Writable<Project>,
Expand Down Expand Up @@ -153,6 +169,24 @@ class ProjectUpdateHandler
resource.externalOAuth = externalOAuth;
}

setMyBusinessUnitAssociateRoleOnCreation(
context: RepositoryContext,
resource: Writable<Project>,
{ associateRole }: ProjectSetBusinessUnitAssociateRoleOnCreationAction,
) {
if (resource.businessUnits === undefined) {
resource.businessUnits = {
//Default status, so we set it here also
myBusinessUnitStatusOnCreation: "Inactive",
};
}

resource.businessUnits.myBusinessUnitAssociateRoleOnCreation = {
typeId: associateRole.typeId,
key: associateRole.key ?? "unknown",
};
}

setShippingRateInputType(
context: RepositoryContext,
resource: Writable<Project>,
Expand Down

0 comments on commit 5f4f55f

Please sign in to comment.