How to work with tickets in the PHP API of Paying.me

1

My difficulty is in doing the parsing of the data returned in the ticket generation. My goal is to take this data and do some transformations, such as formatting the date / time and some other changes like translation of ticket status, etc.

My ticket generation and query methods:

/**
 * Gera um boleto para pagamento
 * 
 * @param int       $valor
 * @param array     $dados
 * @param string    $urlCallBack
 * @param array     $metadados
 * @return          void
 */
public function gerar($valor, $dados, $urlCallBack = null, $metadados = null)
{
    $customer = new Customer($dados);

    return $this->pagarMe->transaction()->boletoTransaction(
                $valor,
                $customer,
                $urlCallBack,
                $metadados
            );
}

/**
 * Retorna os dados do boleto
 * 
 * @return \PagarMe\Sdk\Transaction\BoletoTransaction
 */
public function consultar(int $transacaoId)
{
    return $this->dicionario($this->pagarMe->transaction()->get($transacaoId));
}
    
asked by anonymous 16.09.2017 / 00:33

1 answer

0
<?php    
    $res = TuaClasse->gerar(1000, \PagarMe\Sdk\Customer\Customer $customer, $urlCallBack = null, $metadados = null)

    $id_da_transacao = $res->getId();
?>
    
19.01.2018 / 15:25