Repository: VictorAvelar/mollie-api-go
Pull request #168 (2022-01-29 11:42:36)

Fix most of the errors reported by @golangci-lint
<!--- Provide a general summary of your changes in the Title above -->

## Description

Fix most of the reported @golanci-lint errors.

## Motivation and context

It increases the code base quality.

## How has this been tested?

All the existing tests were refactored to comply with the additions. 

Ex. All the errors from third party libraries are now wrapped and thus the tests needed to be fixed to accept wrapped errors instead of std errors.

## Types of changes

What types of changes does your code introduce? Put an `x` in all the boxes that apply:
- [ ] Bug fix (non-breaking change which fixes an issue)
- [ ] New feature (non-breaking change which adds functionality)
- [ ] Breaking change (fix or feature that would cause existing functionality to change)
- [x] Housekeeping

## Checklist:

Go over all the following points, and put an `x` in all the boxes that apply.

Please, please, please, don't send your pull request until all of the boxes are ticked. Once your pull request is created, it will trigger a build on our continuous integration server to make sure your [tests and code style pass](https://help.github.com/articles/about-required-status-checks/).

- [x] I have read the **[CONTRIBUTING](CONTRIBUTING.md)** document.
- [x] My pull request addresses exactly one patch/feature.
- [x] I have created a branch for this patch/feature.
- [x] Each individual commit in the pull request is meaningful.
- [x] I have added tests to cover my changes.
- [x] If my change requires a change to the documentation, I have updated it accordingly.



Patch:
diff --git a/go.mod b/go.mod
index 6746878..5db6c0a 100644
--- a/go.mod
+++ b/go.mod
@@ -12,8 +12,8 @@ require (
 	github.com/davecgh/go-spew v1.1.1 // indirect
 	github.com/golang/protobuf v1.5.2 // indirect
 	github.com/pmezard/go-difflib v1.0.0 // indirect
-	golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c // indirect
+	golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd // indirect
 	google.golang.org/appengine v1.6.7 // indirect
 	google.golang.org/protobuf v1.27.1 // indirect
-	gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c // indirect
+	gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b // indirect
 )
diff --git a/go.sum b/go.sum
index 6c7b40d..fbd60b9 100644
--- a/go.sum
+++ b/go.sum
@@ -190,8 +190,8 @@ golang.org/x/net v0.0.0-20200520182314-0ba52f642ac2/go.mod h1:qpuaurCH72eLCgpAm/
 golang.org/x/net v0.0.0-20200625001655-4c5254603344/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
 golang.org/x/net v0.0.0-20200707034311-ab3426394381/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
 golang.org/x/net v0.0.0-20200822124328-c89045814202/go.mod h1:/O7V0waA8r7cgGh81Ro3o1hOxt32SMVPicZroKQ2sZA=
-golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c h1:WtYZ93XtWSO5KlOMgPZu7hXY9WhMZpprvlm5VwvAl8c=
-golang.org/x/net v0.0.0-20211201190559-0a0e4e1bb54c/go.mod h1:9nx3DQGgdP8bBQD5qxJ1jj9UTztislL4KSBs9R2vV5Y=
+golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd h1:O7DYs+zxREGLKzKoMQrtrEacpb0ZVXA5rIwylE2Xchk=
+golang.org/x/net v0.0.0-20220127200216-cd36cc0744dd/go.mod h1:CfG3xpIq0wQ8r1q4Su4UZFWDARRcnwPjda9FqA0JpMk=
 golang.org/x/oauth2 v0.0.0-20180821212333-d2e6202438be/go.mod h1:N/0e6XlmueqKjAGxoOufVs8QHGRruUQn6yWY3a++T0U=
 golang.org/x/oauth2 v0.0.0-20190226205417-e64efc72b421/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
 golang.org/x/oauth2 v0.0.0-20190604053449-0f29369cfe45/go.mod h1:gOpvHmFTYa4IltrdGE7lF6nIHvwfUNPOp7c8zoXwtLw=
@@ -232,15 +232,15 @@ golang.org/x/sys v0.0.0-20200511232937-7e40ca221e25/go.mod h1:h1NjWce9XRLGQEsW7w
 golang.org/x/sys v0.0.0-20200515095857-1151b9dac4a9/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20200523222454-059865788121/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
 golang.org/x/sys v0.0.0-20200803210538-64077c9b5642/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20201119102817-f84b799fce68/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/sys v0.0.0-20210423082822-04245dca01da/go.mod h1:h1NjWce9XRLGQEsW7wpKNCjG9DtNlClVuFLEZdDNbEs=
-golang.org/x/term v0.0.0-20201126162022-7de9c90e9dd1/go.mod h1:bj7SfCRtBDWHUb9snDiAeCFNEtKQo2Wmx5Cou7ajbmo=
+golang.org/x/sys v0.0.0-20210615035016-665e8c7367d1/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/sys v0.0.0-20211216021012-1d35b9e2eb4e/go.mod h1:oPkhp1MJrh7nUepCBck5+mAzfO9JrbApNNgaTdGDITg=
+golang.org/x/term v0.0.0-20210927222741-03fcf44c2211/go.mod h1:jbD1KX2456YbFQfuXm/mYQcufACuNUgVhRMnK/tPxf8=
 golang.org/x/text v0.0.0-20170915032832-14c0d48ead0c/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.0/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.1-0.20180807135948-17ff2d5776d2/go.mod h1:NqM8EUOU14njkJ3fqMW+pc6Ldnwhi/IjpwHt7yyuwOQ=
 golang.org/x/text v0.3.2/go.mod h1:bEr9sfX3Q8Zfm5fL9x+3itogRgK3+ptLWKqgva+5dAk=
 golang.org/x/text v0.3.3/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
-golang.org/x/text v0.3.6/go.mod h1:5Zoc/QRtKVWzQhOtBMvqHzDpF6irO9z98xDceosuGiQ=
+golang.org/x/text v0.3.7/go.mod h1:u+2+/6zg+i71rQMx5EYifcz6MCKuco9NR6JIITiCfzQ=
 golang.org/x/time v0.0.0-20181108054448-85acf8d2951c/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20190308202827-9d24e82272b4/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
 golang.org/x/time v0.0.0-20191024005414-555d28b269f0/go.mod h1:tRJNPiyCQ0inRvYxbN9jk5I+vvW/OXSQhTDSoE431IQ=
@@ -373,8 +373,9 @@ gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127 h1:qIbj1fsPNlZgppZ+VLlY7N33
 gopkg.in/check.v1 v1.0.0-20180628173108-788fd7840127/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
 gopkg.in/errgo.v2 v2.1.0/go.mod h1:hNsd1EY+bozCKY1Ytp96fpM3vjJbqLJn88ws8XvfDNI=
 gopkg.in/yaml.v2 v2.2.2/go.mod h1:hI93XBmqTisBFMUTm0b8Fm+jr3Dg1NNxqwp+5A1VGuI=
-gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c h1:dUUwHk2QECo/6vqA44rthZ8ie2QXMNeKRTHCNY2nXvo=
 gopkg.in/yaml.v3 v3.0.0-20200313102051-9f266ea9e77c/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
+gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b h1:h8qDotaEPuJATrMmW04NCwg7v22aHH28wwpauUhK9Oo=
+gopkg.in/yaml.v3 v3.0.0-20210107192922-496545a6307b/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
 honnef.co/go/tools v0.0.0-20190102054323-c2f93a96b099/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190106161140-3f1c8253044a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
 honnef.co/go/tools v0.0.0-20190418001031-e561f6794a2a/go.mod h1:rf3lG4BRIbNafJWhAfAdb/ePZxsR/4RtNHQocxwk9r4=
diff --git a/mollie/captures.go b/mollie/captures.go
index f30eb21..d069c45 100644
--- a/mollie/captures.go
+++ b/mollie/captures.go
@@ -7,10 +7,10 @@ import (
 	"time"
 )
 
-// CapturesService operates over captures resource
+// CapturesService operates over captures resource.
 type CapturesService service
 
-// CaptureLinks contains relevant links for a capture object
+// CaptureLinks contains relevant links for a capture object.
 type CaptureLinks struct {
 	Self          *URL `json:"self,omitempty"`
 	Payment       *URL `json:"payment,omitempty"`
@@ -19,8 +19,8 @@ type CaptureLinks struct {
 	Documentation *URL `json:"documentation,omitempty"`
 }
 
-// Capture describes a single capture
-// Captures are used for payments that have the authorize-then-capture flow
+// Capture describes a single capture.
+// Captures are used for payments that have the authorize-then-capture flow.
 type Capture struct {
 	Resource         string       `json:"resource,omitempty"`
 	ID               string       `json:"id,omitempty"`
@@ -31,10 +31,10 @@ type Capture struct {
 	ShipmentID       string       `json:"shipmentId,omitempty"`
 	SettlementID     string       `json:"settlementId,omitempty"`
 	CreatedAt        *time.Time   `json:"createdAt,omitempty"`
-	Links            CaptureLinks `json:"links,omitempty"`
+	Links            CaptureLinks `json:"_links,omitempty"`
 }
 
-// CapturesList describes a list of captures
+// CapturesList describes a list of captures.
 type CapturesList struct {
 	Count    int `json:"count,omitempty"`
 	Embedded struct {
@@ -49,6 +49,7 @@ type CapturesList struct {
 // See: https://docs.mollie.com/reference/v2/captures-api/get-capture
 func (cs *CapturesService) Get(ctx context.Context, payment, capture string) (res *Response, c *Capture, err error) {
 	u := fmt.Sprintf("v2/payments/%s/captures/%s", payment, capture)
+
 	res, err = cs.client.get(ctx, u, nil)
 	if err != nil {
 		return
@@ -61,11 +62,12 @@ func (cs *CapturesService) Get(ctx context.Context, payment, capture string) (re
 	return
 }
 
-// List retrieves all captures for a certain payment
+// List retrieves all captures for a certain payment.
 //
 // See: https://docs.mollie.com/reference/v2/captures-api/list-captures
 func (cs *CapturesService) List(ctx context.Context, payment string) (res *Response, cl *CapturesList, err error) {
 	u := fmt.Sprintf("v2/payments/%s/captures", payment)
+
 	res, err = cs.client.get(ctx, u, nil)
 	if err != nil {
 		return
diff --git a/mollie/chargebacks.go b/mollie/chargebacks.go
index d641743..400c686 100644
--- a/mollie/chargebacks.go
+++ b/mollie/chargebacks.go
@@ -7,7 +7,7 @@ import (
 	"time"
 )
 
-// Chargeback describes a forced transaction reversal initiated by the cardholder's bank
+// Chargeback describes a forced transaction reversal initiated by the cardholder's bank.
 type Chargeback struct {
 	Resource         string          `json:"resource,omitempty"`
 	ID               string          `json:"id,omitempty"`
@@ -57,9 +57,10 @@ type ChargebacksService service
 // Note the original payment’s ID is needed as well.
 //
 // See: https://docs.mollie.com/reference/v2/chargebacks-api/get-chargeback
-func (cs *ChargebacksService) Get(ctx context.Context, payment, chargeback string, options *ChargebackOptions) (res *Response, p *Chargeback, err error) {
+func (cs *ChargebacksService) Get(ctx context.Context, payment, chargeback string, opts *ChargebackOptions) (res *Response, p *Chargeback, err error) {
 	u := fmt.Sprintf("v2/payments/%s/chargebacks/%s", payment, chargeback)
-	res, err = cs.client.get(ctx, u, options)
+
+	res, err = cs.client.get(ctx, u, opts)
 	if err != nil {
 		return
 	}
@@ -85,7 +86,7 @@ func (cs *ChargebacksService) ListForPayment(ctx context.Context, payment string
 	return cs.list(ctx, fmt.Sprintf("v2/payments/%s/chargebacks", payment), options)
 }
 
-// encapsulates the shared list methods logic
+// encapsulates the shared list methods logic.
 func (cs *ChargebacksService) list(ctx context.Context, uri string, options interface{}) (res *Response, cl *ChargebacksList, err error) {
 	res, err = cs.client.get(ctx, uri, options)
 	if err != nil {
diff --git a/mollie/common_types.go b/mollie/common_types.go
index de4905e..268c271 100644
--- a/mollie/common_types.go
+++ b/mollie/common_types.go
@@ -2,6 +2,7 @@ package mollie
 
 import (
 	"encoding/json"
+	"fmt"
 	"strings"
 	"time"
 )
@@ -36,7 +37,12 @@ type ShortDate struct {
 // MarshalJSON overrides the default marshal action
 // for the Date struct. Returns date as YYYY-MM-DD formatted string.
 func (d *ShortDate) MarshalJSON() ([]byte, error) {
-	return json.Marshal(d.Time.Format("2006-01-02"))
+	bts, err := json.Marshal(d.Time.Format("2006-01-02"))
+	if err != nil {
+		return nil, fmt.Errorf("json_marshall_error: %w", err)
+	}
+
+	return bts, nil
 }
 
 // UnmarshalJSON overrides the default unmarshal action
@@ -44,18 +50,21 @@ func (d *ShortDate) MarshalJSON() ([]byte, error) {
 func (d *ShortDate) UnmarshalJSON(b []byte) error {
 	s := string(b)
 	s = strings.Trim(s, "\"")
-	t, err := time.Parse("2006-01-02", s)
+	date, err := time.Parse("2006-01-02", s)
+
 	if err != nil {
-		return err
+		return fmt.Errorf("time_parse_error: %w", err)
 	}
-	d.Time = t
+
+	d.Time = date
+
 	return nil
 }
 
 // Locale represents a country and language in ISO-15897 format.
 type Locale string
 
-// Mollie supported locales
+// Mollie supported locales.
 const (
 	English       Locale = "en_US"
 	Dutch         Locale = "nl_NL"
@@ -104,10 +113,10 @@ type PaginationLinks struct {
 	Documentation URL `json:"documentation,omitempty"`
 }
 
-// CategoryCode specifies an industry or category
+// CategoryCode specifies an industry or category.
 type CategoryCode uint
 
-// Available category codes
+// Available category codes.
 const (
 	BookMagazinesAndNewspapers          CategoryCode = 5192
 	GeneralMerchandise                  CategoryCode = 5399
@@ -135,7 +144,7 @@ const (
 // Mode contains information about the creation environment.
 type Mode string
 
-// Valid modes
+// Valid modes.
 const (
 	LiveMode Mode = "live"
 	TestMode Mode = "test"
diff --git a/mollie/connect/oauth2.go b/mollie/connect/oauth2.go
index 673e789..6a99fbe 100644
--- a/mollie/connect/oauth2.go
+++ b/mollie/connect/oauth2.go
@@ -4,15 +4,17 @@ import (
 	"golang.org/x/oauth2"
 )
 
-// Mollie's Oauth2 server URLs
+// Mollie's Oauth2 server URLs.
 const (
-	AuthURL   = "https://www.mollie.com/oauth2/authorize"
-	TokensURL = "https://api.mollie.com/oauth2/tokens"
+	authURL   = "https://www.mollie.com/oauth2/authorize"
+	tokensURL = "https://api.mollie.com/oauth2/tokens"
 )
 
-// Endpoint is Mollies's OAuth 2.0 endpoint.
-var Endpoint = oauth2.Endpoint{
-	AuthURL:   AuthURL,
-	TokenURL:  TokensURL,
-	AuthStyle: 0,
+// OauthEndpoint is Mollies's OAuth 2.0 endpoint.
+func OauthEndpoint() *oauth2.Endpoint {
+	return &oauth2.Endpoint{
+		AuthURL:   authURL,
+		TokenURL:  tokensURL,
+		AuthStyle: 0,
+	}
 }
diff --git a/mollie/customers.go b/mollie/customers.go
index b6d63d5..e2cd6f4 100644
--- a/mollie/customers.go
+++ b/mollie/customers.go
@@ -7,10 +7,10 @@ import (
 	"time"
 )
 
-// CustomersService operates over the customer resource
+// CustomersService operates over the customer resource.
 type CustomersService service
 
-// CustomerLinks contains the HAL resources for a customer response
+// CustomerLinks contains the HAL resources for a customer response.
 type CustomerLinks struct {
 	Self          *URL `json:"self,omitempty"`
 	Mandates      *URL `json:"mandates,omitempty"`
@@ -20,7 +20,7 @@ type CustomerLinks struct {
 	Dashboard     *URL `json:"dashboard,omitempty"`
 }
 
-// Customer represents buyers
+// Customer represents buyers.
 type Customer struct {
 	Resource  string                 `json:"resource,omitempty"`
 	ID        string                 `json:"id,omitempty"`
@@ -66,6 +66,7 @@ func (cs *CustomersService) Get(ctx context.Context, id string) (res *Response,
 	if err = json.Unmarshal(res.content, &c); err != nil {
 		return
 	}
+
 	return
 }
 
@@ -82,6 +83,7 @@ func (cs *CustomersService) Create(ctx context.Context, c Customer) (res *Respon
 	if err = json.Unmarshal(res.content, &cc); err != nil {
 		return
 	}
+
 	return
 }
 
diff --git a/mollie/gift_cards.go b/mollie/gift_cards.go
index 9e2bbd1..3ec3dbe 100644
--- a/mollie/gift_cards.go
+++ b/mollie/gift_cards.go
@@ -7,7 +7,7 @@ type GiftCardIssuer string
 // sportenfitcadeau, sustainablefashion, travelcheq, vvvgiftcard, vvvdinercheque,
 // vvvlekkerweg, webshopgiftcard, yourgift
 
-// Supported gift card issuers
+// Supported gift card issuers.
 const (
 	BloemenCadeuKaart          GiftCardIssuer = "bloemencadeaukaart"
 	BloemPlantGiftCard         GiftCardIssuer = "bloemplantgiftcard"
@@ -43,7 +43,7 @@ const (
 // card issuer in your account.
 type GiftCardIssuerStatus string
 
-// Valid issuer statuses
+// Valid issuer statuses.
 const (
 	PendingIssuer GiftCardIssuerStatus = "pending-issuer"
 	EnabledIssuer GiftCardIssuerStatus = "enabled"
diff --git a/mollie/invoices.go b/mollie/invoices.go
index 8a62f7a..c2af8eb 100644
--- a/mollie/invoices.go
+++ b/mollie/invoices.go
@@ -6,17 +6,17 @@ import (
 	"fmt"
 )
 
-// InvoiceStatus status of the invoice
+// InvoiceStatus status of the invoice.
 type InvoiceStatus string
 
-// Valid status of the invoice
+// Valid status of the invoice.
 const (
 	InvoiceStatusOpen    InvoiceStatus = "open"
 	InvoiceStatusPaid    InvoiceStatus = "paid"
 	InvoiceStatusOverdue InvoiceStatus = "overdue"
 )
 
-// Invoice describes an invoice details
+// Invoice describes an invoice details.
 type Invoice struct {
 	Resource    string        `json:"resource,omitempty"`
 	ID          string        `json:"id,omitempty"`
@@ -67,7 +67,7 @@ type InvoicesList struct {
 	Links PaginationLinks `json:"_links,omitempty"`
 }
 
-// InvoicesService instance operates over invoice resources
+// InvoicesService instance operates over invoice resources.
 type InvoicesService service
 
 // Get retrieve details of an invoice, using the invoice’s identifier.
diff --git a/mollie/mandates.go b/mollie/mandates.go
index 4785390..afc2932 100644
--- a/mollie/mandates.go
+++ b/mollie/mandates.go
@@ -24,7 +24,7 @@ type Mandate struct {
 	Links            MandateLinks   `json:"_links,omitempty"`
 }
 
-// MandateDetails are possible values inside the mandate.details field
+// MandateDetails are possible values inside the mandate.details field.
 type MandateDetails struct {
 	ConsumerName    string     `json:"consumerName,omitempty"`
 	ConsumerAccount string     `json:"consumerAccount,omitempty"`
@@ -36,10 +36,10 @@ type MandateDetails struct {
 	CardExpiryDate  *ShortDate `json:"cardExpiryDate,omitempty"`
 }
 
-// MandateStatus for the Mandate object
+// MandateStatus for the Mandate object.
 type MandateStatus string
 
-// Valid mandate statuses
+// Valid mandate statuses.
 const (
 	PendingMandate MandateStatus = "pending"
 	ValidMandate   MandateStatus = "valid"
@@ -49,7 +49,7 @@ const (
 // CardLabel Note that not all labels can be processed through Mollie.
 type CardLabel string
 
-// Available card labels
+// Available card labels.
 const (
 	AmericaExpress CardLabel = "American Express"
 	CartaSi        CardLabel = "Carta Si"
@@ -69,7 +69,7 @@ const (
 // MandatesService operates over customer mandates endpoints.
 type MandatesService service
 
-// MandateLinks response objects
+// MandateLinks response objects.
 type MandateLinks struct {
 	Self          *URL `json:"self,omitempty"`
 	Customer      *URL `json:"customer,omitempty"`
@@ -80,7 +80,7 @@ type MandateLinks struct {
 // to filter the List mandates actions.
 //
 // From is a mandate id to offset from (inclusive)
-// Limit is the max number of mandates to retrieve
+// Limit is the max number of mandates to retrieve.
 type MandatesListOptions struct {
 	From  string `url:"from,omitempty"`
 	Limit int    `url:"limit,omitempty"`
diff --git a/mollie/miscellaneous.go b/mollie/miscellaneous.go
index 9ceddfa..97ffce3 100644
--- a/mollie/miscellaneous.go
+++ b/mollie/miscellaneous.go
@@ -6,10 +6,10 @@ import (
 )
 
 // MiscellaneousService operates over the resources described
-// in Mollie's miscellaneous API endpoints section
+// in Mollie's miscellaneous API endpoints section.
 type MiscellaneousService service
 
-// ApplePaymentSession contains information about an Apple pay session
+// ApplePaymentSession contains information about an Apple pay session.
 type ApplePaymentSession struct {
 	EpochTimestamp    int    `json:"epochTimestamp,omitempty"`
 	ExpiresAt         int    `json:"expiresAt,omitempty"`
@@ -42,5 +42,6 @@ func (ms *MiscellaneousService) ApplePaymentSession(ctx context.Context, asr *Ap
 	if err = json.Unmarshal(res.content, &aps); err != nil {
 		return
 	}
+
 	return
 }
diff --git a/mollie/mollie.go b/mollie/mollie.go
index cacd402..20b7f90 100644
--- a/mollie/mollie.go
+++ b/mollie/mollie.go
@@ -157,15 +157,15 @@ func (c *Client) NewAPIRequest(ctx context.Context, method string, uri string, b
 		return nil, errBadBaseURL
 	}
 
-	u, err := c.BaseURL.Parse(uri)
+	url, err := c.BaseURL.Parse(uri)
 	if err != nil {
-		return nil, err
+		return nil, fmt.Errorf("url_parsing_error: %w", err)
 	}
 
 	if c.config.testing {
-		qp := u.Query()
+		qp := url.Query()
 		qp.Add("testmode", "true")
-		u.RawQuery = qp.Encode()
+		url.RawQuery = qp.Encode()
 	}
 
 	var buf io.ReadWriter
@@ -173,9 +173,10 @@ func (c *Client) NewAPIRequest(ctx context.Context, method string, uri string, b
 		buf = new(bytes.Buffer)
 		enc := json.NewEncoder(buf)
 		enc.SetEscapeHTML(false)
+
 		err := enc.Encode(body)
 		if err != nil {
-			return nil, err
+			return nil, fmt.Errorf("encoding_error: %w", err)
 		}
 	}
 
@@ -183,7 +184,7 @@ func (c *Client) NewAPIRequest(ctx context.Context, method string, uri string, b
 		ctx = context.Background()
 	}
 
-	req, err = http.NewRequestWithContext(ctx, method, u.String(), buf)
+	req, err = http.NewRequestWithContext(ctx, method, url.String(), buf)
 	if err != nil {
 		return
 	}
@@ -201,10 +202,12 @@ func (c *Client) NewAPIRequest(ctx context.Context, method string, uri string, b
 func (c *Client) Do(req *http.Request) (*Response, error) {
 	resp, err := c.client.Do(req)
 	if err != nil {
-		return nil, err
+		return nil, fmt.Errorf("httperror: %w", err)
 	}
+
 	defer resp.Body.Close()
 	response, _ := newResponse(resp)
+
 	err = CheckResponse(resp)
 	if err != nil {
 		return response, err
@@ -223,17 +226,17 @@ func (c *Client) Do(req *http.Request) (*Response, error) {
 //
 // You can also set the token values programmatically by using the Client
 // WithAPIKey and WithOrganizationKey functions.
-func NewClient(baseClient *http.Client, c *Config) (mollie *Client, err error) {
+func NewClient(baseClient *http.Client, conf *Config) (mollie *Client, err error) {
 	if baseClient == nil {
 		baseClient = http.DefaultClient
 	}
 
-	u, _ := url.Parse(BaseURL)
+	uri, _ := url.Parse(BaseURL)
 
 	mollie = &Client{
-		BaseURL: u,
+		BaseURL: uri,
 		client:  baseClient,
-		config:  c,
+		config:  conf,
 	}
 
 	mollie.common.client = mollie
@@ -266,10 +269,11 @@ func NewClient(baseClient *http.Client, c *Config) (mollie *Client, err error) {
 	}, ";")
 
 	// Parse authorization from specified environment variable
-	tkn, ok := os.LookupEnv(c.auth)
+	tkn, ok := os.LookupEnv(mollie.config.auth)
 	if ok {
 		mollie.authentication = tkn
 	}
+
 	return
 }
 
@@ -283,25 +287,28 @@ type Error struct {
 	Response *http.Response `json:"response"` // the full response that produced the error
 }
 
-// Error function complies with the error interface
+// Error function complies with the error interface.
 func (e *Error) Error() string {
 	return fmt.Sprintf("response failed with status %s\npayload: %v", e.Message, e.Content)
 }
 
 /*
-Constructor for Error
+Constructor for Error.
 */
-func newError(r *http.Response) *Error {
-	var e Error
-	e.Response = r
-	e.Code = r.StatusCode
-	e.Message = r.Status
-	c, err := ioutil.ReadAll(r.Body)
+func newError(rsp *http.Response) *Error {
+	var mErr Error
+	mErr.Response = rsp
+	mErr.Code = rsp.StatusCode
+	mErr.Message = rsp.Status
+
+	c, err := ioutil.ReadAll(rsp.Body)
 	if err == nil {
-		e.Content = string(c)
+		mErr.Content = string(c)
 	}
-	r.Body = ioutil.NopCloser(bytes.NewBuffer(c))
-	return &e
+
+	rsp.Body = ioutil.NopCloser(bytes.NewBuffer(c))
+
+	return &mErr
 }
 
 // Response is a Mollie API response. This wraps the standard http.Response
@@ -312,16 +319,19 @@ type Response struct {
 	content []byte
 }
 
-func newResponse(r *http.Response) (*Response, error) {
+func newResponse(rsp *http.Response) (*Response, error) {
 	var res Response
-	c, err := ioutil.ReadAll(r.Body)
+
+	data, err := ioutil.ReadAll(rsp.Body)
 	if err == nil {
-		res.content = c
+		res.content = data
 	}
-	err = json.NewDecoder(r.Body).Decode(&res)
-	r.Body = ioutil.NopCloser(bytes.NewBuffer(c))
-	res.Response = r
-	return &res, err
+
+	err = json.NewDecoder(rsp.Body).Decode(&res)
+	rsp.Body = ioutil.NopCloser(bytes.NewBuffer(data))
+	res.Response = rsp
+
+	return &res, fmt.Errorf("json_decode_error: %w", err)
 }
 
 // CheckResponse checks the API response for errors, and returns them if
@@ -333,5 +343,6 @@ func CheckResponse(r *http.Response) error {
 	if r.StatusCode >= http.StatusMultipleChoices {
 		return newError(r)
 	}
+
 	return nil
 }
diff --git a/mollie/orders.go b/mollie/orders.go
index aa4665a..e5a0773 100644
--- a/mollie/orders.go
+++ b/mollie/orders.go
@@ -9,26 +9,29 @@ import (
 
 // Order explain the items that customers need to pay for.
 type Order struct {
+	TestMode                                 bool          `json:"testmode,omitempty"`
+	IsCancelable                             bool          `json:"isCancelable,omitempty"`
+	ShopperCountryMustMatchTheBillingCountry bool          `json:"shopperCountryMustMatchTheBillingCountry,omitempty"`
 	Resource                                 string        `json:"resource,omitempty"`
 	ID                                       string        `json:"id,omitempty"`
 	ProfileID                                string        `json:"profileId,omitempty"`
-	TestMode                                 bool          `json:"testmode,omitempty"`
-	Method                                   PaymentMethod `json:"method,omitempty"`
+	OrderNumber                              string        `json:"orderNumber,omitempty"`
+	RedirectURL                              string        `json:"redirectUrl,omitempty"`
+	WebhookURL                               string        `json:"webhookUrl,omitempty"`
+	Description                              string        `json:"description,omitempty"`
+	Sku                                      string        `json:"sku,omitempty"`
+	Metadata                                 interface{}   `json:"metadata,omitempty"`
 	Mode                                     Mode          `json:"mode,omitempty"`
+	Method                                   PaymentMethod `json:"method,omitempty"`
+	Status                                   OrderStatus   `json:"status,omitempty"`
+	Locale                                   Locale        `json:"locale,omitempty"`
+	ShippingAddress                          OrderAddress  `json:"shippingAddress,omitempty"`
+	Links                                    OrderLinks    `json:"_links,omitempty"`
 	Amount                                   *Amount       `json:"amount,omitempty"`
 	AmountCaptured                           *Amount       `json:"amountCaptured,omitempty"`
 	AmountRefunded                           *Amount       `json:"amountRefunded,omitempty"`
-	Status                                   OrderStatus   `json:"status,omitempty"`
-	IsCancelable                             bool          `json:"isCancelable,omitempty"`
 	BillingAddress                           *OrderAddress `json:"billingAddress,omitempty"`
 	ConsumerDateOfBirth                      *ShortDate    `json:"consumerDateOfBirth,omitempty"`
-	OrderNumber                              string        `json:"orderNumber,omitempty"`
-	ShippingAddress                          OrderAddress  `json:"shippingAddress,omitempty"`
-	Locale                                   Locale        `json:"locale,omitempty"`
-	Metadata                                 interface{}   `json:"metadata,omitempty"`
-	RedirectURL                              string        `json:"redirectUrl,omitempty"`
-	Lines                                    []*OrderLine  `json:"lines,omitempty"`
-	WebhookURL                               string        `json:"webhookUrl,omitempty"`
 	CreatedAt                                *time.Time    `json:"createdAt,omitempty"`
 	ExpiresAt                                *time.Time    `json:"expiresAt,omitempty"`
 	ExpiredAt                                *time.Time    `json:"expiredAt,omitempty"`
@@ -36,18 +39,15 @@ type Order struct {
 	AuthorizedAt                             *time.Time    `json:"authorizedAt,omitempty"`
 	CanceledAt                               *time.Time    `json:"canceledAt,omitempty"`
 	CompletedAt                              *time.Time    `json:"completedAt,omitempty"`
-	Links                                    OrderLinks    `json:"_links,omitempty"`
 	OrderPayment                             *OrderPayment `json:"payment,omitempty"`
-	Description                              string        `json:"description,omitempty"`
-	ShopperCountryMustMatchTheBillingCountry bool          `json:"shopperCountryMustMatchTheBillingCountry,omitempty"`
-	Sku                                      string        `json:"sku,omitempty"`
+	Lines                                    []*OrderLine  `json:"lines,omitempty"`
 	Embedded                                 struct {
 		Payments []*Payment `json:"payments,omitempty"`
 		Refunds  []*Refund  `json:"refunds,omitempty"`
 	} `json:"_embedded,omitempty"`
 }
 
-// OrderPayment describes payment specific parameters that can be passed during order creation
+// OrderPayment describes payment specific parameters that can be passed during order creation.
 type OrderPayment struct {
 	ConsumerAccount   string          `json:"consumerAccount,omitempty"`
 	CustomerID        string          `json:"customerId,omitempty"`
@@ -135,7 +135,7 @@ type OrderLine struct {
 	Metadata           interface{}     `json:"metadata,omitempty"`
 }
 
-// OrderList for containing the response of list orders
+// OrderList for containing the response of list orders.
 type OrderList struct {
 	Count    int `json:"count,omitempty"`
 	Embedded struct {
@@ -144,7 +144,7 @@ type OrderList struct {
 	Links PaginationLinks `json:"links,omitempty"`
 }
 
-// OrderListRefund for containing the response of list orders
+// OrderListRefund for containing the response of list orders.
 type OrderListRefund struct {
 	Count    int `json:"count,omitempty"`
 	Embedded struct {
diff --git a/mollie/organizations.go b/mollie/organizations.go
index f2bf7a1..3316eb8 100644
--- a/mollie/organizations.go
+++ b/mollie/organizations.go
@@ -7,7 +7,7 @@ import (
 	"time"
 )
 
-// Organization describes an organization detail
+// Organization describes an organization detail.
 type Organization struct {
 	Resource           string            `json:"resource,omitempty"`
 	ID                 string            `json:"id,omitempty"`
@@ -72,7 +72,7 @@ type OrganizationPartnerStatus struct {
 	Links                          OrganizationPartnerLinks `json:"_links,omitempty"`
 }
 
-// OrganizationsService instance operates over organization resources
+// OrganizationsService instance operates over organization resources.
 type OrganizationsService service
 
 // Get retrieve an organization by its id.
@@ -80,7 +80,7 @@ func (os *OrganizationsService) Get(ctx context.Context, id string) (res *Respon
 	return os.get(ctx, fmt.Sprintf("v2/organizations/%s", id))
 }
 
-// GetCurrent retrieve the currently authenticated organization
+// GetCurrent retrieve the currently authenticated organization.
 func (os *OrganizationsService) GetCurrent(ctx context.Context) (res *Response, o *Organization, err error) {
 	return os.get(ctx, "v2/organizations/me")
 }
@@ -107,8 +107,10 @@ func (os *OrganizationsService) get(ctx context.Context, uri string) (res *Respo
 	if err != nil {
 		return
 	}
+
 	if err = json.Unmarshal(res.content, &o); err != nil {
 		return
 	}
+
 	return
 }
diff --git a/mollie/partners.go b/mollie/partners.go
index 6991fec..45f3003 100644
--- a/mollie/partners.go
+++ b/mollie/partners.go
@@ -68,6 +68,7 @@ func (ps *PartnerService) List(ctx context.Context, opts *ListPartnerClientsOpti
 	if err = json.Unmarshal(res.content, &pc); err != nil {
 		return
 	}
+
 	return
 }
 
@@ -83,5 +84,6 @@ func (ps *PartnerService) Get(ctx context.Context, id string, opts *GetPartnerCl
 	if err = json.Unmarshal(res.content, &pc); err != nil {
 		return
 	}
+
 	return
 }
diff --git a/mollie/payment_details.go b/mollie/payment_details.go
index 804e04a..3efc9ee 100644
--- a/mollie/payment_details.go
+++ b/mollie/payment_details.go
@@ -3,7 +3,7 @@ package mollie
 // FeeRegion contains the fee region for the payment.
 type FeeRegion string
 
-// Valid Fee regions
+// Valid Fee regions.
 const (
 	AmericanExpress FeeRegion = "american-express"
 	CarteBancaire   FeeRegion = "carte-bancaire"
@@ -12,10 +12,10 @@ const (
 	Other           FeeRegion = "other"
 )
 
-// FailureReason provides a description on a failed payment
+// FailureReason provides a description on a failed payment.
 type FailureReason string
 
-// Possible failure reasons
+// Possible failure reasons.
 const (
 	ReasonAuthenticationAbandoned      FailureReason = "authentication_abandoned"
 	ReasonAuthenticationUnavailableACS FailureReason = "authentication_unavailable_acs"
@@ -31,10 +31,10 @@ const (
 	ReasonPossibleFraud                FailureReason = "possible_fraud"
 )
 
-// EligibilityReasons for paypal seller protection
+// EligibilityReasons for paypal seller protection.
 type EligibilityReasons string
 
-// Available eligibility reasons for Paypal sellers protection
+// Available eligibility reasons for Paypal sellers protection.
 const (
 	Eligible                        EligibilityReasons = "Eligible"
 	Ineligible                      EligibilityReasons = "Ineligible"
@@ -52,7 +52,7 @@ type UsedGiftCard struct {
 	VoucherNumber string  `json:"voucherNumber,omitempty"`
 }
 
-// PaymentDetails contains details for the specified payment method
+// PaymentDetails contains details for the specified payment method.
 type PaymentDetails struct {
 	PaypalDigitalGoods bool                   `json:"digitalGoods,omitempty"`
 	BankAccount        string                 `json:"bankAccount,omitempty"`
diff --git a/mollie/payment_links.go b/mollie/payment_links.go
index 923389a..1e0ce83 100644
--- a/mollie/payment_links.go
+++ b/mollie/payment_links.go
@@ -73,6 +73,7 @@ func (pls *PaymentLinksService) Get(ctx context.Context, id string) (res *Respon
 	if err = json.Unmarshal(res.content, &pl); err != nil {
 		return
 	}
+
 	return
 }
 
@@ -88,6 +89,7 @@ func (pls *PaymentLinksService) Create(ctx context.Context, p PaymentLink, opts
 	if err = json.Unmarshal(res.content, &np); err != nil {
 		return
 	}
+
 	return
 }
 
@@ -104,5 +106,6 @@ func (pls *PaymentLinksService) List(ctx context.Context, opts *PaymentLinkOptio
 	if err = json.Unmarshal(res.content, &pl); err != nil {
 		return
 	}
+
 	return
 }
diff --git a/mollie/payment_methods.go b/mollie/payment_methods.go
index fcb03fe..1f58152 100644
--- a/mollie/payment_methods.go
+++ b/mollie/payment_methods.go
@@ -11,7 +11,7 @@ import (
 // pending-external rejected.
 type PaymentMethodStatus string
 
-// Available payment method statuses
+// Available payment method statuses.
 const (
 	PaymentMethodActivated       PaymentMethodStatus = "activated"
 	PaymentMethodPendingBoarding PaymentMethodStatus = "pending-boarding"
@@ -90,7 +90,7 @@ type PaymentMethodsListOptions struct {
 	IncludeWallets string       `url:"includeWallets,omitempty"`
 }
 
-// PaymentMethodsService operates on methods endpoints
+// PaymentMethodsService operates on methods endpoints.
 type PaymentMethodsService service
 
 // Get returns information about the payment method specified by id,
diff --git a/mollie/payments.go b/mollie/payments.go
index f9622ac..ac3d649 100644
--- a/mollie/payments.go
+++ b/mollie/payments.go
@@ -10,7 +10,7 @@ import (
 // PaymentMethod is a payment method supported by Mollie.
 type PaymentMethod string
 
-// Supported payment methods
+// Supported payment methods.
 const (
 	Bancontact     PaymentMethod = "bancontact"
 	BankTransfer   PaymentMethod = "banktransfer"
@@ -34,7 +34,7 @@ const (
 // SequenceType indicates which type of payment this is in a recurring sequence.
 type SequenceType string
 
-// Valid sequence types
+// Valid sequence types.
 const (
 	OneOffSequence    SequenceType = "oneoff"
 	FirstSequence     SequenceType = "first"
@@ -131,7 +131,7 @@ type ListPaymentOptions struct {
 	From      string `url:"from,omitempty"`
 }
 
-// PaymentsService instance operates over payment resources
+// PaymentsService instance operates over payment resources.
 type PaymentsService service
 
 // Get retrieves a single payment object by its payment token.
@@ -144,6 +144,7 @@ func (ps *PaymentsService) Get(ctx context.Context, id string, opts *PaymentOpti
 	if err = json.Unmarshal(res.content, &p); err != nil {
 		return
 	}
+
 	return
 }
 
@@ -163,6 +164,7 @@ func (ps *PaymentsService) Create(ctx context.Context, p Payment, opts *PaymentO
 	if err = json.Unmarshal(res.content, &np); err != nil {
 		return
 	}
+
 	return
 }
 
@@ -178,6 +180,7 @@ func (ps *PaymentsService) Cancel(ctx context.Context, id string) (res *Response
 	if err = json.Unmarshal(res.content, &p); err != nil {
 		return
 	}
+
 	return
 }
 
diff --git a/mollie/profiles.go b/mollie/profiles.go
index bc79b52..eee7a1a 100644
--- a/mollie/profiles.go
+++ b/mollie/profiles.go
@@ -8,10 +8,10 @@ import (
 	"time"
 )
 
-// ProfileStatus determines whether the profile is able to receive live payments
+// ProfileStatus determines whether the profile is able to receive live payments.
 type ProfileStatus string
 
-// Possible profile statuses
+// Possible profile statuses.
 const (
 	StatusUnverified ProfileStatus = "unverified"
 	StatusVerified   ProfileStatus = "verified"
@@ -49,7 +49,7 @@ type ProfileLinks struct {
 	Dashboard          *URL `json:"dashboard,omitempty"`
 }
 
-// ProfileListOptions are optional query string parameters for the list profiles request
+// ProfileListOptions are optional query string parameters for the list profiles request.
 type ProfileListOptions struct {
 	From  string `url:"from,omitempty"`
 	Limit uint   `url:"limit,omitempty"`
@@ -64,10 +64,10 @@ type ProfileList struct {
 	Links PaginationLinks `json:"_links,omitempty"`
 }
 
-// ProfilesService operates over profile resource
+// ProfilesService operates over profile resource.
 type ProfilesService service
 
-// List returns all the profiles for the authenticated account
+// List returns all the profiles for the authenticated account.
 func (ps *ProfilesService) List(ctx context.Context, opts *ProfileListOptions) (res *Response, pl *ProfileList, err error) {
 	res, err = ps.client.get(ctx, "v2/profiles", opts)
 	if err != nil {
@@ -116,7 +116,7 @@ func (ps *ProfilesService) Create(ctx context.Context, np *Profile) (res *Respon
 	return
 }
 
-// Update allows you to perform mutations on a profile
+// Update allows you to perform mutations on a profile.
 func (ps *ProfilesService) Update(ctx context.Context, id string, up *Profile) (res *Response, p *Profile, err error) {
 	res, err = ps.client.patch(ctx, fmt.Sprintf("v2/profiles/%s", id), up, nil)
 	if err != nil {
@@ -192,7 +192,7 @@ func (ps *ProfilesService) DisableGiftCardIssuer(ctx context.Context, profileID
 }
 
 // EnableGiftCardIssuerForCurrent activates the specified issuer for the
-// curent profile (token owner).
+// current profile (token owner).
 //
 // See: https://docs.mollie.com/reference/v2/profiles-api/enable-gift-card-issuer
 func (ps *ProfilesService) EnableGiftCardIssuerForCurrent(ctx context.Context, issuer GiftCardIssuer) (res *Response, gc *GiftCardEnabled, err error) {
@@ -208,7 +208,7 @@ func (ps *ProfilesService) EnableGiftCardIssuerForCurrent(ctx context.Context, i
 }
 
 // DisableGiftCardIssuerForCurrent deactivates the specified issuer for the
-// curent profile (token owner).
+// current profile (token owner).
 //
 // See: https://docs.mollie.com/reference/v2/profiles-api/disable-gift-card-issuer
 func (ps *ProfilesService) DisableGiftCardIssuerForCurrent(ctx context.Context, issuer GiftCardIssuer) (res *Response, err error) {
diff --git a/mollie/refunds.go b/mollie/refunds.go
index 20027d5..3df1c60 100644
--- a/mollie/refunds.go
+++ b/mollie/refunds.go
@@ -98,13 +98,13 @@ func (rs *RefundsService) Get(ctx context.Context, paymentID, refundID string, o
 //
 // See https://docs.mollie.com/reference/v2/refunds-api/create-refund.
 func (rs *RefundsService) Create(ctx context.Context, paymentID string, re Refund, options *RefundOptions) (res *Response, rf *Refund, err error) {
-	u := fmt.Sprintf("v2/payments/%s/refunds", paymentID)
+	uri := fmt.Sprintf("v2/payments/%s/refunds", paymentID)
 
 	if rs.client.HasAccessToken() && rs.client.config.testing {
 		re.TestMode = true
 	}
 
-	res, err = rs.client.post(ctx, u, re, options)
+	res, err = rs.client.post(ctx, uri, re, options)
 	if err != nil {
 		return
 	}
diff --git a/mollie/settlements.go b/mollie/settlements.go
index 5cb7b88..87447f6 100644
--- a/mollie/settlements.go
+++ b/mollie/settlements.go
@@ -7,13 +7,13 @@ import (
 	"time"
 )
 
-// SettlementsService operates over settlements resource
+// SettlementsService operates over settlements resource.
 type SettlementsService service
 
-// SettlementStatus describes the status of the settlement
+// SettlementStatus describes the status of the settlement.
 type SettlementStatus string
 
-// Available settlement statuses
+// Available settlement statuses.
 const (
 	SettlementStatusOpen    SettlementStatus = "open"
 	SettlementStatusPending SettlementStatus = "pending"
@@ -21,7 +21,7 @@ const (
 	SettlementStatusFailed  SettlementStatus = "failed"
 )
 
-// SettlementRevenue objects contain the total revenue for each payment method during this period
+// SettlementRevenue objects contain the total revenue for each payment method during this period.
 type SettlementRevenue struct {
 	Description string        `json:"description,omitempty"`
 	AmountNet   *Amount       `json:"amountNet,omitempty"`
@@ -31,7 +31,7 @@ type SettlementRevenue struct {
 	Method      PaymentMethod `json:"method,omitempty"`
 }
 
-// SettlementCosts contains information about costs related to a settlement
+// SettlementCosts contains information about costs related to a settlement.
 type SettlementCosts struct {
 	Description string        `json:"description,omitempty"`
 	AmountNet   *Amount       `json:"amountNet,omitempty"`
@@ -42,16 +42,16 @@ type SettlementCosts struct {
 	Method      PaymentMethod `json:"method,omitempty"`
 }
 
-// SettlementPeriod describe the settlement by month in full detail
+// SettlementPeriod describe the settlement by month in full detail.
 type SettlementPeriod struct {
 	Revenue []*SettlementRevenue `json:"revenue,omitempty"`
 	Costs   []*SettlementCosts   `json:"costs,omitempty"`
 }
 
-// SettlementObject nests as describes for settlement periods
+// SettlementObject nests as describes for settlement periods.
 type SettlementObject map[string]map[string]SettlementPeriod
 
-// SettlementLinks is an object with several URL objects relevant to the settlement
+// SettlementLinks is an object with several URL objects relevant to the settlement.
 type SettlementLinks struct {
 	Self          *URL `json:"self,omitempty"`
 	Payments      *URL `json:"payments,omitempty"`
@@ -63,7 +63,7 @@ type SettlementLinks struct {
 }
 
 // Settlement contains successful payments, together with refunds,
-// captures and chargebacks into settlements
+// captures and chargebacks into settlements.
 type Settlement struct {
 	ID        string           `json:"id,omitempty"`
 	Resource  string           `json:"resource,omitempty"`
@@ -203,17 +203,17 @@ func (ss *SettlementsService) get(ctx context.Context, element string) (res *Res
 }
 
 func (ss *SettlementsService) list(ctx context.Context, id string, category string, opts *SettlementsListOptions) (res *Response, err error) {
-	u := "v2/settlements"
+	uri := "v2/settlements"
 
 	if id != "" {
-		u = fmt.Sprintf("%s/%s", u, id)
+		uri = fmt.Sprintf("%s/%s", uri, id)
 
 		if category != "" {
-			u = fmt.Sprintf("%s/%s", u, category)
+			uri = fmt.Sprintf("%s/%s", uri, category)
 		}
 	}
 
-	res, err = ss.client.get(ctx, u, opts)
+	res, err = ss.client.get(ctx, uri, opts)
 	if err != nil {
 		return
 	}
diff --git a/mollie/shipments.go b/mollie/shipments.go
index b205461..bab6508 100644
--- a/mollie/shipments.go
+++ b/mollie/shipments.go
@@ -56,7 +56,7 @@ func (ss *ShipmentsService) Get(ctx context.Context, oID string, sID string) (re
 	return
 }
 
-// CreateShipmentRequest defines information required to create a new shipment
+// CreateShipmentRequest defines information required to create a new shipment.
 type CreateShipmentRequest struct {
 	Lines    []OrderLine      `json:"lines,omitempty"`
 	Tracking ShipmentTracking `json:"tracking,omitempty"`
@@ -67,13 +67,13 @@ type CreateShipmentRequest struct {
 //
 // See: https://docs.mollie.com/reference/v2/shipments-api/create-shipment
 func (ss *ShipmentsService) Create(ctx context.Context, oID string, cs CreateShipmentRequest) (res *Response, s *Shipment, err error) {
-	u := fmt.Sprintf("v2/orders/%s/shipments", oID)
+	uri := fmt.Sprintf("v2/orders/%s/shipments", oID)
 
 	if ss.client.HasAccessToken() && ss.client.config.testing {
 		cs.TestMode = true
 	}
 
-	res, err = ss.client.post(ctx, u, cs, nil)
+	res, err = ss.client.post(ctx, uri, cs, nil)
 	if err != nil {
 		return
 	}
diff --git a/mollie/subscriptions.go b/mollie/subscriptions.go
index 94dd4e0..6be155b 100644
--- a/mollie/subscriptions.go
+++ b/mollie/subscriptions.go
@@ -7,13 +7,13 @@ import (
 	"time"
 )
 
-// SubscriptionsService operates over subscriptions resource
+// SubscriptionsService operates over subscriptions resource.
 type SubscriptionsService service
 
-// SubscriptionStatus contains references to valid subscription statuses
+// SubscriptionStatus contains references to valid subscription statuses.
 type SubscriptionStatus string
 
-// Available subscription statuses
+// Available subscription statuses.
 const (
 	SubscriptionStatusPending   SubscriptionStatus = "pending"
 	SubscriptionStatusActive    SubscriptionStatus = "active"
@@ -22,7 +22,7 @@ const (
 	SubscriptionStatusCompleted SubscriptionStatus = "completed"
 )
 
-// SubscriptionLinks contains several URL objects relevant to the subscription
+// SubscriptionLinks contains several URL objects relevant to the subscription.
 type SubscriptionLinks struct {
 	Self          *URL `json:"self,omitempty"`
 	Customer      *URL `json:"customer,omitempty"`
@@ -30,7 +30,7 @@ type SubscriptionLinks struct {
 	Documentation *URL `json:"documentation,omitempty"`
 }
 
-// Subscription contains information about a customer subscription
+// Subscription contains information about a customer subscription.
 type Subscription struct {
 	Resource        string                 `json:"resource,omitempty"`
 	ID              string                 `json:"id,omitempty"`
@@ -54,7 +54,7 @@ type Subscription struct {
 	Links           SubscriptionLinks      `json:"_links,omitempty"`
 }
 
-// SubscriptionList describes the response for subscription list endpoints
+// SubscriptionList describes the response for subscription list endpoints.
 type SubscriptionList struct {
 	Count    int `json:"count,omitempty"`
 	Embedded struct {
@@ -63,7 +63,7 @@ type SubscriptionList struct {
 	Links PaginationLinks `json:"_links,omitempty"`
 }
 
-// SubscriptionListOptions holds query string parameters valid for subscription lists
+// SubscriptionListOptions holds query string parameters valid for subscription lists.
 type SubscriptionListOptions struct {
 	From      string `url:"from,omitempty"`
 	Limit     int    `url:"limit,omitempty"`
@@ -91,13 +91,13 @@ func (ss *SubscriptionsService) Get(ctx context.Context, cID, sID string) (res *
 //
 // See: https://docs.mollie.com/reference/v2/subscriptions-api/create-subscription
 func (ss *SubscriptionsService) Create(ctx context.Context, cID string, sc *Subscription) (res *Response, s *Subscription, err error) {
-	u := fmt.Sprintf("v2/customers/%s/subscriptions", cID)
+	uri := fmt.Sprintf("v2/customers/%s/subscriptions", cID)
 
 	if ss.client.HasAccessToken() && ss.client.config.testing {
 		sc.TestMode = true
 	}
 
-	res, err = ss.client.post(ctx, u, sc, nil)
+	res, err = ss.client.post(ctx, uri, sc, nil)
 	if err != nil {
 		return
 	}


Test patch:
diff --git a/mollie/connect/oauth2_test.go b/mollie/connect/oauth2_test.go
index dc6374d..e236483 100644
--- a/mollie/connect/oauth2_test.go
+++ b/mollie/connect/oauth2_test.go
@@ -8,7 +8,8 @@ import (
 )
 
 func Test_Endpoint(t *testing.T) {
-	require.Equal(t, Endpoint.AuthURL, AuthURL)
-	require.Equal(t, Endpoint.AuthStyle, oauth2.AuthStyleAutoDetect)
-	require.Equal(t, Endpoint.TokenURL, TokensURL)
+	ept := OauthEndpoint()
+	require.Equal(t, ept.AuthURL, authURL)
+	require.Equal(t, ept.AuthStyle, oauth2.AuthStyleAutoDetect)
+	require.Equal(t, ept.TokenURL, tokensURL)
 }
diff --git a/mollie/mollie_test.go b/mollie/mollie_test.go
index 28fa771..5d8e3e7 100644
--- a/mollie/mollie_test.go
+++ b/mollie/mollie_test.go
@@ -198,7 +198,7 @@ func TestClient_NewAPIRequest_ForceErrors(t *testing.T) {
 				"test",
 				make(chan int),
 			},
-			fmt.Errorf("json: unsupported type: chan int"),
+			fmt.Errorf("encoding_error: json: unsupported type: chan int"),
 			noPre,
 		},
 		{
@@ -209,7 +209,7 @@ func TestClient_NewAPIRequest_ForceErrors(t *testing.T) {
 				":",
 				nil,
 			},
-			fmt.Errorf("parse \":\": missing protocol scheme"),
+			fmt.Errorf("url_parsing_error: parse \":\": missing protocol scheme"),
 			noPre,
 		},
 	}
@@ -335,7 +335,7 @@ func TestClient_Do(t *testing.T) {
 				nil,
 			},
 			true,
-			fmt.Errorf("Get \"\": http: nil Request.URL"),
+			fmt.Errorf("httperror: Get \"\": http: nil Request.URL"),
 			http.StatusOK,
 			func(w http.ResponseWriter, r *http.Request) {
 				testMethod(t, r, "GET")