Process document
Updated date: 30/04/2023
Updated by: VNPT eContract's team
Purpose
The function performs document processing according to the workflow, including signing and approving the documents.
Caution
The function processes documents and requires the waitingProcess.id information from either the Send document process API or the Login with the processing code API. Therefore, this function only works if the user has executed the aforementioned APIs beforehand and has received the waitingProcess data from the response body.
- Request URL:
/api/documents/process
- HTTP method:
POST
- HTTP content-type:
application/json
- Authorize:
Bearer token
- Parameter:
Key | Type | Description |
---|---|---|
processId | string | [Required] Id of waiting process (get form waitingProcess.id) |
reason | string | [Required] Reason |
reject | boolean | [Required] Reject the document true: Reject the document |
otp | string | [Required] OTP confirmation code // pass null for the first time, // pass the OTP value for confirming/rejecting document in email/sms |
signatureDisplayMode | int | [Required] Signature display mode 1: Text only 2: Text and image 3: Image only |
signatureImage | string | [Required] Signature image // base64 string of the signature image |
signingPage | int | [Required] Sign page |
signingPosition | string | [Required] Signature position / coordinates Rectangle = llx, lly, urx, ury • llx, lly = coordinates of the bottom-left corner of the signature • urx = llx + width • ury = lly + height The coordinate origin is the bottom-left point of the document |
signatureText | string | [Required] Note |
fontSize | int | [Required] Font size |
showReason | boolean | [Required] Display reason false: do not display reason true: display reason |
confirmTermsConditions | boolean | [Required] Confirm legal terms before processing documents false: Do not agree true: Agree |
Sample request 1st
{
"processId": "73f4e64c-521e-457f-013f-08dad829ec1c",
"reason": "Approve this valid documents",
"reject": false,
"otp": null,
"signatureDisplayMode": 3,
"signatureImage": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUgAAD…",
"signingPage": 1,
"signingPosition": "10,110,202,200",
"signatureText": "Tran Viet Trinh",
"fontSize": 12,
"showReason": false,
"ConfirmTermsConditions": true
}
Sample response body 1st
{
"data": {
"isBatchProcess": false,
"isSingleProcess": false,
"documentId": "00000000-0000-0000-0000-000000000000",
"accessPermission": 2,
"signMethod": 2,
"signatureDisplayMode": 0,
"batchProcessStatus": 0,
"signingPage": 0,
"reason": "Approve this valid documents",
"confirmReason": "Approve this valid documents",
"showReason": false,
"fontSize": 0,
"receiveOtpMethod": 1,
"receiveOtpPhone": "0919380999",
"receiveOtpEmail": "phannhan@email.com",
"requireOtpConfirmation": true,
"vnptCaPluginAdvancedSign": false,
},
"success": true,
"code": 100,
"messages": [
"Send confirmation otp success"
]
}
Sample request 2nd (After obtaining the OTP code received from Email/SMS)
{
"processId": "73f4e64c-521e-457f-013f-08dad829ec1c",
"reason": "Approve this valid documents",
"reject": false,
"otp": "089278", // OTP will be sent to the user's email or SMS
"signatureDisplayMode": 3,
"signatureImage": "data:image/png;base64,iVBORw0KGgoAAAANSUhEUg…",
"signingPage": 1,
"signingPosition": "10,110,202,200",
"signatureText": "Tran Viet Trinh",
"fontSize": 12,
"showReason": false,
"confirmTermsConditions": true
}
Sample response body 2nd
{
"data": {
"id": "d83812e9-1a93-4872-fce3-08dad8f7f8b6",
"createdDate": "2022-12-08T15:41:16.4710372",
"lastModifiedDate": "2022-12-08T15:45:20.7859944+07:00",
"no": "177667",
"subject": "Create document via API",
"hasVerified": false,
"fileType": 0,
"status": {
"value": 3,
"description": "Processing document"
},
"contractStatus": {
"value": 0,
"description": "Undefined"
},
"description": "Create document via API",
"createdByUserId": 2341,
"processRecipientCount": 2,
"waitingProcess": {
"id": "ec332bc3-4ff9-45c4-b216-08dad8f7fb89",
"createdDate": "2022-12-08T15:41:21.4876576",
"comId": 164,
"isOrder": false,
"orderNo": 3,
"pageSign": 0,
"displayType": {
"value": 0,
"description": "0"
},
"accessPermission": {
"value": 3,
"description": "Approve"
},
"status": {
"value": 1,
"description": "Waiting"
},
"processedByUserId": 2341,
"documentId": "d83812e9-1a93-4872-fce3-08dad8f7f8b6"
},
"processInOrder": false,
"isWaitToSignDraw": false,
"isWaitToSignDigital": false,
"isWaitToApprove": true,
"isCancelable": true,
"isEditable": false,
"isShareable": false,
"isAccessable": false,
"isExpired": false,
"canDownload": false,
"messages": [
{
"createdDate": "2022-12-08T15:45:20.753105+07:00",
"content": "Approve this valid documents",
"senderId": 2341,
"sender": {
"id": 2341,
"createdDate": "2022-09-15T10:15:57.0220583",
"comId": 164,
"code": "phannhan",
"name": "Phan Nhan",
"phone": "0919380999",
"email": "phannhan@email.com",
"validFrom": "2022-09-19T10:52:00",
"validTo": "2025-09-19T10:52:00",
"isValid": true,
"signConfirmationEnabled": true,
"isAccountLocked": false,
"signMethod": {
"value": 2,
"description": "VNPT Smart CA"
},
"status": {
"value": 1,
"description": "Enabled"
},
"receiveOtpMethod": {
"value": 1,
"description": "Email"
},
"receiveNotificationMethod": {
"value": 0,
"description": "Email"
},
"personalCertificateId": 1947,
],
"file": {
"name": "Document.pdf",
"size": 1213764
},
"downloadUrl": "{HOST}/Api/Download?token=..."
},
"success": true,
"code": 0,
"messages": [
"Sign document success"
]
}