颜料实验室/airmee-php-sdk

Airmee API的PHP SDK

1.2.1 2022-05-03 09:56 UTC

This package is auto-updated.

Last update: 2024-09-30 01:52:11 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 )

  • 角色:地址的标准表示
  • 约束:所有字段非空/非空
物品

( parcel_id string, length double, width double, height double, weight double, quantity integer, price integer, name string )

  • 角色:用户在在线购物时选择的物品的标准表示
  • 约束
    • length, width, heigh, weight, quantity非空且为正数
    • name非空/非空
交付间隔

( 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使用的交付间隔的标准表示

  • 约束

    • pickup_time_earliest, pickup_time_latest, dropoff_time_earliest, dropoff_time_latest非空且为正数
    • pickup_schedule_formatted, dropoff_schedule_formatted非空/非空
    • pickup_time_earliest < pickup_time_latest
    • dropoff_time_earliest < dropoff_time_latest
  • 注意:参数应该是不可变的,因为它们由服务器提供。这个参数的最佳构造函数模式是什么?

交付请求

( 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 [可选], dropoff_lat [可选], dropoff_lon [可选] )

  • 角色:Airmee使用的交付请求的标准表示
  • 约束
    • dropoff_address非空且有效
    • delivered_items非空,数组不为空,且所有内部物品都有效
    • ecomm_id, receiver_name非空/非空
    • receiver_phone_number(_country_code)有效 -> 可能需要使用 https://github.com/giggsey/libphonenumber-for-php 验证
    • receiver_email有效/非空 -> 使用正则表达式验证
    • chosen_delivery_interval有效/非空

函数

  • 决定如何轻松地将这些函数展示给SDK消费者
  • 我们应该有一个提供所有功能的类吗?
get_Delivery_Intervals_For_Zip_Code(zip_code string)
create_Delivery_Request(lots of params...)

测试、文档和版本控制

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