# FR 集成

{% hint style="info" %}
遇到 API 接入问题时，可登录 [Eva](https://www.atriptech.com/) 寻求帮助。
{% endhint %}

当你接入 Ryanair 预订流程时，使用这个页面。

### 什么时候使用这条流程

以下场景使用 FR 流程：

* 航司为 `FR`
* 最终支付前必须先做订单确认
* 需要弹窗或 iframe 确认页
* 需要遵守 Ryanair 的展示和儿童座位规则

### FR 与标准流程的区别

相比标准预订流程，FR 多了这些要求：

* 票价和附加服务费用必须拆开展示
* FR 确认页必须收集旅客明确同意
* 支付前必须先调用 `orderCommit.do`
* 儿童座位场景有特殊处理
* 需要 FR 专用的 UAT 和 IP 白名单

### 标准 FR 预订流程

{% stepper %}
{% step %}

### 搜索

调用 [搜索](https://resources.atriptech.com/api-wen-dang/ji-cheng-zhi-nan/yu-ding-liu-cheng-gai-lan/sou-suo)，保存选中的 `routingIdentifier`。
{% endstep %}

{% step %}

### 验价

调用 [验价](https://resources.atriptech.com/api-wen-dang/ji-cheng-zhi-nan/yu-ding-liu-cheng-gai-lan/yan-jia)，保存返回的 `sessionId`。
{% endstep %}

{% step %}

### 创建订单

调用 [创建订单](https://resources.atriptech.com/api-wen-dang/ji-cheng-zhi-nan/yu-ding-liu-cheng-gai-lan/chuang-jian-ding-dan)，传入乘客、联系人和 FR 必填字段。

这个阶段可以先向用户收款。\
但**不要**立刻调用 `pay.do`。
{% endstep %}

{% step %}

### 确认订单

调用 [确认订单](https://resources.atriptech.com/api-wen-dang/ji-cheng-zhi-nan/yu-ding-liu-cheng-gai-lan/que-ren-ding-dan)。\
使用弹窗模式或 iframe 模式向用户展示 FR 确认页。
{% endstep %}

{% step %}

### 支付与出票

只有在用户完成确认后，才能调用 [支付与出票](https://resources.atriptech.com/api-wen-dang/ji-cheng-zhi-nan/yu-ding-liu-cheng-gai-lan/zhi-fu-yu-chu-piao)。
{% endstep %}

{% step %}

### 轮询最终状态

调用 [查询订单](https://resources.atriptech.com/api-wen-dang/ji-cheng-zhi-nan/yu-ding-liu-cheng-gai-lan/cha-xun-ding-dan)，直到 `orderStatus=2` 且 `ticketStatus=0`。
{% endstep %}
{% endstepper %}

### 确认订单模式

#### 弹窗模式

传入订单号和 `redirectUri`。\
Atlas 返回 `confirmationUrl`。\
把用户跳转到该页面。

用户确认后，FR 会跳回你的 `redirectUri`。

#### Iframe 模式

传入订单号，并设置 `iframe=true`。\
Atlas 返回 `confirmationUrl`。\
在你的 iframe 流程中展示该页面。

iframe 模式下会忽略 `redirectUri`。

### 支付时机规则

订单确认完成前，不要调用 `pay.do`。

如果用户在建单后 30 分钟内没有完成确认：

* 订单会过期
* Atlas 不会继续出票
* 如果 OTA 已向终端用户收款，应自行退款

### FR 必要业务规则

#### 价格透明展示

以下费用需要拆开展示：

* 航司票价
* 航司支付手续费
* Atlas 服务费
* 分销商加价
* 附加服务费用

支付手续费请读取搜索和验价响应里的 `cardChargeList`。

#### 旅客同意

FR 确认页必须收集用户对以下内容的明确同意：

* 服务条款
* 隐私政策
* Cookie 政策
* myRyanair 账号确认

#### 联系信息

需要同时传：

* 乘客邮箱
* `clientContact` 中的分销商邮箱和公司名称

这样能确保双方都能收到航司通知。

### 儿童座位规则

订单中包含 12 岁以下儿童时，FR 有特殊规则。

#### 关键规则

* 每名成人最多带 4 名儿童
* 至少一名成人可能必须购买付费座位
* 儿童必须与同行成人坐在同一排
* 支付前可能必须先选座

#### Atlas 简化接入方案

如果你暂时还不能完整支持 FR 儿童选座逻辑：

1. 关闭选座
2. 收取强制座位费
3. 让 Atlas 自动给第一位成人和儿童分配座位

金额读取搜索和验价响应中的 `childMandatorySeatingFee`。

同时确保单个订单中的儿童数不超过 4 名。

{% hint style="warning" %}
如果 FR 儿童座位逻辑还没准备好，请先拦截这类订单。
{% endhint %}

### UI 建议

建议最大宽度：

* popup：`1028px`
* iframe：`1028px`

建议桌面端和移动端断点：

* `768px`

### UAT 要求

#### IP 白名单

在进行正式 FR 测试前，先提供固定 IP 给 Ryanair 加白。

#### FR 沙箱 VCC 测试卡

| 卡号                 | 类型            |
| ------------------ | ------------- |
| `5200000000002235` | Mastercard，通过 |
| `4000000000002701` | Visa，通过       |
| `5476850000000002` | 拒付卡           |
| `5100000014101198` | 拒付卡           |

可以用拒付卡验证支付失败处理流程。

{% hint style="danger" %}
测试环境不要使用真实卡。
{% endhint %}

#### FR 测试航线

* `DUB-KIR`
* `KIR-DUB`
* `DUB-LON`
* `LON-DUB`
* `MAN-DUB`
* `DUB-MAN`

#### UAT 场景

使用下面的 FR 专用 UAT 文件。

{% file src="<https://content.gitbook.com/content/ClIWQjtgO3wtMk0oYDks/blobs/0lBBC0zmG3yQs4eiuNBB/Ryan%20Air%20(FR)%20Atlas%20UAT%20Test%20Shopping%20&%20Ticketing%20Services%20Only%20Template.xlsx>" %}

### 相关页面

* [确认订单](https://resources.atriptech.com/api-wen-dang/ji-cheng-zhi-nan/yu-ding-liu-cheng-gai-lan/que-ren-ding-dan)
* [支付与出票](https://resources.atriptech.com/api-wen-dang/ji-cheng-zhi-nan/yu-ding-liu-cheng-gai-lan/zhi-fu-yu-chu-piao)
* [UAT 验证](https://resources.atriptech.com/api-wen-dang/ji-cheng-zhi-nan/quick-start/uat-submission-guide)
* [特殊集成](https://resources.atriptech.com/api-wen-dang/ji-cheng-zhi-nan/te-shu-ji-cheng)
