/**
  * @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 string $openpayCustomerId
  * @param CardInterface[] $cardsToSave
  * @return array
  */
 protected function saveCards($openpayCustomerId, array $cardsToSave)
 {
     $savedCards = [];
     foreach ($cardsToSave as $card) {
         $savedCards[] = $this->cardRepository->save($openpayCustomerId, $card);
     }
     return $savedCards;
 }