src/ClearSaleID/Entity/Request/Payment.php
public function toXML( XMLWriter $XMLWriter )
    {
        $XMLWriter->startElement( 'Pagamento' );

        if ($this->sequential) {
            $XMLWriter->writeElement( 'NumeroSequencial', $this->sequential );
        }

        if ($this->date) {
            $XMLWriter->writeElement( 'Data', $this->date->format( self::DATE_TIME_FORMAT ) );
        } else {
            throw new RequiredFieldException( 'Field Date of the Payment object is required' );
        }

        if (is_numeric( $this->amount ) && $this->amount >= 0.0) {
            $XMLWriter->writeElement( 'Valor', $this->amount );
        } else {
            throw new RequiredFieldException( 'Field Amount of the Payment object is required' );
        }

        if ($this->type) {
            $XMLWriter->writeElement( 'TipoPagamentoID', $this->type );
        } else {
            throw new RequiredFieldException( 'Field PaymentTypeID of the Payment object is required' );
        }

        if ($this->quantityInstallments) {
            $XMLWriter->writeElement( 'QtdParcelas', $this->quantityInstallments );
        }

        if ($this->card) {
            $this->card->toXML( $XMLWriter );
        }

        if ($this->legalDocument) {
            $XMLWriter->writeElement( 'DocumentoLegal1', $this->legalDocument );
        }

        $XMLWriter->endElement();
    }
public function toXML( XMLWriter $XMLWriter )
    {
        $XMLWriter->startElement( 'Pagamento' );

        if ($this->sequential) {
            $XMLWriter->writeElement( 'NumeroSequencial', $this->sequential );
        }

        if ($this->date) {
            $XMLWriter->writeElement( 'Data', $this->date->format( self::DATE_TIME_FORMAT ) );
        } else {
            throw new RequiredFieldException( 'Field Date of the Payment object is required' );
        }

        if (is_numeric( $this->amount ) && $this->amount >= 0.0) {
            $XMLWriter->writeElement( 'Valor', $this->amount );
        } else {
            throw new RequiredFieldException( 'Field Amount of the Payment object is required' );
        }

        if ($this->type) {
            $XMLWriter->writeElement( 'TipoPagamentoID', $this->type );
        } else {
            throw new RequiredFieldException( 'Field PaymentTypeID of the Payment object is required' );
        }

        if ($this->quantityInstallments) {
            $XMLWriter->writeElement( 'QtdParcelas', $this->quantityInstallments );
        }

        if ($this->card) {
            $this->card->toXML( $XMLWriter );
        }

        if ($this->legalDocument) {
            $XMLWriter->writeElement( 'DocumentoLegal1', $this->legalDocument );
        }

        $XMLWriter->endElement();
    }
@param  \XMLWriter $XMLWriter

@throws \RodrigoPedra\ClearSaleID\Exception\RequiredFieldException