Skip to content

Commit c9c1a38

Browse files
committed
Remove unused tokenservice endpoints
1 parent 9451bef commit c9c1a38

File tree

5 files changed

+12
-56
lines changed

5 files changed

+12
-56
lines changed

.github/workflows/lint-test.yaml

+2-2
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ jobs:
1111
- name: Setup Go
1212
uses: actions/setup-go@v5
1313
with:
14-
go-version: "1.21.x"
14+
go-version: "1.23"
1515
- name: Install dependencies
1616
run: go get .
1717
- name: Install linters
@@ -33,7 +33,7 @@ jobs:
3333
- name: Setup Go
3434
uses: actions/setup-go@v5
3535
with:
36-
go-version: "1.21.x"
36+
go-version: "1.23"
3737
- name: Install dependencies
3838
run: go get .
3939
- name: Run Tests

README.md

+7-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,10 @@
11
[Docs](https://pkg.go.dev/github.com/plutov/paypal)
22

3+
<p>
4+
<a href="https://github.com/plutov/paypal/releases"><img src="https://img.shields.io/github/release/plutov/paypal.svg" alt="Latest Release"></a>
5+
<a href="https://pkg.go.dev/github.com/plutov/paypal?tab=doc"><img src="https://godoc.org/github.com/golang/gddo?status.svg" alt="GoDoc"></a>
6+
</p>
7+
38
# Go client for PayPal REST API
49

510
## Paypal REST API Docs
@@ -294,10 +299,10 @@ invoice, err := c.GetInvoiceDetails(ctx, "INV2-XFXV-YW42-ZANU-4F33")
294299
- Check that tests are passing
295300
- Create PR
296301

297-
Current contributors:
302+
Main contributors:
298303

299-
- [Roopak Venkatakrishnan](https://github.com/roopakv)
300304
- [Alex Pliutau](https://github.com/plutov)
305+
- [Roopak Venkatakrishnan](https://github.com/roopakv)
301306

302307
## Tests
303308

go.mod

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
module github.com/plutov/paypal/v4
22

3-
go 1.21
3+
go 1.23
44

55
require github.com/stretchr/testify v1.9.0
66

identity.go

-49
Original file line numberDiff line numberDiff line change
@@ -4,59 +4,10 @@ import (
44
"context"
55
"fmt"
66
"net/http"
7-
"net/url"
8-
"strings"
97
)
108

11-
// GrantNewAccessTokenFromAuthCode - Use this call to grant a new access token, using the previously obtained authorization code.
12-
// Endpoint: POST /v1/identity/openidconnect/tokenservice
13-
func (c *Client) GrantNewAccessTokenFromAuthCode(ctx context.Context, code, redirectURI string) (*TokenResponse, error) {
14-
token := &TokenResponse{}
15-
16-
q := url.Values{}
17-
q.Set("grant_type", "authorization_code")
18-
q.Set("code", code)
19-
q.Set("redirect_uri", redirectURI)
20-
21-
req, err := http.NewRequestWithContext(ctx, "POST", fmt.Sprintf("%s%s", c.APIBase, "/v1/identity/openidconnect/tokenservice"), strings.NewReader(q.Encode()))
22-
if err != nil {
23-
return token, err
24-
}
25-
26-
req.Header.Add("Content-Type", "application/x-www-form-urlencoded")
27-
28-
if err = c.SendWithBasicAuth(req, token); err != nil {
29-
return token, err
30-
}
31-
32-
return token, nil
33-
}
34-
35-
// GrantNewAccessTokenFromRefreshToken - Use this call to grant a new access token, using a refresh token.
36-
// Endpoint: POST /v1/identity/openidconnect/tokenservice
37-
func (c *Client) GrantNewAccessTokenFromRefreshToken(ctx context.Context, refreshToken string) (*TokenResponse, error) {
38-
type request struct {
39-
GrantType string `json:"grant_type"`
40-
RefreshToken string `json:"refresh_token"`
41-
}
42-
43-
token := &TokenResponse{}
44-
45-
req, err := c.NewRequest(ctx, "POST", fmt.Sprintf("%s%s", c.APIBase, "/v1/identity/openidconnect/tokenservice"), request{GrantType: "refresh_token", RefreshToken: refreshToken})
46-
if err != nil {
47-
return token, err
48-
}
49-
50-
if err = c.SendWithAuth(req, token); err != nil {
51-
return token, err
52-
}
53-
54-
return token, nil
55-
}
56-
579
// GetUserInfo - Use this call to retrieve user profile attributes.
5810
// Endpoint: GET /v1/identity/openidconnect/userinfo/?schema=<Schema>
59-
// Pass the schema that is used to return as per openidconnect protocol. The only supported schema value is openid.
6011
func (c *Client) GetUserInfo(ctx context.Context, schema string) (*UserInfo, error) {
6112
u := &UserInfo{}
6213

types.go

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,10 +12,10 @@ import (
1212

1313
const (
1414
// APIBaseSandBox points to the sandbox (for testing) version of the API
15-
APIBaseSandBox = "https://api.sandbox.paypal.com"
15+
APIBaseSandBox = "https://api-m.sandbox.paypal.com"
1616

1717
// APIBaseLive points to the live version of the API
18-
APIBaseLive = "https://api.paypal.com"
18+
APIBaseLive = "https://api-m.paypal.com"
1919

2020
// RequestNewTokenBeforeExpiresIn is used by SendWithAuth and try to get new Token when it's about to expire
2121
RequestNewTokenBeforeExpiresIn = time.Duration(60) * time.Second

0 commit comments

Comments
 (0)