Skip to content

Commit 925d7bd

Browse files
Merge pull request #295 from topcoder-platform/feature/batch-payments
Feature/batch payments
2 parents 431157e + 75e915c commit 925d7bd

13 files changed

+679
-104
lines changed

app-constants.js

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -82,9 +82,10 @@ const ChallengeStatus = {
8282
COMPLETED: 'Completed'
8383
}
8484

85-
const PaymentProcessingSwitch = {
86-
ON: 'ON',
87-
OFF: 'OFF'
85+
const WorkPeriodPaymentStatus = {
86+
COMPLETED: 'completed',
87+
CANCELLED: 'cancelled',
88+
SCHEDULED: 'scheduled'
8889
}
8990

9091
module.exports = {
@@ -93,5 +94,5 @@ module.exports = {
9394
Scopes,
9495
Interviews,
9596
ChallengeStatus,
96-
PaymentProcessingSwitch
97+
WorkPeriodPaymentStatus
9798
}

config/default.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -169,7 +169,6 @@ module.exports = {
169169
ROLE_ID_SUBMITTER: process.env.ROLE_ID_SUBMITTER || '732339e7-8e30-49d7-9198-cccf9451e221',
170170
TYPE_ID_TASK: process.env.TYPE_ID_TASK || 'ecd58c69-238f-43a4-a4bb-d172719b9f31',
171171
DEFAULT_TIMELINE_TEMPLATE_ID: process.env.DEFAULT_TIMELINE_TEMPLATE_ID || '53a307ce-b4b3-4d6f-b9a1-3741a58f77e6',
172-
DEFAULT_TRACK_ID: process.env.DEFAULT_TRACK_ID || '9b6fc876-f4d9-4ccb-9dfd-419247628825',
172+
DEFAULT_TRACK_ID: process.env.DEFAULT_TRACK_ID || '9b6fc876-f4d9-4ccb-9dfd-419247628825'
173173

174-
PAYMENT_PROCESSING_SWITCH: process.env.PAYMENT_PROCESSING_SWITCH || 'OFF'
175174
}

docs/Topcoder-bookings-api.postman_collection.json

Lines changed: 282 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -16907,6 +16907,55 @@
1690716907
},
1690816908
"response": []
1690916909
},
16910+
{
16911+
"name": "create work period2",
16912+
"event": [
16913+
{
16914+
"listen": "test",
16915+
"script": {
16916+
"exec": [
16917+
"pm.test('Status code is 200', function () {\r",
16918+
" pm.response.to.have.status(200);\r",
16919+
" if(pm.response.status === \"OK\"){\r",
16920+
" const response = pm.response.json()\r",
16921+
" pm.environment.set(\"workPeriodId2\", response.id);\r",
16922+
" }\r",
16923+
"});"
16924+
],
16925+
"type": "text/javascript"
16926+
}
16927+
}
16928+
],
16929+
"request": {
16930+
"method": "POST",
16931+
"header": [
16932+
{
16933+
"key": "Authorization",
16934+
"type": "text",
16935+
"value": "Bearer {{token_bookingManager}}"
16936+
}
16937+
],
16938+
"body": {
16939+
"mode": "raw",
16940+
"raw": "{\r\n \"resourceBookingId\": \"{{resourceBookingId}}\",\r\n \"startDate\": \"2021-03-14\",\r\n \"endDate\": \"2021-03-20\",\r\n \"daysWorked\": 2,\r\n \"memberRate\": 13.13,\r\n \"customerRate\": 13.13,\r\n \"paymentStatus\": \"pending\"\r\n}",
16941+
"options": {
16942+
"raw": {
16943+
"language": "json"
16944+
}
16945+
}
16946+
},
16947+
"url": {
16948+
"raw": "{{URL}}/work-periods",
16949+
"host": [
16950+
"{{URL}}"
16951+
],
16952+
"path": [
16953+
"work-periods"
16954+
]
16955+
}
16956+
},
16957+
"response": []
16958+
},
1691016959
{
1691116960
"name": "create work period with m2m",
1691216961
"event": [
@@ -17007,6 +17056,97 @@
1700717056
},
1700817057
"response": []
1700917058
},
17059+
{
17060+
"name": "create multiple work period payments with boooking manager",
17061+
"event": [
17062+
{
17063+
"listen": "test",
17064+
"script": {
17065+
"exec": [
17066+
"pm.test('Status code is 200', function () {\r",
17067+
" pm.response.to.have.status(200);\r",
17068+
"});"
17069+
],
17070+
"type": "text/javascript"
17071+
}
17072+
}
17073+
],
17074+
"request": {
17075+
"method": "POST",
17076+
"header": [
17077+
{
17078+
"key": "Authorization",
17079+
"type": "text",
17080+
"value": "Bearer {{token_bookingManager}}"
17081+
}
17082+
],
17083+
"body": {
17084+
"mode": "raw",
17085+
"raw": "[{\r\n \"workPeriodId\": \"{{workPeriodId}}\",\r\n \"amount\": 600\r\n},{\r\n \"workPeriodId\": \"{{workPeriodId2}}\",\r\n \"amount\": 900\r\n}]",
17086+
"options": {
17087+
"raw": {
17088+
"language": "json"
17089+
}
17090+
}
17091+
},
17092+
"url": {
17093+
"raw": "{{URL}}/work-period-payments",
17094+
"host": [
17095+
"{{URL}}"
17096+
],
17097+
"path": [
17098+
"work-period-payments"
17099+
]
17100+
}
17101+
},
17102+
"response": []
17103+
},
17104+
{
17105+
"name": "create query work period payments with boooking manager",
17106+
"event": [
17107+
{
17108+
"listen": "test",
17109+
"script": {
17110+
"exec": [
17111+
"pm.test('Status code is 200', function () {\r",
17112+
" pm.response.to.have.status(200);\r",
17113+
"});"
17114+
],
17115+
"type": "text/javascript"
17116+
}
17117+
}
17118+
],
17119+
"request": {
17120+
"method": "POST",
17121+
"header": [
17122+
{
17123+
"key": "Authorization",
17124+
"type": "text",
17125+
"value": "Bearer {{token_bookingManager}}"
17126+
}
17127+
],
17128+
"body": {
17129+
"mode": "raw",
17130+
"raw": "{\"query\": { \"workPeriods.paymentStatus\": \"pending\" } }",
17131+
"options": {
17132+
"raw": {
17133+
"language": "json"
17134+
}
17135+
}
17136+
},
17137+
"url": {
17138+
"raw": "{{URL}}/work-period-payments/query",
17139+
"host": [
17140+
"{{URL}}"
17141+
],
17142+
"path": [
17143+
"work-period-payments",
17144+
"query"
17145+
]
17146+
}
17147+
},
17148+
"response": []
17149+
},
1701017150
{
1701117151
"name": "create work period payment with m2m create",
1701217152
"event": [
@@ -27377,6 +27517,52 @@
2737727517
},
2737827518
"response": []
2737927519
},
27520+
{
27521+
"name": "✔ create multiple work period payment with administrator",
27522+
"event": [
27523+
{
27524+
"listen": "test",
27525+
"script": {
27526+
"exec": [
27527+
"pm.test('Status code is 200', function () {\r",
27528+
" pm.response.to.have.status(200);\r",
27529+
"});"
27530+
],
27531+
"type": "text/javascript"
27532+
}
27533+
}
27534+
],
27535+
"request": {
27536+
"method": "POST",
27537+
"header": [
27538+
{
27539+
"key": "Authorization",
27540+
"type": "text",
27541+
"value": "Bearer {{token_administrator}}"
27542+
}
27543+
],
27544+
"body": {
27545+
"mode": "raw",
27546+
"raw": "{\"query\": { \"workPeriods.paymentStatus\": \"pending\" } }",
27547+
"options": {
27548+
"raw": {
27549+
"language": "json"
27550+
}
27551+
}
27552+
},
27553+
"url": {
27554+
"raw": "{{URL}}/work-period-payments/query",
27555+
"host": [
27556+
"{{URL}}"
27557+
],
27558+
"path": [
27559+
"work-period-payments",
27560+
"query"
27561+
]
27562+
}
27563+
},
27564+
"response": []
27565+
},
2738027566
{
2738127567
"name": "✔ get work period payment with administrator",
2738227568
"event": [
@@ -29829,6 +30015,54 @@
2982930015
},
2983030016
"response": []
2983130017
},
30018+
{
30019+
"name": "✘ create query work period payment with member",
30020+
"event": [
30021+
{
30022+
"listen": "test",
30023+
"script": {
30024+
"exec": [
30025+
"pm.test('Status code is 403', function () {\r",
30026+
" pm.response.to.have.status(403);\r",
30027+
" const response = pm.response.json()\r",
30028+
" pm.expect(response.message).to.eq(\"You are not allowed to perform this action!\")\r",
30029+
"});"
30030+
],
30031+
"type": "text/javascript"
30032+
}
30033+
}
30034+
],
30035+
"request": {
30036+
"method": "POST",
30037+
"header": [
30038+
{
30039+
"key": "Authorization",
30040+
"type": "text",
30041+
"value": "Bearer {{token_member_tester1234}}"
30042+
}
30043+
],
30044+
"body": {
30045+
"mode": "raw",
30046+
"raw": "{\"query\": { \"workPeriods.paymentStatus\": \"pending\" } }",
30047+
"options": {
30048+
"raw": {
30049+
"language": "json"
30050+
}
30051+
}
30052+
},
30053+
"url": {
30054+
"raw": "{{URL}}/work-period-payments/query",
30055+
"host": [
30056+
"{{URL}}"
30057+
],
30058+
"path": [
30059+
"work-period-payments",
30060+
"query"
30061+
]
30062+
}
30063+
},
30064+
"response": []
30065+
},
2983230066
{
2983330067
"name": "✘ get work period payment with member",
2983430068
"event": [
@@ -32343,6 +32577,54 @@
3234332577
},
3234432578
"response": []
3234532579
},
32580+
{
32581+
"name": "✘ create query work period payment with connect manager",
32582+
"event": [
32583+
{
32584+
"listen": "test",
32585+
"script": {
32586+
"exec": [
32587+
"pm.test('Status code is 403', function () {\r",
32588+
" pm.response.to.have.status(403);\r",
32589+
" const response = pm.response.json()\r",
32590+
" pm.expect(response.message).to.eq(\"You are not allowed to perform this action!\")\r",
32591+
"});"
32592+
],
32593+
"type": "text/javascript"
32594+
}
32595+
}
32596+
],
32597+
"request": {
32598+
"method": "POST",
32599+
"header": [
32600+
{
32601+
"key": "Authorization",
32602+
"type": "text",
32603+
"value": "Bearer {{token_connect_manager_pshahcopmanag2}}"
32604+
}
32605+
],
32606+
"body": {
32607+
"mode": "raw",
32608+
"raw": "{\"query\": { \"workPeriods.paymentStatus\": \"pending\" } }",
32609+
"options": {
32610+
"raw": {
32611+
"language": "json"
32612+
}
32613+
}
32614+
},
32615+
"url": {
32616+
"raw": "{{URL}}/work-period-payments/query",
32617+
"host": [
32618+
"{{URL}}"
32619+
],
32620+
"path": [
32621+
"work-period-payments",
32622+
"query"
32623+
]
32624+
}
32625+
},
32626+
"response": []
32627+
},
3234632628
{
3234732629
"name": "✘ get work period payment with connect manager",
3234832630
"event": [

0 commit comments

Comments
 (0)