amritms / waveapps-client-php
Laravel 集成包,用于 SaaS 应用程序消耗 Wave 的 API,该 API 使用 GraphQL 构建
0.3.1
2023-03-13 15:25 UTC
Requires
- guzzlehttp/guzzle: ^7.0.1
Requires (Dev)
- orchestra/testbench: ^6.0@dev
- phpunit/phpunit: ^9.1
This package is auto-updated.
Last update: 2024-09-19 07:46:06 UTC
README
一个包装器,用于在您的 Laravel SaaS 应用程序中使用 WaveApps 的 GraphQL API。此仓库可以代表第三方用户管理 webapp 账户。
注意:如果您想代表单个用户使用 WaveApps,请使用 subbe/waveapp
原始文档可在以下位置找到:
要使用 WaveApps,您需要在开发者门户上 注册。然后创建新应用程序并获取 client_id 和 client_secret。
需求与安装
打开您的 composer.json 文件并添加
"amritms/waveapps-client-php":"0.1"
然后在终端中进入您的 composer 文件位置并运行
composer update
php artisan vendor:publish
路由
Route::post('webapps/token', 'WebappsController@handleToken');
更新您的 .env 文件以包含
WAVE_CLIENT_ID=
WAVE_CLIENT_SECRET=
WAVE_GRAPHQL_AUTH_URI=https://api.waveapps.com/oauth2/token/
WAVE_GRAPHQL_URI=https://gql.waveapps.com/graphql/public
查询
- 用户
- 国家
- 国家
- 客户
- 产品
- 发票
- 企业
- 企业
- 货币
- 货币
- 账户类型
- 账户子类型
突变
客户
- 客户创建
- 客户更新
- 客户删除
账户
- 账户创建
- 账户更新
- 账户存档
产品
- 产品创建
- 产品更新
- 产品存档
销售
- 销售税创建
- 销售税更新
- 销售税率创建
- 销售税存档
货币交易
- 货币交易创建
发票
- 发票创建
- 发票删除
- 发票发送
- 发票批准
- 发票标记已发送
如何使用
查询
$waveapp = new \Amritms\WaveappsClientPhp\Waveapps();
$countries = $waveapp->countries();
--- OR ---
$country = $waveapp->country(['code' => 'US']);
突变
$waveapp = new \Amritms\WaveappsClientPhp\Waveapps();
$customer = [
"input" => [
"businessId" => "<REPLACE-THIS-WITH-THE-BUSINESS-ID>",
"name" => "Lucifer Morningstar",
"firstName" => "Lucifer",
"lastName" => "Morningstar",
"displayId" => "Lucifer",
"email" => "lucifer.morningstar@hell.com",
"mobile" => "6666666",
"phone" => "6666666",
"fax" => "",
"address" => [
"addressLine1" => "666 Diablo Street",
"addressLine2" => "Hell's Kitchen",
"city" => "New York",
"postalCode" => "10018",
"countryCode" => "US"
],
"tollFree" => "",
"website" => "",
"internalNotes" => "",
"currency" => "USD",
"shippingDetails" => [
"name" => "Lucifer",
"phone" => "6666666",
"instructions" => "pray",
"address" => [
"addressLine1" => "666 Diablo Street",
"addressLine2" => "Hell's Kitchen",
"city" => "New York",
"postalCode" => "10018",
"countryCode" => "US"
]
]
]
];
$newCustomer = $waveapp->customerCreate($customer, "CustomerCreateInput");
注意:此仓库基于 subbe/waveapp