Skip to content

Commit

Permalink
(nobids) map apple purchase keys to inhouse keys (#2975)
Browse files Browse the repository at this point in the history
  • Loading branch information
manuelsc authored Nov 11, 2024
1 parent 4f2f07e commit f2a2926
Showing 1 changed file with 16 additions and 1 deletion.
17 changes: 16 additions & 1 deletion exporter/appsubscription_oracle.go
Original file line number Diff line number Diff line change
Expand Up @@ -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,
Expand Down Expand Up @@ -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 {
Expand Down

0 comments on commit f2a2926

Please sign in to comment.