折扣
折扣指令用于应用具有多种计算规则的折扣。若相关 Boleto 已存在折扣,且折扣指令被接受,则原有折扣将被覆盖。
注意!
若存在待确认的折扣添加申请,则不允许创建新的申请。
Request
ENDPOINT
/account/ACCOUNT_KEY/requester_profile/REQUESTER_PROFILE_KEY/bank_slip/BANK_SLIP_KEY/discountMÉTODO
POST路径参数
| 字段 | 类型 | 描述 | 字符数 |
|---|---|---|---|
account_key | uuidv4 | 账户唯一识别密钥,格式为 uuid v4 | 36 |
requester_profile_key | uuidv4 | 钱包唯一识别密钥,格式为 uuid v4 | 36 |
bank_slip_key | uuidv4 | Boleto 唯一识别密钥,格式为 uuid v4 | 36 |
Request Body
{
"request_control_key": "2e2f0053-a988-40c7-ad17-41c4c4da861e",
"discounts_data": [
{
"discount_type": "anticipation_workdays_daily_percentage",
"discount_percentage": 2,
"discount_number": 1,
"discount_limit_date": "2024-12-01"
},
{
"discount_type": "anticipation_workdays_daily_percentage",
"discount_percentage": 1,
"discount_number": 2,
"discount_limit_date": "2025-01-02"
}
]
}
Request Body Params
| 字段 | 类型 | 描述 | 字符数 |
|---|---|---|---|
request_control_key * | uuidv4 | 客户使用的请求唯一识别密钥,格式为 uuid v4 | 36 |
discounts_data | object array | 折扣 | discount 对象 |
discount 对象
选项 1:绝对值折扣(discount_type in ["absolute", "anticipation_calendar_days_daily_amount", "anticipation_workdays_daily_amount"])
| 字段 | 类型 | 描述 | 字符数 |
|---|---|---|---|
discount_amount * | float | 按时间单位计的绝对折扣值 | - |
discount_number * | integer | 折扣编号 | - |
discount_type * | string | 绝对值折扣配置 | discount_type 枚举值 |
discount_limit_date * | string | 折扣应用截止日期 | 10 |
discount_type in ["percentage", "anticipation_calendar_days_daily_percentage", "anticipation_workdays_daily_percentage"])
| 字段 | 类型 | 描述 | 字符数 |
|---|---|---|---|
discount_percentage * | float | 按时间单位计的百分比折扣值 | - |
discount_number * | integer | 折扣编号 | - |
discount_type * | string | 百分比折扣配置 | discount_type 枚举值 |
discount_limit_date * | string | 折扣应用截止日期 | 10 |
注意!
一张 Boleto 最多可有三个折扣,且折扣必须为同一类型,即必须具有相同的 discount_type。折扣必须按升序编号,从 1 开始。即,若请求中发送两个折扣,则必须编号为 1 和 2。
discount_type 枚举值
| 枚举值 | 描述 |
|---|---|
| absolute | 固定值 |
| anticipation_calendar_days_daily_amount | 按自然日计的每日提前折扣值 |
| anticipation_workdays_daily_amount | 按工作日计的每日提前折扣值 |
| percentage | 固定百分比 |
| anticipation_calendar_days_daily_percentage | 按自然日计的月提前折扣百分比 |
| anticipation_workdays_daily_percentage | 按工作日计的年提前折扣百分比 |
Response
STATUS
202Response Body
{
"occurrence_key": "aaf64135-6bd8-4d49-be6f-e8f884b20ee7",
"bank_slip_key": "470cfcae-159b-4de4-ad22-2d3b2dd717f7"
}
Response Body Params
| 字段 | 类型 | 描述 | 字符数 |
|---|---|---|---|
occurrence_key * | uuidv4 | 事件(指令)唯一识别密钥,格式为 uuid v4 | 36 |
bank_slip_key * | uuidv4 | Boleto 唯一识别密钥,格式为 uuid v4 | 36 |
错误响应
STATUS
4xxResponse Body: 错误
{
"title": "titulo",
"description": "description in English",
"translation": "descrição em portugues",
"code": "codigo",
"extra_fields": {}
}
HTTP 代码status | QI 代码code | 标题title | 英文描述description | 葡语描述translation |
|---|---|---|---|---|
| 400 | QIT000001 | Bad Request | Schema Error | Schema Inválido |
| 404 | BKS000006 | Not Found | The source account key was not found. | A chave da conta de origem não foi encontrada. |
| 400 | BKS000007 | Bad Request | It was not possible to consult the source account at this time. Please try again in a few minutes. | Não foi possível consultar a conta de origem neste momento. Por favor, tente novamente em alguns minutos. |
| 400 | BKS000008 | Bad Request | The source account is closed. | A conta de origem está fechada. |
| 400 | BKS000009 | Bad Request | The source account is blocked. | A conta de origem está bloqueada. |
| 404 | BKS000013 | Not Found | Requester profile not found | Carteira não encontrada |
| 409 | BKS000014 | Conflict | Request control key already sent or duplicated sent: <request_control_key> | Chave de controle da requisição já utilizada ou enviada duplicada: <request_control_key> |
| 400 | BKS000018 | Bad Request | The discount dates must be less than the expiration date and increasing. | A data dos descontos devem ser menores que a de expiração e crescentes. |
| 400 | BKS000022 | Bad Request | Requester profile is not opened. | Carteira não está aberta. |
| 404 | BKS000029 | Not Found | Bank slip not found for the given key ({bank_slip_key}). | Boleto não encontrado para a chave fornecida ({bank_slip_key}). |
| 400 | BKS000032 | Bad Request | Bank slip must be in 'registered' status. | O boleto deve possuir o status 'registered'. |
| 400 | BKS000043 | Bad Request | Invalid discount numbering. Discounts must be numbered in ascending order and start on 1. | Numeração dos descontos inválida. Os descontos devem ser numerados em ordem crescente e começar em 1. |
| 400 | BKS000046 | Bad Request | Invalid discount type. All types in the discount list must be the same. | Tipo de desconto inválido. Todos os tipos da lista de descontos devem ser iguais. |
| 409 | BKS000048 | Conflict | There is already a pending discount occurrence for this bank slip. Please, wait for the confirmation of this occurrence before sending another one. | Já existe uma ocorrência de desconto pendente para este boleto. Por favor, aguarde a confirmação dessa ocorrência antes de enviar outra. |