Skip to content

Commit

Permalink
Data Protection API (#239)
Browse files Browse the repository at this point in the history
* Data Protection API

* Update Readme.md
  • Loading branch information
michaelpaul authored Aug 29, 2023
1 parent 967b6c6 commit f938d21
Show file tree
Hide file tree
Showing 10 changed files with 810 additions and 16 deletions.
4 changes: 3 additions & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ openapi-generator-cli:=java -jar $(openapi-generator-jar)
goimports:=$(shell go env GOPATH)/bin/goimports

generator:=go
services:=balancecontrol balanceplatform acswebhook configurationwebhook reportwebhook transferwebhook binlookup checkout legalentity management managementwebhook payments payout posterminalmanagement recurring storedvalue transfers
services:=balancecontrol balanceplatform acswebhook configurationwebhook reportwebhook transferwebhook binlookup checkout legalentity management managementwebhook payments payout posterminalmanagement recurring storedvalue transfers dataprotection
output:=src
templates:=templates/custom

Expand Down Expand Up @@ -56,6 +56,8 @@ management: hasRestServiceError=true
managementwebhook: spec=ManagementNotificationService-v1
posterminalmanagement: spec=TfmAPIService-v1
posterminalmanagement: serviceName=PosTerminalManagementApi
dataprotection: spec=DataProtectionService-v1
dataprotection: serviceName=DataProtection

# Generate a full client (models and service classes)
$(services): schema $(openapi-generator-jar) $(goimports)
Expand Down
31 changes: 16 additions & 15 deletions Readme.md

Large diffs are not rendered by default.

19 changes: 19 additions & 0 deletions src/adyen/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,7 @@ package adyen

import (
"fmt"
"github.com/adyen/adyen-go-api-library/v7/src/dataprotection"
"net/http"

"github.com/adyen/adyen-go-api-library/v7/src/balancecontrol"
Expand Down Expand Up @@ -53,6 +54,8 @@ const (
LegalEntityEntityLive = "https://kyc-live.adyen.com/lem"
PosTerminalManagementEndpointTest = "https://postfmapi-test.adyen.com/postfmapi/terminal"
PosTerminalManagementEndpointLive = "https://postfmapi-live.adyen.com/postfmapi/terminal"
DataProtectionEndpointTest = "https://ca-test.adyen.com/ca/services/DataProtectionService"
DataProtectionEndpointLive = "https://ca-live.adyen.com/ca/services/DataProtectionService"
)

// also update LibVersion in src/common/configuration.go when a version is updated and a major lib version is released
Expand All @@ -74,6 +77,7 @@ const (
ManagementAPIVersion = "v1"
LegalEntityAPIVersion = "v3"
PosTerminalManagementAPIVersion = "v1"
DataProtectionAPIVersion = "v1"
)

// APIClient Manages access to Adyen API services.
Expand Down Expand Up @@ -102,6 +106,7 @@ type APIClient struct {
transfers *transfers.APIClient
management *management.APIClient
legalEntity *legalentity.APIClient
dataProtection *dataprotection.GeneralApi
}

// NewClient creates a new API client. Requires Config object.
Expand Down Expand Up @@ -368,6 +373,18 @@ func (c *APIClient) PlatformsNotificationConfiguration() *platformsnotificationc
return c.platformsNotificationConfiguration
}

func (c *APIClient) DataProtection() *dataprotection.GeneralApi {
if c.dataProtection == nil {
c.dataProtection = &dataprotection.GeneralApi{
Client: c.client,
BasePath: func() string {
return fmt.Sprintf("%s/%s", c.client.Cfg.DataProtectionEndpoint, DataProtectionAPIVersion)
},
}
}
return c.dataProtection
}

/*
SetEnvironment This defines the payment environment for live or test
Expand All @@ -392,6 +409,7 @@ func (c *APIClient) SetEnvironment(env common.Environment, liveEndpointURLPrefix
c.client.Cfg.ManagementEndpoint = ManagementEndpointLive
c.client.Cfg.LegalEntityEndpoint = LegalEntityEntityLive
c.client.Cfg.PosTerminalManagementEndpoint = PosTerminalManagementEndpointLive
c.client.Cfg.DataProtectionEndpoint = DataProtectionEndpointLive
} else {
c.client.Cfg.Environment = env
c.client.Cfg.Endpoint = EndpointTest
Expand All @@ -404,6 +422,7 @@ func (c *APIClient) SetEnvironment(env common.Environment, liveEndpointURLPrefix
c.client.Cfg.ManagementEndpoint = ManagementEndpointTest
c.client.Cfg.LegalEntityEndpoint = LegalEntityEntityTest
c.client.Cfg.PosTerminalManagementEndpoint = PosTerminalManagementEndpointTest
c.client.Cfg.DataProtectionEndpoint = DataProtectionEndpointTest
}

c.client.Cfg.CheckoutEndpoint += "/" + CheckoutAPIVersion
Expand Down
1 change: 1 addition & 0 deletions src/common/configuration.go
Original file line number Diff line number Diff line change
Expand Up @@ -71,6 +71,7 @@ type Config struct {
LegalEntityEndpoint string `json:"legalEntityEndpoint,omitempty"`
TransfersEndpoint string `json:"transfersEndpoint,omitempty"`
PosTerminalManagementEndpoint string `json:"posTerminalManagementEndpoint,omitempty"`
DataProtectionEndpoint string `json:"dataProtectionEndpoint,omitempty"`

//Checkout Specific
CheckoutEndpoint string `json:"checkoutEndpoint,omitempty"`
Expand Down
4 changes: 4 additions & 0 deletions src/dataprotection/.openapi-generator-ignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# OpenAPI Generator Ignore

# Single class service does not need an "index" to group multiple tags
client.go
67 changes: 67 additions & 0 deletions src/dataprotection/api_general.go

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

Loading

0 comments on commit f938d21

Please sign in to comment.