instanceFactory = $instanceFactory; $this->paymentMethodList = $paymentMethodList; } /** * @inheritdoc */ public function getList($storeId) { return $this->filterList($this->paymentMethodList->getList($storeId)); } /** * @inheritdoc */ public function getActiveList($storeId) { return $this->filterList($this->paymentMethodList->getActiveList($storeId)); } /** * Filter vault methods from payments * @param PaymentMethodInterface[] $list * @return VaultPaymentInterface[] */ private function filterList(array $list) { $paymentMethods = array_map( function (PaymentMethodInterface $paymentMethod) { return $this->instanceFactory->create($paymentMethod); }, $list ); $availableMethods = array_filter( $paymentMethods, function (MethodInterface $methodInstance) { return $methodInstance instanceof VaultPaymentInterface; } ); return array_values($availableMethods); } }