Golint and fixed a typo

This commit is contained in:
Jumpei Tsuji
2016-05-13 13:28:59 +09:00
parent db9d5922fa
commit c6384b927f
3 changed files with 11 additions and 6 deletions

View File

@@ -12,11 +12,13 @@ import (
)
const (
// SandboxURL is the endpoint for local environment.
SandboxURL string = "http://localhost:8080/RVSSandbox"
// ProductionURL is the endpoint for production environment.
ProductionURL string = "https://appstore-sdk.amazon.com"
)
func getSandboxUrl() string {
func getSandboxURL() string {
url := os.Getenv("IAP_SANDBOX_URL")
if url == "" {
url = SandboxURL
@@ -41,6 +43,7 @@ type IAPResponse struct {
TestTransaction bool `json:"testTransaction"`
}
// The IAPResponseError typs has error message and status.
type IAPResponseError struct {
Message string `json:"message"`
Status bool `json:"status"`
@@ -61,7 +64,7 @@ type Client struct {
// New creates a client object
func New(secret string) IAPClient {
client := Client{
URL: getSandboxUrl(),
URL: getSandboxURL(),
Secret: secret,
TimeOut: time.Second * 5,
}
@@ -78,7 +81,7 @@ func NewWithConfig(config Config) Client {
}
client := Client{
URL: getSandboxUrl(),
URL: getSandboxURL(),
Secret: config.Secret,
TimeOut: config.TimeOut,
}

View File

@@ -13,7 +13,9 @@ import (
)
const (
// SandboxURL is the endpoint for sandbox environment.
SandboxURL string = "https://sandbox.itunes.apple.com/verifyReceipt"
// ProductionURL is the endpoint for production environment.
ProductionURL string = "https://buy.itunes.apple.com/verifyReceipt"
)

View File

@@ -63,7 +63,7 @@ func TestHandleError(t *testing.T) {
t.Errorf("got %v\nwant %v", actual, expected)
}
// status unkown
// status unknown
expected = errors.New("An unknown error ocurred")
actual = HandleError(100)
if !reflect.DeepEqual(actual, expected) {