Skip to content

Commit e70e544

Browse files
committed
Update package name
1 parent f7f8c60 commit e70e544

18 files changed

+67
-69
lines changed

README.md

+22-22
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
1-
[![Go Report Card](https://goreportcard.com/badge/plutov/PayPal-Go-SDK)](https://goreportcard.com/report/plutov/PayPal-Go-SDK)
2-
[![Build Status](https://travis-ci.org/plutov/PayPal-Go-SDK.svg?branch=master)](https://travis-ci.org/plutov/PayPal-Go-SDK)
3-
[![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/plutov/PayPal-Go-SDK)
1+
[![Go Report Card](https://goreportcard.com/badge/plutov/paypal)](https://goreportcard.com/report/plutov/paypal)
2+
[![Build Status](https://travis-ci.org/plutov/paypal.svg?branch=master)](https://travis-ci.org/plutov/paypal)
3+
[![Godoc](http://img.shields.io/badge/godoc-reference-blue.svg?style=flat)](https://godoc.org/github.com/plutov/paypal)
44

55
### Go client for PayPal REST API
66

@@ -43,15 +43,15 @@ Currently supports **v2** only, if you want to use **v1**, use **v1.1.4** git ta
4343
* POST /v2/payments/billing-agreements/***TOKEN***/agreement-execute
4444

4545
### Missing endpoints
46-
It is possible that some endpoints are missing in this SDK Client, but you can use built-in **paypalsdk** functions to perform a request: **NewClient -> NewRequest -> SendWithAuth**
46+
It is possible that some endpoints are missing in this SDK Client, but you can use built-in **paypal** functions to perform a request: **NewClient -> NewRequest -> SendWithAuth**
4747

4848
### New Client
4949

5050
```go
51-
import "github.com/plutov/PayPal-Go-SDK"
51+
import "github.com/plutov/paypal"
5252

5353
// Create a client instance
54-
c, err := paypalsdk.NewClient("clientID", "secretID", paypalsdk.APIBaseSandBox)
54+
c, err := paypal.NewClient("clientID", "secretID", paypal.APIBaseSandBox)
5555
c.SetLog(os.Stdout) // Set log to terminal stdout
5656

5757
accessToken, err := c.GetAccessToken()
@@ -66,7 +66,7 @@ auth, err := c.GetAuthorization("2DC87612EK520411B")
6666
### Capture authorization
6767

6868
```go
69-
capture, err := c.CaptureAuthorization(authID, &paypalsdk.Amount{Total: "7.00", Currency: "USD"}, true)
69+
capture, err := c.CaptureAuthorization(authID, &paypal.Amount{Total: "7.00", Currency: "USD"}, true)
7070
```
7171

7272
### Void authorization
@@ -78,7 +78,7 @@ auth, err := c.VoidAuthorization(authID)
7878
### Reauthorize authorization
7979

8080
```go
81-
auth, err := c.ReauthorizeAuthorization(authID, &paypalsdk.Amount{Total: "7.00", Currency: "USD"})
81+
auth, err := c.ReauthorizeAuthorization(authID, &paypal.Amount{Total: "7.00", Currency: "USD"})
8282
```
8383

8484
### Get Sale by ID
@@ -93,7 +93,7 @@ sale, err := c.GetSale("36C38912MN9658832")
9393
// Full
9494
refund, err := c.RefundSale(saleID, nil)
9595
// Partial
96-
refund, err := c.RefundSale(saleID, &paypalsdk.Amount{Total: "7.00", Currency: "USD"})
96+
refund, err := c.RefundSale(saleID, &paypal.Amount{Total: "7.00", Currency: "USD"})
9797
```
9898

9999
### Get Refund by ID
@@ -111,25 +111,25 @@ order, err := c.GetOrder("O-4J082351X3132253H")
111111
### Create an Order
112112

113113
```go
114-
order, err := c.CreateOrder(paypalsdk.OrderIntentCapture, []paypalsdk.PurchaseUnitRequest{paypalsdk.PurchaseUnitRequest{ReferenceID: "ref-id", Amount: paypalsdk.Amount{Total: "7.00", Currency: "USD"}}})
114+
order, err := c.CreateOrder(paypal.OrderIntentCapture, []paypal.PurchaseUnitRequest{paypal.PurchaseUnitRequest{ReferenceID: "ref-id", Amount: paypal.Amount{Total: "7.00", Currency: "USD"}}})
115115
```
116116

117117
### Update Order by ID
118118

119119
```go
120-
order, err := c.UpdateOrder("O-4J082351X3132253H", []paypalsdk.PurchaseUnitRequest{})
120+
order, err := c.UpdateOrder("O-4J082351X3132253H", []paypal.PurchaseUnitRequest{})
121121
```
122122

123123
### Authorize Order
124124

125125
```go
126-
auth, err := c.AuthorizeOrder(orderID, paypalsdk.AuthorizeOrderRequest{})
126+
auth, err := c.AuthorizeOrder(orderID, paypal.AuthorizeOrderRequest{})
127127
```
128128

129129
### Capture Order
130130

131131
```go
132-
capture, err := c.CaptureOrder(orderID, paypalsdk.CaptureOrderRequest{})
132+
capture, err := c.CaptureOrder(orderID, paypal.CaptureOrderRequest{})
133133
```
134134

135135
### Identity
@@ -149,15 +149,15 @@ userInfo, err := c.GetUserInfo("openid")
149149
### Create single payout to email
150150

151151
```go
152-
payout := paypalsdk.Payout{
153-
SenderBatchHeader: &paypalsdk.SenderBatchHeader{
152+
payout := paypal.Payout{
153+
SenderBatchHeader: &paypal.SenderBatchHeader{
154154
EmailSubject: "Subject will be displayed on PayPal",
155155
},
156-
Items: []paypalsdk.PayoutItem{
157-
paypalsdk.PayoutItem{
156+
Items: []paypal.PayoutItem{
157+
paypal.PayoutItem{
158158
RecipientType: "EMAIL",
159159
Receiver: "[email protected]",
160-
Amount: &paypalsdk.AmountPayout{
160+
Amount: &paypal.AmountPayout{
161161
Value: "15.11",
162162
Currency: "USD",
163163
},
@@ -247,7 +247,7 @@ err := c.DeleteWebProfile("XP-CP6S-W9DY-96H8-MVN2")
247247

248248
```go
249249
// Store CC
250-
c.StoreCreditCard(paypalsdk.CreditCard{
250+
c.StoreCreditCard(paypal.CreditCard{
251251
Number: "4417119669820331",
252252
Type: "visa",
253253
ExpireMonth: "11",
@@ -261,8 +261,8 @@ c.StoreCreditCard(paypalsdk.CreditCard{
261261
c.DeleteCreditCard("CARD-ID-123")
262262

263263
// Edit it
264-
c.PatchCreditCard("CARD-ID-123", []paypalsdk.CreditCardField{
265-
paypalsdk.CreditCardField{
264+
c.PatchCreditCard("CARD-ID-123", []paypal.CreditCardField{
265+
paypal.CreditCardField{
266266
Operation: "replace",
267267
Path: "/billing_address/line1",
268268
Value: "New value",
@@ -290,5 +290,5 @@ Current contributors:
290290

291291
### Tests
292292

293-
* Unit tests: `go test`
293+
* Unit tests: `go test -v ./...`
294294
* Integration tests: `go test -tags=integration`

authorization.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paypalsdk
1+
package paypal
22

33
import (
44
"bytes"

billing.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paypalsdk
1+
package paypal
22

33
import (
44
"bytes"

billing_test.go

+19-21
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,37 @@
1-
package paypalsdk_test
1+
package paypal_test
22

33
import (
44
"fmt"
55
"time"
6-
7-
pp "github.com/plutov/PayPal-Go-SDK"
86
)
97

108
func BillingExample() {
11-
plan := pp.BillingPlan{
9+
plan := BillingPlan{
1210
Name: "Plan with Regular and Trial Payment Definitions",
1311
Description: "Plan with regular and trial payment definitions.",
1412
Type: "fixed",
15-
PaymentDefinitions: []pp.PaymentDefinition{
13+
PaymentDefinitions: []PaymentDefinition{
1614
{
1715
Name: "Regular payment definition",
1816
Type: "REGULAR",
1917
Frequency: "MONTH",
2018
FrequencyInterval: "2",
21-
Amount: pp.AmountPayout{
19+
Amount: AmountPayout{
2220
Value: "100",
2321
Currency: "USD",
2422
},
2523
Cycles: "12",
26-
ChargeModels: []pp.ChargeModel{
24+
ChargeModels: []ChargeModel{
2725
{
2826
Type: "SHIPPING",
29-
Amount: pp.AmountPayout{
27+
Amount: AmountPayout{
3028
Value: "10",
3129
Currency: "USD",
3230
},
3331
},
3432
{
3533
Type: "TAX",
36-
Amount: pp.AmountPayout{
34+
Amount: AmountPayout{
3735
Value: "12",
3836
Currency: "USD",
3937
},
@@ -45,31 +43,31 @@ func BillingExample() {
4543
Type: "trial",
4644
Frequency: "week",
4745
FrequencyInterval: "5",
48-
Amount: pp.AmountPayout{
46+
Amount: AmountPayout{
4947
Value: "9.19",
5048
Currency: "USD",
5149
},
5250
Cycles: "2",
53-
ChargeModels: []pp.ChargeModel{
51+
ChargeModels: []ChargeModel{
5452
{
5553
Type: "SHIPPING",
56-
Amount: pp.AmountPayout{
54+
Amount: AmountPayout{
5755
Value: "1",
5856
Currency: "USD",
5957
},
6058
},
6159
{
6260
Type: "TAX",
63-
Amount: pp.AmountPayout{
61+
Amount: AmountPayout{
6462
Value: "2",
6563
Currency: "USD",
6664
},
6765
},
6866
},
6967
},
7068
},
71-
MerchantPreferences: &pp.MerchantPreferences{
72-
SetupFee: &pp.AmountPayout{
69+
MerchantPreferences: &MerchantPreferences{
70+
SetupFee: &AmountPayout{
7371
Value: "1",
7472
Currency: "USD",
7573
},
@@ -80,7 +78,7 @@ func BillingExample() {
8078
MaxFailAttempts: "0",
8179
},
8280
}
83-
c, err := pp.NewClient("clientID", "secretID", pp.APIBaseSandBox)
81+
c, err := NewClient("clientID", "secretID", APIBaseSandBox)
8482
if err != nil {
8583
panic(err)
8684
}
@@ -94,18 +92,18 @@ func BillingExample() {
9492
}
9593
err = c.ActivatePlan(planResp.ID)
9694
fmt.Println(err)
97-
agreement := pp.BillingAgreement{
95+
agreement := BillingAgreement{
9896
Name: "Fast Speed Agreement",
9997
Description: "Agreement for Fast Speed Plan",
100-
StartDate: pp.JSONTime(time.Now().Add(time.Hour * 24)),
101-
Plan: pp.BillingPlan{ID: planResp.ID},
102-
Payer: pp.Payer{
98+
StartDate: JSONTime(time.Now().Add(time.Hour * 24)),
99+
Plan: BillingPlan{ID: planResp.ID},
100+
Payer: Payer{
103101
PaymentMethod: "paypal",
104102
},
105103
}
106104
resp, err := c.CreateBillingAgreement(agreement)
107105
fmt.Println(err, resp)
108106

109-
bps, err := c.ListBillingPlans(pp.BillingPlanListParams{Status: "ACTIVE"})
107+
bps, err := c.ListBillingPlans(BillingPlanListParams{Status: "ACTIVE"})
110108
fmt.Println(err, bps)
111109
}

client.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paypalsdk
1+
package paypal
22

33
import (
44
"bytes"
@@ -13,7 +13,7 @@ import (
1313
)
1414

1515
// NewClient returns new Client struct
16-
// APIBase is a base API URL, for testing you can use paypalsdk.APIBaseSandBox
16+
// APIBase is a base API URL, for testing you can use paypal.APIBaseSandBox
1717
func NewClient(clientID string, secret string, APIBase string) (*Client, error) {
1818
if clientID == "" || secret == "" || APIBase == "" {
1919
return nil, errors.New("ClientID, Secret and APIBase are required to create a Client")
@@ -65,7 +65,7 @@ func (c *Client) SetAccessToken(token string) {
6565
}
6666

6767
// SetLog will set/change the output destination.
68-
// If log file is set paypalsdk will log all requests and responses to this Writer
68+
// If log file is set paypal will log all requests and responses to this Writer
6969
func (c *Client) SetLog(log io.Writer) {
7070
c.Log = log
7171
}

doc.go

+5-5
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
/*
2-
Package paypalsdk provides a wrapper to PayPal API (https://developer.paypal.com/webapps/developer/docs/api/).
3-
The first thing you do is to create a Client (you can select API base URL using paypalsdk contants).
4-
c, err := paypalsdk.NewClient("clientID", "secretID", paypalsdk.APIBaseSandBox)
2+
Package paypal provides a wrapper to PayPal API (https://developer.paypal.com/webapps/developer/docs/api/).
3+
The first thing you do is to create a Client (you can select API base URL using paypal contants).
4+
c, err := paypal.NewClient("clientID", "secretID", paypal.APIBaseSandBox)
55
Then you can get an access token from PayPal:
66
accessToken, err := c.GetAccessToken()
77
After you have an access token you can call built-in functions to get data from PayPal.
8-
paypalsdk will assign all responses to go structures.
8+
paypal will assign all responses to go structures.
99
*/
10-
package paypalsdk
10+
package paypal

example_test.go

+3-3
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
1-
package paypalsdk_test
1+
package paypal_test
22

3-
import paypalsdk "github.com/plutov/PayPal-Go-SDK"
3+
import paypal "github.com/plutov/paypal"
44

55
func Example() {
66
// Initialize client
7-
c, err := paypalsdk.NewClient("clientID", "secretID", paypalsdk.APIBaseSandBox)
7+
c, err := paypal.NewClient("clientID", "secretID", paypal.APIBaseSandBox)
88
if err != nil {
99
panic(err)
1010
}

filter.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paypalsdk
1+
package paypal
22

33
import (
44
"fmt"

filter_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paypalsdk
1+
package paypal
22

33
import (
44
"testing"

identity.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paypalsdk
1+
package paypal
22

33
import (
44
"fmt"

integration_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
// +build integration
22

3-
package paypalsdk
3+
package paypal
44

55
import (
66
"testing"

order.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paypalsdk
1+
package paypal
22

33
import "fmt"
44

payout.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paypalsdk
1+
package paypal
22

33
import (
44
"fmt"

sale.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paypalsdk
1+
package paypal
22

33
import "fmt"
44

types.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paypalsdk
1+
package paypal
22

33
import (
44
"encoding/json"

unit_test.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paypalsdk
1+
package paypal
22

33
import (
44
"encoding/json"

vault.go

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
package paypalsdk
1+
package paypal
22

33
import (
44
"fmt"

0 commit comments

Comments
 (0)