/** * @param string $customerId * @param CardInterface $card * @return \Openpay\Client\Type\OpenpayCardType * @throws LocalizedException */ public function save($customerId, CardInterface $card) { $params = ['token_id' => $card->getToken(), 'device_session_id' => $card->getDeviceSessionId()]; try { $openpayCard = $this->cardAdapter->store($customerId, $params); } catch (OpenpayException $e) { throw new LocalizedException(__($e->getDescription()), $e); } $cacheIdentifier = $this->getCacheIdentifier($customerId); $this->cache->remove($cacheIdentifier); return $openpayCard; }