Foxpro / GP-API Collection / DIA_1.0 Get Disputes List
Back to Collection Items
LOCAL loHttp
LOCAL lnSuccess
LOCAL loQueryParams
LOCAL loResp
* This example assumes the Chilkat API to have been previously unlocked.
* See Global Unlock Sample for sample code.
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.Http')
loHttp = CreateObject('Chilkat.Http')
* For versions of Chilkat < 10.0.0, use CreateObject('Chilkat_9_5_0.JsonObject')
loQueryParams = CreateObject('Chilkat.JsonObject')
loQueryParams.UpdateInt("page_size",1000)
loQueryParams.UpdateString("order","ASC")
loQueryParams.UpdateString("stage","CHARGEBACK")
loQueryParams.UpdateString("from_stage_time_created","2020-06-09")
loHttp.SetRequestHeader("Content-Type","application/json")
loHttp.SetRequestHeader("X-GP-Version","{{version}}")
* Adds the "Authorization: Bearer {{token}}" header.
loHttp.AuthToken = "{{token}}"
loHttp.SetRequestHeader("idempotency-key","12345")
loHttp.SetRequestHeader("Accept","application/json")
loResp = loHttp.QuickRequestParams("GET","https://{{url}}/ucp/disputes",loQueryParams)
IF (loHttp.LastMethodSuccess = 0) THEN
? loHttp.LastErrorText
RELEASE loHttp
RELEASE loQueryParams
CANCEL
ENDIF
? STR(loResp.StatusCode)
? loResp.BodyStr
RELEASE loResp
RELEASE loHttp
RELEASE loQueryParams
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": [
]
}