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 (
"fmt"
pp "github.com/logpacker/PayPal-Go-SDK"
"time"
pp "github.com/logpacker/PayPal-Go-SDK"
)
func BillingExample() {
@ -72,8 +73,8 @@ func BillingExample() {
Value: "1",
Currency: "USD",
},
ReturnUrl: "http://www.paypal.com",
CancelUrl: "http://www.paypal.com/cancel",
ReturnURL: "http://www.paypal.com",
CancelURL: "http://www.paypal.com/cancel",
AutoBillAmount: "YES",
InitialFailAmountAction: "CONTINUE",
MaxFailAttempts: "0",
@ -96,7 +97,7 @@ func BillingExample() {
agreement := pp.BillingAgreement{
Name: "Fast Speed Agreement",
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},
Payer: pp.Payer{
PaymentMethod: "paypal",

View File

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

View File

@ -44,8 +44,8 @@ const (
)
type (
// JsonTime overrides MarshalJson method to format in ISO8601
JsonTime time.Time
// JSONTime overrides MarshalJson method to format in ISO8601
JSONTime time.Time
// Address struct
Address struct {
@ -113,7 +113,7 @@ type (
BillingAgreement struct {
Name string `json:"name,omitempty"`
Description string `json:"description,omitempty"`
StartDate JsonTime `json:"start_date,omitempty"`
StartDate JSONTime `json:"start_date,omitempty"`
Plan BillingPlan `json:"plan,omitempty"`
Payer Payer `json:"payer,omitempty"`
ShippingAddress *ShippingAddress `json:"shipping_address,omitempty"`
@ -287,8 +287,8 @@ type (
// MerchantPreferences struct
MerchantPreferences struct {
SetupFee *AmountPayout `json:"setup_fee,omitempty"`
ReturnUrl string `json:"return_url,omitempty"`
CancelUrl string `json:"cancel_url,omitempty"`
ReturnURL string `json:"return_url,omitempty"`
CancelURL string `json:"cancel_url,omitempty"`
AutoBillAmount string `json:"auto_bill_amount,omitempty"`
InitialFailAmountAction string `json:"initial_fail_amount_action,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)
}
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))
return []byte(stamp), nil
}