Build a module that retrieves data from an external API endpoint and transforms the response. The remote API can reply with a variety of HTTP status codes — for example, 401 (Unauthorized), 402 (Payment Required), and others. Your implementation must detect these different outcomes, handle each case appropriately, and process the payload so that a consistent result is returned to the caller. Structure the code so it remains easy to extend and maintain.