travelrez/rezb2b

Rezb2b 与 travelrez 连接

该软件包的官方仓库似乎已消失,因此该软件包已被冻结。


README

如何使用代码?

连接 APi


use Travelrez\Travelrez;

$gateway = Travelrez::create('Rezb2b');

$gateway->setTestMode(1);
$gateway->setApiKey('YOUR_API_KEY');

1. 获取产品信息


$response = $gateway->getProduct(array(
   "product_code" => "3"
))->send();

if($response->isSuccessful()){
   echo '<pre>';print_r($response->getResult());
}else{
   echo  "Error " .$response->getCode() . ': ' . $response->getMessage();
}

请求

密钥 类型 信息
product_code 字符串 产品代码唯一标识符(有时代码相同,但渠道不同)

响应

密钥 类型 信息
provider_code 字符串 旅游提供商代码
provider_id 字符串 旅游提供商 ID 或渠道 ID
provider_name 字符串 旅游提供商名称
name 字符串 旅游名称
product_entity_type 字符串 旅游类型
is_departure_date_required 布尔型 预订是否需要出发日期?
display_room_option 布尔型 预订时显示房间选项?
min_per_booking 整数 每笔预订的最少人数
max_per_booking 整数 每笔预订的最多人数
duration 字符串 旅游时长
currency 字符 货币 3 位代码
default_price 十进制 默认旅游价格
rates 数组 见此处
description 文本 旅游描述
short_description 文本 旅游简短描述
images 数组 见此处
free_sale 布尔型 旅游是否免费销售?
pickup_locations 数组 取货地点
booking_fields 数组 见此处
first_available_date 日期 运营首次可用日期
is_soldout 布尔型 产品是否售罄?

价格

密钥 类型 信息
rate_id 字符串 价格标识符
name 字符串 rate_name
标签 字符串 价格标签
seats_used 整数 选择此价格时将使用的座位数
min_quantity 整数 选择此价格所需的最小数量
max_quantity 整数 选择此价格所需的最大数量
price 十进制 价格起始(价格按旅游货币计算)
price_type 字符串 标识价格是按订单、每人等(未来更新)

图片

密钥 类型 信息
thumbnail_url 字符串 产品缩略图 URL
image_url 字符串 产品图片 URL
extra_image_url 数组 如有额外图片

预订字段

密钥 类型 信息
标签 字符串 预订字段标签
required_per_participant 布尔型 字段是否每个参与者都需要
required_per_booking 布尔型 字段是否每笔预订都需要
visible_per_participant 布尔型 字段是否每个参与者可见
visible_per_booking 布尔型 字段是否每笔预订可见
field_type 字符串 字段类型如 TEXT
options 数组 可供选择的选项
tips 字符串 字段的提示
use_for 数组 需要显示此字段以哪个价格 ID,例如 ALL / ADULT_RATE

2. 获取产品可用性


$response = $gateway->getProductAvailability(array(
	"product_code" => "3", // example product code
	"start_date"   => "YYYY-MM-DD",
	"end_date"     => "YYYY-MM-DD"
))->send();

if($response->isSuccessful()){
   echo '<pre>';print_r($response->getResult());die;	
}else{
   echo  "Error " .$response->getCode() . ': ' . $response->getMessage();
}

请求

密钥 类型 信息
product_code 字符串 产品代码唯一标识符
start_date 日期 开始日期以查找特定时期的可用性
end_date 日期 结束日期以查找特定时期的可用性

响应

密钥 类型 信息
available_dates 数组 所有可用旅游列表 查看这里
isAutoConfirm 布尔型 基于出发日期,旅游是否将自动确认?

可用性

密钥 类型 信息
departure_date 日期 可预订的日期
is_need_departure_time 布尔型 在预订时是否需要出发时间?
departure_times 数组 该日期可用的出发时间 查看这里

出发时间

密钥 类型 信息
departure_time 时间 特定日期的出发时间
rates 数组 所有特定出发时间的可用价格列表 查看这里

3. 获取产品预订请求


$items = array(
	"product_code" => "3", // example product code
	"departure_start_date" => "YYYY-MM-DD",	
);

$response = $gateway->getProductBookingRequest($items)->send();

if($response->isSuccessful()){
   echo '<pre>';print_r($response->getResult());die;	
}else{
   echo  "Error " .$response->getCode() . ': ' . $response->getMessage();
}

请求

密钥 类型 信息
product_code 字符串 产品代码唯一标识符
departure_start_date 日期 获取预订字段的出发起始日期

响应

密钥 类型 信息
product_code 整数 product id
product_name 字符串 产品名称
sale_quantity_rule 字符串 产品销售数量规则,如按人计
price 数组 product price 查看这里
attributes 数组 产品属性 查看这里
pickup_on_request 布尔型 需要客户提供的取货地点吗?
pickup_points 数组 产品取货点 查看这里

价格

密钥 类型 信息
sale_currency 字符 价格货币
min_booking_size 整数 预订者可选择的最低人数
spaces_remaining 整数 旅游剩余空间
total_price 十进制 产品总价
total_price_display 字符串 仅在转换价格时显示,如果不需要请勿使用
price_breakdown 字符串 仅在转换价格时显示,如果不需要请勿使用

属性

密钥 类型 信息
option_name 字符串 属性选项名称
option_id 整数 属性选项ID
is_multi 布尔型 是否可以选择多个选项值?
required 整数 可选择的选项数量
short_description 文本 选项的简短描述
option_selections 数组 属性选项 查看这里
total_price_display 字符串 仅在转换价格时显示,如果不需要请勿使用
price_breakdown 字符串 仅在转换价格时显示,如果不需要请勿使用

选项

密钥 类型 信息
value 整数 在选项选择时需要使用
price double 选项价格(请注意,这是默认价格,它将与人数/数量/预订/持续时间相乘)
option_sale_currency 字符 价格中使用的货币
文本 字符串 option name
is_has_sub 布尔型 是否有子选项?
sub_options 数组 可用的子选项 查看这里

子选项

密钥 类型 信息
value 整数 在子选项选择时需要使用
price double 子选项价格(请注意,这是默认价格,它将与人数/数量/预订/持续时间相乘)
option_sale_currency 字符 价格中使用的货币
文本 字符串 sub option name

取货

密钥 类型 信息
pickup_key 字符串 在预订时发送,该取货的值为该取货
时间 字符串 pickup time
取货时间 字符串 取货名称
description 字符串 取货名称
取货描述 address1 string
取货地址行1 address1 address2
postcode 字符串 取货的邮政编码
geocode 字符串 位置的地理编码
pickup_on_request 布尔型 需要客户提供的取货地点吗?
special_note 字符串 取货点的特殊说明

4. 获取产品价格计算


$items = array(
	"product_code" => "3", // example product code
	"departure_start_date" => "YYYY-MM-DD",	
	"rates" => array(
	    array(
	    	array(
		     "rate_id" => RATE_ID,
		     "qty"     => QTY
		),
		array(
		     "rate_id" => RATE_ID,
		     "qty"     => QTY
		)
	    )
	),
    "options" => array(
        "490" => array("280") // as rezb2b allow multiple upgrade
    )
);

$response = $gateway->getProductPriceCalculation($items)->send();

if($response->isSuccessful()){
   echo '<pre>';print_r($response->getResult());die;	
}else{
   echo  "Error " .$response->getCode() . ': ' . $response->getMessage();
}

请求

密钥 类型 信息
product_code 字符串 产品代码唯一标识符
departure_start_date 日期 出发日期
rates 数组 发送包含以下数组格式的预订数组("rate_id" => "价格ID", "qty" => 1)
options 数组 发送选项和值一起,例如:"options" => array("490" => array("280"))

响应

密钥 类型 信息
product_code 整数 产品代码
provider_id 整数 旅游供应商ID
departure_start_date 字符串 旅游开始日期,格式如 "2018-03-15"
出发结束日期 字符串 旅游结束日期,格式如 "2018-03-15"
sale_currency 字符 产品货币
price 数组 产品价格 查看此处

产品价格

密钥 类型 信息
总计 double 旅游总计
小计 double 旅游小计
price_breakdown 数组 仅显示目的,返回价格是如何计算的
属性总计 double 所选属性的总计

4. 创建订单


$data = array(
  "items" => array(
    	"product_code" => "3", // example product code
    	"departure_start_date" => "YYYY-MM-DD",	
    	"rates" => array(
	   1 => array(
	    	array(
		    "rate_id" => ADULT_RATE,
		    "qty"     => 2,
	    	)
	   ),
    	),
	"options" => array(
            "490" => array(
	    	1680
	    )
        ),
	"participants" => array(
	    array(
		"first_name"  => "Foo1",
		"last_name"   => "Bar1"  
	    ),
	    array(
		"first_name"  => "Foo2",
		"last_name"   => "Bar2"  
	    )
	),
	"pickup_location" => "", // customer's pickup in case of pickup_on_request = 1 see 3. Get Product Booking Request 
	"departure_location" => "11:30 AM::Golden era park",
	"flight" => array(
		"arrival_airline_name" => "Air France",
		"arrival_flight_no" => "AF 356",
		"arrival_airport_name" => "YYZ",
		"arrival_date" => "2018-05-01",
		"arrival_time" => "12:00",
		"departure_airline_name" => "Air France",
		"departure_flight_no" => "AF 412",
		"departure_airport_name" => "YYZ",
		"departure_date" => "2018-05-04",
		"departure_time" => "16:10"
	)
   ),
   "customers" => array(
       "title"      => "Mr",
       "first_name" => "Pravin",
       "last_name"  => "Solanki",
       "email"      => "iipl.pravins@gmail.com",
       "telephone"  => +91 7896541230
   ),
   "note" => ""
);

$response = $gateway->createBooking($data)->send();

if($response->isSuccessful()){
   echo '<pre>';print_r($response->getResult());die;	
}else{
   echo  "Error " .$response->getCode() . ': ' . $response->getMessage();
}

请求

密钥 类型 信息
项目 数组 项目数组,见示例
客户 数组 客户(旅客结账选项)数组,见示例
备注 字符串 如有特殊备注,请客户注明

响应

密钥 类型 信息
预订ID 字符串 预订编号
状态 字符串 预订状态字符串,如已确认或新

23-03-2018