Skip to content

Commit

Permalink
Merge pull request #106 from Adyen/develop
Browse files Browse the repository at this point in the history
Release v5.0.1
  • Loading branch information
deepu105 authored Mar 15, 2021
2 parents bf40f69 + d983eec commit dd32c9c
Show file tree
Hide file tree
Showing 17 changed files with 1,056 additions and 95 deletions.
35 changes: 18 additions & 17 deletions GENERATING_MODELS.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,11 @@ We use custom mustache templates to generate the open api client for the API spe

**Step 1**: Generate the the client for a Schema using open api Docker image or cli. Provide the following parameters

- `-i` path to open api spec yaml
- `-t` path to custom templates in `./templates/go`
- `-g` generator type `go`
- `-p packageName= <Api namespace in StartCase>`
- `-o` output path `./src/<Api namespace in lowercase>`
- `-i` path to open api spec yaml
- `-t` path to custom templates in `./templates/go`
- `-g` generator type `go`
- `-p packageName= <Api namespace in StartCase>`
- `-o` output path `./src/<Api namespace in lowercase>`

```
docker run --rm -v ${PWD}:/local openapitools/openapi-generator-cli generate \
Expand All @@ -32,16 +32,15 @@ openapi-generator-cli generate \

**Step 2**: Delete the following files/folders from `./src/<api package folder name in lowercase>`. If the foldername is not in lowercase, rename it

- `configuration.go`
- `client.go`
- `utils.go`
- `response.go`
- `travis.yml`
- `git_push.sh`
- `go.mod`
- `go.sum`
- `docs`

- `configuration.go`
- `client.go`
- `utils.go`
- `response.go`
- `travis.yml`
- `git_push.sh`
- `go.mod`
- `go.sum`
- `docs`

**Step 3**: Remove the HTTP method(Post, Get, Put, Patch) suffix on API endpoint methods (Regex to find them `([A-Z][a-zA-Z0-9]*)Post\(request`)

Expand Down Expand Up @@ -79,6 +78,8 @@ func NewClient(cfg *common.Config) *APIClient {

**Step 5**: Run `make run` or `go run main.go` and Fix any issues found

**Step 6**: Add tests for the new APIs created under `./src/<Api namespace in lowercase>`
**Step 6**: Change any model fields that have `anyof` or `oneof` fields to `interface{}` (if we have typed structs) or `map[string]interface{}` (if its a key value pair). If `interface{}` is used then make sure to add a custom `UnmarshalJSON` method on the structs with test cases. See `src/checkout/model_payment_response.go` for example

**Step 7**: Add tests for the new APIs created under `./src/<Api namespace in lowercase>`

**Step 7**: Run `make test` or `go test ./...` and Fix any issues found
**Step 8**: Run `make test` or `go test ./...` and Fix any issues found
17 changes: 17 additions & 0 deletions RELEASE_PROCESS.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
## Steps for Release of this library

Release is done on GitHub on the `master` branch all development is done on the `develop` branch only

**Step 1**: Update the exact library version to be released in `LibVersion` constant on `src/common/configuration.go`

**Step 2**: If a open-api spec update was done, make sure the to follow [GENERATING_MODELS.md](/GENERATING_MODELS.md) and make sure appropriate versions and URLS are updated on `src/adyen/api.go`

**Step 3**: Run `make build` to ensure there are no build errors

**Step 4**: For patch and minor version releases go to step 6, For major version releases go to step 5

**Step 5**: Find and replace `github.com/adyen/adyen-go-api-library/v<current major version>` with `github.com/adyen/adyen-go-api-library/v<new major version>` through out the project including test files and readme. For example `github.com/adyen/adyen-go-api-library/v5` will become `github.com/adyen/adyen-go-api-library/v6`

**Step 6**: create a PR form `develop` to `master` and wait for all tests to pass and for approvals

**Step 7**: once ready merge the PR to master and create a GitHub release with changelog and a new tag corresponding to the version
28 changes: 16 additions & 12 deletions src/adyen/api.go
Original file line number Diff line number Diff line change
Expand Up @@ -26,27 +26,31 @@ import (

// Constants used for the client API
const (
EndpointTest = "https://pal-test.adyen.com"
EndpointLive = "https://pal-live.adyen.com"
EndpointLiveSuffix = "-pal-live.adyenpayments.com"
MarketpayEndpointTest = "https://cal-test.adyen.com/cal/services"
MarketpayEndpointLive = "https://cal-live.adyen.com/cal/services"
EndpointTest = "https://pal-test.adyen.com"
EndpointLive = "https://pal-live.adyen.com"
EndpointLiveSuffix = "-pal-live.adyenpayments.com"
MarketpayEndpointTest = "https://cal-test.adyen.com/cal/services"
MarketpayEndpointLive = "https://cal-live.adyen.com/cal/services"
CheckoutEndpointTest = "https://checkout-test.adyen.com/checkout"
CheckoutEndpointLiveSuffix = "-checkout-live.adyenpayments.com/checkout"
BinLookupPalSuffix = "/pal/servlet/BinLookup/"
TerminalAPIEndpointTest = "https://terminal-api-test.adyen.com"
TerminalAPIEndpointLive = "https://terminal-api-live.adyen.com"
DisputesEndpointTest = "https://ca-test.adyen.com/ca/services/DisputeService"
DisputesEndpointLive = "https://ca-live.adyen.com/ca/services/DisputeService"
)

// also update LibVersion in src/common/configuration.go when a version is updated and a major lib version is released
const (
MarketpayAccountAPIVersion = "v6"
MarketpayFundAPIVersion = "v6"
MarketpayNotificationAPIVersion = "v6"
MarketpayHopAPIVersion = "v6"
PaymentAPIVersion = "v64"
RecurringAPIVersion = "v49"
CheckoutEndpointTest = "https://checkout-test.adyen.com/checkout"
CheckoutEndpointLiveSuffix = "-checkout-live.adyenpayments.com/checkout"
CheckoutAPIVersion = "v67"
BinLookupPalSuffix = "/pal/servlet/BinLookup/"
BinLookupAPIVersion = "v50"
TerminalAPIEndpointTest = "https://terminal-api-test.adyen.com"
TerminalAPIEndpointLive = "https://terminal-api-live.adyen.com"
EndpointProtocol = "https://"
DisputesEndpointTest = "https://ca-test.adyen.com/ca/services/DisputeService"
DisputesEndpointLive = "https://ca-live.adyen.com/ca/services/DisputeService"
DisputesAPIVersion = "v30"
)

Expand Down
11 changes: 7 additions & 4 deletions src/checkout/model_checkout_balance_check_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,17 +9,20 @@
*/

package checkout

import "github.com/adyen/adyen-go-api-library/v5/src/common"

// CheckoutBalanceCheckResponse struct for CheckoutBalanceCheckResponse
type CheckoutBalanceCheckResponse struct {
// This field contains additional data, which may be required to return in a particular payment response. To choose data fields to be returned, go to **Customer Area** > **Account** > **API URLs** > **Additional data settings**.
AdditionalData map[string]string `json:"additionalData,omitempty"`
Balance Amount `json:"balance"`
FraudResult *FraudResult `json:"fraudResult,omitempty"`
Balance Amount `json:"balance"`
FraudResult *FraudResult `json:"fraudResult,omitempty"`
// Adyen's 16-character string reference associated with the transaction/request. This value is globally unique; quote it when communicating with us about this request. > `pspReference` is returned only for non-redirect payment methods.
PspReference string `json:"pspReference,omitempty"`
// If the payment's authorisation is refused or an error occurs during authorisation, this field holds Adyen's mapped reason for the refusal or a description of the error. When a transaction fails, the authorisation response includes `resultCode` and `refusalReason` values. For more information, see [Refusal reasons](https://docs.adyen.com/development-resources/refusal-reasons).
RefusalReason string `json:"refusalReason,omitempty"`
// The result of the payment. For more information, see [Result codes](https://docs.adyen.com/online-payments/payment-result-codes). Possible values: * **AuthenticationFinished** – The payment has been successfully authenticated with 3D Secure 2. Returned for 3D Secure 2 authentication-only transactions. * **AuthenticationNotRequired** – The transaction does not require 3D Secure authentication. Returned for [standalone authentication-only integrations](https://docs.adyen.com/online-payments/3d-secure/other-3ds-flows/authentication-only). * **Authorised** – The payment was successfully authorised. This state serves as an indicator to proceed with the delivery of goods and services. This is a final state. * **Cancelled** – Indicates the payment has been cancelled (either by the shopper or the merchant) before processing was completed. This is a final state. * **ChallengeShopper** – The issuer requires further shopper interaction before the payment can be authenticated. Returned for 3D Secure 2 transactions. * **Error** – There was an error when the payment was being processed. The reason is given in the `refusalReason` field. This is a final state. * **IdentifyShopper** – The issuer requires the shopper's device fingerprint before the payment can be authenticated. Returned for 3D Secure 2 transactions. * **Pending** – Indicates that it is not possible to obtain the final status of the payment. This can happen if the systems providing final status information for the payment are unavailable, or if the shopper needs to take further action to complete the payment. * **PresentToShopper** – Indicates that the response contains additional information that you need to present to a shopper, so that they can use it to complete a payment. * **Received** – Indicates the payment has successfully been received by Adyen, and will be processed. This is the initial state for all payments. * **RedirectShopper** – Indicates the shopper should be redirected to an external web page or app to complete the authorisation. * **Refused** – Indicates the payment was refused. The reason is given in the `refusalReason` field. This is a final state.
ResultCode string `json:"resultCode,omitempty"`
TransactionLimit *Amount `json:"transactionLimit,omitempty"`
ResultCode *common.ResultCode `json:"resultCode,omitempty"`
TransactionLimit *Amount `json:"transactionLimit,omitempty"`
}
9 changes: 6 additions & 3 deletions src/checkout/model_checkout_create_order_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,23 @@
*/

package checkout

import "github.com/adyen/adyen-go-api-library/v5/src/common"

// CheckoutCreateOrderResponse struct for CheckoutCreateOrderResponse
type CheckoutCreateOrderResponse struct {
// This field contains additional data, which may be required to return in a particular payment response. To choose data fields to be returned, go to **Customer Area** > **Account** > **API URLs** > **Additional data settings**.
AdditionalData map[string]string `json:"additionalData,omitempty"`
// The date that the order will expire.
ExpiresAt string `json:"expiresAt"`
ExpiresAt string `json:"expiresAt"`
FraudResult *FraudResult `json:"fraudResult,omitempty"`
// The encrypted data that will be used by merchant for adding payments to the order.
OrderData string `json:"orderData"`
// Adyen's 16-character string reference associated with the transaction/request. This value is globally unique; quote it when communicating with us about this request. > `pspReference` is returned only for non-redirect payment methods.
PspReference string `json:"pspReference,omitempty"`
// If the payment's authorisation is refused or an error occurs during authorisation, this field holds Adyen's mapped reason for the refusal or a description of the error. When a transaction fails, the authorisation response includes `resultCode` and `refusalReason` values. For more information, see [Refusal reasons](https://docs.adyen.com/development-resources/refusal-reasons).
RefusalReason string `json:"refusalReason,omitempty"`
RefusalReason string `json:"refusalReason,omitempty"`
RemainingAmount Amount `json:"remainingAmount"`
// The result of the payment. For more information, see [Result codes](https://docs.adyen.com/online-payments/payment-result-codes). Possible values: * **AuthenticationFinished** – The payment has been successfully authenticated with 3D Secure 2. Returned for 3D Secure 2 authentication-only transactions. * **AuthenticationNotRequired** – The transaction does not require 3D Secure authentication. Returned for [standalone authentication-only integrations](https://docs.adyen.com/online-payments/3d-secure/other-3ds-flows/authentication-only). * **Authorised** – The payment was successfully authorised. This state serves as an indicator to proceed with the delivery of goods and services. This is a final state. * **Cancelled** – Indicates the payment has been cancelled (either by the shopper or the merchant) before processing was completed. This is a final state. * **ChallengeShopper** – The issuer requires further shopper interaction before the payment can be authenticated. Returned for 3D Secure 2 transactions. * **Error** – There was an error when the payment was being processed. The reason is given in the `refusalReason` field. This is a final state. * **IdentifyShopper** – The issuer requires the shopper's device fingerprint before the payment can be authenticated. Returned for 3D Secure 2 transactions. * **Pending** – Indicates that it is not possible to obtain the final status of the payment. This can happen if the systems providing final status information for the payment are unavailable, or if the shopper needs to take further action to complete the payment. * **PresentToShopper** – Indicates that the response contains additional information that you need to present to a shopper, so that they can use it to complete a payment. * **Received** – Indicates the payment has successfully been received by Adyen, and will be processed. This is the initial state for all payments. * **RedirectShopper** – Indicates the shopper should be redirected to an external web page or app to complete the authorisation. * **Refused** – Indicates the payment was refused. The reason is given in the `refusalReason` field. This is a final state.
ResultCode string `json:"resultCode,omitempty"`
ResultCode *common.ResultCode `json:"resultCode,omitempty"`
}
16 changes: 10 additions & 6 deletions src/checkout/model_payment_details_response.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,24 +9,28 @@
*/

package checkout

import "github.com/adyen/adyen-go-api-library/v5/src/common"

// PaymentDetailsResponse struct for PaymentDetailsResponse
type PaymentDetailsResponse struct {
// This field contains additional data, which may be required to return in a particular payment response. To choose data fields to be returned, go to **Customer Area** > **Account** > **API URLs** > **Additional data settings**.
AdditionalData map[string]string `json:"additionalData,omitempty"`
Amount *Amount `json:"amount,omitempty"`
Amount *Amount `json:"amount,omitempty"`
// Donation Token containing payment details for Adyen Giving.
DonationToken string `json:"donationToken,omitempty"`
FraudResult *FraudResult `json:"fraudResult,omitempty"`
DonationToken string `json:"donationToken,omitempty"`
FraudResult *FraudResult `json:"fraudResult,omitempty"`
// The reference to uniquely identify a payment. This reference is used in all communication with you about the payment status. We recommend using a unique value per payment; however, it is not a requirement. If you need to provide multiple references for a transaction, separate them with hyphens (\"-\"). Maximum length: 80 characters.
MerchantReference string `json:"merchantReference,omitempty"`
Order *CheckoutOrderResponse `json:"order,omitempty"`
MerchantReference string `json:"merchantReference,omitempty"`
Order *CheckoutOrderResponse `json:"order,omitempty"`
// Adyen's 16-character string reference associated with the transaction/request. This value is globally unique; quote it when communicating with us about this request. > `pspReference` is returned only for non-redirect payment methods.
PspReference string `json:"pspReference,omitempty"`
// If the payment's authorisation is refused or an error occurs during authorisation, this field holds Adyen's mapped reason for the refusal or a description of the error. When a transaction fails, the authorisation response includes `resultCode` and `refusalReason` values. For more information, see [Refusal reasons](https://docs.adyen.com/development-resources/refusal-reasons).
RefusalReason string `json:"refusalReason,omitempty"`
// Code that specifies the refusal reason. For more information, see [Authorisation refusal reasons](https://docs.adyen.com/development-resources/refusal-reasons).
RefusalReasonCode string `json:"refusalReasonCode,omitempty"`
// The result of the payment. For more information, see [Result codes](https://docs.adyen.com/online-payments/payment-result-codes). Possible values: * **AuthenticationFinished** – The payment has been successfully authenticated with 3D Secure 2. Returned for 3D Secure 2 authentication-only transactions. * **AuthenticationNotRequired** – The transaction does not require 3D Secure authentication. Returned for [standalone authentication-only integrations](https://docs.adyen.com/online-payments/3d-secure/other-3ds-flows/authentication-only). * **Authorised** – The payment was successfully authorised. This state serves as an indicator to proceed with the delivery of goods and services. This is a final state. * **Cancelled** – Indicates the payment has been cancelled (either by the shopper or the merchant) before processing was completed. This is a final state. * **ChallengeShopper** – The issuer requires further shopper interaction before the payment can be authenticated. Returned for 3D Secure 2 transactions. * **Error** – There was an error when the payment was being processed. The reason is given in the `refusalReason` field. This is a final state. * **IdentifyShopper** – The issuer requires the shopper's device fingerprint before the payment can be authenticated. Returned for 3D Secure 2 transactions. * **Pending** – Indicates that it is not possible to obtain the final status of the payment. This can happen if the systems providing final status information for the payment are unavailable, or if the shopper needs to take further action to complete the payment. * **PresentToShopper** – Indicates that the response contains additional information that you need to present to a shopper, so that they can use it to complete a payment. * **Received** – Indicates the payment has successfully been received by Adyen, and will be processed. This is the initial state for all payments. * **RedirectShopper** – Indicates the shopper should be redirected to an external web page or app to complete the authorisation. * **Refused** – Indicates the payment was refused. The reason is given in the `refusalReason` field. This is a final state.
ResultCode string `json:"resultCode,omitempty"`
ResultCode *common.ResultCode `json:"resultCode,omitempty"`

ThreeDS2Result *ThreeDS2Result `json:"threeDS2Result,omitempty"`
}
Loading

0 comments on commit dd32c9c

Please sign in to comment.