-
Notifications
You must be signed in to change notification settings - Fork 0
/
customer.ts
1253 lines (1251 loc) · 32.1 KB
/
customer.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
690
691
692
693
694
695
696
697
698
699
700
701
702
703
704
705
706
707
708
709
710
711
712
713
714
715
716
717
718
719
720
721
722
723
724
725
726
727
728
729
730
731
732
733
734
735
736
737
738
739
740
741
742
743
744
745
746
747
748
749
750
751
752
753
754
755
756
757
758
759
760
761
762
763
764
765
766
767
768
769
770
771
772
773
774
775
776
777
778
779
780
781
782
783
784
785
786
787
788
789
790
791
792
793
794
795
796
797
798
799
800
801
802
803
804
805
806
807
808
809
810
811
812
813
814
815
816
817
818
819
820
821
822
823
824
825
826
827
828
829
830
831
832
833
834
835
836
837
838
839
840
841
842
843
844
845
846
847
848
849
850
851
852
853
854
855
856
857
858
859
860
861
862
863
864
865
866
867
868
869
870
871
872
873
874
875
876
877
878
879
880
881
882
883
884
885
886
887
888
889
890
891
892
893
894
895
896
897
898
899
900
901
902
903
904
905
906
907
908
909
910
911
912
913
914
915
916
917
918
919
920
921
922
923
924
925
926
927
928
929
930
931
932
933
934
935
936
937
938
939
940
941
942
943
944
945
946
947
948
949
950
951
952
953
954
955
956
957
958
959
960
961
962
963
964
965
966
967
968
969
970
971
972
973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
990
991
992
993
994
995
996
997
998
999
1000
/**
* Code generated by [commercetools RMF-Codegen](https://github.com/commercetools/rmf-codegen). DO NOT EDIT.
* Please don't change this file manually but run `rmf-codegen generate raml_file_path -o output_path -t typescript_client` to update it.
* For more information about the commercetools platform APIs, visit https://docs.commercetools.com/.
*/
import { Cart, CartResourceIdentifier } from './cart.js'
import { Address, BaseAddress, BaseResource, CreatedBy, LastModifiedBy, _BaseAddress } from './common.js'
import { CustomerGroupReference, CustomerGroupResourceIdentifier } from './customer-group.js'
import { StoreKeyReference, StoreResourceIdentifier } from './store.js'
import { CustomFields, CustomFieldsDraft, FieldContainer, TypeResourceIdentifier } from './type.js'
export type AnonymousCartSignInMode = 'MergeWithExistingCustomerCart' | 'UseAsNewActiveCustomerCart' | string
export type AuthenticationMode = 'ExternalAuth' | 'Password' | string
/**
* If `stores` is not empty, the Customer is specific to those Stores.
*
*/
export interface Customer extends BaseResource {
/**
* Unique identifier of the Customer.
*
*
*/
readonly id: string
/**
* Current version of the Customer.
*
*
*/
readonly version: number
/**
* User-defined unique identifier of the Customer.
*
*
*/
readonly key?: string
/**
* User-defined unique identifier of the Customer.
*
* Can be used to refer to a Customer in a human-readable way (in emails, invoices, and other correspondence).
*
*
*/
readonly customerNumber?: string
/**
* Optional identifier for use in external systems like Customer Relationship Management (CRM) or Enterprise Resource Planning (ERP).
*
*
*/
readonly externalId?: string
/**
* Date and time (UTC) the Customer was initially created.
*
*
*/
readonly createdAt: string
/**
* Date and time (UTC) the Customer was last updated.
*
*
*/
readonly lastModifiedAt: string
/**
* Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked).
*
*
*/
readonly lastModifiedBy?: LastModifiedBy
/**
* Present on resources created after 1 February 2019 except for [events not tracked](/../api/client-logging#events-tracked).
*
*
*/
readonly createdBy?: CreatedBy
/**
* Email address of the Customer that is [unique](/../api/customers-overview#customer-uniqueness) for an entire Project or to a Store the Customer is assigned to.
* It is the mandatory unique identifier of a Customer.
*
*
*/
readonly email: string
/**
* Present only when `authenticationMode` is set to `Password`.
*
*
*/
readonly password?: string
/**
* Given name (first name) of the Customer.
*
*
*/
readonly firstName?: string
/**
* Family name (last name) of the Customer.
*
*
*/
readonly lastName?: string
/**
* Middle name of the Customer.
*
*
*/
readonly middleName?: string
/**
* Title of the Customer, for example, 'Dr.'.
*
*
*/
readonly title?: string
/**
* Date of birth of the Customer.
*
*
*/
readonly dateOfBirth?: string
/**
* Company name of the Customer.
*
*
*/
readonly companyName?: string
/**
* Unique VAT ID of the Customer.
*
*
*/
readonly vatId?: string
/**
* Addresses used by the Customer.
*
*
*/
readonly addresses: Address[]
/**
* ID of the address in `addresses` used as the default shipping address.
*
*
*/
readonly defaultShippingAddressId?: string
/**
* IDs of addresses in `addresses` used as shipping addresses.
*
*
*/
readonly shippingAddressIds?: string[]
/**
* ID of the address in `addresses` used as the default billing address.
*
*
*/
readonly defaultBillingAddressId?: string
/**
* IDs of addresses in `addresses` used as billing addresses.
*
*
*/
readonly billingAddressIds?: string[]
/**
* Indicates whether the email address of the Customer is [verified](#email-verification-of-customer).
*
*
*/
readonly isEmailVerified: boolean
/**
* [CustomerGroup](ctp:api:type:CustomerGroup) to which the Customer belongs.
*
*
*/
readonly customerGroup?: CustomerGroupReference
/**
* Custom Fields for the Customer.
*
*
*/
readonly custom?: CustomFields
/**
* Preferred language of the Customer.
*
*
*/
readonly locale?: string
/**
* Salutation of the Customer, for example, 'Mr.' or 'Mrs.'.
*
*
*/
readonly salutation?: string
/**
* [Stores](ctp:api:type:Store) to which the Customer is assigned to.
*
* - If no Stores are specified, the Customer is a global customer, and can log in using the [Password Flow for global Customers](/../api/authorization#password-flow-for-global-customers).
* - If any Stores are specified, the Customer can only log in using the [Password Flow for Customers in a Store](/../api/authorization#password-flow-for-customers-in-a-store) for those specific Stores.
*
*
*/
readonly stores?: StoreKeyReference[]
/**
* Indicates whether the `password` is required for the Customer.
*
*
*/
readonly authenticationMode: AuthenticationMode
}
export interface CustomerChangePassword {
/**
* Unique identifier of the Customer.
*
*
*/
readonly id: string
/**
* Expected version of the Customer on which the changes should be applied.
*
*
*/
readonly version: number
/**
* Current password of the Customer.
*
* If the current password does not match, an [InvalidCurrentPassword](ctp:api:type:InvalidCurrentPasswordError) error is returned.
*
*
*/
readonly currentPassword: string
/**
* New password to be set.
*
*
*/
readonly newPassword: string
}
export interface CustomerCreateEmailToken {
/**
* Unique identifier of the Customer.
*
*/
readonly id: string
/**
* Expected version of the Customer.
*
*/
readonly version?: number
/**
* Validity period of the generated token in minutes.
*
*/
readonly ttlMinutes: number
}
export interface CustomerCreatePasswordResetToken {
/**
* Email address of the Customer treated as [case-insensitive](/../api/customers-overview#email-case-insensitivity).
*
*
*/
readonly email: string
/**
* Validity period of the generated token in minutes.
*
*
*/
readonly ttlMinutes?: number
}
export interface CustomerDraft {
/**
* User-defined unique identifier for the Customer.
* The `key` field is preferred over `customerNumber` as it is mutable and provides more flexibility.
*
*
*/
readonly key?: string
/**
* User-defined unique identifier for a Customer.
* Once set, it cannot be changed.
*
* Can be used to refer to a Customer in a human-readable way (in emails, invoices, and other correspondence).
*
*
*/
readonly customerNumber?: string
/**
* Optional identifier for use in external systems like Customer Relationship Management (CRM) or Enterprise Resource Planning (ERP).
*
*
*/
readonly externalId?: string
/**
* Email address of the Customer that must be [unique](/../api/customers-overview#customer-uniqueness) for an entire Project or to a Store the Customer is assigned to.
* It is the mandatory unique identifier of a Customer.
*
*
*/
readonly email: string
/**
* Required when `authenticationMode` is set to `Password`.
* Provide the Customer's password in plain text. The API stores passwords in an encrypted format.
*
*
*/
readonly password?: string
/**
* Given name (first name) of the Customer.
*
*
*/
readonly firstName?: string
/**
* Family name (last name) of the Customer.
*
*
*/
readonly lastName?: string
/**
* Middle name of the Customer.
*
*
*/
readonly middleName?: string
/**
* Title of the Customer, for example, 'Dr.'.
*
*
*/
readonly title?: string
/**
* Deprecated since an anonymous [Cart](ctp:api:type:Cart) can be identified by its `id` or external `key`.
*
* @deprecated
*/
readonly anonymousCartId?: string
/**
* Identifies a [Cart](ctp:api:type:Cart) that will be assigned to the new Customer.
*
*
*/
readonly anonymousCart?: CartResourceIdentifier
/**
* Identifies Carts and Orders belonging to an anonymous session that will be assigned to the new Customer.
*
*
*/
readonly anonymousId?: string
/**
* Date of birth of the Customer.
*
*
*/
readonly dateOfBirth?: string
/**
* Company name of the Customer. When representing a company as a Customer, [Business Units](ctp:api:type:BusinessUnit) provide extended funtionality.
*
*
*/
readonly companyName?: string
/**
* Unique VAT ID of the Customer.
*
*
*/
readonly vatId?: string
/**
* Addresses of the Customer.
*
*
*/
readonly addresses?: BaseAddress[]
/**
* Index of the address in the `addresses` array to use as the default shipping address.
* The `defaultShippingAddressId` of the Customer will be set to the `id` of that address.
*
*
*/
readonly defaultShippingAddress?: number
/**
* Indices of the shipping addresses in the `addresses` array.
* The `shippingAddressIds` of the Customer will be set to the IDs of these addresses.
*
*
*/
readonly shippingAddresses?: number[]
/**
* Index of the address in the `addresses` array to use as the default billing address.
* The `defaultBillingAddressId` of the Customer will be set to the `id` of that address.
*
*
*/
readonly defaultBillingAddress?: number
/**
* Indices of the billing addresses in the `addresses` array.
* The `billingAddressIds` of the Customer will be set to the IDs of these addresses.
*
*
*/
readonly billingAddresses?: number[]
/**
* Set to `true` if the email address of the Customer has been verified already.
* The intended use is to leave this field unset upon sign-up of the Customer and initiate the [email verification](#email-verification-of-customer) afterwards.
*
*
*/
readonly isEmailVerified?: boolean
/**
* Sets the [CustomerGroup](ctp:api:type:CustomerGroup) for the Customer.
*
*
*/
readonly customerGroup?: CustomerGroupResourceIdentifier
/**
* Custom Fields for the Customer.
*
*
*/
readonly custom?: CustomFieldsDraft
/**
* Preferred language of the Customer.
* Must be one of the languages supported by the [Project](ctp:api:type:Project).
*
*
*/
readonly locale?: string
/**
* Salutation of the Customer, for example, 'Mr.' or 'Mrs.'.
*
*
*/
readonly salutation?: string
/**
* Sets the [Stores](ctp:api:type:Store) for the Customer.
*
* - If no Stores are specified, the Customer is a global customer, and can log in using the [Password Flow for global Customers](/../api/authorization#password-flow-for-global-customers).
* - If any Stores are specified, the Customer can only log in using the [Password Flow for Customers in a Store](/../api/authorization#password-flow-for-customers-in-a-store) for those specific Stores.
*
*
*/
readonly stores?: StoreResourceIdentifier[]
/**
* - Set to `Password` to make the `password` field required for the Customer.
* - Set to `ExternalAuth` when the password is not required for the Customer.
*
*
*/
readonly authenticationMode?: AuthenticationMode
}
export interface CustomerEmailVerify {
/**
* Expected version of the Customer.
*
*
*/
readonly version?: number
/**
* Value of the token to verify Customer email.
*
*
*/
readonly tokenValue: string
}
/**
* [PagedQueryResult](/../api/general-concepts#pagedqueryresult) with results containing an array of [Customer](ctp:api:type:Customer).
*
*/
export interface CustomerPagedQueryResponse {
/**
* Number of [results requested](/../api/general-concepts#limit).
*
*
*/
readonly limit: number
/**
* Number of [elements skipped](/../api/general-concepts#offset).
*
*
*/
readonly offset: number
/**
* Actual number of results returned.
*
*
*/
readonly count: number
/**
* Total number of results matching the query.
* This number is an estimation that is not [strongly consistent](/../api/general-concepts#strong-consistency).
* This field is returned by default.
* For improved performance, calculating this field can be deactivated by using the query parameter `withTotal=false`.
* When the results are filtered with a [Query Predicate](/../api/predicates/query), `total` is subject to a [limit](/../api/limits#queries).
*
*
*/
readonly total?: number
/**
* [Customers](ctp:api:type:Customer) matching the query.
*
*
*/
readonly results: Customer[]
}
/**
* [Reference](ctp:api:type:Reference) to a [Customer](ctp:api:type:Customer).
*
*/
export interface CustomerReference {
readonly typeId: 'customer'
/**
* Unique identifier of the referenced [Customer](ctp:api:type:Customer).
*
*
*/
readonly id: string
/**
* Contains the representation of the expanded Customer. Only present in responses to requests with [Reference Expansion](ctp:api:type:Expansion) for Customers.
*
*
*/
readonly obj?: Customer
}
export interface CustomerResetPassword {
/**
* Value of the token to reset the Customer password.
*
*
*/
readonly tokenValue: string
/**
* New password to be set.
*
*
*/
readonly newPassword: string
/**
* Expected version of the Customer.
*
*
*/
readonly version?: number
}
/**
* [ResourceIdentifier](ctp:api:type:ResourceIdentifier) to a [Customer](ctp:api:type:Customer). Either `id` or `key` is required.
*
*/
export interface CustomerResourceIdentifier {
readonly typeId: 'customer'
/**
* Unique identifier of the referenced [Customer](ctp:api:type:Customer).
*
*
*/
readonly id?: string
/**
* User-defined unique identifier of the referenced [Customer](ctp:api:type:Customer).
*
*
*/
readonly key?: string
}
export interface CustomerSignInResult {
/**
* Customer [signed up](ctp:api:endpoint:/{projectKey}/customers:POST) or [signed in](ctp:api:endpoint:/{projectKey}/login:POST) after authentication.
*
*
*/
readonly customer: Customer
/**
* Cart associated with the Customer.
* If empty, the Customer does not have a Cart assigned.
*
*
*/
readonly cart?: Cart
}
export interface CustomerSignin {
/**
* Email address of the Customer treated as [case-insensitive](/../api/customers-overview#email-case-insensitivity).
*
*
*/
readonly email: string
/**
* Password of the Customer.
*
*
*/
readonly password: string
/**
* Deprecated since it is now possible to identify an anonymous cart by using its `id` or external `key`.
*
* @deprecated
*/
readonly anonymousCartId?: string
/**
* Identifies a [Cart](ctp:api:type:Cart) that will be assigned to the Customer.
*
*
*/
readonly anonymousCart?: CartResourceIdentifier
/**
* - Set to `MergeWithExistingCustomerCart` if [LineItems](ctp:api:type:LineItem) of the anonymous Cart should be merged with the active Customer Cart that has been modified most recently.
* - Set to `UseAsNewActiveCustomerCart` if the anonymous Cart should be used as the new active Customer Cart and no [LineItems](ctp:api:type:LineItem) are to be merged.
*
*
*/
readonly anonymousCartSignInMode?: AnonymousCartSignInMode
/**
* If both `anonymousCart` and `anonymousId` are provided, the `anonymousId` on the CustomerSignin must match that of the anonymous [Cart](ctp:api:type:Cart).
* Otherwise a [400 Bad Request](ctp:api:type:InvalidOperationError) `Invalid Operation` error is returned with the message:
* "Cart with the ID cart-id does not have the expected anonymousId.".
*
*
*/
readonly anonymousId?: string
/**
* - If `true`, the [LineItem](ctp:api:type:LineItem) Product data (`name`, `variant`, and `productType`) of the returned Cart will be updated.
* - If `false`, only the prices, discounts, and tax rates will be updated.
*
*
*/
readonly updateProductData?: boolean
}
export interface CustomerToken {
/**
* Unique identifier of the token.
*
*
*/
readonly id: string
/**
* Date and time (UTC) the token was initially created.
*
*
*/
readonly createdAt: string
/**
* When the token is created, `lastModifiedAt` is set to `createdAt`.
*
*
*/
readonly lastModifiedAt?: string
/**
* The `id` of the Customer.
*
*
*/
readonly customerId: string
/**
* Date and time (UTC) the token expires.
*
*
*/
readonly expiresAt: string
/**
* Value of the token.
*
*
*/
readonly value: string
}
export interface CustomerUpdate {
/**
* Expected version of the Customer on which the changes should be applied. If the expected version does not match the actual version, a [409 Conflict](/../api/errors#409-conflict) error will be returned.
*
*
*/
readonly version: number
/**
* Update actions to be performed on the Customer.
*
*
*/
readonly actions: CustomerUpdateAction[]
}
export type CustomerUpdateAction =
| CustomerAddAddressAction
| CustomerAddBillingAddressIdAction
| CustomerAddShippingAddressIdAction
| CustomerAddStoreAction
| CustomerChangeAddressAction
| CustomerChangeEmailAction
| CustomerRemoveAddressAction
| CustomerRemoveBillingAddressIdAction
| CustomerRemoveShippingAddressIdAction
| CustomerRemoveStoreAction
| CustomerSetAddressCustomFieldAction
| CustomerSetAddressCustomTypeAction
| CustomerSetAuthenticationModeAction
| CustomerSetCompanyNameAction
| CustomerSetCustomFieldAction
| CustomerSetCustomTypeAction
| CustomerSetCustomerGroupAction
| CustomerSetCustomerNumberAction
| CustomerSetDateOfBirthAction
| CustomerSetDefaultBillingAddressAction
| CustomerSetDefaultShippingAddressAction
| CustomerSetExternalIdAction
| CustomerSetFirstNameAction
| CustomerSetKeyAction
| CustomerSetLastNameAction
| CustomerSetLocaleAction
| CustomerSetMiddleNameAction
| CustomerSetSalutationAction
| CustomerSetStoresAction
| CustomerSetTitleAction
| CustomerSetVatIdAction
export interface MyCustomerChangePassword {
/**
* Expected version of the Customer on which the changes should be applied.
*
*
*/
readonly version: number
/**
* Current password of the Customer.
*
* If the current password does not match, an [InvalidCurrentPassword](ctp:api:type:InvalidCurrentPasswordError) error is returned.
*
*
*/
readonly currentPassword: string
/**
* New password to be set.
*
*
*/
readonly newPassword: string
}
export interface MyCustomerEmailVerify {
/**
* Value of the token to verify Customer email.
*
*
*/
readonly tokenValue: string
}
export interface MyCustomerResetPassword {
/**
* Value of the token to reset the Customer password.
*
*
*/
readonly tokenValue: string
/**
* New password to be set.
*
*
*/
readonly newPassword: string
}
export interface MyCustomerSignin {
/**
* Email address of the Customer treated as [case-insensitive](/../api/customers-overview#email-case-insensitivity).
*
*
*/
readonly email: string
/**
* Password of the Customer.
*
*
*/
readonly password: string
/**
* - If `MergeWithExistingCustomerCart`, [LineItems](ctp:api:type:LineItem) of the anonymous Cart are merged with the recently modified active Customer Cart.
* - If `UseAsNewActiveCustomerCart`, the anonymous Cart is used as the new active Customer Cart, and no [LineItems](ctp:api:type:LineItem) are merged.
*
*
*/
readonly activeCartSignInMode?: AnonymousCartSignInMode
/**
* - If `true`, the [LineItem](ctp:api:type:LineItem) Product data (`name`, `variant`, and `productType`) of the returned Cart is updated.
* - If `false`, only the prices, discounts, and tax rates are updated.
*
*
*/
readonly updateProductData?: boolean
}
/**
* Adding an address to the Customer produces the [CustomerAddressAdded](ctp:api:type:CustomerAddressAddedMessage) Message.
*
*/
export interface CustomerAddAddressAction {
readonly action: 'addAddress'
/**
* Value to append to the `addresses` array.
*
*
*/
readonly address: _BaseAddress
}
/**
* Adds an Address from the `addresses` array to `billingAddressIds`. Either `addressId` or `addressKey` is required.
*
*/
export interface CustomerAddBillingAddressIdAction {
readonly action: 'addBillingAddressId'
/**
* `id` of the [Address](ctp:api:type:Address) to become a billing address.
*
*
*/
readonly addressId?: string
/**
* `key` of the [Address](ctp:api:type:Address) to become a billing address.
*
*
*/
readonly addressKey?: string
}
/**
* Adds an Address from the `addresses` array to `shippingAddressIds`. Either `addressId` or `addressKey` is required.
*
*/
export interface CustomerAddShippingAddressIdAction {
readonly action: 'addShippingAddressId'
/**
* `id` of the [Address](ctp:api:type:Address) to become a shipping address.
*
*
*/
readonly addressId?: string
/**
* `key` of the [Address](ctp:api:type:Address) to become a shipping address.
*
*
*/
readonly addressKey?: string
}
/**
* Associates the Customer with a Store.
*
*/
export interface CustomerAddStoreAction {
readonly action: 'addStore'
/**
* ResourceIdentifier of the Store to add.
*
*
*/
readonly store: StoreResourceIdentifier
}
/**
* Changing an address of the Customer produces the [CustomerAddressChanged](ctp:api:type:CustomerAddressChangedMessage) Message.
*
* Either `addressId` or `addressKey` is required.
*
*/
export interface CustomerChangeAddressAction {
readonly action: 'changeAddress'
/**
* `id` of the [Address](ctp:api:type:Address) to change.
*
*
*/
readonly addressId?: string
/**
* `key` of the [Address](ctp:api:type:Address) to change.
*
*
*/
readonly addressKey?: string
/**
* Value to set.
*
*
*/
readonly address: _BaseAddress
}
/**
* Changing the email of the Customer produces the [CustomerEmailChanged](ctp:api:type:CustomerEmailChangedMessage) Message.
*
*/
export interface CustomerChangeEmailAction {
readonly action: 'changeEmail'
/**
* Value to set.
*
*
*/
readonly email: string
}
/**
* Removing an address from the Customer produces the [CustomerAddressRemoved](ctp:api:type:CustomerAddressRemovedMessage) Message.
*
* Either `addressId` or `addressKey` is required.
*
*/
export interface CustomerRemoveAddressAction {
readonly action: 'removeAddress'
/**
* `id` of the [Address](ctp:api:type:Address) to remove.
*
*
*/
readonly addressId?: string
/**
* `key` of the [Address](ctp:api:type:Address) to remove.
*
*
*/
readonly addressKey?: string
}
/**
* Removes a billing address from `billingAddressesIds`.
* If the billing address is the default billing address, the `defaultBillingAddressId` is unset. Either `addressId` or `addressKey` is required.
*
*/
export interface CustomerRemoveBillingAddressIdAction {
readonly action: 'removeBillingAddressId'
/**
* `id` of the [Address](ctp:api:type:Address) to remove from `billingAddressesIds`.
*
*
*/
readonly addressId?: string
/**
* `key` of the [Address](ctp:api:type:Address) to remove from `billingAddressesIds`.
*
*
*/
readonly addressKey?: string
}
/**
* Removes a shipping address from `shippingAddressesIds`.
* If the shipping address is the default shipping address, the `defaultShippingAddressId` is unset. Either `addressId` or `addressKey` is required.
*
*/
export interface CustomerRemoveShippingAddressIdAction {
readonly action: 'removeShippingAddressId'
/**
* `id` of the [Address](ctp:api:type:Address) to remove from `shippingAddressesIds`.
*
*
*/
readonly addressId?: string
/**
* `key` of the [Address](ctp:api:type:Address) to remove from `shippingAddressesIds`.
*
*
*/
readonly addressKey?: string
}
/**
* Removes the association to a Store from the Customer.
* If no more Stores are assigned, the Customer becomes a [global Customer](/../api/customers-overview#global-versus-store-specific-customers).
*
*/
export interface CustomerRemoveStoreAction {
readonly action: 'removeStore'
/**
* ResourceIdentifier of the Store to remove.
*
*
*/
readonly store: StoreResourceIdentifier
}
export interface CustomerSetAddressCustomFieldAction {
readonly action: 'setAddressCustomField'
/**
* User-defined unique identifier of the [Address](ctp:api:type:Address) to be updated.
*
*
*/
readonly addressId: string
/**
* Name of the [Custom Field](/../api/projects/custom-fields).
*
*
*/
readonly name: string
/**
* If `value` is absent or `null`, this field will be removed if it exists.
* If `value` is provided, it is set for the field defined by `name`.
* Trying to remove a field that does not exist will fail with an [InvalidOperation](ctp:api:type:InvalidOperationError) error.
*
*
*/
readonly value?: any
}
export interface CustomerSetAddressCustomTypeAction {
readonly action: 'setAddressCustomType'
/**
* User-defined unique identifier of the [Address](ctp:api:type:Address) to be updated.
*
*
*/
readonly addressId: string
/**
* Defines the [Type](ctp:api:type:Type) that extends the `address` with [Custom Fields](/../api/projects/custom-fields).
* If absent, any existing Type and Custom Fields are removed from the `address`.
*
*
*/
readonly type?: TypeResourceIdentifier
/**
* Sets the [Custom Fields](/../api/projects/custom-fields) fields for the `address`.
*
*
*/
readonly fields?: FieldContainer
}