Skip to content

Commit ee27df4

Browse files
authored
Merge pull request #72 from topcoder-platform/feature/payment-scheduler
Payment scheduler
2 parents 9c43b15 + 4989548 commit ee27df4

File tree

4 files changed

+20
-2
lines changed

4 files changed

+20
-2
lines changed

src/bootstrap.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ 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', 'scheduled', '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
@@ -130,6 +130,16 @@ async function createIndex () {
130130
challengeId: { type: 'keyword' },
131131
amount: { type: 'float' },
132132
status: { type: 'keyword' },
133+
statusDetails: {
134+
type: 'nested',
135+
properties: {
136+
errorMessage: { type: 'text' },
137+
errorCode: { type: 'integer' },
138+
retry: { type: 'integer' },
139+
step: { type: 'keyword' },
140+
challengeId: { type: 'keyword' }
141+
}
142+
},
133143
billingAccountId: { type: 'integer' },
134144
createdAt: { type: 'date' },
135145
createdBy: { type: 'keyword' },

src/services/WorkPeriodPaymentProcessorService.js

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -69,6 +69,13 @@ processCreate.schema = {
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)