Skip to content

Commit

Permalink
fix: fixed duplicate reference (incentro-ecx#92)
Browse files Browse the repository at this point in the history
* fix: fixed duplicate reference

* fix: added tests
  • Loading branch information
Thomas De Meyer authored Mar 28, 2023
1 parent 5cdd09c commit 053eac2
Show file tree
Hide file tree
Showing 56 changed files with 884 additions and 1,133 deletions.
4 changes: 2 additions & 2 deletions commercelayer/resource_market.go
Original file line number Diff line number Diff line change
Expand Up @@ -274,7 +274,7 @@ func resourceMarketUpdateFunc(ctx context.Context, d *schema.ResourceData, i int
marketUpdate.Data.Relationships.TaxCalculator = &commercelayer.MarketCreateDataRelationshipsTaxCalculator{
Data: commercelayer.MarketDataRelationshipsTaxCalculatorData{
Type: stringRef(taxCalculatorType),
Id: stringRef(taxCalculatorId),
Id: taxCalculatorId,
}}
}

Expand All @@ -283,7 +283,7 @@ func resourceMarketUpdateFunc(ctx context.Context, d *schema.ResourceData, i int
marketUpdate.Data.Relationships.CustomerGroup = &commercelayer.CustomerCreateDataRelationshipsCustomerGroup{
Data: commercelayer.CustomerDataRelationshipsCustomerGroupData{
Type: stringRef(customerGroupType),
Id: stringRef(customerGroupId),
Id: customerGroupId,
}}
}

Expand Down
2 changes: 2 additions & 0 deletions commercelayer/resource_market_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -45,6 +45,7 @@ func (s *AcceptanceSuite) TestAccMarket_basic() {
testAccInventoryModelCreate(resourceName),
testAccMerchantCreate(resourceName),
testAccPriceListCreate(resourceName),
testAccExternalTaxCalculatorCreate(resourceName),
testAccMarketCreate(resourceName)}, "\n",
),
Check: resource.ComposeTestCheckFunc(
Expand All @@ -58,6 +59,7 @@ func (s *AcceptanceSuite) TestAccMarket_basic() {
testAccInventoryModelCreate(resourceName),
testAccMerchantCreate(resourceName),
testAccPriceListCreate(resourceName),
testAccExternalTaxCalculatorCreate(resourceName),
testAccMarketUpdate(resourceName)}, "\n",
),
Check: resource.ComposeTestCheckFunc(
Expand Down

This file was deleted.

Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"id" : "a0d4edac-d70a-4ee9-aaea-27bb1523d45f",
"id" : "eee94f55-882b-47fc-847c-f0cfe371d21c",
"name" : "api_addresses",
"request" : {
"url" : "/api/addresses",
Expand All @@ -12,7 +12,7 @@
},
"response" : {
"status" : 201,
"body" : "{\"data\":{\"id\":\"dDqwuQoeJY\",\"type\":\"addresses\",\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/dDqwuQoeJY\"},\"attributes\":{\"business\":true,\"first_name\":null,\"last_name\":null,\"company\":\"Incentro\",\"full_name\":\"Incentro\",\"line_1\":\"Van Nelleweg 1\",\"line_2\":null,\"city\":\"Rotterdam\",\"zip_code\":\"3044 BC\",\"state_code\":\"ZH\",\"country_code\":\"NL\",\"phone\":\"+31(0)10 20 20 544\",\"full_address\":\"Van Nelleweg 1, 3044 BC Rotterdam ZH (NL) +31(0)10 20 20 544\",\"name\":\"Incentro, Van Nelleweg 1, 3044 BC Rotterdam ZH (NL) +31(0)10 20 20 544\",\"email\":null,\"notes\":null,\"lat\":null,\"lng\":null,\"is_localized\":false,\"is_geocoded\":false,\"provider_name\":null,\"map_url\":null,\"static_map_url\":null,\"billing_info\":null,\"created_at\":\"2022-10-27T08:56:28.566Z\",\"updated_at\":\"2022-10-27T08:56:28.566Z\",\"reference\":null,\"reference_origin\":null,\"metadata\":{\"foo\":\"bar\",\"testName\":\"commercelayer_market.incentro_market\"}},\"relationships\":{\"geocoder\":{\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/dDqwuQoeJY/relationships/geocoder\",\"related\":\"https://the-green-brand-245.commercelayer.io/api/addresses/dDqwuQoeJY/geocoder\"}}},\"meta\":{\"mode\":\"test\",\"organization_id\":\"VyjBZFOWJy\"}}}",
"body" : "{\"data\":{\"id\":\"BExAuMRAKr\",\"type\":\"addresses\",\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/BExAuMRAKr\"},\"attributes\":{\"business\":true,\"first_name\":null,\"last_name\":null,\"company\":\"Incentro\",\"full_name\":\"Incentro\",\"line_1\":\"Van Nelleweg 1\",\"line_2\":null,\"city\":\"Rotterdam\",\"zip_code\":\"3044 BC\",\"state_code\":\"ZH\",\"country_code\":\"NL\",\"phone\":\"+31(0)10 20 20 544\",\"full_address\":\"Van Nelleweg 1, 3044 BC Rotterdam ZH (NL) +31(0)10 20 20 544\",\"name\":\"Incentro, Van Nelleweg 1, 3044 BC Rotterdam ZH (NL) +31(0)10 20 20 544\",\"email\":null,\"notes\":null,\"lat\":null,\"lng\":null,\"is_localized\":false,\"is_geocoded\":false,\"provider_name\":null,\"map_url\":null,\"static_map_url\":null,\"billing_info\":null,\"created_at\":\"2023-03-28T08:12:18.127Z\",\"updated_at\":\"2023-03-28T08:12:18.127Z\",\"reference\":null,\"reference_origin\":null,\"metadata\":{\"foo\":\"bar\",\"testName\":\"commercelayer_market.incentro_market\"}},\"relationships\":{\"geocoder\":{\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/BExAuMRAKr/relationships/geocoder\",\"related\":\"https://the-green-brand-245.commercelayer.io/api/addresses/BExAuMRAKr/geocoder\"}}},\"meta\":{\"mode\":\"test\",\"organization_id\":\"VyjBZFOWJy\"}}}",
"headers" : {
"Server" : "Cowboy",
"X-Frame-Options" : "SAMEORIGIN",
Expand All @@ -22,24 +22,24 @@
"X-Permitted-Cross-Domain-Policies" : "none",
"Referrer-Policy" : "strict-origin-when-cross-origin",
"X-Ratelimit-Limit" : "600",
"X-Ratelimit-Count" : "48",
"X-Ratelimit-Count" : "5",
"X-Ratelimit-Period" : "300",
"Content-Type" : "application/vnd.api+json",
"Etag" : "W/\"161323c4abaf2e80f923bd4f097b0fd4\"",
"Etag" : "W/\"a7a505c9dd0e42b4ff6e62703c626f5e\"",
"Cache-Control" : "max-age=0, private, must-revalidate",
"X-Request-Id" : "ed2b4882-9d7e-4807-bfda-0e72c44022ca",
"X-Request-Id" : "a91c1d0f-099f-49ac-8227-980de360557d",
"Strict-Transport-Security" : "max-age=63072000; includeSubDomains",
"Via" : "1.1 vegur, 1.1 varnish",
"Accept-Ranges" : "bytes",
"Date" : "Thu, 27 Oct 2022 08:56:28 GMT",
"X-Served-By" : "cache-ams21051-AMS",
"Date" : "Tue, 28 Mar 2023 08:12:18 GMT",
"X-Served-By" : "cache-ams21063-AMS",
"X-Cache" : "MISS",
"X-Cache-Hits" : "0",
"X-Timer" : "S1666860989.503109,VS0,VE78",
"X-Timer" : "S1679991138.061651,VS0,VE82",
"Vary" : "Accept, Origin"
}
},
"uuid" : "a0d4edac-d70a-4ee9-aaea-27bb1523d45f",
"uuid" : "eee94f55-882b-47fc-847c-f0cfe371d21c",
"persistent" : true,
"insertionIndex" : 42
"insertionIndex" : 622
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"id" : "7b0f9e80-a8e8-448a-9fcc-1467f4231587",
"name" : "api_addresses_ddqwuqoejy",
"id" : "16977d61-78e4-4496-aeba-5b729135daff",
"name" : "api_addresses_bexaumrakr",
"request" : {
"url" : "/api/addresses/dDqwuQoeJY",
"url" : "/api/addresses/BExAuMRAKr",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "{\"data\":{\"id\":\"dDqwuQoeJY\",\"type\":\"addresses\",\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/dDqwuQoeJY\"},\"attributes\":{\"business\":true,\"first_name\":null,\"last_name\":null,\"company\":\"Incentro\",\"full_name\":\"Incentro\",\"line_1\":\"Van Nelleweg 1\",\"line_2\":null,\"city\":\"Rotterdam\",\"zip_code\":\"3044 BC\",\"state_code\":\"ZH\",\"country_code\":\"NL\",\"phone\":\"+31(0)10 20 20 544\",\"full_address\":\"Van Nelleweg 1, 3044 BC Rotterdam ZH (NL) +31(0)10 20 20 544\",\"name\":\"Incentro, Van Nelleweg 1, 3044 BC Rotterdam ZH (NL) +31(0)10 20 20 544\",\"email\":null,\"notes\":null,\"lat\":null,\"lng\":null,\"is_localized\":false,\"is_geocoded\":false,\"provider_name\":null,\"map_url\":null,\"static_map_url\":null,\"billing_info\":null,\"created_at\":\"2022-10-27T08:56:28.566Z\",\"updated_at\":\"2022-10-27T08:56:28.566Z\",\"reference\":null,\"reference_origin\":null,\"metadata\":{\"foo\":\"bar\",\"testName\":\"commercelayer_market.incentro_market\"}},\"relationships\":{\"geocoder\":{\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/dDqwuQoeJY/relationships/geocoder\",\"related\":\"https://the-green-brand-245.commercelayer.io/api/addresses/dDqwuQoeJY/geocoder\"}}},\"meta\":{\"mode\":\"test\",\"organization_id\":\"VyjBZFOWJy\"}}}",
"body" : "{\"data\":{\"id\":\"BExAuMRAKr\",\"type\":\"addresses\",\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/BExAuMRAKr\"},\"attributes\":{\"business\":true,\"first_name\":null,\"last_name\":null,\"company\":\"Incentro\",\"full_name\":\"Incentro\",\"line_1\":\"Van Nelleweg 1\",\"line_2\":null,\"city\":\"Rotterdam\",\"zip_code\":\"3044 BC\",\"state_code\":\"ZH\",\"country_code\":\"NL\",\"phone\":\"+31(0)10 20 20 544\",\"full_address\":\"Van Nelleweg 1, 3044 BC Rotterdam ZH (NL) +31(0)10 20 20 544\",\"name\":\"Incentro, Van Nelleweg 1, 3044 BC Rotterdam ZH (NL) +31(0)10 20 20 544\",\"email\":null,\"notes\":null,\"lat\":null,\"lng\":null,\"is_localized\":false,\"is_geocoded\":false,\"provider_name\":null,\"map_url\":null,\"static_map_url\":null,\"billing_info\":null,\"created_at\":\"2023-03-28T08:12:18.127Z\",\"updated_at\":\"2023-03-28T08:12:18.127Z\",\"reference\":null,\"reference_origin\":null,\"metadata\":{\"foo\":\"bar\",\"testName\":\"commercelayer_market.incentro_market\"}},\"relationships\":{\"geocoder\":{\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/BExAuMRAKr/relationships/geocoder\",\"related\":\"https://the-green-brand-245.commercelayer.io/api/addresses/BExAuMRAKr/geocoder\"}}},\"meta\":{\"mode\":\"test\",\"organization_id\":\"VyjBZFOWJy\"}}}",
"headers" : {
"Server" : "Cowboy",
"X-Frame-Options" : "SAMEORIGIN",
Expand All @@ -17,26 +17,26 @@
"X-Permitted-Cross-Domain-Policies" : "none",
"Referrer-Policy" : "strict-origin-when-cross-origin",
"X-Ratelimit-Limit" : "600",
"X-Ratelimit-Count" : "60",
"X-Ratelimit-Count" : "21",
"X-Ratelimit-Period" : "300",
"Content-Type" : "application/vnd.api+json",
"Etag" : "W/\"161323c4abaf2e80f923bd4f097b0fd4\"",
"Etag" : "W/\"a7a505c9dd0e42b4ff6e62703c626f5e\"",
"Cache-Control" : "max-age=0, private, must-revalidate",
"X-Request-Id" : "1e95bccc-589e-4b80-b024-81ebfa89d133",
"X-Request-Id" : "9346ae20-dc12-4019-bfa0-3722704b05bd",
"Strict-Transport-Security" : "max-age=63072000; includeSubDomains",
"Via" : "1.1 vegur, 1.1 varnish",
"Accept-Ranges" : "bytes",
"Date" : "Thu, 27 Oct 2022 08:56:30 GMT",
"X-Served-By" : "cache-ams21066-AMS",
"Date" : "Tue, 28 Mar 2023 08:12:19 GMT",
"X-Served-By" : "cache-ams21043-AMS",
"X-Cache" : "MISS",
"X-Cache-Hits" : "0",
"X-Timer" : "S1666860990.126022,VS0,VE58",
"X-Timer" : "S1679991140.828164,VS0,VE76",
"Vary" : "Accept, Origin"
}
},
"uuid" : "7b0f9e80-a8e8-448a-9fcc-1467f4231587",
"uuid" : "16977d61-78e4-4496-aeba-5b729135daff",
"persistent" : true,
"scenarioName" : "scenario-7-api-addresses-dDqwuQoeJY",
"requiredScenarioState" : "scenario-7-api-addresses-dDqwuQoeJY-3",
"insertionIndex" : 58
"scenarioName" : "scenario-4-api-addresses-BExAuMRAKr",
"requiredScenarioState" : "scenario-4-api-addresses-BExAuMRAKr-3",
"insertionIndex" : 641
}
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
{
"id" : "3d8d17a3-06be-4393-9dbc-f8809a446e74",
"name" : "api_addresses_ddqwuqoejy",
"id" : "7bdbdd50-b89f-485c-a732-6ad99a9dc51e",
"name" : "api_addresses_bexaumrakr",
"request" : {
"url" : "/api/addresses/dDqwuQoeJY",
"url" : "/api/addresses/BExAuMRAKr",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "{\"data\":{\"id\":\"dDqwuQoeJY\",\"type\":\"addresses\",\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/dDqwuQoeJY\"},\"attributes\":{\"business\":true,\"first_name\":null,\"last_name\":null,\"company\":\"Incentro\",\"full_name\":\"Incentro\",\"line_1\":\"Van Nelleweg 1\",\"line_2\":null,\"city\":\"Rotterdam\",\"zip_code\":\"3044 BC\",\"state_code\":\"ZH\",\"country_code\":\"NL\",\"phone\":\"+31(0)10 20 20 544\",\"full_address\":\"Van Nelleweg 1, 3044 BC Rotterdam ZH (NL) +31(0)10 20 20 544\",\"name\":\"Incentro, Van Nelleweg 1, 3044 BC Rotterdam ZH (NL) +31(0)10 20 20 544\",\"email\":null,\"notes\":null,\"lat\":null,\"lng\":null,\"is_localized\":false,\"is_geocoded\":false,\"provider_name\":null,\"map_url\":null,\"static_map_url\":null,\"billing_info\":null,\"created_at\":\"2022-10-27T08:56:28.566Z\",\"updated_at\":\"2022-10-27T08:56:28.566Z\",\"reference\":null,\"reference_origin\":null,\"metadata\":{\"foo\":\"bar\",\"testName\":\"commercelayer_market.incentro_market\"}},\"relationships\":{\"geocoder\":{\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/dDqwuQoeJY/relationships/geocoder\",\"related\":\"https://the-green-brand-245.commercelayer.io/api/addresses/dDqwuQoeJY/geocoder\"}}},\"meta\":{\"mode\":\"test\",\"organization_id\":\"VyjBZFOWJy\"}}}",
"body" : "{\"data\":{\"id\":\"BExAuMRAKr\",\"type\":\"addresses\",\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/BExAuMRAKr\"},\"attributes\":{\"business\":true,\"first_name\":null,\"last_name\":null,\"company\":\"Incentro\",\"full_name\":\"Incentro\",\"line_1\":\"Van Nelleweg 1\",\"line_2\":null,\"city\":\"Rotterdam\",\"zip_code\":\"3044 BC\",\"state_code\":\"ZH\",\"country_code\":\"NL\",\"phone\":\"+31(0)10 20 20 544\",\"full_address\":\"Van Nelleweg 1, 3044 BC Rotterdam ZH (NL) +31(0)10 20 20 544\",\"name\":\"Incentro, Van Nelleweg 1, 3044 BC Rotterdam ZH (NL) +31(0)10 20 20 544\",\"email\":null,\"notes\":null,\"lat\":null,\"lng\":null,\"is_localized\":false,\"is_geocoded\":false,\"provider_name\":null,\"map_url\":null,\"static_map_url\":null,\"billing_info\":null,\"created_at\":\"2023-03-28T08:12:18.127Z\",\"updated_at\":\"2023-03-28T08:12:18.127Z\",\"reference\":null,\"reference_origin\":null,\"metadata\":{\"foo\":\"bar\",\"testName\":\"commercelayer_market.incentro_market\"}},\"relationships\":{\"geocoder\":{\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/BExAuMRAKr/relationships/geocoder\",\"related\":\"https://the-green-brand-245.commercelayer.io/api/addresses/BExAuMRAKr/geocoder\"}}},\"meta\":{\"mode\":\"test\",\"organization_id\":\"VyjBZFOWJy\"}}}",
"headers" : {
"Server" : "Cowboy",
"X-Frame-Options" : "SAMEORIGIN",
Expand All @@ -17,27 +17,27 @@
"X-Permitted-Cross-Domain-Policies" : "none",
"Referrer-Policy" : "strict-origin-when-cross-origin",
"X-Ratelimit-Limit" : "600",
"X-Ratelimit-Count" : "53",
"X-Ratelimit-Count" : "10",
"X-Ratelimit-Period" : "300",
"Content-Type" : "application/vnd.api+json",
"Etag" : "W/\"161323c4abaf2e80f923bd4f097b0fd4\"",
"Etag" : "W/\"a7a505c9dd0e42b4ff6e62703c626f5e\"",
"Cache-Control" : "max-age=0, private, must-revalidate",
"X-Request-Id" : "f13d87d3-4255-40fb-a1eb-8b159998266e",
"X-Request-Id" : "3f9c9eb2-c96f-4d37-859c-cb16b7f85f88",
"Strict-Transport-Security" : "max-age=63072000; includeSubDomains",
"Via" : "1.1 vegur, 1.1 varnish",
"Accept-Ranges" : "bytes",
"Date" : "Thu, 27 Oct 2022 08:56:29 GMT",
"X-Served-By" : "cache-ams21053-AMS",
"Date" : "Tue, 28 Mar 2023 08:12:18 GMT",
"X-Served-By" : "cache-ams21061-AMS",
"X-Cache" : "MISS",
"X-Cache-Hits" : "0",
"X-Timer" : "S1666860989.090567,VS0,VE41",
"X-Timer" : "S1679991139.691360,VS0,VE81",
"Vary" : "Accept, Origin"
}
},
"uuid" : "3d8d17a3-06be-4393-9dbc-f8809a446e74",
"uuid" : "7bdbdd50-b89f-485c-a732-6ad99a9dc51e",
"persistent" : true,
"scenarioName" : "scenario-7-api-addresses-dDqwuQoeJY",
"scenarioName" : "scenario-4-api-addresses-BExAuMRAKr",
"requiredScenarioState" : "Started",
"newScenarioState" : "scenario-7-api-addresses-dDqwuQoeJY-2",
"insertionIndex" : 47
"newScenarioState" : "scenario-4-api-addresses-BExAuMRAKr-2",
"insertionIndex" : 628
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"id" : "8403a2b2-f948-4ef3-b233-ead9108ebc02",
"name" : "api_addresses_bexaumrakr",
"request" : {
"url" : "/api/addresses/BExAuMRAKr",
"method" : "DELETE"
},
"response" : {
"status" : 204,
"headers" : {
"Server" : "Cowboy",
"X-Frame-Options" : "SAMEORIGIN",
"X-Xss-Protection" : "1; mode=block",
"X-Content-Type-Options" : "nosniff",
"X-Download-Options" : "noopen",
"X-Permitted-Cross-Domain-Policies" : "none",
"Referrer-Policy" : "strict-origin-when-cross-origin",
"X-Ratelimit-Limit" : "600",
"X-Ratelimit-Count" : "29",
"X-Ratelimit-Period" : "300",
"Cache-Control" : "no-cache",
"X-Request-Id" : "3f82a555-76dd-4911-af1f-379b7696d022",
"Strict-Transport-Security" : "max-age=63072000; includeSubDomains",
"Via" : "1.1 vegur, 1.1 varnish",
"Accept-Ranges" : "bytes",
"Date" : "Tue, 28 Mar 2023 08:12:20 GMT",
"X-Served-By" : "cache-ams21067-AMS",
"X-Cache" : "MISS",
"X-Cache-Hits" : "0",
"X-Timer" : "S1679991141.678704,VS0,VE49",
"Vary" : "Origin"
}
},
"uuid" : "8403a2b2-f948-4ef3-b233-ead9108ebc02",
"persistent" : true,
"insertionIndex" : 649
}
Loading

0 comments on commit 053eac2

Please sign in to comment.