Added the subscription validator for in app billing

This commit is contained in:
tsuji_jumpei
2014-12-04 22:35:01 +09:00
parent 1f1601cd3c
commit 99e9a4e759
6 changed files with 244 additions and 8 deletions

View File

@@ -68,8 +68,8 @@ func HandleError(status int) error {
}
// New creates a client object
func New() *Client {
client := &Client{
func New() Client {
client := Client{
URL: sandboxURL,
TimeOut: time.Second * 5,
}
@@ -80,12 +80,12 @@ func New() *Client {
}
// NewWithConfig creates a client with configuration
func NewWithConfig(config Config) *Client {
func NewWithConfig(config Config) Client {
if config.TimeOut == 0 {
config.TimeOut = time.Second * 5
}
client := &Client{
client := Client{
URL: sandboxURL,
TimeOut: config.TimeOut,
}

View File

@@ -68,7 +68,7 @@ func TestHandleError(t *testing.T) {
}
func TestNew(t *testing.T) {
expected := &Client{
expected := Client{
URL: "https://sandbox.itunes.apple.com/verifyReceipt",
TimeOut: time.Second * 5,
}
@@ -85,7 +85,7 @@ func TestNewWithConfig(t *testing.T) {
TimeOut: time.Second * 2,
}
expected := &Client{
expected := Client{
URL: "https://buy.itunes.apple.com/verifyReceipt",
TimeOut: time.Second * 2,
}