sveaekonomi / php-instore
1.0.0
2024-05-15 13:17 UTC
Requires
- php: ^7.4 || ^8.0
- ext-curl: *
- ext-json: *
- ext-mbstring: *
- guzzlehttp/guzzle: ^7.3
- guzzlehttp/psr7: ^1.7 || ^2.0
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.5
- phpunit/phpunit: ^8.0 || ^9.0
This package is not auto-updated.
Last update: 2024-09-21 08:04:56 UTC
README
Instore API 允许收银机创建 Svea 订单,客户可以通过短信收到的链接进行结账。
此 PHP 包由 Swagger Codegen 项目自动生成 Swagger Codegen
- API 版本:v1
- 构建包:io.swagger.codegen.v3.generators.php.PhpClientCodegen
需求
PHP 5.5 及以上
安装 & 使用
Composer
要使用 Composer 安装绑定,请将以下内容添加到 composer.json
{
"repositories": [
{
"type": "git",
"url": "https://github.com/sveaekonomi/php-instore.git"
}
],
"require": {
"sveaekonomi/php-instore": "*@dev"
}
}
然后运行 composer install
手动安装
下载文件并包含 autoload.php
require_once('/path/to/lib/vendor/autoload.php');
测试
要运行单元测试
composer install
./vendor/bin/phpunit
入门
请按照 安装过程 进行操作,然后运行以下命令
<?php require_once(__DIR__ . '/vendor/autoload.php'); // Configure HTTP basic authorization: basic $config = Svea\Instore\Configuration::getDefaultConfiguration() ->setUsername('YOUR_USERNAME') ->setPassword('YOUR_PASSWORD'); $apiInstance = new Svea\Instore\Api\OrderApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $merchantOrderNumber = "merchantOrderNumber_example"; // string | The unique merchant order number used when creating the order try { $result = $apiInstance->cancelOrder($merchantOrderNumber); print_r($result); } catch (Exception $e) { echo 'Exception when calling OrderApi->cancelOrder: ', $e->getMessage(), PHP_EOL; } // Configure HTTP basic authorization: basic $config = Svea\Instore\Configuration::getDefaultConfiguration() ->setUsername('YOUR_USERNAME') ->setPassword('YOUR_PASSWORD'); $apiInstance = new Svea\Instore\Api\OrderApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $body = new \Svea\Instore\Model\CreateOrderRequest(); // \Svea\Instore\Model\CreateOrderRequest | try { $result = $apiInstance->createOrder($body); print_r($result); } catch (Exception $e) { echo 'Exception when calling OrderApi->createOrder: ', $e->getMessage(), PHP_EOL; } // Configure HTTP basic authorization: basic $config = Svea\Instore\Configuration::getDefaultConfiguration() ->setUsername('YOUR_USERNAME') ->setPassword('YOUR_PASSWORD'); $apiInstance = new Svea\Instore\Api\OrderApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $merchantOrderNumber = "merchantOrderNumber_example"; // string | The unique merchant order number used when creating the order try { $result = $apiInstance->getOrderStatus($merchantOrderNumber); print_r($result); } catch (Exception $e) { echo 'Exception when calling OrderApi->getOrderStatus: ', $e->getMessage(), PHP_EOL; } // Configure HTTP basic authorization: basic $config = Svea\Instore\Configuration::getDefaultConfiguration() ->setUsername('YOUR_USERNAME') ->setPassword('YOUR_PASSWORD'); $apiInstance = new Svea\Instore\Api\OrderApi( // If you want use custom http client, pass your client which implements `GuzzleHttp\ClientInterface`. // This is optional, `GuzzleHttp\Client` will be used as default. new GuzzleHttp\Client(), $config ); $merchantOrderNumber = "merchantOrderNumber_example"; // string | The unique merchant order number used when creating the order $body = new \Svea\Instore\Model\RevokeOrderRequest(); // \Svea\Instore\Model\RevokeOrderRequest | Order rows to credit. Doesn't have to match the order rows on the invoice. try { $result = $apiInstance->returnOrder($merchantOrderNumber, $body); print_r($result); } catch (Exception $e) { echo 'Exception when calling OrderApi->returnOrder: ', $e->getMessage(), PHP_EOL; } ?>
API 端点文档
所有 URI 都是相对于 https://webpayinstoreapi.svea.com
模型文档
授权文档
基本认证
- 类型:HTTP 基本认证