diff --git a/api-specs/api/resources/customers.raml b/api-specs/api/resources/customers.raml index eec264f90..f972f90b8 100644 --- a/api-specs/api/resources/customers.raml +++ b/api-specs/api/resources/customers.raml @@ -28,7 +28,8 @@ post: description: | If the `anonymousCart` field is set on the [CustomerDraft](ctp:api:type:CustomerDraft), then the newly created Customer will be assigned to that [Cart](ctp:api:type:Cart). Similarly, if the `anonymousId` field is set, the Customer will be set on all [Carts](ctp:api:type:Cart), [Orders](ctp:api:type:Order), [ShoppingLists](ctp:api:type:ShoppingList) and [Payments](ctp:api:type:Payment) with the same `anonymousId`. - Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message. + + Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message. Simultaneously creating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error. body: application/json: example: !include ../examples/customer-create.example.json @@ -170,6 +171,7 @@ post: description: Checks if a Customer exists for a given `key`. Returns a `200 OK` status if the Customer exists or a `404 Not Found` otherwise. post: securedBy: [oauth_2_0: { scopes: ['manage_customers:{projectKey}'] }] + description: Simultaneously updating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error. body: application/json: example: !include ../examples/customer-update.example.json @@ -208,6 +210,7 @@ post: description: Checks if a Customer exists for a given `id`. Returns a `200 OK` status if the Customer exists or a `404 Not Found` otherwise. post: securedBy: [oauth_2_0: { scopes: ['manage_customers:{projectKey}'] }] + description: Simultaneously updating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error. body: application/json: example: !include ../examples/customer-update.example.json diff --git a/api-specs/api/resources/in-store.raml b/api-specs/api/resources/in-store.raml index d010a6174..bee79c785 100644 --- a/api-specs/api/resources/in-store.raml +++ b/api-specs/api/resources/in-store.raml @@ -1458,7 +1458,8 @@ uriParameters: If the `anonymousCart` field is set on the [CustomerDraft](ctp:api:type:CustomerDraft), then the newly created Customer will be assigned to that [Cart](ctp:api:type:Cart). Similarly, if the `anonymousId` field is set, the Customer will be set on all [Carts](ctp:api:type:Cart), [Orders](ctp:api:type:Order), [ShoppingLists](ctp:api:type:ShoppingList) and [Payments](ctp:api:type:Payment) with the same `anonymousId`. If a Cart with a `store` field specified, the `store` field must reference the same [Store](ctp:api:type:Store) specified in the `{storeKey}` path parameter. - Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message. + + Creating a Customer produces the [CustomerCreated](ctp:api:type:CustomerCreatedMessage) Message. Simultaneously creating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error. body: application/json: example: !include ../examples/customer-create.example.json @@ -1651,6 +1652,8 @@ uriParameters: displayName: Update customer by key in store description: | If the Customer exists in the Project but the `stores` field references a different Store, this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + Simultaneously updating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error. securedBy: - oauth_2_0: scopes: @@ -1714,6 +1717,8 @@ uriParameters: displayName: Update customer by id in store description: | If the Customer exists in the Project but the `stores` field references a different [Store](ctp:api:type:Store), this method returns a [ResourceNotFound](ctp:api:type:ResourceNotFoundError) error. + + Simultaneously updating two Customers with the same email address can return a [LockedField](ctp:api:type:LockedFieldError) error. securedBy: - oauth_2_0: scopes: diff --git a/api-specs/api/types/error/LockedFieldError.raml b/api-specs/api/types/error/LockedFieldError.raml new file mode 100644 index 000000000..13e048f30 --- /dev/null +++ b/api-specs/api/types/error/LockedFieldError.raml @@ -0,0 +1,20 @@ +#%RAML 1.0 DataType +(package): Error +type: ErrorObject +displayName: LockedFieldError +discriminatorValue: LockedField +description: | + Returned when two [Customers](ctp:api:type:Customer) are simultaneously created or updated with the same email address. + + To confirm if the operation was successful, repeat the request. +properties: + field: + type: string + description: | + Field that is currently locked. + code: + type: string + message: + type: string + description: | + `"'$field' is locked by another request. Please try again later."` diff --git a/api-specs/api/types/error/graphql/GraphQLLockedFieldError.raml b/api-specs/api/types/error/graphql/GraphQLLockedFieldError.raml new file mode 100644 index 000000000..4591d40e8 --- /dev/null +++ b/api-specs/api/types/error/graphql/GraphQLLockedFieldError.raml @@ -0,0 +1,16 @@ +#%RAML 1.0 DataType +(package): Error +type: GraphQLErrorObject +displayName: GraphQLLockedFieldError +discriminatorValue: LockedField +description: | + Returned when two [Customers](ctp:api:type:Customer) are simultaneously created or updated with the same email address. + + To confirm if the operation was successful, repeat the request. +properties: + field: + type: string + description: | + Field that is currently locked. + code: + type: string diff --git a/api-specs/api/types/types.raml b/api-specs/api/types/types.raml index f981cd5e1..771c7e52e 100644 --- a/api-specs/api/types/types.raml +++ b/api-specs/api/types/types.raml @@ -525,6 +525,7 @@ InvalidOperationError: !include error/InvalidOperationError.raml InvalidSubjectError: !include error/InvalidSubjectError.raml InvalidTokenError: !include error/InvalidTokenError.raml LanguageUsedInStoresError: !include error/LanguageUsedInStoresError.raml +LockedFieldError: !include error/LockedFieldError.raml MatchingPriceNotFoundError: !include error/MatchingPriceNotFoundError.raml MaxCartDiscountsReachedError: !include error/MaxCartDiscountsReachedError.raml MaxResourceLimitExceededError: !include error/MaxResourceLimitExceededError.raml @@ -604,6 +605,7 @@ GraphQLInvalidOperationError: !include error/graphql/GraphQLInvalidOperationErro GraphQLInvalidSubjectError: !include error/graphql/GraphQLInvalidSubjectError.raml GraphQLInvalidTokenError: !include error/graphql/GraphQLInvalidTokenError.raml GraphQLLanguageUsedInStoresError: !include error/graphql/GraphQLLanguageUsedInStoresError.raml +GraphQLLockedFieldError: !include error/graphql/GraphQLLockedFieldError.raml GraphQLMatchingPriceNotFoundError: !include error/graphql/GraphQLMatchingPriceNotFoundError.raml GraphQLMaxCartDiscountsReachedError: !include error/graphql/GraphQLMaxCartDiscountsReachedError.raml GraphQLMaxResourceLimitExceededError: !include error/graphql/GraphQLMaxResourceLimitExceededError.raml