Remove iOS 6 style transaction receipt fields

This commit is contained in:
Yingjie Run
2017-07-24 17:43:16 +08:00
parent 7808531e12
commit 58b1c636fd
3 changed files with 7 additions and 19 deletions

View File

@@ -108,13 +108,12 @@ type (
// https://developer.apple.com/library/ios/releasenotes/General/ValidateAppStoreReceipt/Chapters/ReceiptFields.html // 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. // If you get other types or fileds from the IAP response, you should use the struct you defined.
IAPResponse struct { IAPResponse struct {
Status int `json:"status"` Status int `json:"status"`
Environment string `json:"environment"` Environment string `json:"environment"`
Receipt Receipt `json:"receipt"` Receipt Receipt `json:"receipt"`
LatestReceiptInfo []InApp `json:"latest_receipt_info"` LatestReceiptInfo []InApp `json:"latest_receipt_info"`
LatestReceipt string `json:"latest_receipt"` LatestReceipt string `json:"latest_receipt"`
LatestExpiredReceiptInfo InApp `json:"latest_expired_receipt_info"` PendingRenewalInfo []PendingRenewalInfo `json:"pending_renewal_info"`
PendingRenewalInfo []PendingRenewalInfo `json:"pending_renewal_info"` IsRetryable bool `json:"is-retryable"`
IsRetryable bool `json:"is-retryable"`
} }
) )

View File

@@ -56,10 +56,6 @@ func HandleError(status int) error {
case 21005: case 21005:
message = "The receipt server is not currently available." 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: 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." 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."

View File

@@ -53,13 +53,6 @@ func TestHandleError(t *testing.T) {
t.Errorf("got %v\nwant %v", actual, expected) 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 // 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.") 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) actual = HandleError(21007)