Skip to content

Commit

Permalink
Card token - code quality
Browse files Browse the repository at this point in the history
  • Loading branch information
meliguilhermefernandes authored and eltinMeli committed Feb 9, 2024
1 parent 768fd8e commit 666fb04
Show file tree
Hide file tree
Showing 4 changed files with 29 additions and 1 deletion.
11 changes: 10 additions & 1 deletion go.mod
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,13 @@ module github.com/mercadopago/sdk-go

go 1.21.0

require github.com/google/uuid v1.5.0
require (
github.com/google/uuid v1.5.0
github.com/stretchr/testify v1.8.4
)

require (
github.com/davecgh/go-spew v1.1.1 // indirect
github.com/pmezard/go-difflib v1.0.0 // indirect
gopkg.in/yaml.v3 v3.0.1 // indirect
)
10 changes: 10 additions & 0 deletions go.sum
Original file line number Diff line number Diff line change
@@ -1,2 +1,12 @@
github.com/davecgh/go-spew v1.1.1 h1:vj9j/u1bqnvCEfJOwUhtlOARqs3+rkHYY13jYWTU97c=
github.com/davecgh/go-spew v1.1.1/go.mod h1:J7Y8YcW2NihsgmVo/mv3lAwl/skON4iLHjSsI+c5H38=
github.com/google/uuid v1.5.0 h1:1p67kYwdtXjb0gL0BPiP1Av9wiZPo5A8z2cWkTZ+eyU=
github.com/google/uuid v1.5.0/go.mod h1:TIyPZe4MgqvfeYDBFedMoGGpEw/LqOeaOT+nhxU+yHo=
github.com/pmezard/go-difflib v1.0.0 h1:4DBwDE0NGyQoBHbLQYPwSUPoCMWR5BEzIk/f1lZbAQM=
github.com/pmezard/go-difflib v1.0.0/go.mod h1:iKH77koFhYxTK1pcRnkKkqfTogsbg7gZNVY4sRDYZ/4=
github.com/stretchr/testify v1.8.4 h1:CcVxjf3Q8PM0mHUKJCdn+eZZtm5yQwehR5yeSVQQcUk=
github.com/stretchr/testify v1.8.4/go.mod h1:sz/lmYIOXD/1dqDmKjjqLyZ2RngseejIcXlSw2iwfAo=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405 h1:yhCVgyC4o1eVCa2tZl7eS0r+SDo693bJlVdllGtEeKM=
gopkg.in/check.v1 v0.0.0-20161208181325-20d25e280405/go.mod h1:Co6ibVJAznAaIkqp8huTwlJQCZ016jof/cbN4VW5Yz0=
gopkg.in/yaml.v3 v3.0.1 h1:fxVm/GzAzEWqLHuvctI91KS9hhNmmWOoWu0XTYJS7CA=
gopkg.in/yaml.v3 v3.0.1/go.mod h1:K4uyk7z7BCEPqu6E+C64Yfv1cQ7kz7rIZviUmN+EgEM=
3 changes: 3 additions & 0 deletions pkg/cardtoken/client.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,10 @@ const (
url = "https://api.mercadopago.com/v1/card_tokens"
)

// Client contains the method to interact with the card token API.
type Client interface {
// Create create a card token.
// It is a post request to the endpoint: https://api.mercadopago.com/v1/card_tokens
Create(ctx context.Context, request Request) (*Response, error)
}

Expand Down
6 changes: 6 additions & 0 deletions pkg/cardtoken/client_test.go
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,11 @@ import (
"reflect"
"strings"
"testing"
"time"

"github.com/mercadopago/sdk-go/pkg/config"
"github.com/mercadopago/sdk-go/pkg/internal/httpclient"
"github.com/stretchr/testify/assert"
)

var (
Expand Down Expand Up @@ -93,3 +95,7 @@ func TestCreate(t *testing.T) {
})
}
}

func Test_parseDate(t *testing.T) {
assert.IsType(t, &time.Time{}, parseDate("2024-02-08T09:05:42.725-04:00"))
}

0 comments on commit 666fb04

Please sign in to comment.