ServiceAPI: Cannot add organization as duplicated AddressId

Found in

EPiServer.ServiceApi 5.4.0

Fixed in

EPiServer.ServiceApi 5.4.2

Created

Sep 18, 2019

Updated

Jan 08, 2020

Area

Service API

State

Closed, Fixed and tested


Description

Steps to reproduce

  1. Run POST /episerverapi/commerce/customers/organization/ with attached data (no AddressId)
  2. Run about request one more time without changes.

Expected:
You can post another organization with same info in step 1. (After step 1, an address is created with a random guid for AddressId.)

Actual:
After step 1, an address is created with AddressId is " (00000000-0000-0000-0000-000000000000)." So you cannot post an organization with
"ExceptionMessage": "Violation of PRIMARY KEY constraint 'PK_cls_Addr_091C2AFBD96D595D'. Cannot insert duplicate key in object 'dbo.cls_Address'. The duplicate key value is (00000000-0000-0000-0000-000000000000).\r\n The statement has been terminated.",