/** * @param Transaction $transaction * @param DOMDocument $document * @return \DOMElement */ private function createDadosPortador(Transaction $transaction, DOMDocument $document) { $holder = $transaction->getHolder(); $token = $holder->getToken(); $dadosPortador = $document->createElementNS(self::NS, 'dados-portador'); $this->createElementAndAppendWithNs($dadosPortador, 'numero', $holder->getCreditCardNumber()); $this->createElementAndAppendWithNs($dadosPortador, 'validade', $holder->getExpiration()); $this->createElementAndAppendWithNs($dadosPortador, 'indicador', $holder->getCVVIndicator()); $this->createElementAndAppendWithNs($dadosPortador, 'codigo-seguranca', $holder->getCVV()); $this->createElementAndAppendWithNs($dadosPortador, 'token', empty($token) ? null : $token); return $dadosPortador; }
private function createDadosPortador(Transaction $transaction, DOMDocument $document) { $holder = $transaction->getHolder(); $token = $holder->getToken(); $dadosPortador = $document->createElementNS(TransactionRequestSerializer::NS, 'dados-portador'); if (empty($token)) { $dadosPortador->appendChild($document->createElementNS(TransactionRequestSerializer::NS, 'numero', $holder->getCreditCardNumber())); $dadosPortador->appendChild($document->createElementNS(TransactionRequestSerializer::NS, 'validade', $holder->getExpiration())); $dadosPortador->appendChild($document->createElementNS(TransactionRequestSerializer::NS, 'indicador', $holder->getCVVIndicator())); $dadosPortador->appendChild($document->createElementNS(TransactionRequestSerializer::NS, 'codigo-seguranca', $holder->getCVV())); $dadosPortador->appendChild($document->createElementNS(TransactionRequestSerializer::NS, 'token')); } else { $dadosPortador->appendChild($document->createElementNS(TransactionRequestSerializer::NS, 'token', $token)); } return $dadosPortador; }