Nhảy tới nội dung
Phiên bản: 1.0.0

Xử lý chứng từ

Ngày cập nhật: 30 tháng 4, 2023
Người cập nhật: VNPT eContract's team


Mục đích: Hàm thực hiện xử lý chứng từ theo quy trình, bao gồm: ký nháy và phê duyệt chứng từ.

Lưu ý

Hàm thực hiện xử lý chứng từ cần thông tin waitingProcess.id từ API gửi quy trình chứng từ hoặc API đăng nhập bằng mã xử lý. Nên hàm này chỉ có tác dụng khi người dùng đã thực thi 2 APIs trên trước đó và có dữ liệu waitingProcess trả về từ response body.

  • Request URL: /api/documents/process
  • HTTP method: POST
  • HTTP content-type: application/json
  • Authorize: Bearer token
  • Parameter:
KeyTypeDescription
processIdstring[Bắt buộc] Id quy trình chờ xử lý (Lấy thông tin từ waitingProcess.id)
reasonstring[Bắt buộc] Lý do
rejectboolean[Bắt buộc] Từ chối ký chứng từ
true: từ chối ký chứng từ
otpstring[Bắt buộc] Mã xác nhận OTP
// lần đầu truyền null,
// lần thứ 2 truyền giá trị OTP xác nhận ký/từ chối ký chứng từ trong email/sms
signatureDisplayModeint[Bắt buộc] Chế độ hiển thị chữ ký
1: Chỉ văn bản
2: Văn bản và hình ảnh
3: Chỉ hình ảnh
signatureImagestring[Bắt buộc] Hình ảnh chữ ký
// chuỗi base64 của hình ảnh chữ ký
signingPageint[Bắt buộc] Số trang ký
signingPositionstring[Bắt buộc] Vị trí / tọa độ ký
Rectagle = llx, lly, urx, ury
- llx, lly = tọa độ góc dưới cùng bên trái của chữ ký
- urx = llx + width
- ury = lly + height
Gốc tọa độ là điểm dưới cùng bên trái của tài liệu
signatureTextstring[Bắt buộc] Nội dung ký
fontSizeint[Bắt buộc] Cỡ chữ
showReasonboolean[Bắt buộc] Hiển thị lý do
false: không hiển thị lý do ký
true: hiển thị lý do ký
confirmTermsConditionsboolean[Bắt buộc] Xác nhận điều khoản pháp lý trước khi xử lý chứng từ
false: Không đồng ý
true: đồng ý

Mẫu request lần 1 (json)

{
"processId": "73f4e64c-521e-457f-013f-08dad829ec1c",
"reason": "Đồng ý",
"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
}

Mẫu response body lần 1

{
"data": {
"isBatchProcess": false,
"isSingleProcess": false,
"documentId": "00000000-0000-0000-0000-000000000000",
"accessPermission": 2,
"signMethod": 2,
"signatureDisplayMode": 0,
"batchProcessStatus": 0,
"signingPage": 0,
"reason": "Đồng ý",
"confirmReason": "Đồng ý",
"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"
]
}

Mẫu request lần 2 (json) (Sau khi có thông tin mã OTP nhận được từ Email/SMS)

{
"processId": "73f4e64c-521e-457f-013f-08dad829ec1c",
"reason": "Đồng ý",
"reject": false,
"otp": "089278", // OTP sẽ gửi tới email hoặc sms của người dùng
"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
}

Mẫu response body lần 2

{
"data": {
"id": "d83812e9-1a93-4872-fce3-08dad8f7f8b6",
"createdDate": "2022-12-08T15:41:16.4710372",
"lastModifiedDate": "2022-12-08T15:45:20.7859944+07:00",
"no": "Test0.3409670801871343",
"subject": "Test0.3409670801871343",
"hasVerified": false,
"fileType": 0,
"status": {
"value": 3,
"description": "Processing document"
},
"contractStatus": {
"value": 0,
"description": "Undefined"
},
"description": "Test tạo mới chứng từ bằng 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": "Đồng ý",
"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"
]
}