forked from Mirrors/go-iap
Golint and fixed a typo
This commit is contained in:
@@ -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,
|
||||
}
|
||||
|
||||
@@ -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"
|
||||
)
|
||||
|
||||
|
||||
@@ -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) {
|
||||
|
||||
Reference in New Issue
Block a user