'NotificationCanceled', NotificationEventType::REFUND_SUCCEEDED => 'NotificationRefundSucceeded', NotificationEventType::PAYMENT_SUCCEEDED => 'NotificationSucceeded', NotificationEventType::PAYMENT_WAITING_FOR_CAPTURE => 'NotificationWaitingForCapture', ); /** * @param array $data * @return AbstractNotification */ public function factory(array $data) { if (!array_key_exists('event', $data)) { throw new \InvalidArgumentException( 'Parameter event not specified in NotificationFactory.factory()' ); } if (!is_string($data['event'])) { throw new \InvalidArgumentException('Invalid notification type value in notification factory'); } if (!array_key_exists($data['event'], $this->typeClassMap)) { throw new \InvalidArgumentException('Invalid notification data type "' . $data['event'] . '"'); } $className = __NAMESPACE__ . '\\' . $this->typeClassMap[$data['event']]; return new $className($data); } }