/** * @param $customerDataObject * @return CardInterface[] */ protected function getCardsFromOpenpay($customerDataObject) { try { $cards = $this->cardRepository->getCardsByOpenpayCustomerId($customerDataObject); } catch (\Exception $e) { $cards = ['error' => __('Could not retrieve available cards from OpenPay for the given user')]; } return $cards; }
/** * @param CustomerInterface $customer */ protected function refreshCards(CustomerInterface $customer) { $openpayCustomerId = $this->getOpenpayCustomerId($customer); $cards = $this->cardRepository->getCardsByOpenpayCustomerId($openpayCustomerId); $customer->getExtensionAttributes()->setOpenpayCard($cards); }