From 58b1c636fd9931adf56b8f5a0fb2a6087e03657a Mon Sep 17 00:00:00 2001 From: Yingjie Run Date: Mon, 24 Jul 2017 17:43:16 +0800 Subject: [PATCH] Remove iOS 6 style transaction receipt fields --- appstore/model.go | 15 +++++++-------- appstore/validator.go | 4 ---- appstore/validator_test.go | 7 ------- 3 files changed, 7 insertions(+), 19 deletions(-) diff --git a/appstore/model.go b/appstore/model.go index b75e6a6..5aa9595 100644 --- a/appstore/model.go +++ b/appstore/model.go @@ -108,13 +108,12 @@ type ( // https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html // If you get other types or fileds from the IAP response, you should use the struct you defined. IAPResponse struct { - Status int `json:"status"` - Environment string `json:"environment"` - Receipt Receipt `json:"receipt"` - LatestReceiptInfo []InApp `json:"latest_receipt_info"` - LatestReceipt string `json:"latest_receipt"` - LatestExpiredReceiptInfo InApp `json:"latest_expired_receipt_info"` - PendingRenewalInfo []PendingRenewalInfo `json:"pending_renewal_info"` - IsRetryable bool `json:"is-retryable"` + Status int `json:"status"` + Environment string `json:"environment"` + Receipt Receipt `json:"receipt"` + LatestReceiptInfo []InApp `json:"latest_receipt_info"` + LatestReceipt string `json:"latest_receipt"` + PendingRenewalInfo []PendingRenewalInfo `json:"pending_renewal_info"` + IsRetryable bool `json:"is-retryable"` } ) diff --git a/appstore/validator.go b/appstore/validator.go index bc8065a..31c9930 100644 --- a/appstore/validator.go +++ b/appstore/validator.go @@ -56,10 +56,6 @@ func HandleError(status int) error { case 21005: message = "The receipt server is not currently available." - case 21006: - // Only returned for iOS 6 style transaction receipts for auto-renewable subscriptions. - message = "This receipt is valid but the subscription has expired. When this status code is returned to your server, the receipt data is also decoded and returned as part of the response." - case 21007: message = "This receipt is from the test environment, but it was sent to the production environment for verification. Send it to the test environment instead." diff --git a/appstore/validator_test.go b/appstore/validator_test.go index 2eed017..52436c1 100644 --- a/appstore/validator_test.go +++ b/appstore/validator_test.go @@ -53,13 +53,6 @@ func TestHandleError(t *testing.T) { t.Errorf("got %v\nwant %v", actual, expected) } - // status 21006 - expected = errors.New("This receipt is valid but the subscription has expired. When this status code is returned to your server, the receipt data is also decoded and returned as part of the response.") - actual = HandleError(21006) - if !reflect.DeepEqual(actual, expected) { - t.Errorf("got %v\nwant %v", actual, expected) - } - // status 21007 expected = errors.New("This receipt is from the test environment, but it was sent to the production environment for verification. Send it to the test environment instead.") actual = HandleError(21007)