# 变更 RDR 申请状态

> 提交 RDR 申请、撤回申请、申请关闭服务，或重新提交开通失败的申请。

```yaml
openapi: 3.1.0
x-onerway-docs-version: v2
x-onerway-spec-key: payments/versions/v2/rdr/update-rdr-enrollment-status
info:
  title: 变更 RDR 申请状态
  version: v2
  description: 提交 RDR 申请、撤回申请、申请关闭服务，或重新提交开通失败的申请。
servers:
  - url: https://sandbox-payment-api.onerway.com
    description: sandbox
  - url: https://payment-api.onerway.com
    description: production
paths:
  /rdr/agency-cw/enrollment/transition:
    post:
      summary: 变更 RDR 申请状态
      description: 提交 RDR 申请、撤回申请、申请关闭服务，或重新提交开通失败的申请。
      parameters:
        - name: ApiKey
          in: header
          required: true
          description: 商户账户的 API Key，通过 `ApiKey`
            请求头传入。详见[请求认证](/zh/payments/versions/v2/get-started/authentication)。
          schema:
            type: string
            description: 商户账户的 API Key，通过 `ApiKey`
              请求头传入。详见[请求认证](/zh/payments/versions/v2/get-started/authentication)。
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                merchantNo:
                  type: string
                  description: Onerway 分配的商户号；用于限定要变更的申请所属商户账户。
                id:
                  type: string
                  description: 申请单号，用于指定要变更状态的 RDR 服务申请记录。
                bin:
                  type: string
                  description: 收单机构 BIN（Bank Identification Number），用于标识为商户提供收单服务的机构。
                  x-onerway-condition:
                    - 重新提交或补充申请信息时可提供。
                dba:
                  type: string
                  description: 商户对外经营名称（DBA，Doing Business As）。
                  x-onerway-condition:
                    - 重新提交或补充申请信息时可提供。
                caid:
                  type: string
                  description: 商户受理标识（CAID，Card Acceptor ID）。
                  x-onerway-condition:
                    - 重新提交或补充申请信息时可提供。
                mcc:
                  type: string
                  description: 商户类别代码（MCC，Merchant Category Code）。
                  x-onerway-condition:
                    - 重新提交或补充申请信息时可提供。
                arn:
                  type: string
                  description: 收单参考号（ARN，Acquirer Reference Number）。
                  x-onerway-condition:
                    - 重新提交或补充申请信息时可提供。
                resellerSubMerchantId:
                  type: string
                  description: 代理运营商的子商户标识。
                  x-onerway-condition:
                    - 代理运营商变更其子商户申请状态时提供。
                enrollmentStatus:
                  type: string
                  description: 期望的当前申请状态；填写时须与申请记录的当前状态一致。不填写时，Onerway 使用记录中的当前状态，再由事件确定下一状态。
                  enum:
                    - PENDING_SUBMISSION
                    - SUBMITTED_AND_PENDING_ENROLLMENT
                    - ENROLLING
                    - ENROLLED
                    - ENROLLMENT_FAILED
                    - SUBMITTED_AND_PENDING_DISENROLLMENT
                    - DISENROLLING
                    - DISENROLLED
                  x-enum-descriptions:
                    PENDING_SUBMISSION: 待提交：申请已创建，尚未提交审核。
                    SUBMITTED_AND_PENDING_ENROLLMENT: 已提交，等待开通：申请已提交，正在排队等待审核与开通处理。
                    ENROLLING: 开通中：审核通过，正在执行服务开通配置。
                    ENROLLED: 已开通：服务已生效。
                    ENROLLMENT_FAILED: 开通失败：审核未通过或开通受阻，申请未能完成开通；重新提交前应查看审核意见。
                    SUBMITTED_AND_PENDING_DISENROLLMENT: 已提交，等待关闭服务：停用请求已提交，正在等待处理。
                    DISENROLLING: 关闭中：正在执行服务停用。
                    DISENROLLED: 已关闭：服务已停用。
                  x-onerway-constraints:
                    - kind: rule
                      text: 仅支持 `enrollmentEvent` 中列明的当前状态与事件组合；`ENROLLING` 和 `DISENROLLING`
                        状态下不能执行商户状态变更。
                    - kind: rule
                      text: 从 `PENDING_SUBMISSION` 或 `ENROLLMENT_FAILED` 提交时，申请信息须包含
                        `bin`、`caid`、`mcc` 和 `dba`。
                enrollmentEvent:
                  type: string
                  description: 申请状态变更事件，用于表达本次变更动作。
                  enum:
                    - MERCHANT_SUBMIT
                    - MERCHANT_WITHDRAW
                  x-enum-descriptions:
                    MERCHANT_SUBMIT: 当前状态为 `PENDING_SUBMISSION`、`ENROLLMENT_FAILED` 或 `DISENROLLED`
                      时，提交开通申请，进入 `SUBMITTED_AND_PENDING_ENROLLMENT`；当前状态为
                      `ENROLLED` 时，提交关闭服务申请，进入
                      `SUBMITTED_AND_PENDING_DISENROLLMENT`。
                    MERCHANT_WITHDRAW: 当前状态为 `SUBMITTED_AND_PENDING_ENROLLMENT` 时，撤回开通申请并返回
                      `PENDING_SUBMISSION`；当前状态为
                      `SUBMITTED_AND_PENDING_DISENROLLMENT` 时，撤回关闭申请并返回
                      `ENROLLED`。
                notes:
                  type: string
                  description: 状态变更说明，用于填写撤回原因、重新提交说明或补充材料说明。
                comments:
                  type: string
                  description: 审核意见字段。商户提交变更时留空；补充说明请使用 `notes`。
                  x-onerway-constraints:
                    - kind: rule
                      text: 商户变更申请时请留空；如需补充说明请使用 `notes`。
              required:
                - merchantNo
                - id
                - enrollmentEvent
            examples:
              update-rdr-enrollment-status:
                summary: 变更 RDR 申请状态
                value:
                  merchantNo: replace_with_merchant_no
                  id: replace_with_enrollment_id
                  enrollmentStatus: ENROLLMENT_FAILED
                  enrollmentEvent: MERCHANT_SUBMIT
                  bin: replace_with_acquirer_bin
                  caid: demo_card_acceptor_id
                  mcc: "5999"
                  dba: EXAMPLE STORE
                  notes: Updated application details
      responses:
        "200":
          description: Response
          content:
            application/json:
              schema:
                type: object
                properties:
                  respCode:
                    type: string
                    description: 响应码；`20000`
                      表示请求处理成功，其余为错误码。完整码表见[响应码](/zh/payments/versions/v2/api-reference/response-codes)。
                  respMsg:
                    type: string
                    description: 响应码对应的可读说明。
                  data:
                    type: object
                    properties:
                      success:
                        type: boolean
                        description: 本次状态变更请求是否被系统受理并执行；`true` 表示变更动作已生效，但不等同于服务最终开通 /
                          关闭结果，最新申请状态仍需通过[查询 RDR
                          申请状态](/zh/payments/versions/v2/api-reference/endpoints/query-rdr-enrollments)或
                          [RDR
                          报备状态通知](/zh/payments/versions/v2/api-reference/webhooks/rdr-enrollment-changed)确认。
                      sign:
                        type: string
                        description: 响应签名字符串，可用于校验响应数据完整性。
                    description: 业务数据对象，包含本次状态变更是否被系统受理 / 处理成功。
      security:
        - apiKeyAuth:
            []
components:
  securitySchemes:
    apiKeyAuth:
      type: apiKey
      in: header
      name: ApiKey
```
