fpy/tuangou

sdk of dianping/tuangou

1.0.0 2019-01-22 07:58 UTC

This package is auto-updated.

Last update: 2024-05-23 00:20:19 UTC


README

Build Status 68747470733a2f2f6170702e666f7373612e696f2f6170692f70726f6a656374732f6769742532426769746875622e636f6d253246667079353632372532466469616e70696e672d7475616e676f752e7376673f747970653d736869656c64

sdk of dianping/tuangou.

北极星开放平台,美团api接口SDK

环境需求

  • PHP >= 5.6

Installing/安装

$ composer require fpy/tuangou

Usage/使用

只有团购的api,以及自用型应用、工具型应用授权,新版接口不推荐使用app_shop_id,因此本sdk只使用open_shop_uuid

授权

商家通过接入授权UI,可获取到对应的auth_code,通过此接口获取此次发起授权的session。

use Fpy\TuanGou\Session;
$session = new Session($appKey, $appSecret);
//session换取接口
$session->getToken($authCode,$redirectUrl=null);

//session刷新接口
$session->refreshToken($refreshToken);

//session范围查询接口
$session->sessionQuery($session);

//session适用店铺查询接口
$session->getScope($bid,$session);

团购

use Fpy\TuanGou\TuanGou;
$tuangou = new TuanGou($appKey, $appSecret);

//输码验券校验接口
$tuangou->prepare($receiptCode, $openShopUuid, $session);

//扫码验券校验接口
$tuangou->scanPrepare($receiptCode, $openShopUuid, $session);

//验券接口
$tuangou->consume($requestId, $code, $count, $openShopUuid, $session, $shopAccount, $shopAccountName);

//查询已验券信息接口
$tuangou->getConsumed($code, $openShopUuid, $session);

//验券记录
$tuangou->consumeHistory($date, $openShopUuid, $session, $type=0, $bizType=null, $pageIndex=1, $pageSize=10);

//撤销验券接口(超过10分钟不能退券)
$tuangou->reverseConsume($appDealId, $code, $openShopUuid, $session, $shopAccount, $shopAccountName)

//获取团购信息接口

$tuangou->queryShopDeal($openShopUuid, $session, $pageIndex=1, $pageSize=10);

Contributing

You can contribute in one of three ways:

  1. File bug reports using the issue tracker.
  2. Answer questions or fix bugs on the issue tracker.
  3. Contribute new features or update the wiki.

The code contribution process is not very formal. You just need to make sure that you follow the PSR-0, PSR-1, and PSR-2 coding guidelines. Any new code contributions must be accompanied by unit tests where applicable.

License

FOSSA Status