public function getService(Payment $payment, $intent)
    {
        $method = 'create' . ucfirst($intent) . 'Service';
        $values = $this->extend($method, $payment);

        if (count($values) > 1) {
            throw new InvalidConfigurationException("Multiple extensions are trying to create a service for '$intent'");
        }

        if (count($values) === 1 && $values[0] instanceof PaymentService) {
            return $values[0];
        }

        if (method_exists($this, $method)) {
            return $this->$method($payment);
        }

        $serviceMap = $this->config()->get('services');

        if (is_array($serviceMap) && isset($serviceMap[$intent])) {
            $serviceType = $serviceMap[$intent];

            if (is_subclass_of($serviceType, PaymentService::class)) {
                return $serviceType::create($payment);
            }
        }

        throw new InvalidConfigurationException("Unable to create a service for '$intent'");
    }