Ir para o conteúdo

Reports Pix

Get Reports

Warning

Feature available since App Pix v1.3.0.1 and PhastPay-SDK v1.0.0.0.

getReports

The getReports function is used to get the transaction report for a given period.

Request

{
  "start_date": "2024-06-01T00:40:01.444Z",
  "end_date": "2024-06-05T00:40:01.444Z",
  "report_type": "SUMMARY"
}

Parámetros

Name Type Required Description
request String Yes Object containing the request information.
callback GetReportsCallback Yes Callback to be executed for success or error notifications.

Parameter Details

request (getReports)

Name Type Required Description Default
start_date String No Start date in UTC format. -
end_date String No End date in UTC format. -
report_type SUMMARY, DETAILED No Indicates the type of report to generate: summary or detailed. SUMMARY

Parameter Details

callback (GetReportsCallback)

Name Type Required Description
onSuccess String Yes Method called in case of success..
onError String Yes Method called in case of error. The response will be a String, in JSON format, containing the fields defined in the IpcResponseError class.
fun getReportsService(
    pixClient: PixClient,
    startDate: String,
    endDate: String,
    reportType: ReportType
) {
    val gson: Gson = Gson()

    if (pixClient.isBound()) {
        val getReportsRequest = GetReportsRequest(startDate, endDate, reportType)
        val callback = object : PixClient.ICallbackService {
            override fun onError(response: String?) {
                val responseError = gson.fromJson(response, IpcResponseError::class.java)
                println("Erro $responseError")
            }

            override fun onSuccess(response: String?) {
               println("consultado $response")
            }
        }
          pixClient.getReports(
            gson.toJson(getReportsRequest),
            callback
        )
    }
}

Requests and Responses

GetReportsRequest

data class GetReportsRequest(
    @SerializedName("start_date")
    val startDate: String,

    @SerializedName("end_date")
    val endDate: String,

    @SerializedName("report_type")
    val reportType: ReportType
)

IpcResponseError

class IpcResponseError (
    @SerializedName("error_message")
    val errorMessage: String
)