PowerBuilder / GP-API Collection / DIA_1.0 Get Disputes List
Back to Collection Items
integer li_rc
oleobject loo_Http
integer li_Success
oleobject loo_QueryParams
oleobject loo_Resp
// This example assumes the Chilkat API to have been previously unlocked.
// See Global Unlock Sample for sample code.
loo_Http = create oleobject
// Use "Chilkat_9_5_0.Http" for versions of Chilkat < 10.0.0
li_rc = loo_Http.ConnectToNewObject("Chilkat.Http")
if li_rc < 0 then
destroy loo_Http
MessageBox("Error","Connecting to COM object failed")
return
end if
loo_QueryParams = create oleobject
// Use "Chilkat_9_5_0.JsonObject" for versions of Chilkat < 10.0.0
li_rc = loo_QueryParams.ConnectToNewObject("Chilkat.JsonObject")
loo_QueryParams.UpdateInt("page_size",1000)
loo_QueryParams.UpdateString("order","ASC")
loo_QueryParams.UpdateString("stage","CHARGEBACK")
loo_QueryParams.UpdateString("from_stage_time_created","2020-06-09")
loo_Http.SetRequestHeader("Content-Type","application/json")
loo_Http.SetRequestHeader("X-GP-Version","{{version}}")
// Adds the "Authorization: Bearer {{token}}" header.
loo_Http.AuthToken = "{{token}}"
loo_Http.SetRequestHeader("idempotency-key","12345")
loo_Http.SetRequestHeader("Accept","application/json")
loo_Resp = loo_Http.QuickRequestParams("GET","https://{{url}}/ucp/disputes",loo_QueryParams)
if loo_Http.LastMethodSuccess = 0 then
Write-Debug loo_Http.LastErrorText
destroy loo_Http
destroy loo_QueryParams
return
end if
Write-Debug string(loo_Resp.StatusCode)
Write-Debug loo_Resp.BodyStr
destroy loo_Resp
destroy loo_Http
destroy loo_QueryParams
Curl Command
curl -G -d "page_size=1000"
-d "order=ASC"
-d "stage=CHARGEBACK"
-d "from_stage_time_created=2020-06-09"
-H "Content-Type: application/json"
-H "Authorization: Bearer {{token}}"
-H "Accept: application/json"
-H "X-GP-Version: {{version}}"
-H "idempotency-key: 12345"
https://{{url}}/ucp/disputes
Postman Collection Item JSON
{
"name": "DIA_1.0 Get Disputes List",
"event": [
{
"listen": "test",
"script": {
"exec": [
"\r",
"var totalAdjDebitAmount=0;\r",
"var totalAdjCreditAmount=0;\r",
"var totalAdjEvenAmount=0;\r",
"var totalAdjDebitCount=0;\r",
"var totalAdjCreditCount=0;\r",
"var totalAdjEvenCount=0;\r",
"var totalRecordCount=0;\r",
"var i=0;\r",
"\r",
"var jsonData = JSON.parse(responseBody);\r",
"\r",
"\r",
"for(i = 0; i < jsonData.disputes.length; i++) {\r",
"\r",
" var obj = jsonData.disputes[i];\r",
" fundingType = String(obj.last_adjustment_funding);\r",
" \r",
" if (fundingType == \"DEBIT\"){\r",
" totalAdjDebitAmount += parseInt(obj.last_adjustment_amount);\r",
" totalAdjDebitCount++;\r",
" }else if(fundingType == \"CREDIT\") {\r",
" totalAdjCreditAmount += parseInt(obj.last_adjustment_amount);\r",
" totalAdjCreditCount++;\r",
" \r",
" }else {\r",
" totalAdjEvenAmount += parseInt(obj.last_adjustment_amount);\r",
" totalAdjEvenCount++;\r",
" \r",
" }\r",
" totalRecordCount++;\r",
"}\r",
"\r",
"totalAdjCreditAmount = 0 - totalAdjCreditAmount;\r",
"\r",
"console.log(\"dr amt: \" + totalAdjDebitAmount);\r",
"console.log(\"dr cnt: \" + totalAdjDebitCount);\r",
"\r",
"console.log(\"cr amt: \" + totalAdjCreditAmount);\r",
"console.log(\"cr cnt: \" + totalAdjCreditCount);\r",
"\r",
"console.log(\"ev amt: \" + totalAdjEvenAmount);\r",
"console.log(\"ev cnt: \" + totalAdjEvenCount);\r",
"\r",
"console.log(\"ttl cnt: \" + totalRecordCount);\r",
"console.log(\"ttl amt (sum): \" + (totalAdjDebitAmount + totalAdjCreditAmount + totalAdjEvenAmount));\r",
"\r",
"console.log(\"ttl cnt (sum): \" + (totalAdjDebitCount + totalAdjCreditCount + totalAdjEvenCount));\r",
"\r",
"console.log(\"ttl cnt: \" + totalRecordCount);\r",
"console.log(\"ttl amt (sum): \" + (totalAdjDebitAmount + totalAdjCreditAmount));\r",
"\r",
"console.log(\"ttl cnt (sum): \" + (totalAdjDebitCount + totalAdjCreditCount));\r",
"\r",
"console.log(\" ********** \");\r",
"\r",
"\r",
"tests[\"Response time is acceptable\"] = _.inRange(responseTime, 100, 1500); \r",
"\r",
"\r",
"pm.test(\"Successful POST request\", function () {\r",
" pm.expect(pm.response.code).to.be.oneOf([200,201,202]);\r",
"});\r",
"\r",
"pm.test(\"Status code name has string\", function () {\r",
" pm.response.to.have.status(\"OK\");\r",
"});"
],
"type": "text/javascript"
}
}
],
"request": {
"method": "GET",
"header": [
{
"key": "Content-Type",
"value": "application/json",
"type": "text",
"disabled": true
},
{
"key": "Authorization",
"value": "Bearer {{token}}",
"type": "text"
},
{
"key": "Accept",
"value": "application/json",
"type": "text"
},
{
"key": "X-GP-Version",
"value": "{{version}}",
"type": "text"
},
{
"key": "idempotency-key",
"value": "12345",
"type": "text"
}
],
"url": {
"raw": "https://{{url}}/ucp/disputes?page_size=1000&order=ASC&stage=CHARGEBACK&from_stage_time_created=2020-06-09",
"protocol": "https",
"host": [
"{{url}}"
],
"path": [
"ucp",
"disputes"
],
"query": [
{
"key": "page_size",
"value": "1000"
},
{
"key": "to_stage_time_created",
"value": "2020-01-29",
"disabled": true
},
{
"key": "from_adjustment_time_created",
"value": "2020-01-01",
"disabled": true
},
{
"key": "to_adjustment_time_created",
"value": "2020-03-31",
"disabled": true
},
{
"key": "order_by",
"value": "id",
"disabled": true
},
{
"key": "order",
"value": "ASC"
},
{
"key": "last_adjustment_funding",
"value": "CREDIT",
"disabled": true
},
{
"key": "result",
"value": "WON",
"disabled": true
},
{
"key": "stage",
"value": "CHARGEBACK"
},
{
"key": "stage",
"value": "REVERSAL",
"disabled": true
},
{
"key": "stage",
"value": "SECOND_CHARGEBACK",
"disabled": true
},
{
"key": "id",
"value": "",
"disabled": true
},
{
"key": "system.mid",
"value": "",
"disabled": true
},
{
"key": "to_stage_time_created",
"value": "2020-03-31",
"disabled": true
},
{
"key": "system.hierarchy",
"value": "",
"disabled": true
},
{
"key": "from_stage_time_created",
"value": "2020-06-09"
},
{
"key": "from_status_time_created",
"value": "2020-07-25",
"disabled": true
},
{
"key": "order_by",
"value": "arn",
"disabled": true
}
]
},
"description": "This request retrieves all disputes from GP that have been made by a Payer or a Payer's Bank. User can pass in certain criteria in the query string in order to return specific types of disputes such as:\r\n- Chargebacks\r\n- Retrieval\r\n- Reversal\r\n- Arbitration\r\n- & more\r\n\r\nTo see further criteria, visit https://developer.globalpay.com/api/disputes#/Disputes/get_disputes\r\n\r\nAdditionally, the user can change page size, how the response is ordered and change the date from when the disputes date back too.\r\n\r\n\r\nIn the response received back, you will see the merchant_id along with the disputes and their reason code/description for the dispute."
},
"response": [
]
}