Skip to content

Commit bfd4d48

Browse files
committed
Batch Payments - Part 1 - Scheduler
1 parent 19c4190 commit bfd4d48

File tree

4 files changed

+22
-4
lines changed

4 files changed

+22
-4
lines changed

src/bootstrap.js

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,13 +12,13 @@ global.Promise = require('bluebird')
1212
Joi.rateType = () => Joi.string().valid('hourly', 'daily', 'weekly', 'monthly')
1313
Joi.jobStatus = () => Joi.string().valid('sourcing', 'in-review', 'assigned', 'closed', 'cancelled')
1414
Joi.resourceBookingStatus = () => Joi.string().valid('placed', 'closed', 'cancelled')
15-
Joi.jobCandidateStatus = () => Joi.string().valid('open', 'placed', 'selected', 'client rejected - screening', 'client rejected - interview', 'rejected - other', 'cancelled', 'interview', 'topcoder-rejected','applied','rejected-pre-screen','skills-test','skills-test','phone-screen','job-closed')
15+
Joi.jobCandidateStatus = () => Joi.string().valid('open', 'placed', 'selected', 'client rejected - screening', 'client rejected - interview', 'rejected - other', 'cancelled', 'interview', 'topcoder-rejected', 'applied', 'rejected-pre-screen', 'skills-test', 'skills-test', 'phone-screen', 'job-closed')
1616
Joi.workload = () => Joi.string().valid('full-time', 'fractional')
1717
Joi.title = () => Joi.string().max(128)
1818
Joi.paymentStatus = () => Joi.string().valid('pending', 'partially-completed', 'completed', 'cancelled')
1919
Joi.xaiTemplate = () => Joi.string().valid(...allowedXAITemplates)
2020
Joi.interviewStatus = () => Joi.string().valid(...allowedInterviewStatuses)
21-
Joi.workPeriodPaymentStatus = () => Joi.string().valid('completed', 'cancelled')
21+
Joi.workPeriodPaymentStatus = () => Joi.string().valid('completed', 'scheduled', 'in-progress', 'failed', 'cancelled')
2222
// Empty string is not allowed by Joi by default and must be enabled with allow('').
2323
// See https://joi.dev/api/?v=17.3.0#string fro details why it's like this.
2424
// In many cases we would like to allow empty string to make it easier to create UI for editing data.

src/scripts/createIndex.js

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -120,6 +120,16 @@ async function createIndex () {
120120
challengeId: { type: 'keyword' },
121121
amount: { type: 'float' },
122122
status: { type: 'keyword' },
123+
statusDetails: {
124+
type: 'nested',
125+
properties: {
126+
errorMessage: { type: 'text' },
127+
errorCode: { type: 'integer' },
128+
retry: { type: 'integer' },
129+
step: { type: 'keyword' },
130+
challengeId: { type: 'keyword' }
131+
}
132+
},
123133
billingAccountId: { type: 'integer' },
124134
createdAt: { type: 'date' },
125135
createdBy: { type: 'keyword' },

src/services/WorkPeriodPaymentProcessorService.js

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,10 +65,17 @@ processCreate.schema = {
6565
payload: Joi.object().keys({
6666
id: Joi.string().uuid().required(),
6767
workPeriodId: Joi.string().uuid().required(),
68-
challengeId: Joi.string().uuid().required(),
68+
challengeId: Joi.string().uuid().allow(null),
6969
amount: Joi.number().greater(0).allow(null),
7070
status: Joi.workPeriodPaymentStatus().required(),
7171
billingAccountId: Joi.number().allow(null),
72+
statusDetails: Joi.object().keys({
73+
errorMessage: Joi.string().required(),
74+
errorCode: Joi.number().integer().allow(null),
75+
retry: Joi.number().integer().allow(null),
76+
step: Joi.string().allow(null),
77+
challengeId: Joi.string().uuid().allow(null)
78+
}).unknown(true).allow(null),
7279
createdAt: Joi.date().required(),
7380
createdBy: Joi.string().uuid().required(),
7481
updatedAt: Joi.date().allow(null),

test/common/testHelper.js

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,8 @@ async function clearES () {
4040
query: {
4141
match_all: {}
4242
}
43-
}
43+
},
44+
refresh: true
4445
})
4546
}
4647
}

0 commit comments

Comments
 (0)