Skip to content
This repository has been archived by the owner on Nov 22, 2024. It is now read-only.

Commit

Permalink
Merge remote-tracking branch 'origin/main' into feat/external-gateway
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas De Meyer committed Oct 19, 2022
2 parents 1bb0694 + bb594ea commit 1a09c67
Show file tree
Hide file tree
Showing 82 changed files with 3,326 additions and 8 deletions.
25 changes: 17 additions & 8 deletions .github/workflows/pull-requests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -29,14 +29,19 @@ jobs:
- run: go test -v -cover ./...

acceptance-tests:
name: Acceptance Tests (Terraform ${{ matrix.terraform-version }})
name: acceptance-tests (terraform ${{ matrix.terraform-version }})
runs-on: ubuntu-latest
services:
commercelayer-mock:
image: wiremock/wiremock:2.34.0
ports:
- "8080:8080"
strategy:
fail-fast: false
matrix:
terraform-version:
# - '1.0.*'
# - '1.1.*'
- '1.0.*'
- '1.1.*'
- '1.2.*'
steps:
- uses: actions/checkout@v3
Expand All @@ -47,11 +52,15 @@ jobs:
with:
terraform_version: ${{ matrix.terraform-version }}
terraform_wrapper: false
- name: load mock data
shell: bash
run: |
FILES="${{ github.workspace }}/mock/mappings/*"
for f in $FILES; do curl --location --request POST 'http://localhost:8080/__admin/mappings' --header 'Content-Type: application/json' --header 'Accept: application/json' --data-raw "$(cat "$f")"; done
- run: go test -v -p 1 ./...
env:
# TODO: switch to mocked server at some point, as this runs live
TF_ACC: '1'
COMMERCELAYER_CLIENT_ID: ${{ secrets.COMMERCELAYER_CLIENT_ID }}
COMMERCELAYER_CLIENT_SECRET: ${{ secrets.COMMERCELAYER_CLIENT_SECRET }}
COMMERCELAYER_API_ENDPOINT: ${{ secrets.COMMERCELAYER_API_ENDPOINT }}
COMMERCELAYER_AUTH_ENDPOINT: ${{ secrets.COMMERCELAYER_AUTH_ENDPOINT }}
COMMERCELAYER_CLIENT_ID: client-id
COMMERCELAYER_CLIENT_SECRET: client-secret
COMMERCELAYER_API_ENDPOINT: http://localhost:8080/api
COMMERCELAYER_AUTH_ENDPOINT: http://localhost:8080/oauth/token
25 changes: 25 additions & 0 deletions .idea/jsonSchemas.xml

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

8 changes: 8 additions & 0 deletions docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,8 @@
version: "3.9"
services:
commercelayer-mock:
image: wiremock/wiremock:2.34.0
ports:
- "8080:8080"
volumes:
- ./mock/mappings:/home/wiremock/mappings
Original file line number Diff line number Diff line change
@@ -0,0 +1,47 @@
{
"id" : "46d78ff4-6782-43ed-a787-c4f2a81f7c0f",
"name" : "api_addresses",
"request" : {
"url" : "/api/addresses",
"method" : "POST",
"bodyPatterns" : [ {
"equalToJson" : "{\"data\":{\"attributes\":{\"business\":true,\"city\":\"Rotterdam\",\"company\":\"Incentro\",\"country_code\":\"NL\",\"line_1\":\"Van Nelleweg 1\",\"metadata\":{\"foo\":\"bar\"},\"phone\":\"+31(0)10 20 20 544\",\"state_code\":\"ZH\",\"zip_code\":\"3044 BC\"},\"type\":\"addresses\"}}\n",
"ignoreArrayOrder" : true,
"ignoreExtraElements" : true
} ]
},
"response" : {
"status" : 201,
"body" : "{\"data\":{\"id\":\"bQxruNrewv\",\"type\":\"addresses\",\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/bQxruNrewv\"},\"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-18T12:05:42.662Z\",\"updated_at\":\"2022-10-18T12:05:42.662Z\",\"reference\":null,\"reference_origin\":null,\"metadata\":{\"foo\":\"bar\"}},\"relationships\":{\"geocoder\":{\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/bQxruNrewv/relationships/geocoder\",\"related\":\"https://the-green-brand-245.commercelayer.io/api/addresses/bQxruNrewv/geocoder\"}}},\"meta\":{\"mode\":\"test\",\"organization_id\":\"VyjBZFOWJy\"}}}",
"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" : "28",
"X-Ratelimit-Period" : "300",
"Content-Type" : "application/vnd.api+json",
"Etag" : "W/\"5b6976d29a70ef2c04754c38dbaeeb67\"",
"Cache-Control" : "max-age=0, private, must-revalidate",
"X-Request-Id" : "4fb3da39-c958-43b8-acc9-c66b6bc90ad7",
"Strict-Transport-Security" : "max-age=63072000; includeSubDomains",
"Via" : "1.1 vegur, 1.1 varnish",
"Accept-Ranges" : "bytes",
"Date" : "Tue, 18 Oct 2022 12:05:42 GMT",
"X-Served-By" : "cache-ams21080-AMS",
"X-Cache" : "MISS",
"X-Cache-Hits" : "0",
"X-Timer" : "S1666094743.595234,VS0,VE81",
"Vary" : "Accept, Origin"
}
},
"uuid" : "46d78ff4-6782-43ed-a787-c4f2a81f7c0f",
"persistent" : true,
"scenarioName" : "scenario-2-api-addresses",
"requiredScenarioState" : "scenario-2-api-addresses-2",
"insertionIndex" : 28
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
{
"id" : "4d011296-4d93-4057-a786-ff254692b5d4",
"name" : "api_addresses",
"request" : {
"url" : "/api/addresses",
"method" : "POST",
"bodyPatterns" : [ {
"equalToJson" : "{\"data\":{\"attributes\":{\"business\":true,\"city\":\"Rotterdam\",\"company\":\"Incentro\",\"country_code\":\"NL\",\"line_1\":\"Van Nelleweg 1\",\"metadata\":{\"foo\":\"bar\"},\"phone\":\"+31(0)10 20 20 544\",\"state_code\":\"ZH\",\"zip_code\":\"3044 BC\"},\"type\":\"addresses\"}}\n",
"ignoreArrayOrder" : true,
"ignoreExtraElements" : true
} ]
},
"response" : {
"status" : 201,
"body" : "{\"data\":{\"id\":\"bJeJuYeRpN\",\"type\":\"addresses\",\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/bJeJuYeRpN\"},\"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-18T12:05:37.752Z\",\"updated_at\":\"2022-10-18T12:05:37.752Z\",\"reference\":null,\"reference_origin\":null,\"metadata\":{\"foo\":\"bar\"}},\"relationships\":{\"geocoder\":{\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/bJeJuYeRpN/relationships/geocoder\",\"related\":\"https://the-green-brand-245.commercelayer.io/api/addresses/bJeJuYeRpN/geocoder\"}}},\"meta\":{\"mode\":\"test\",\"organization_id\":\"VyjBZFOWJy\"}}}",
"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" : "2",
"X-Ratelimit-Period" : "300",
"Content-Type" : "application/vnd.api+json",
"Etag" : "W/\"82222e544b4a5607899b232b16659530\"",
"Cache-Control" : "max-age=0, private, must-revalidate",
"X-Request-Id" : "a2847f3d-1057-46d6-ade1-551317a74ac9",
"Strict-Transport-Security" : "max-age=63072000; includeSubDomains",
"Via" : "1.1 vegur, 1.1 varnish",
"Accept-Ranges" : "bytes",
"Date" : "Tue, 18 Oct 2022 12:05:37 GMT",
"X-Served-By" : "cache-ams21036-AMS",
"X-Cache" : "MISS",
"X-Cache-Hits" : "0",
"X-Timer" : "S1666094738.681843,VS0,VE82",
"Vary" : "Accept, Origin"
}
},
"uuid" : "4d011296-4d93-4057-a786-ff254692b5d4",
"persistent" : true,
"scenarioName" : "scenario-2-api-addresses",
"requiredScenarioState" : "Started",
"newScenarioState" : "scenario-2-api-addresses-2",
"insertionIndex" : 2
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"id" : "142e549a-65a6-47fb-b9fc-0de026d9f97c",
"name" : "api_addresses_bjejuyerpn",
"request" : {
"url" : "/api/addresses/bJeJuYeRpN",
"method" : "GET"
},
"response" : {
"status" : 404,
"body" : "<!DOCTYPE html>\n<html>\n<head>\n <title>Error 404</title>\n <meta name=\"viewport\" content=\"width=device-width,initial-scale=1\">\n <link href=\"https://data.commercelayer.app/assets/logos/full-logo/white/commercelayer_full_logo_white.svg\"\n rel=\"preload\" as=\"image\">\n <link href=\"https://data.commercelayer.app/assets/fonts/eina01.min.css\" rel=\"preload\" as=\"style\">\n <link href=\"https://data.commercelayer.app/assets/css/commercelayer.v3.min.css\" rel=\"stylesheet\">\n</head>\n<body class=\"bg-white\">\n <div class=\"py-6\" style=\"background-color: #131313;\">\n <img class=\"w-52 mx-auto max-w-screen-sm lg:max-w-screen-lg\"\n src=\"https://data.commercelayer.app/assets/logos/full-logo/white/commercelayer_full_logo_white.svg\"\n alt=\"Commerce Layer logo\">\n </div>\n <div class=\"md:h-screen flex flex-wrap justify-center content-center items-center my-auto\">\n <div class=\"w-screen flex flex-wrap justify-center content-center items-center\">\n <svg class=\"w-1/2 md:w-2/5 pt-20 pb-10 md:pb-16 fill-current text-gray-200\" version=\"1.1\" id=\"error\"\n xmlns=\"http://www.w3.org/2000/svg\" xmlns:xlink=\"http://www.w3.org/1999/xlink\" x=\"0px\" y=\"0px\"\n viewBox=\"0 0 800 540\" style=\"enable-background:new 0 0 800 540;\" xml:space=\"preserve\">\n <style type=\"text/css\">\n .st0 {\n fill: #E5E5E5;\n }\n </style>\n <g id=\"_x34_04\">\n <g id=\"_x34_R\">\n <path class=\"st0\"\n d=\"M800,287.3h-34.5v73.5h-67.9v-73.5H529.4v-54.7L688,1h77.5v221.9H800V287.3z M697.1,97.3L611,222.9h86.6V97.3H697.1z\" />\n </g>\n <g id=\"_x34_L\">\n <path class=\"st0\"\n d=\"M270.6,287.3h-34.5v73.5h-67.9v-73.5H0v-54.7L158.6,1h77.5v221.9h34.5V287.3z M167.7,97.3L81.6,222.9h86.6V97.3H167.7z\" />\n </g>\n <path id=\"magnifying-glass\" class=\"st0\"\n d=\"M548.6,361.6c-3.5-6.9-12.2-9.8-19.2-5.8l-11.4,6.5l-13.8-27.6c35.6-21.4,64.1-55,78.2-97.4C613.6,143,562.4,40.8,468.2,9.5S271.7,29.3,240.4,123.6S260.2,320,354.5,351.4c42.4,14.1,86.4,11.4,124.8-4.3l14.5,28.9l-12.7,7.2c-6.4,3.6-8.8,11.7-5.5,18.3l57.8,115.4c10.3,20.5,35.2,28.8,55.8,18.6c20.5-10.3,28.8-35.3,18.6-55.8L548.6,361.6z M372,298.8c-65.3-21.7-100.7-92.4-79-157.7c21.7-65.3,92.4-100.7,157.7-79s100.7,92.4,79,157.7C508,285,437.2,320.5,372,298.8z\" />\n <path id=\"question-mark\" class=\"st0\"\n d=\"M412.3,91c-49.6,0-89.9,40.3-89.9,89.9c0,49.6,40.3,89.9,89.9,89.9c49.6,0,89.9-40.3,89.9-89.9C502.3,131.3,461.9,91,412.3,91z M411.4,236c-8,0-13.5-5.4-13.5-13.4c0-7.8,5.6-13.5,13.5-13.5c7.8,0,13.5,5.7,13.5,13.5C424.9,230.6,419.2,236,411.4,236z M420.9,199.9c0,2.1,0.3,3,0.3,3h-21c0,0-0.3-1.9-0.3-3.3c0-23.6,25.8-27.8,25.8-41.6c0-8-5.4-12.6-13.2-12.6c-8.1,0-13.7,5.4-13.7,13.2c0,3.9,0.9,8,0.9,8h-21.3c0,0-1.1-3.9-1.1-8.9c0-18.2,13.7-31.9,35-31.9c22.7,0,35,13.7,35,31.5C447.3,182.1,420.9,187.2,420.9,199.9z\" />\n </g>\n </svg>\n </div>\n <div class=\"w-screen flex flex-wrap pb-16 justify-center content-end md:content-center items-end md:items-center\">\n <div class=\"px-6 md:px-32 lg:px-48 text-center\">\n <h2 class=\"uppercase text-xl md:text-4xl lg:text-5xl leading-tight\"\n style=\"font-family: Eina01-Bold, sans-serif; color: #131313; font-weight: bold;\">Oops, <span\n style=\"color: #2DAEFF;\">page not found.</span></h2>\n <p class=\"mt-2 text-sm md:text-base lg:text-lg max-w-xl md:max-w-4xl text-gray-900\"\n style=\"font-family: Eina01-Regular, sans-serif; color: #464646\">The page you are looking for doesn't seem to\n exist. It might have been removed, had its name changed, or you might has mistyped the address.</p>\n </div>\n </div>\n </div>\n</body>\n</html>",
"headers" : {
"Server" : "Varnish",
"Retry-After" : "0",
"Content-Type" : "text/html",
"Accept-Ranges" : "bytes",
"Date" : "Tue, 18 Oct 2022 12:05:39 GMT",
"Via" : "1.1 varnish",
"X-Served-By" : "cache-ams21021-AMS",
"X-Cache" : "MISS",
"X-Cache-Hits" : "0",
"X-Timer" : "S1666094740.760778,VS0,VE33"
}
},
"uuid" : "142e549a-65a6-47fb-b9fc-0de026d9f97c",
"persistent" : true,
"scenarioName" : "scenario-3-api-addresses-bJeJuYeRpN",
"requiredScenarioState" : "scenario-3-api-addresses-bJeJuYeRpN-4",
"insertionIndex" : 13
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
{
"id" : "23ced5c5-8895-4749-80a3-94f7d731ded0",
"name" : "api_addresses_bjejuyerpn",
"request" : {
"url" : "/api/addresses/bJeJuYeRpN",
"method" : "GET"
},
"response" : {
"status" : 200,
"body" : "{\"data\":{\"id\":\"bJeJuYeRpN\",\"type\":\"addresses\",\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/bJeJuYeRpN\"},\"attributes\":{\"business\":true,\"first_name\":null,\"last_name\":null,\"company\":\"Incentro\",\"full_name\":\"Incentro\",\"line_1\":\"Moermanskkade 113\",\"line_2\":null,\"city\":\"Amsterdam\",\"zip_code\":\"1013 BC\",\"state_code\":\"NH\",\"country_code\":\"NL\",\"phone\":\"020 409 0444\",\"full_address\":\"Moermanskkade 113, 1013 BC Amsterdam NH (NL) 020 409 0444\",\"name\":\"Incentro, Moermanskkade 113, 1013 BC Amsterdam NH (NL) 020 409 0444\",\"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-18T12:05:37.752Z\",\"updated_at\":\"2022-10-18T12:05:38.893Z\",\"reference\":null,\"reference_origin\":null,\"metadata\":{\"bar\":\"foo\"}},\"relationships\":{\"geocoder\":{\"links\":{\"self\":\"https://the-green-brand-245.commercelayer.io/api/addresses/bJeJuYeRpN/relationships/geocoder\",\"related\":\"https://the-green-brand-245.commercelayer.io/api/addresses/bJeJuYeRpN/geocoder\"}}},\"meta\":{\"mode\":\"test\",\"organization_id\":\"VyjBZFOWJy\"}}}",
"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" : "10",
"X-Ratelimit-Period" : "300",
"Content-Type" : "application/vnd.api+json",
"Etag" : "W/\"499c06c12f90f99fa4fb48c70208b1f9\"",
"Cache-Control" : "max-age=0, private, must-revalidate",
"X-Request-Id" : "83b905eb-c8e0-439f-afa0-543432093683",
"Strict-Transport-Security" : "max-age=63072000; includeSubDomains",
"Via" : "1.1 vegur, 1.1 varnish",
"Accept-Ranges" : "bytes",
"Date" : "Tue, 18 Oct 2022 12:05:39 GMT",
"X-Served-By" : "cache-ams21065-AMS",
"X-Cache" : "MISS",
"X-Cache-Hits" : "0",
"X-Timer" : "S1666094739.217331,VS0,VE94",
"Vary" : "Accept, Origin"
}
},
"uuid" : "23ced5c5-8895-4749-80a3-94f7d731ded0",
"persistent" : true,
"scenarioName" : "scenario-3-api-addresses-bJeJuYeRpN",
"requiredScenarioState" : "scenario-3-api-addresses-bJeJuYeRpN-3",
"newScenarioState" : "scenario-3-api-addresses-bJeJuYeRpN-4",
"insertionIndex" : 10
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"id" : "2a12017c-2202-4085-941b-53e340f12412",
"name" : "api_addresses_bjejuyerpn",
"request" : {
"url" : "/api/addresses/bJeJuYeRpN",
"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" : "12",
"X-Ratelimit-Period" : "300",
"Cache-Control" : "no-cache",
"X-Request-Id" : "b81064ec-0aaf-4198-bf6a-f91b8f4c9263",
"Strict-Transport-Security" : "max-age=63072000; includeSubDomains",
"Via" : "1.1 vegur, 1.1 varnish",
"Accept-Ranges" : "bytes",
"Date" : "Tue, 18 Oct 2022 12:05:39 GMT",
"X-Served-By" : "cache-ams21053-AMS",
"X-Cache" : "MISS",
"X-Cache-Hits" : "0",
"X-Timer" : "S1666094740.604563,VS0,VE83",
"Vary" : "Origin"
}
},
"uuid" : "2a12017c-2202-4085-941b-53e340f12412",
"persistent" : true,
"insertionIndex" : 12
}
Loading

0 comments on commit 1a09c67

Please sign in to comment.