airmee/php-sdk

Airmee API 的 PHP SDK

1.0.0 2017-04-21 08:23 UTC

This package is not auto-updated.

Last update: 2024-09-20 19:30:05 UTC


README

[本文件中的一切内容均可能随着 SDK 的发展而变化]

API 文档可在以下网址获取: http://integration.docs.airmee.com.s3-website-eu-west-1.amazonaws.com/

集成流程的基本流程: https://drive.google.com/open?id=13vg0jsBPaGoygjvpUl38iTmu5s5P8Gf2hKBDgg7sEII

  • Airmee SDK 提出的主类
  • 决定以最合理的方式实现对象的构造函数(是否足够使用构建者模式?)
地址
(
street_and_number string, 
city string, 
zip_code string,
country string
)
  • 角色:地址的标准表示
  • 约束:所有字段不为 null / 空值
商品
(
length double,
width double,
height double,
weight double,
quantity integer,
price integer,
name string
)
  • 角色:用户在在线购物时选择商品的标准表示
  • 约束
    • 长度、宽度、高度、重量、数量不为 null 且为正数
    • 名称不为 null / 空值
Delivery_Interval
(
pickup_time_earliest bigint,
pickup_time_latest bigint,
dropoff_time_earliest bigint,
dropoff_time_latest bigint, 
pickup_schedule_formatted string, 
dropoff_schedule_formatted string
)
  • 角色:Airmee 使用的配送间隔的标准表示
  • 约束

    • 最早提货时间、最晚提货时间、最早交货时间、最晚交货时间不为 null 且为正数
    • 格式化的提货时间表、格式化的交货时间表不为 null / 空值
    • 最早提货时间 < 最晚提货时间
    • 最早交货时间 < 最晚交货时间
  • 注意:参数应该是不可变的,因为它们由服务器提供。这种构造函数模式最好?

Delivery_Request
(
dropoff_address Address,
delivered_items Item[],

ecomm_id,
receiver_name,
receiver_phone_number, 
receiver_phone_number_country_code, 
receiver_email, 

chosen_delivery_intervals DeliveryInterval,

dropoff_message_to_courier [optional],
dropoff_lat [optional],
dropoff_lon [optional]
)
  • 角色:Airmee 使用的配送请求的标准表示
  • 约束
    • dropoff_address 不为 null 且有效
    • delivered_items 不为 null,数组不为空,且所有商品都有效
    • ecomm_id、receiver_name 不为 null / 空值
    • receiver_phone_number(_country_code) 有效 -> 可能使用 https://github.com/giggsey/libphonenumber-for-php 验证
    • receiver_email 有效 / 不为 null -> 使用正则表达式验证
    • chosen_delivery_interval 有效 / 不为 null

函数

  • 决定如何轻松地向 SDK 消费者展示这些函数
  • 我们是否应该有一个提供所有函数的单个类?
get_Delivery_Intervals_For_Zip_Code(zip_code string)
create_Delivery_Request(大量参数...)

测试、文档和版本控制

  • 我们使用什么进行测试?
  • 我们应该有什么样的文档?有 2 种文档类型:面向 SDK 消费者和面向 SDK 开发者
  • 语义版本控制: http://semver.org/
  • 我们使用什么进行依赖管理?