/**
  * @param PaymentInterface $payment
  * @return HandlerInterface
  * @throws InvalidPaymentException
  */
 public function getPaymentHandler(PaymentInterface $payment)
 {
     $slug = $payment->getPaymentMethod()->getSlug();
     if (!array_key_exists($slug, $this->handlers)) {
         throw new InvalidPaymentException('Undefined payment method.');
     }
     return $this->handlers[$slug];
 }