@@ -583,6 +583,31 @@ async function activateProject (projectId, currentUser, name, description) {
583583 }
584584}
585585
586+ /**
587+ * Update self service project info
588+ * @param {* } projectId the project id
589+ * @param {* } workItemPlannedEndDate the planned end date of the work item
590+ * @param {* } currentUser the current user
591+ */
592+ async function updateSelfServiceProjectInfo ( projectId , workItemPlannedEndDate , currentUser ) {
593+ const project = await ensureProjectExist ( projectId , currentUser )
594+ const payment = await getProjectPayment ( projectId )
595+ const token = await getM2MToken ( )
596+ const url = `${ config . PROJECTS_API_URL } /${ projectId } `
597+ const res = await axios . patch ( url , {
598+ details : {
599+ ...project . details ,
600+ paymentProvider : config . DEFAULT_PAYMENT_PROVIDER ,
601+ paymentId : payment . id ,
602+ paymentIntentId : payment . paymentIntentId ,
603+ paymentAmount : payment . amount ,
604+ paymentCurrency : payment . currency ,
605+ paymentStatus : payment . status ,
606+ workItemPlannedEndDate
607+ }
608+ } , { headers : { Authorization : `Bearer ${ token } ` } } )
609+ }
610+
586611/**
587612 * Get resource roles
588613 * @returns {Promise<Array> } the challenge resources
@@ -1257,5 +1282,6 @@ module.exports = {
12571282 sendSelfServiceNotification,
12581283 getMemberByHandle,
12591284 submitZendeskRequest,
1260- getMemberById
1285+ getMemberById,
1286+ updateSelfServiceProjectInfo
12611287}
0 commit comments