didww/php-sdk

此软件包已被弃用且不再维护。未建议替代软件包。
此软件包的最新版本(0.1.1)没有可用的许可证信息。

DIDWW API 2 PHP SDK

0.1.1 2015-11-30 13:58 UTC

This package is not auto-updated.

Last update: 2021-03-19 20:40:01 UTC


README

⚠️ 不再维护 ⚠️

API 2 正在维护模式

考虑切换到 API 3 https://github.com/didww/didww-api-3-php-sdk

DIDWW API 2 PHP 客户端

Build Status Coverage Status

关于 DIDWW API 2.0

DIDWW API 对分销商免费提供,无需支付任何许可费用。此外,通过此 API 购买的任何服务都不需要支付给 DIDWW 的设置费用,从商业角度来看,这增加了该模式的吸引力和灵活性。

了解更多 http://open.didww.com/index.php/DIDWW_API_2.0

使用方法

连接初始化

    $userName = "user@gmail";
    $password = "44AEIRTCH5NE2MAPDXYGKHJHH";
    $testMode = false;
    use Didww\API2\ApiCredentials, Didww\API2\ApiClient as Client;
    Client::setCredentials(new ApiCredentials($userName,$password,$testMode));
    Client::setDebug(false);

创建 DID 号码

    use Didww\API2\Order;
    use Didww\API2\MappingToGtalk;
    
    $order = new Order();
    $order->setMapData(new MappingToGtalk("googlemail@gmail.com"));
    $order->setCustomerId(81);
    $order->setCountryIso("IL");
    $order->setCityId(908);
    $order->setCityPrefix(8);
    $order->setPeriod(1);
    $number = $order->createNumber();

更改映射

    use Didww\API2\MappingToGtalk;
    $order->updateMapping(new MappingToGtalk("anothergooglemail@gmail.com"));

客户余额列表

    use Didww\API2\Balance;
    $balances =  Balance::getBalanceList();

处理余额

    $balance = new Balance();
    $balance->setCustomerId(81);
    $balance->synchronizePrepaidBalance();
    echo $balance->getPrepaidBalance();
    $balance->removeFunds(10);
    $balance->addFunds(20);

CDR 和 CDR 费用

    use Didww\API2\CDR;
    use Didww\API2\CDRInvoice;
    use Didww\API2\CDRCollection;
    
    $invoice = new CDRInvoice();
    $invoice->setCustomerId(81);
    $invoice->setFromDate('2012-01-01');
    $invoice->setToDate('2012-01-31');
    
    $invoice->load();
    echo $invoice->getAmount();
    
    
    $cdrs = new CDRCollection();
    $cdrs->setFromDate('2012-01-01');
    $cdrs->setToDate('2012-03-01');
    $cdrs->setCustomerId(85);
    $cdrs->load();

地区

    use Didww\API2\Country;
    $countries = Country::getAll();

城市

 use Didww\API2\Country;
 $country = new Country(array('country_iso'=>'US'));
 $country->loadCities()->getCities();

还有更多...