An anti-corruption layer for the API you cannot change

Integrating with a third party whose model does not match yours spreads their vocabulary through your codebase — their status codes, their date format, their idea of what a customer is — until changing providers means changing everything.

interface StockLevels
{
    /** @return int|null */
    public function forSku($sku);
}

final class SupplierStockLevels implements StockLevels
{
    public function forSku($sku)
    {
        $raw = $this->client->get('/inv', array( 'a' => $sku ));

        return isset($raw['qty_avail']) ? (int) $raw['qty_avail'] : null;
    }
}

The interface is written in your language and the adapter does the translation, in one place. The discipline is that nothing outside the adapter may see qty_avail — the moment it leaks, the layer stops being a boundary. It also becomes the natural place for the retry, the timeout and the circuit breaker, all of which belong to the integration rather than to the domain.