From 255a560aa36b9868273e13a80c4ef65f043df032 Mon Sep 17 00:00:00 2001 From: "dependabot[bot]" <49699333+dependabot[bot]@users.noreply.github.com> Date: Mon, 31 Aug 2020 08:46:12 +0200 Subject: [PATCH 1/3] Bump github.com/google/uuid from 1.1.1 to 1.1.2 (#82) Co-authored-by: dependabot[bot] <49699333+dependabot[bot]@users.noreply.github.com> Co-authored-by: KadoBOT --- go.mod | 2 +- go.sum | 2 ++ tests/checkoututility_test.go | 2 +- 3 files changed, 4 insertions(+), 2 deletions(-) diff --git a/go.mod b/go.mod index 1fd8570ee..ab4226e91 100644 --- a/go.mod +++ b/go.mod @@ -3,7 +3,7 @@ module github.com/adyen/adyen-go-api-library/v2 go 1.13 require ( - github.com/google/uuid v1.1.1 + github.com/google/uuid v1.1.2 github.com/joho/godotenv v1.3.0 github.com/stretchr/testify v1.6.1 golang.org/x/oauth2 v0.0.0-20200107190931-bf48bf16ab8d diff --git a/go.sum b/go.sum index b22b8fffc..e99953f6b 100644 --- a/go.sum +++ b/go.sum @@ -5,6 +5,8 @@ github.com/golang/protobuf v1.2.0 h1:P3YflyNX/ehuJFLhxviNdFxQPkGK5cDcApsge1SqnvM github.com/golang/protobuf v1.2.0/go.mod h1:6lQm79b+lXiMfvg/cZm0SGofjICqVBUtrP5yJMmIC1U= github.com/google/uuid v1.1.1 h1:Gkbcsh/GbpXz7lPftLA3P6TYMwjCLYm83jiFQZF/3gY= github.com/google/uuid v1.1.1/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= +github.com/google/uuid v1.1.2 h1:EVhdT+1Kseyi1/pUmXKaFxYsDNy9RQYkMWRH68J/W7Y= +github.com/google/uuid v1.1.2/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo= github.com/joho/godotenv v1.3.0 h1:Zjp+RcGpHhGlrMbJzXTrZZPrWj+1vfm90La1wgB6Bhc= github.com/joho/godotenv v1.3.0/go.mod h1:7hK45KPybAkOC6peb+G5yklZfMxEjkZhHbwpqxOKXbg= github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM= diff --git a/tests/checkoututility_test.go b/tests/checkoututility_test.go index 18f9a96f4..c428262cf 100644 --- a/tests/checkoututility_test.go +++ b/tests/checkoututility_test.go @@ -39,7 +39,7 @@ func Test_CheckoutUtility(t *testing.T) { require.NotNil(t, err) require.NotNil(t, httpRes) assert.Equal(t, true, strings.Contains(err.Error(), "Required field 'originDomains' is null")) - assert.Equal(t, 500, httpRes.StatusCode) + assert.Equal(t, 400, httpRes.StatusCode) require.NotNil(t, res) }) t.Run("Create an API request that should pass", func(t *testing.T) { From 5d09fd494369a544a7846c182cb1ecfe8659dac1 Mon Sep 17 00:00:00 2001 From: Alexander Stevenson Date: Wed, 16 Sep 2020 08:23:06 +0200 Subject: [PATCH 2/3] Fix/issue 83 idempotency key (#85) --- src/adyen/api.go | 10 ----- src/common/client.go | 31 +++++++++++--- src/common/configuration.go | 5 --- tests/checkout_test.go | 13 +++--- tests/checkoutidempotency_test.go | 67 +++++++++++++++++++++++++++++++ 5 files changed, 101 insertions(+), 25 deletions(-) create mode 100644 tests/checkoutidempotency_test.go diff --git a/src/adyen/api.go b/src/adyen/api.go index 078e81fb6..76c148936 100644 --- a/src/adyen/api.go +++ b/src/adyen/api.go @@ -252,13 +252,3 @@ func (c *APIClient) SetEnvironment(env common.Environment, liveEndpointURLPrefix func (c *APIClient) GetConfig() *common.Config { return c.client.Cfg } - -/* -SetIdempotencyKey A idempotency key is added to the request headers once. A subsequent request using the same -idempotency key will be processed as if it was the first request. -This header option is not persistent which means that whenever you want to use a idempotency key, you need to -"SetIdempotencyKey" again before each request. -*/ -func (c *APIClient) SetIdempotencyKey(i string) { - c.client.Cfg.AddDefaultHeader("Idempotency-Key", i) -} diff --git a/src/common/client.go b/src/common/client.go index 40b955e4d..6858c9603 100644 --- a/src/common/client.go +++ b/src/common/client.go @@ -88,11 +88,6 @@ func (c *Client) MakeHTTPPostRequest(req interface{}, res interface{}, path stri httpResponse, err := c.CallAPI(r) - _, ok := c.Cfg.DefaultHeader["Idempotency-Key"] - if ok { - delete(c.Cfg.DefaultHeader, "Idempotency-Key") - } - if err != nil || httpResponse == nil { return httpResponse, err } @@ -247,6 +242,10 @@ func (c *Client) PrepareRequest( localVarRequest.Header.Add(header, value) } + if key, ok := IdempotencyKey(ctx); ok { + localVarRequest.Header.Add("Idempotency-Key", key) + } + return localVarRequest, nil } @@ -531,3 +530,25 @@ func (e APIError) Error() string { } return e.Err } + +type ctxKey int + +var ctxKeyIdempotencyKey ctxKey = 1 + +/* +WithIdempotencyKey returns a context with an Idempotency-Key added to the provided context. +Pass this context as the first context to a call to Adyen, and the idempotency +key will be added to the header +*/ +func WithIdempotencyKey(ctx context.Context, i string) context.Context { + return context.WithValue(ctx, ctxKeyIdempotencyKey, i) +} + +func IdempotencyKey(ctx context.Context) (string, bool) { + if ctx == nil { + return "", false + } + ikey := ctx.Value(ctxKeyIdempotencyKey) + key, ok := ikey.(string) + return key, ok +} diff --git a/src/common/configuration.go b/src/common/configuration.go index b6fc21564..b0462d3d6 100644 --- a/src/common/configuration.go +++ b/src/common/configuration.go @@ -98,8 +98,3 @@ func (c *Config) GetCheckoutEndpoint() (string, error) { } return c.CheckoutEndpoint, nil } - -// AddDefaultHeader adds a new HTTP header to the default header in the Request -func (c *Config) AddDefaultHeader(key string, value string) { - c.DefaultHeader[key] = value -} diff --git a/tests/checkout_test.go b/tests/checkout_test.go index 87679edbe..c5b0eb08b 100644 --- a/tests/checkout_test.go +++ b/tests/checkout_test.go @@ -7,11 +7,13 @@ package tests import ( - "github.com/google/uuid" + "context" "os" "strings" "testing" + "github.com/google/uuid" + "github.com/adyen/adyen-go-api-library/v2/src/adyen" "github.com/adyen/adyen-go-api-library/v2/src/checkout" "github.com/adyen/adyen-go-api-library/v2/src/common" @@ -184,12 +186,13 @@ func Test_Checkout(t *testing.T) { require.Nil(t, req.ApplicationInfo) iKey := uuid.New().String() - client.SetIdempotencyKey(iKey) - res, _, _ := client.Checkout.Payments(req) + ctx := context.Background() + ctx = common.WithIdempotencyKey(ctx, iKey) + res, _, _ := client.Checkout.Payments(req, ctx) pspRef := res.PspReference - client.SetIdempotencyKey(iKey) - res, _, _ = client.Checkout.Payments(req) + ctx = common.WithIdempotencyKey(ctx, iKey) + res, _, _ = client.Checkout.Payments(req, ctx) require.Equal(t, pspRef, res.PspReference) // Idempotency Key is not set for this request. Should have a new PspReference. diff --git a/tests/checkoutidempotency_test.go b/tests/checkoutidempotency_test.go new file mode 100644 index 000000000..e8432a925 --- /dev/null +++ b/tests/checkoutidempotency_test.go @@ -0,0 +1,67 @@ +package tests + +import ( + "context" + "encoding/json" + "fmt" + "io/ioutil" + "net/http" + "net/http/httptest" + "sync" + "testing" + "time" + + "github.com/adyen/adyen-go-api-library/v2/src/adyen" + "github.com/adyen/adyen-go-api-library/v2/src/checkout" + "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/google/uuid" + "github.com/stretchr/testify/require" +) + +var idempotencyKeys *sync.Map + +type referenceAndIdempotencyKeyTransport struct { + errChan chan error +} + +func (rl *referenceAndIdempotencyKeyTransport) RoundTrip(req *http.Request) (*http.Response, error) { + body, _ := ioutil.ReadAll(req.Body) + data := map[string]interface{}{} + json.Unmarshal(body, &data) + reference := data["reference"] + idempotencyKey := req.Header.Get("Idempotency-Key") + idempotencyKeys.Store(reference.(string), idempotencyKey) + resp := httptest.NewRecorder() + resp.WriteHeader(http.StatusOK) + return resp.Result(), nil +} + +func Test_Checkout_Idempotency_Race(t *testing.T) { + idempotencyKeys = &sync.Map{} + client := adyen.NewClient(&common.Config{ + HTTPClient: &http.Client{ + Transport: &referenceAndIdempotencyKeyTransport{}, + }, + }) + + for r := 0; r < 10; r++ { + t.Run(fmt.Sprintf("Routine %d", r), func(t *testing.T) { + ir := r + t.Parallel() + for i := 0; i < 100; i++ { + idempotencyKey := uuid.Must(uuid.NewRandom()).String() + ref := fmt.Sprintf("%d/%d", ir, i) + ctx, cancel := context.WithTimeout(context.Background(), time.Second*5) + defer cancel() + ctx = common.WithIdempotencyKey(ctx, idempotencyKey) + _, _, err := client.Checkout.Payments(&checkout.PaymentRequest{ + Reference: ref, + }, ctx) + require.NoError(t, err) + v, ok := idempotencyKeys.Load(ref) + require.True(t, ok) + require.Equal(t, v.(string), idempotencyKey) + } + }) + } +} From 197afa14fba87a69e6ee36f3d81cca1a98af2623 Mon Sep 17 00:00:00 2001 From: KadoBOT Date: Wed, 16 Sep 2020 11:16:07 +0200 Subject: [PATCH 3/3] Release v3.0.0 --- Readme.md | 30 +++++++++---------- go.mod | 2 +- main.go | 4 +-- main_test.go | 6 ++-- src/adyen/api.go | 24 +++++++-------- src/adyen/api_test.go | 6 ++-- src/binlookup/api_default.go | 2 +- src/checkout/api_default.go | 2 +- src/checkout/model_payment_response.go | 2 +- .../model_payment_verification_response.go | 2 +- src/checkoututility/api_default.go | 2 +- src/common/client.go | 8 ++--- src/common/configuration.go | 2 +- src/hmacvalidator/hmacvalidator.go | 2 +- src/hmacvalidator/hmacvalidator_test.go | 2 +- src/notification/notification_handler.go | 2 +- src/payments/api_default.go | 2 +- src/payments/model_payment_result.go | 2 +- src/payouts/api_default.go | 2 +- src/payouts/model_payout_response.go | 2 +- src/platformsaccount/api_default.go | 2 +- src/platformsfund/api_default.go | 2 +- .../api_default.go | 2 +- .../api_default.go | 2 +- src/recurring/api_default.go | 2 +- templates/go/api.mustache | 2 +- tests/binlookup_test.go | 6 ++-- tests/checkout_test.go | 6 ++-- tests/checkoutidempotency_test.go | 6 ++-- tests/checkoututility_test.go | 6 ++-- tests/notification_handler_test.go | 6 ++-- tests/payment_test.go | 6 ++-- tests/payouts_test.go | 8 ++--- tests/platforms_test.go | 10 +++---- tests/recurring_test.go | 6 ++-- 35 files changed, 88 insertions(+), 90 deletions(-) diff --git a/Readme.md b/Readme.md index eda6a71bf..c7104093e 100644 --- a/Readme.md +++ b/Readme.md @@ -26,7 +26,7 @@ You can use go modules to add our library to your project ### Go module ```bash -go get github.com/adyen/adyen-go-api-library/v2 +go get github.com/adyen/adyen-go-api-library/v3 ``` ## Documentation @@ -40,9 +40,9 @@ go get github.com/adyen/adyen-go-api-library/v2 ```go import ( - "github.com/adyen/adyen-go-api-library/v2/src/checkout" - "github.com/adyen/adyen-go-api-library/v2/src/common" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/checkout" + "github.com/adyen/adyen-go-api-library/v3/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" ) client := adyen.NewClient(&common.Config{ @@ -59,9 +59,9 @@ res, httpRes, err := client.Checkout.PaymentMethods(&checkout.PaymentMethodsRequ ```go import ( - "github.com/adyen/adyen-go-api-library/v2/src/checkout" - "github.com/adyen/adyen-go-api-library/v2/src/common" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/checkout" + "github.com/adyen/adyen-go-api-library/v3/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" ) client := adyen.NewClient(&common.Config{ @@ -79,9 +79,9 @@ res, httpRes, err := client.Checkout.PaymentMethods(&checkout.PaymentMethodsRequ ```go import ( - "github.com/adyen/adyen-go-api-library/v2/src/recurring" - "github.com/adyen/adyen-go-api-library/v2/src/common" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/recurring" + "github.com/adyen/adyen-go-api-library/v3/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" ) client := adyen.NewClient(&common.Config{ @@ -104,8 +104,8 @@ res, httpRes, err := client.Recurring.ListRecurringDetails(&recurring.RecurringD ```go import ( - "github.com/adyen/adyen-go-api-library/v2/src/adyen" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) client := adyen.NewClient(&common.Config{ @@ -120,9 +120,9 @@ notification, err := client.Notification.HandleNotificationRequest(jsonRequestSt ```go import ( - "github.com/adyen/adyen-go-api-library/v2/src/common" - "github.com/adyen/adyen-go-api-library/v2/src/checkout" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/checkout" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" ) client := adyen.NewClient(&common.Config{ diff --git a/go.mod b/go.mod index ab4226e91..8e05d1a4c 100644 --- a/go.mod +++ b/go.mod @@ -1,4 +1,4 @@ -module github.com/adyen/adyen-go-api-library/v2 +module github.com/adyen/adyen-go-api-library/v3 go 1.13 diff --git a/main.go b/main.go index abad68684..1306722b9 100644 --- a/main.go +++ b/main.go @@ -9,8 +9,8 @@ package main import ( "fmt" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) func main() { diff --git a/main_test.go b/main_test.go index f260b47d2..d51c6f070 100644 --- a/main_test.go +++ b/main_test.go @@ -10,9 +10,9 @@ import ( "strings" "testing" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" - "github.com/adyen/adyen-go-api-library/v2/src/checkout" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/checkout" + "github.com/adyen/adyen-go-api-library/v3/src/common" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/src/adyen/api.go b/src/adyen/api.go index 76c148936..27bcb3d5e 100644 --- a/src/adyen/api.go +++ b/src/adyen/api.go @@ -10,18 +10,18 @@ import ( "fmt" "net/http" - binlookup "github.com/adyen/adyen-go-api-library/v2/src/binlookup" - checkout "github.com/adyen/adyen-go-api-library/v2/src/checkout" - checkoututility "github.com/adyen/adyen-go-api-library/v2/src/checkoututility" - common "github.com/adyen/adyen-go-api-library/v2/src/common" - notification "github.com/adyen/adyen-go-api-library/v2/src/notification" - payments "github.com/adyen/adyen-go-api-library/v2/src/payments" - payouts "github.com/adyen/adyen-go-api-library/v2/src/payouts" - platformsaccount "github.com/adyen/adyen-go-api-library/v2/src/platformsaccount" - platformsfund "github.com/adyen/adyen-go-api-library/v2/src/platformsfund" - platformshostedonboardingpage "github.com/adyen/adyen-go-api-library/v2/src/platformshostedonboardingpage" - platformsnotificationconfiguration "github.com/adyen/adyen-go-api-library/v2/src/platformsnotificationconfiguration" - recurring "github.com/adyen/adyen-go-api-library/v2/src/recurring" + binlookup "github.com/adyen/adyen-go-api-library/v3/src/binlookup" + checkout "github.com/adyen/adyen-go-api-library/v3/src/checkout" + checkoututility "github.com/adyen/adyen-go-api-library/v3/src/checkoututility" + common "github.com/adyen/adyen-go-api-library/v3/src/common" + notification "github.com/adyen/adyen-go-api-library/v3/src/notification" + payments "github.com/adyen/adyen-go-api-library/v3/src/payments" + payouts "github.com/adyen/adyen-go-api-library/v3/src/payouts" + platformsaccount "github.com/adyen/adyen-go-api-library/v3/src/platformsaccount" + platformsfund "github.com/adyen/adyen-go-api-library/v3/src/platformsfund" + platformshostedonboardingpage "github.com/adyen/adyen-go-api-library/v3/src/platformshostedonboardingpage" + platformsnotificationconfiguration "github.com/adyen/adyen-go-api-library/v3/src/platformsnotificationconfiguration" + recurring "github.com/adyen/adyen-go-api-library/v3/src/recurring" ) // Constants used for the client API diff --git a/src/adyen/api_test.go b/src/adyen/api_test.go index 0d4baadbf..17c477e24 100644 --- a/src/adyen/api_test.go +++ b/src/adyen/api_test.go @@ -12,9 +12,9 @@ import ( "testing" "time" - "github.com/adyen/adyen-go-api-library/v2/src/checkout" - "github.com/adyen/adyen-go-api-library/v2/src/common" - "github.com/adyen/adyen-go-api-library/v2/src/recurring" + "github.com/adyen/adyen-go-api-library/v3/src/checkout" + "github.com/adyen/adyen-go-api-library/v3/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/recurring" "github.com/joho/godotenv" "github.com/stretchr/testify/assert" diff --git a/src/binlookup/api_default.go b/src/binlookup/api_default.go index 4c8b94b0f..59a52846a 100644 --- a/src/binlookup/api_default.go +++ b/src/binlookup/api_default.go @@ -14,7 +14,7 @@ import ( _context "context" _nethttp "net/http" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) // BinLookup BinLookup service diff --git a/src/checkout/api_default.go b/src/checkout/api_default.go index 2b3805a04..a0cc7c7cc 100644 --- a/src/checkout/api_default.go +++ b/src/checkout/api_default.go @@ -14,7 +14,7 @@ import ( _context "context" _nethttp "net/http" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) // Checkout Checkout service diff --git a/src/checkout/model_payment_response.go b/src/checkout/model_payment_response.go index 34aeec41c..c87e5b28d 100644 --- a/src/checkout/model_payment_response.go +++ b/src/checkout/model_payment_response.go @@ -11,7 +11,7 @@ package checkout import ( - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) // PaymentResponse struct for PaymentResponse diff --git a/src/checkout/model_payment_verification_response.go b/src/checkout/model_payment_verification_response.go index 2ad6f500d..6679cf35b 100644 --- a/src/checkout/model_payment_verification_response.go +++ b/src/checkout/model_payment_verification_response.go @@ -10,7 +10,7 @@ package checkout -import "github.com/adyen/adyen-go-api-library/v2/src/common" +import "github.com/adyen/adyen-go-api-library/v3/src/common" // PaymentVerificationResponse struct for PaymentVerificationResponse type PaymentVerificationResponse struct { diff --git a/src/checkoututility/api_default.go b/src/checkoututility/api_default.go index b3d250860..c6025066d 100644 --- a/src/checkoututility/api_default.go +++ b/src/checkoututility/api_default.go @@ -14,7 +14,7 @@ import ( _context "context" _nethttp "net/http" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) // CheckoutUtility CheckoutUtility service diff --git a/src/common/client.go b/src/common/client.go index 6858c9603..406acfb56 100644 --- a/src/common/client.go +++ b/src/common/client.go @@ -531,17 +531,15 @@ func (e APIError) Error() string { return e.Err } -type ctxKey int - -var ctxKeyIdempotencyKey ctxKey = 1 +var ctxKeyIdempotencyKey = 1 /* WithIdempotencyKey returns a context with an Idempotency-Key added to the provided context. Pass this context as the first context to a call to Adyen, and the idempotency key will be added to the header */ -func WithIdempotencyKey(ctx context.Context, i string) context.Context { - return context.WithValue(ctx, ctxKeyIdempotencyKey, i) +func WithIdempotencyKey(ctx context.Context, idempotencyKey string) context.Context { + return context.WithValue(ctx, ctxKeyIdempotencyKey, idempotencyKey) } func IdempotencyKey(ctx context.Context) (string, bool) { diff --git a/src/common/configuration.go b/src/common/configuration.go index b0462d3d6..31b3c6142 100644 --- a/src/common/configuration.go +++ b/src/common/configuration.go @@ -61,7 +61,7 @@ const ( const ( LibName = "adyen-go-api-library" - LibVersion = "2.2.0" + LibVersion = "3.0.0" ) // Config stores the configuration of the API client diff --git a/src/hmacvalidator/hmacvalidator.go b/src/hmacvalidator/hmacvalidator.go index 0b5c20ed3..832364e43 100644 --- a/src/hmacvalidator/hmacvalidator.go +++ b/src/hmacvalidator/hmacvalidator.go @@ -11,7 +11,7 @@ import ( "strconv" "strings" - "github.com/adyen/adyen-go-api-library/v2/src/notification" + "github.com/adyen/adyen-go-api-library/v3/src/notification" ) // CalculateHmac calculates the SHA-256 HMAC for the given data and key diff --git a/src/hmacvalidator/hmacvalidator_test.go b/src/hmacvalidator/hmacvalidator_test.go index 101cd46e6..a18089d41 100644 --- a/src/hmacvalidator/hmacvalidator_test.go +++ b/src/hmacvalidator/hmacvalidator_test.go @@ -4,7 +4,7 @@ import ( "testing" "time" - "github.com/adyen/adyen-go-api-library/v2/src/notification" + "github.com/adyen/adyen-go-api-library/v3/src/notification" "github.com/stretchr/testify/assert" ) diff --git a/src/notification/notification_handler.go b/src/notification/notification_handler.go index 7a9654958..a2fa04144 100644 --- a/src/notification/notification_handler.go +++ b/src/notification/notification_handler.go @@ -3,7 +3,7 @@ package notification import ( "encoding/json" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) // NotificationService used to namespace this util under the client for consistency and for future prooffing if this ever requires api access diff --git a/src/payments/api_default.go b/src/payments/api_default.go index ff0d5f465..3a7bc461f 100644 --- a/src/payments/api_default.go +++ b/src/payments/api_default.go @@ -14,7 +14,7 @@ import ( _context "context" _nethttp "net/http" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) // Payments Payments service diff --git a/src/payments/model_payment_result.go b/src/payments/model_payment_result.go index f4bcdc0a5..8f4c8d0e2 100644 --- a/src/payments/model_payment_result.go +++ b/src/payments/model_payment_result.go @@ -10,7 +10,7 @@ package payments -import "github.com/adyen/adyen-go-api-library/v2/src/common" +import "github.com/adyen/adyen-go-api-library/v3/src/common" // PaymentResult struct for PaymentResult type PaymentResult struct { diff --git a/src/payouts/api_default.go b/src/payouts/api_default.go index fa9196047..3519169a5 100644 --- a/src/payouts/api_default.go +++ b/src/payouts/api_default.go @@ -14,7 +14,7 @@ import ( _context "context" _nethttp "net/http" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) // Payouts Payouts service diff --git a/src/payouts/model_payout_response.go b/src/payouts/model_payout_response.go index 8790fec85..8c9bcbc8a 100644 --- a/src/payouts/model_payout_response.go +++ b/src/payouts/model_payout_response.go @@ -10,7 +10,7 @@ package payouts -import "github.com/adyen/adyen-go-api-library/v2/src/common" +import "github.com/adyen/adyen-go-api-library/v3/src/common" // PayoutResponse struct for PayoutResponse type PayoutResponse struct { diff --git a/src/platformsaccount/api_default.go b/src/platformsaccount/api_default.go index 080e43286..a76e3d6fc 100644 --- a/src/platformsaccount/api_default.go +++ b/src/platformsaccount/api_default.go @@ -14,7 +14,7 @@ import ( _context "context" _nethttp "net/http" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) // PlatformsAccount PlatformsAccount service diff --git a/src/platformsfund/api_default.go b/src/platformsfund/api_default.go index 9b304c85f..60c4e646f 100644 --- a/src/platformsfund/api_default.go +++ b/src/platformsfund/api_default.go @@ -14,7 +14,7 @@ import ( _context "context" _nethttp "net/http" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) // PlatformsFund PlatformsFund service diff --git a/src/platformshostedonboardingpage/api_default.go b/src/platformshostedonboardingpage/api_default.go index 6881dc6f8..fe86ff34e 100644 --- a/src/platformshostedonboardingpage/api_default.go +++ b/src/platformshostedonboardingpage/api_default.go @@ -14,7 +14,7 @@ import ( _context "context" _nethttp "net/http" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) // PlatformsHostedOnboardingPage PlatformsHostedOnboardingPage service diff --git a/src/platformsnotificationconfiguration/api_default.go b/src/platformsnotificationconfiguration/api_default.go index 67b4178f1..1c98e02d4 100644 --- a/src/platformsnotificationconfiguration/api_default.go +++ b/src/platformsnotificationconfiguration/api_default.go @@ -14,7 +14,7 @@ import ( _context "context" _nethttp "net/http" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) // PlatformsNotificationConfiguration PlatformsNotificationConfiguration service diff --git a/src/recurring/api_default.go b/src/recurring/api_default.go index aee359e2a..fe5efcd7c 100644 --- a/src/recurring/api_default.go +++ b/src/recurring/api_default.go @@ -14,7 +14,7 @@ import ( _context "context" _nethttp "net/http" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) // Recurring Recurring service diff --git a/templates/go/api.mustache b/templates/go/api.mustache index 9666855cd..27105b591 100644 --- a/templates/go/api.mustache +++ b/templates/go/api.mustache @@ -8,7 +8,7 @@ import ( _context "context" _nethttp "net/http" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/common" ) // {{packageName}} {{packageName}} service diff --git a/tests/binlookup_test.go b/tests/binlookup_test.go index d25ece82e..47b4984f4 100644 --- a/tests/binlookup_test.go +++ b/tests/binlookup_test.go @@ -10,9 +10,9 @@ import ( "os" "testing" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" - "github.com/adyen/adyen-go-api-library/v2/src/binlookup" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/binlookup" + "github.com/adyen/adyen-go-api-library/v3/src/common" "github.com/joho/godotenv" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/tests/checkout_test.go b/tests/checkout_test.go index c5b0eb08b..e282a00e5 100644 --- a/tests/checkout_test.go +++ b/tests/checkout_test.go @@ -14,9 +14,9 @@ import ( "github.com/google/uuid" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" - "github.com/adyen/adyen-go-api-library/v2/src/checkout" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/checkout" + "github.com/adyen/adyen-go-api-library/v3/src/common" "github.com/joho/godotenv" diff --git a/tests/checkoutidempotency_test.go b/tests/checkoutidempotency_test.go index e8432a925..4bd6d56f0 100644 --- a/tests/checkoutidempotency_test.go +++ b/tests/checkoutidempotency_test.go @@ -11,9 +11,9 @@ import ( "testing" "time" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" - "github.com/adyen/adyen-go-api-library/v2/src/checkout" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/checkout" + "github.com/adyen/adyen-go-api-library/v3/src/common" "github.com/google/uuid" "github.com/stretchr/testify/require" ) diff --git a/tests/checkoututility_test.go b/tests/checkoututility_test.go index c428262cf..1c1c5e953 100644 --- a/tests/checkoututility_test.go +++ b/tests/checkoututility_test.go @@ -11,9 +11,9 @@ import ( "strings" "testing" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" - "github.com/adyen/adyen-go-api-library/v2/src/checkoututility" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/checkoututility" + "github.com/adyen/adyen-go-api-library/v3/src/common" "github.com/joho/godotenv" "github.com/stretchr/testify/assert" diff --git a/tests/notification_handler_test.go b/tests/notification_handler_test.go index a79f4c69a..cc03a1beb 100644 --- a/tests/notification_handler_test.go +++ b/tests/notification_handler_test.go @@ -6,9 +6,9 @@ import ( "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" - "github.com/adyen/adyen-go-api-library/v2/src/common" - "github.com/adyen/adyen-go-api-library/v2/src/notification" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/notification" ) func TestNotificationService_HandleNotificationRequest(t *testing.T) { diff --git a/tests/payment_test.go b/tests/payment_test.go index ff945658f..4d4f4202a 100644 --- a/tests/payment_test.go +++ b/tests/payment_test.go @@ -6,9 +6,9 @@ import ( "testing" "time" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" - "github.com/adyen/adyen-go-api-library/v2/src/common" - "github.com/adyen/adyen-go-api-library/v2/src/payments" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/payments" "github.com/joho/godotenv" "github.com/stretchr/testify/assert" "github.com/stretchr/testify/require" diff --git a/tests/payouts_test.go b/tests/payouts_test.go index 3fc8dbc5b..aba02e0dc 100644 --- a/tests/payouts_test.go +++ b/tests/payouts_test.go @@ -13,10 +13,10 @@ import ( "testing" "time" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" - "github.com/adyen/adyen-go-api-library/v2/src/checkout" - "github.com/adyen/adyen-go-api-library/v2/src/common" - "github.com/adyen/adyen-go-api-library/v2/src/payouts" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/checkout" + "github.com/adyen/adyen-go-api-library/v3/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/payouts" "github.com/joho/godotenv" "github.com/stretchr/testify/assert" diff --git a/tests/platforms_test.go b/tests/platforms_test.go index dd533bb58..c5501859d 100644 --- a/tests/platforms_test.go +++ b/tests/platforms_test.go @@ -15,11 +15,11 @@ import ( "os" "testing" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" - "github.com/adyen/adyen-go-api-library/v2/src/common" - "github.com/adyen/adyen-go-api-library/v2/src/platformsaccount" - "github.com/adyen/adyen-go-api-library/v2/src/platformsfund" - "github.com/adyen/adyen-go-api-library/v2/src/platformsnotificationconfiguration" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/platformsaccount" + "github.com/adyen/adyen-go-api-library/v3/src/platformsfund" + "github.com/adyen/adyen-go-api-library/v3/src/platformsnotificationconfiguration" "github.com/google/uuid" "github.com/joho/godotenv" "github.com/stretchr/testify/assert" diff --git a/tests/recurring_test.go b/tests/recurring_test.go index 16829938d..2d347de11 100644 --- a/tests/recurring_test.go +++ b/tests/recurring_test.go @@ -11,10 +11,10 @@ import ( "strings" "testing" - "github.com/adyen/adyen-go-api-library/v2/src/adyen" - "github.com/adyen/adyen-go-api-library/v2/src/common" + "github.com/adyen/adyen-go-api-library/v3/src/adyen" + "github.com/adyen/adyen-go-api-library/v3/src/common" - "github.com/adyen/adyen-go-api-library/v2/src/recurring" + "github.com/adyen/adyen-go-api-library/v3/src/recurring" "github.com/joho/godotenv" "github.com/stretchr/testify/assert"