@labdigital/commercetools-mock 2.26.0 → 2.26.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/index.cjs +11 -0
- package/dist/index.cjs.map +1 -1
- package/dist/index.js +11 -0
- package/dist/index.js.map +1 -1
- package/package.json +1 -1
- package/src/repositories/customer/actions.ts +18 -1
package/package.json
CHANGED
|
@@ -5,6 +5,7 @@ import type {
|
|
|
5
5
|
CustomerSetAuthenticationModeAction,
|
|
6
6
|
CustomerSetCompanyNameAction,
|
|
7
7
|
CustomerSetCustomFieldAction,
|
|
8
|
+
CustomerSetCustomTypeAction,
|
|
8
9
|
CustomerSetCustomerNumberAction,
|
|
9
10
|
CustomerSetExternalIdAction,
|
|
10
11
|
CustomerSetFirstNameAction,
|
|
@@ -25,7 +26,7 @@ import {
|
|
|
25
26
|
UpdateHandlerInterface,
|
|
26
27
|
type RepositoryContext,
|
|
27
28
|
} from "../abstract";
|
|
28
|
-
import { createAddress } from "../helpers";
|
|
29
|
+
import { createAddress, createCustomFields } from "../helpers";
|
|
29
30
|
|
|
30
31
|
export class CustomerUpdateHandler
|
|
31
32
|
extends AbstractUpdateHandler
|
|
@@ -143,6 +144,22 @@ export class CustomerUpdateHandler
|
|
|
143
144
|
resource.custom.fields[name] = value;
|
|
144
145
|
}
|
|
145
146
|
|
|
147
|
+
setCustomType(
|
|
148
|
+
context: RepositoryContext,
|
|
149
|
+
resource: Writable<Customer>,
|
|
150
|
+
{ type, fields }: CustomerSetCustomTypeAction,
|
|
151
|
+
) {
|
|
152
|
+
if (type) {
|
|
153
|
+
resource.custom = createCustomFields(
|
|
154
|
+
{ type, fields },
|
|
155
|
+
context.projectKey,
|
|
156
|
+
this._storage,
|
|
157
|
+
);
|
|
158
|
+
} else {
|
|
159
|
+
resource.custom = undefined;
|
|
160
|
+
}
|
|
161
|
+
}
|
|
162
|
+
|
|
146
163
|
setExternalId(
|
|
147
164
|
_context: RepositoryContext,
|
|
148
165
|
resource: Writable<Customer>,
|