INSS 贷款转移 + 再融资手册
QI Tech 的 webhooks 不应以严格方式进行映射。 我们 API 返回的 webhook payload 中可能会包含额外字段。
您可以按照以下文档中的详细说明查询并重新发送 webhooks:重新发送 Webhooks。
要启动 INSS 贷款转移 + 再融资流程,首先需要收集福利数据以检查资格,以及福利支付账户数据。第 1 和第 2 条描述了查询特定受益人福利列表的程序以及查询福利数据的程序。
1 - 通过合作方正式授权书查询福利列表:
1.1. 福利持有人是授权书的签署人。
请求
- ENDPOINT/social_security/benefits_request
- MÉTODOPOST
Payload:
payload.json
{
"document_number": "16514548091",
"authorization_term": {
"document_number": "16514548091",
"signature": {
"signer": {
"name": "Nome Devedor",
"phone": {
"number": "887577622",
"area_code": "19",
"country_code": "55"
},
"document_number": "16514548091"
},
"authentication_type": "opt_in",
"authenticity": {
"timestamp": "2023-12-05T21:04:06",
"ip_address": "200.223.171.82",
"fingerprint": {
"lat": "-44.00524157713981",
"long": "-19.807649431219804",
"name": "Nome Cliente",
"model": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1",
"localeHashValue": "hash cliente"
},
"third_party_additional_data": {},
"session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
"signed_object": {
"document_key": "cfbc8469-89ea-4a80-9f64-ba7b1566c68b"
}
}
}
}
1.2. 福利持有人不是授权书的签署人(有法定代理人)。
由于本例中授权书的签署人是法定代理人,填写 signer 对象的数据为法定代理人的数据。
请求
- ENDPOINT/social_security/benefits_request
- MÉTODOPOST
Payload:
payload.json
{
"document_number": "16514548091",
"authorization_term": {
"document_number": "16514548091",
"legal_representative_document_number": "70957091060",
"signature": {
"signer": {
"name": "Nome Representante legal",
"phone": {
"number": "887577622",
"area_code": "19",
"country_code": "55"
},
"document_number": "70957091060"
},
"authentication_type": "opt_in",
"authenticity": {
"timestamp": "2023-12-05T21:04:06",
"ip_address": "200.223.171.82",
"fingerprint": {
"lat": "-44.00524157713981",
"long": "-19.807649431219804",
"name": "Nome Cliente",
"model": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1",
"localeHashValue": "hash cliente"
},
"third_party_additional_data": {},
"session_id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
},
"signed_object": {
"document_key": "cfbc8469-89ea-4a80-9f64-ba7b1566c68b"
}
}
}
}
在有法定代理人的情况下,需要在 "legal_representative_document_number" 字段中填写法定代理人的 CPF,且 "signer" 对象中的数据应填写法定代理人的数据。
"document_key":使用 /upload 端点返回的 GUID
除了在 "authorization_term.signed_object.document_key" 对象中提供签名 PDF 文档的键之外,也可以通过 "authorization_term.signed_object.raw_text" 对象发送授权书的纯文本内容。
响应
- MÉTODOPOST
- ENDPOINTsocial_security/benefits_request
body.json
{
"benefits_request_key": "c9d2aa83-006b-4753-92ad-64411a7aa700",
"document_number": "18028522041",
"status": "pending_authorization",
"authorization_term": {
"authorization_term_key": "5a7b6489-8a47-4b61-a85a-6986b058fda6",
"status": "signed"
},
"status_events": [
{
"status": "pending_authorization",
"event_date": "2023-12-22T16:12:50"
}
]
}
福利列表查询成功时:
Webhook
- WEBHOOK_TYPEsocial_security_benefits_request
- STATUSSuccess
Body:
body.json
{
"webhook": {
"key": "54cddd0f-b976-4266-91ea-90279bfb49a1",
"data": [
{
"grant_date": [
"2010-10-18"
],
"benefit_number": 2052711150,
"benefit_status": "elegible"
}
],
"status": "success",
"webhook_type": "social_security_benefits_request",
"event_datetime": "2023-12-22T13:20:44"
}
}
| 字段 | 描述 | 值 |
|---|---|---|
| benefit_number | 福利编号 | - |
| benefit_status | 福利状态 | 枚举值 |
福利列表查询失败时:
Webhook
- WEBHOOK_TYPEsocial_security_benefits_request
- STATUSFailure
Body:
body.json
{
"webhook": {
"key": "0020653e-c3b0-4606-af31-2ea4a577a5ce",
"data": {
"enumerator": "inexistent_beneficiary",
"description": "no beneficiary found"
},
"status": "failure",
"webhook_type": "social_security_benefits_request",
"event_datetime": "2023-12-22T15:46:31"
}
}
失败 Webhook 中的字段详情
| 字段 | 描述 | 值 |
|---|---|---|
| enumerator | Dataprev 代码的映射返回值 | 枚举值 |
在 Sandbox 中模拟福利查询的成功和失败场景:
场景模拟基于操作中填写的 CPF 的第一位数字。
11.1. 对于以数字 1 开头的 CPF,将通过 Webhook 返回异步成功响应。
11.2. 对于其他 CPF,将根据输入的 CPF 的第一位数字返回异步错误响应,如下表所示。
| CPF 开头 | 枚举值 | 描述 |
|---|---|---|
| 2 | inexistent_beneficiary | no beneficiary found |
所有第一位数字没有映射场景的 CPF 将收到一个包含未映射测试场景标准错误的 webhook。
| 枚举值 | 描述 |
|---|---|
| mock_error | Informed document number is not a valid mock on test environment |
2 - 查询福利数据
2.1. 使用之前提交的授权书查询福利数据。
请求
- MÉTODOPOST
- ENDPOINT/social_security/balance_request
Payload:
payload.json
{
"document_number": "16514548091",
"benefit_number": 2052711150
}
响应
- MÉTODOPOST
- ENDPOINT/social_security/balance_request
Body:
body.json
{
"balance_request_key": "ffda1935-9cad-47df-b848-cd33c96024e4",
"document_number": "16514548091",
"status": "pending_authorization",
"authorization_term": {
"authorization_term_key": "19196811-366f-4422-a729-4d0aa552449b",
"status": "allowed"
},
"status_events": [
{
"status": "pending_authorization",
"event_date": "2023-12-22T16:18:18"
}
]
}
2.2. 随授权书一同提交进行福利数据查询。
请求
- MÉTODOPOST
- ENDPOINT/social_security/balance_request
Payload:
payload.json
{
"document_number": "14950479032",
"benefit_number": 22255220,
"authorization_term": {
"document_number": "14950479032",
"legal_representative_document_number": "32866210050", // CPF do representante legal (caso aplicável)
"signature": {
"signer": {
"name": "Nome Cliente",
"phone": {
"number": "887577622",
"area_code": "19",
"country_code": "55"
},
"document_number": "14950479032"
},
"authentication_type": "opt_in",
"authenticity": {
"timestamp": "2023-12-05T21:04:06",
"ip_address": "200.223.171.82",
"fingerprint": {
"lat": "-44.00524157713981",
"long": "-19.807649431219804",
"name": "Nome Cliente",
"model": "Mozilla/5.0 (iPhone; CPU iPhone OS 16_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Version/16.6 Mobile/15E148 Safari/604.1",
"localeHashValue": "hash cliente"
},
"third_party_additional_data": {},
"session_id": "b75c7ac2-3be3-41b6-b769-4d982a5824a2"
},
"signed_object": {
"document_key": "cfbc8469-89ea-4a80-9f64-ba7b1566c68b"
}
}
}
}
在有法定代理人的情况下,需要在 "legal_representative_document_number" 字段中填写法定代理人的 CPF,且 "signer" 对象中的数据应填写法定代理人的数据。
响应
-
MÉTODOPOST
-
ENDPOINT/social_security/balance_request
-
Body:
body.json
{
"balance_request_key": "ffda1935-9cad-47df-b848-cd33c96024e4",
"document_number": "14950479032",
"status": "pending_authorization",
"authorization_term": {
"authorization_term_key": "19196811-366f-4422-a729-4d0aa552449b",
"status": "signed"
},
"status_events": [
{
"status": "pending_authorization",
"event_date": "2023-12-22T16:18:18"
}
]
}
福利数据查询成功时
Webhook
- WEBHOOK_TYPE/social_security/balance_request
- STATUSSuccess
Body:
body.json
{
"webhook": {
"key": "ffda1935-9cad-47df-b848-cd33c96024e4",
"data": {
"name": "IVOLANDO MIRANDA",
"state": "SP",
"alimony": "not_payer",
"birth_date": "07021961",
"grant_date": "2022-09-02",
"credit_type": "checking_account",
"block_type": "not_blocked",
"benefit_card": {
"limit": 2083.2,
"balance": 0
},
"benefit_number": "22255220",
"benefit_status": "elegible",
"payroll_card": {
"limit": 2083.2,
"balance": 0
},
"assistance_type": "retirement_by_age",
"document_number": "14950479032",
"benefit_end_date": "2020-12-01",
"consigned_credit": {
"balance": 1000
},
"benefit_situation": "active",
"max_total_balance": 2000,
"used_total_balance": 1000,
"politically_exposed": {
"type": "politically_exposed_level_1",
"is_politically_exposed": true
},
"has_power_of_attorney": false,
"available_total_balance": 1000,
"has_judicial_concession": false,
"number_of_portabilities": 0,
"disbursement_bank_account": {
"bank_code": "341",
"account_digit": "6",
"account_branch": "0155",
"account_number": "000059923"
},
"has_entity_representation": false,
"social_benefit_max_balance": 2000,
"social_benefit_used_balance": 1000,
"benefit_quota_expiration_date": null,
"number_of_active_reservations": 0,
"number_of_suspended_reservations": 0,
"number_of_refinanced_reservations": 0,
"number_of_active_suspended_reservations": 3
},
"status": "success",
"webhook_type": "social_security_balance_request",
"event_datetime": "2023-12-22T16:18:21"
}
}
成功 Webhook 中的字段详情
| 字段 | 描述 | 值 |
|---|---|---|
| assistance_type | 福利类型 | 枚举值 |
| benefit_status | 福利状态 | 枚举值 |
| has_entity_representation | 是否有代理实体(不允许背书) | True 或 False |
| alimony_code | 赡养费分类器 | not_payer, payer, benefit |
| has_judicial_concession | 通过临时禁令批准的福利 | True 或 False |
| has_power_of_attorney | 是否有代理人? | True 或 False |
| credit_type | 信贷类型 - 福利领取方式 | Magnetic_card, checking_account |
| benefit_situation | 福利状态 | 枚举值 |
| used_total_balance | 用于贷款背书、转移预留、再融资、变更、RMC 和 RCC 的已占用总金额 | 数值 |
| max_total_balance | 相应福利类型可占用的金额上限 | 数值 |
| available_total_balance | 可用于贷款的总金额(所有模式之和,即 max_total_balance 与 used_total_balance 之差) | 数值 |
| benefit_quota_expiration_date | 福利终止日期。该信息仅适用于部分死亡养恤金。 | 字符串或空值 |
| block_type | 福利锁定类型 | 枚举值 |
| politically_exposed.type | 政治敏感人士 | 枚举值 |
| is_politically_exposed | 政治敏感人士 | True 或 False |
福利列表查询失败时
Webhook
- WEBHOOK_TYPE/social_security/balance_request
- STATUSFailure
Body:
body.json
{
"webhook": {
"key": "37a14593-b934-457c-8cf6-e51f184b1f1c",
"data": {
"enumerator": "inexistent_beneficiary",
"description": "no beneficiary found"
},
"status": "failure",
"webhook_type": "social_security_balance_request",
"event_datetime": "2023-12-22T16:22:29"
}
}