Skip to content

How to handle errors? #8

Open
Open

Description

@jgmdev

I successfully integrated the athmovil payment system but I'm not sure how to handle the error codes listed on the readme, the readme doesn't mentions how they are produced. Are these error codes set by the json response as:

{
    'error': 'error_code'
}

???

Activity

  1. octafishmedia commented on May 9, 2020

    @octafishmedia
    Collaborator

    Hola!

    I'm having trouble with the GET transactions endpoint.

    I was able to implement the Payment Button, and REFUND via POST to endpoint but nothing I try works when I try to GET a list of transactions.

    Maybe we can help each other out since "support" from Evertec is weak.

    Saludos ...

  2. jgmdev commented on May 10, 2020

    @jgmdev
    Author

    Saludos! No se si valga la pena escribir ingles aquí ya que la mayoría que vaya a implementar esto es de Puerto Rico (o eso es lo que creo) pero bueno aquí vamos....

    The Evertec json response includes utf-bom bytes that you need to strip out before converting it to an object you can work with. Otherwise unserialization of the response will fail.

    Here is the partial php code of what I did to strip out the utf bits:

    //Store response
    $response = @stream_get_contents($fp, 1024*10);
    
    //Close connection
    fclose($fp);
    
    $response = explode("\r\n\r\n", $response);
    $response_body = explode("\n", $response[1]);
    
    // Decode json response
    $json_response = array();
    if(count($response_body) > 1) // handle utf-8 bom
    {
        $json_response = json_decode(trim($response_body[1]), true);
    }
    else
    {
        $json_response = json_decode(trim($response_body[0]), true);
    }
  3. octafishmedia commented on May 10, 2020

    @octafishmedia
    Collaborator
  4. jgmdev commented on May 10, 2020

    @jgmdev
    Author

    Ahora que me percato bien, yo no implemente el listar las transacciones, solo validarlas. Por un momento cuando leí el mensaje pensé que era validar una transacción para ver si es verdadera. Quien sabe si ese endpoint que estás tratando de utilizar no funciona correctamente. Lo que puedes hacer es guardar todos los números de referencia y luego utilizar el /rs/v2/transactionStatus para obtener la información de esas transacciones.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions