diff --git a/exporter/appsubscription_oracle.go b/exporter/appsubscription_oracle.go index b47798150e..8ae81b33d1 100644 --- a/exporter/appsubscription_oracle.go +++ b/exporter/appsubscription_oracle.go @@ -223,6 +223,21 @@ func rejectReason(valid bool) string { return "expired" } +func mapAppleProductID(productID string) string { + mappings := map[string]string{ + "orca.yearly.apple": "orca.yearly", + "orca.apple": "orca", + "dolphin.yearly.apple": "dolphin.yearly", + "dolphin.apple": "dolphin", + "guppy.yearly.apple": "guppy.yearly", + "guppy.apple": "guppy", + } + if mapped, ok := mappings[productID]; ok { + return mapped + } + return productID +} + func verifyApple(apple *api.StoreClient, receipt *types.PremiumData) (*VerifyResponse, error) { response := &VerifyResponse{ Valid: false, @@ -287,7 +302,7 @@ func verifyApple(apple *api.StoreClient, receipt *types.PremiumData) (*VerifyRes response.RejectReason = "invalid_product_id" return response, nil } - receipt.ProductID = productId + receipt.ProductID = mapAppleProductID(productId) expiresDateFloat, ok := claims["expiresDate"].(float64) if !ok {