Skip to content

Commit e5d8118

Browse files
authored
Merge pull request #438 from eisbilir/feature/bulk-payments
endpoints for create/update WPP in bulk
2 parents 407326b + 9a85ee2 commit e5d8118

6 files changed

+457
-46
lines changed

docs/Topcoder-bookings-api.postman_collection.json

Lines changed: 201 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
{
22
"info": {
3-
"_postman_id": "8ead1433-9679-46de-9baa-d27d59106673",
3+
"_postman_id": "7954a27f-3833-404f-9e55-6016a938c86e",
44
"name": "Topcoder-bookings-api",
55
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
66
},
@@ -15940,8 +15940,12 @@
1594015940
" pm.response.to.have.status(200);\r",
1594115941
" if(pm.response.status === \"OK\"){\r",
1594215942
" const response = pm.response.json()\r",
15943-
" pm.environment.set(\"workPeriodPaymentId-2\", response[0].id);\r",
15944-
" pm.environment.set(\"workPeriodPaymentId-3\", response[1].id);\r",
15943+
" if (response[0].id) {\r",
15944+
" pm.environment.set(\"workPeriodPaymentId-2\", response[0].id);\r",
15945+
" }\r",
15946+
" if (response[1].id) {\r",
15947+
" pm.environment.set(\"workPeriodPaymentId-3\", response[1].id);\r",
15948+
" }\r",
1594515949
" }\r",
1594615950
"});"
1594715951
],
@@ -15968,12 +15972,13 @@
1596815972
}
1596915973
},
1597015974
"url": {
15971-
"raw": "{{URL}}/work-period-payments",
15975+
"raw": "{{URL}}/work-period-payments/bulk",
1597215976
"host": [
1597315977
"{{URL}}"
1597415978
],
1597515979
"path": [
15976-
"work-period-payments"
15980+
"work-period-payments",
15981+
"bulk"
1597715982
]
1597815983
}
1597915984
},
@@ -16498,7 +16503,7 @@
1649816503
"response": []
1649916504
},
1650016505
{
16501-
"name": "create work period payment with invalid days 2 Copy",
16506+
"name": "create work period payment with invalid days 3",
1650216507
"event": [
1650316508
{
1650416509
"listen": "test",
@@ -17680,6 +17685,196 @@
1768017685
}
1768117686
},
1768217687
"response": []
17688+
},
17689+
{
17690+
"name": "patch work period payment in bulk",
17691+
"event": [
17692+
{
17693+
"listen": "test",
17694+
"script": {
17695+
"exec": [
17696+
"pm.test('Status code is 200', function () {\r",
17697+
" pm.response.to.have.status(200);\r",
17698+
"});"
17699+
],
17700+
"type": "text/javascript"
17701+
}
17702+
}
17703+
],
17704+
"request": {
17705+
"method": "PATCH",
17706+
"header": [
17707+
{
17708+
"key": "Authorization",
17709+
"type": "text",
17710+
"value": "Bearer {{token_bookingManager}}"
17711+
}
17712+
],
17713+
"body": {
17714+
"mode": "raw",
17715+
"raw": "[\r\n {\r\n \"id\": \"{{workPeriodPaymentId}}\",\r\n \"status\": \"cancelled\",\r\n \"days\": 5,\r\n \"amount\": 10,\r\n \"memberRate\": 2,\r\n \"customerRate\": null,\r\n \"billingAccountId\": 44\r\n },\r\n {\r\n \"id\": \"{{workPeriodPaymentId-2}}\",\r\n \"status\": \"scheduled\"\r\n },\r\n {\r\n \"id\": \"{{workPeriodPaymentId-3}}\",\r\n \"days\": 5,\r\n \"amount\": 10,\r\n \"memberRate\": 2,\r\n \"customerRate\": 5,\r\n \"billingAccountId\": 44\r\n },\r\n {\r\n \"id\": \"{{workPeriodPaymentIdCreatedByM2M}}\",\r\n \"days\": 3\r\n }\r\n]",
17716+
"options": {
17717+
"raw": {
17718+
"language": "json"
17719+
}
17720+
}
17721+
},
17722+
"url": {
17723+
"raw": "{{URL}}/work-period-payments/bulk",
17724+
"host": [
17725+
"{{URL}}"
17726+
],
17727+
"path": [
17728+
"work-period-payments",
17729+
"bulk"
17730+
]
17731+
}
17732+
},
17733+
"response": []
17734+
},
17735+
{
17736+
"name": "patch work period payment in bulk invalid parameters - 1",
17737+
"event": [
17738+
{
17739+
"listen": "test",
17740+
"script": {
17741+
"exec": [
17742+
"pm.test('Status code is 400', function () {\r",
17743+
" pm.response.to.have.status(400);\r",
17744+
" const response = pm.response.json()\r",
17745+
" pm.expect(response.message).to.eq(\"\\\"workPeriodPayments[0].status\\\" must be one of [scheduled, cancelled]\")\r",
17746+
"});"
17747+
],
17748+
"type": "text/javascript"
17749+
}
17750+
}
17751+
],
17752+
"request": {
17753+
"method": "PATCH",
17754+
"header": [
17755+
{
17756+
"key": "Authorization",
17757+
"type": "text",
17758+
"value": "Bearer {{token_bookingManager}}"
17759+
}
17760+
],
17761+
"body": {
17762+
"mode": "raw",
17763+
"raw": "[\r\n {\r\n \"id\": \"{{workPeriodPaymentId}}\",\r\n \"status\": \"completed\"\r\n }\r\n]",
17764+
"options": {
17765+
"raw": {
17766+
"language": "json"
17767+
}
17768+
}
17769+
},
17770+
"url": {
17771+
"raw": "{{URL}}/work-period-payments/bulk",
17772+
"host": [
17773+
"{{URL}}"
17774+
],
17775+
"path": [
17776+
"work-period-payments",
17777+
"bulk"
17778+
]
17779+
}
17780+
},
17781+
"response": []
17782+
},
17783+
{
17784+
"name": "patch work period payment in bulk invalid parameters - 2",
17785+
"event": [
17786+
{
17787+
"listen": "test",
17788+
"script": {
17789+
"exec": [
17790+
"pm.test('Status code is 400', function () {\r",
17791+
" pm.response.to.have.status(400);\r",
17792+
" const response = pm.response.json()\r",
17793+
" pm.expect(response.message).to.eq(\"\\\"workPeriodPayments[0].days\\\" must be less than or equal to 10\")\r",
17794+
"});"
17795+
],
17796+
"type": "text/javascript"
17797+
}
17798+
}
17799+
],
17800+
"request": {
17801+
"method": "PATCH",
17802+
"header": [
17803+
{
17804+
"key": "Authorization",
17805+
"type": "text",
17806+
"value": "Bearer {{token_bookingManager}}"
17807+
}
17808+
],
17809+
"body": {
17810+
"mode": "raw",
17811+
"raw": "[\r\n {\r\n \"id\": \"{{workPeriodPaymentId}}\",\r\n \"days\": 11\r\n }\r\n]",
17812+
"options": {
17813+
"raw": {
17814+
"language": "json"
17815+
}
17816+
}
17817+
},
17818+
"url": {
17819+
"raw": "{{URL}}/work-period-payments/bulk",
17820+
"host": [
17821+
"{{URL}}"
17822+
],
17823+
"path": [
17824+
"work-period-payments",
17825+
"bulk"
17826+
]
17827+
}
17828+
},
17829+
"response": []
17830+
},
17831+
{
17832+
"name": "patch work period payment in bulk invalid parameters - 3",
17833+
"event": [
17834+
{
17835+
"listen": "test",
17836+
"script": {
17837+
"exec": [
17838+
"pm.test('Status code is 400', function () {\r",
17839+
" pm.response.to.have.status(400);\r",
17840+
" const response = pm.response.json()\r",
17841+
" pm.expect(response.message).to.eq(\"\\\"workPeriodPayments[0].amount\\\" must be greater than 0\")\r",
17842+
"});"
17843+
],
17844+
"type": "text/javascript"
17845+
}
17846+
}
17847+
],
17848+
"request": {
17849+
"method": "PATCH",
17850+
"header": [
17851+
{
17852+
"key": "Authorization",
17853+
"type": "text",
17854+
"value": "Bearer {{token_bookingManager}}"
17855+
}
17856+
],
17857+
"body": {
17858+
"mode": "raw",
17859+
"raw": "[\r\n {\r\n \"id\": \"{{workPeriodPaymentId}}\",\r\n \"amount\": 0\r\n }\r\n]",
17860+
"options": {
17861+
"raw": {
17862+
"language": "json"
17863+
}
17864+
}
17865+
},
17866+
"url": {
17867+
"raw": "{{URL}}/work-period-payments/bulk",
17868+
"host": [
17869+
"{{URL}}"
17870+
],
17871+
"path": [
17872+
"work-period-payments",
17873+
"bulk"
17874+
]
17875+
}
17876+
},
17877+
"response": []
1768317878
}
1768417879
]
1768517880
},

0 commit comments

Comments
 (0)