Merge pull request #39 from logpacker/bugfix/go_linting

Fix linter issues
This commit is contained in:
Alex Pliutau 2017-10-02 22:34:11 -05:00 committed by GitHub
commit 9e9173db8d
3 changed files with 115 additions and 114 deletions

View File

@ -2,8 +2,9 @@ package paypalsdk_test
import ( import (
"fmt" "fmt"
pp "github.com/logpacker/PayPal-Go-SDK"
"time" "time"
pp "github.com/logpacker/PayPal-Go-SDK"
) )
func BillingExample() { func BillingExample() {
@ -72,8 +73,8 @@ func BillingExample() {
Value: "1", Value: "1",
Currency: "USD", Currency: "USD",
}, },
ReturnUrl: "http://www.paypal.com", ReturnURL: "http://www.paypal.com",
CancelUrl: "http://www.paypal.com/cancel", CancelURL: "http://www.paypal.com/cancel",
AutoBillAmount: "YES", AutoBillAmount: "YES",
InitialFailAmountAction: "CONTINUE", InitialFailAmountAction: "CONTINUE",
MaxFailAttempts: "0", MaxFailAttempts: "0",
@ -96,7 +97,7 @@ func BillingExample() {
agreement := pp.BillingAgreement{ agreement := pp.BillingAgreement{
Name: "Fast Speed Agreement", Name: "Fast Speed Agreement",
Description: "Agreement for Fast Speed Plan", Description: "Agreement for Fast Speed Plan",
StartDate: pp.JsonTime(time.Now().Add(time.Hour * 24)), StartDate: pp.JSONTime(time.Now().Add(time.Hour * 24)),
Plan: pp.BillingPlan{ID: planResp.ID}, Plan: pp.BillingPlan{ID: planResp.ID},
Payer: pp.Payer{ Payer: pp.Payer{
PaymentMethod: "paypal", PaymentMethod: "paypal",

View File

@ -58,7 +58,6 @@ func (c *Client) SetHTTPClient(client *http.Client) error {
return nil return nil
} }
// SetAccessToken sets saved token to current client // SetAccessToken sets saved token to current client
func (c *Client) SetAccessToken(token string) error { func (c *Client) SetAccessToken(token string) error {
c.Token = &TokenResponse{ c.Token = &TokenResponse{

View File

@ -44,8 +44,8 @@ const (
) )
type ( type (
// JsonTime overrides MarshalJson method to format in ISO8601 // JSONTime overrides MarshalJson method to format in ISO8601
JsonTime time.Time JSONTime time.Time
// Address struct // Address struct
Address struct { Address struct {
@ -113,7 +113,7 @@ type (
BillingAgreement struct { BillingAgreement struct {
Name string `json:"name,omitempty"` Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"` Description string `json:"description,omitempty"`
StartDate JsonTime `json:"start_date,omitempty"` StartDate JSONTime `json:"start_date,omitempty"`
Plan BillingPlan `json:"plan,omitempty"` Plan BillingPlan `json:"plan,omitempty"`
Payer Payer `json:"payer,omitempty"` Payer Payer `json:"payer,omitempty"`
ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"` ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
@ -287,8 +287,8 @@ type (
// MerchantPreferences struct // MerchantPreferences struct
MerchantPreferences struct { MerchantPreferences struct {
SetupFee *AmountPayout `json:"setup_fee,omitempty"` SetupFee *AmountPayout `json:"setup_fee,omitempty"`
ReturnUrl string `json:"return_url,omitempty"` ReturnURL string `json:"return_url,omitempty"`
CancelUrl string `json:"cancel_url,omitempty"` CancelURL string `json:"cancel_url,omitempty"`
AutoBillAmount string `json:"auto_bill_amount,omitempty"` AutoBillAmount string `json:"auto_bill_amount,omitempty"`
InitialFailAmountAction string `json:"initial_fail_amount_action,omitempty"` InitialFailAmountAction string `json:"initial_fail_amount_action,omitempty"`
MaxFailAttempts string `json:"max_fail_attempts,omitempty"` MaxFailAttempts string `json:"max_fail_attempts,omitempty"`
@ -539,7 +539,8 @@ func (r *ErrorResponse) Error() string {
return fmt.Sprintf("%v %v: %d %s", r.Response.Request.Method, r.Response.Request.URL, r.Response.StatusCode, r.Message) return fmt.Sprintf("%v %v: %d %s", r.Response.Request.Method, r.Response.Request.URL, r.Response.StatusCode, r.Message)
} }
func (t JsonTime) MarshalJSON() ([]byte, error) { // MarshalJSON for JSONTime
func (t JSONTime) MarshalJSON() ([]byte, error) {
stamp := fmt.Sprintf(`"%s"`, time.Time(t).UTC().Format(time.RFC3339)) stamp := fmt.Sprintf(`"%s"`, time.Time(t).UTC().Format(time.RFC3339))
return []byte(stamp), nil return []byte(stamp), nil
} }