/** * @param PaymentTokenInterface $token * @param OrderPaymentInterface $payment * @return bool */ public function saveTokenWithPaymentLink(PaymentTokenInterface $token, OrderPaymentInterface $payment) { $tokenDuplicate = $this->getByPublicHash($token->getPublicHash(), $token->getCustomerId()); if (!empty($tokenDuplicate)) { $token->setEntityId($tokenDuplicate->getEntityId()); $token->setIsVisible($token->getIsActive()); } $this->paymentTokenRepository->save($token); $result = $this->addLinkToOrderPayment($token->getEntityId(), $payment->getEntityId()); return $result; }