aurimasniekis / gmo-aozora-client
基于PSR-18/17的客户端,用于从 https://gmo-aozora.com/ 访问您的银行信息
1.0.0
2020-03-20 13:10 UTC
Requires
- php: ^7.4||^8.0
- ext-json: *
- psr/http-client: ^1.0
- psr/http-factory: ^1.0
Requires (Dev)
This package is auto-updated.
Last update: 2024-09-20 23:03:40 UTC
README
基于PSR-18/17的客户端,用于从 https://gmo-aozora.com/ 访问您的银行信息
安装
通过Composer
$ composer require aurimasniekis/gmo-aozora-client
此包依赖于PSR-17和PSR-18包才能使用。对于更简单的版本,请使用 aurimasniekis/gmo-aozora-simple-client。
配置
定义配置有两种方式,一种是通过静态定义值,另一种是从JSON配置文件加载,该文件将包含认证令牌和设备令牌。设备令牌需要保留,以防止新的登录发出通知。
静态配置
<?php use AurimasNiekis\GmoAozoraClient\Configuration; $config = new Configuration( string $username, string $password, string $deviceToken = null, string $faToken = null, string $serviceType = self::SERVICE_TYPE, // https://bank.gmo-aozora.com/v1 string $ssoDomain = self::SSO_DOMAIN, // https://sso.gmo-aozora.com string $apiDomain = self::API_DOMAIN // https://bank.gmo-aozora.com/v1 );
JSON配置文件
<?php use AurimasNiekis\GmoAozoraClient\JsonFileConfiguration; $config = new JsonFileConfiguration( string $configFile );
{ "username": "1233456", "password": "1233456" }
可用选项
用法
在示例中,PSR-17和PSR-18由: nyholm/psr7
和 kriswallsmith/buzz
包提供。
<?php use Buzz\Client\Curl; use Nyholm\Psr7\Factory\Psr17Factory; use AurimasNiekis\GmoAozoraClient\Client; use AurimasNiekis\GmoAozoraClient\WebClient; use AurimasNiekis\GmoAozoraClient\JsonFileConfiguration; $factory = new Psr17Factory(); $client = new Curl($factory); $config = new JsonFileConfiguration(__DIR__ . '/config.json'); $webClient = new WebClient($config, $client, $factory, $factory); $client = new Client($webClient);
获取账户详情
$accountDetails = $client->accountDetails();
^ AurimasNiekis\GmoAozoraClient\Model\AccountDetails^ {#9 -raw: array:27 [ ... ] -customerName: null -customerType: null -lastLoginDatetime: DateTimeImmutable @1584736703 {#10 date: 2020-03-20 20:38:23.626 UTC (+00:00) } -queryDatetime: DateTimeImmutable @1584738476 {#11 date: 2020-03-20 21:07:56.664 UTC (+00:00) } -isLock: null -rankName: "1テックま君" -rankLogoUrl: null -atmFeeFreeCount: 2 -transferFeeFreeCount: 1 -transferLimitAmount: "500000000000" -oneDayTransferLimitAmount: "500000000000" -lastDayTotalBalance: "9999999" -totalBalance: "9999999" -ordinaryDepositTotalBalance: "9999999" -sweepTotalBalance: "" -lastDaySweepTotalBalance: "" -termDepositTotalBalance: "" -fcyOrdinaryDepositTotalJpyBalance: "" -uncollectedAmount: "0" -uncollectedDeducationBalance: null -branchCode: "123" -branchName: "..." -accountNumber: "1234567" -debitPlanList: [] -rateList: array:8 [ 0 => array:16 [ "customerRateId" => "1212321" "currency" => "USD" "ttb" => "110.07" "tts" => "110.11" "ttbRiseOrFall" => "1" "ttmRiseOrFall" => "1" "ttsRiseOrFall" => "1" "isServiceTime" => "1" "isValidRate" => "1" "currencyName" => "米ドル" "displayFractionLength" => 2 "orderFractionLength" => 2 "currencyServiceStatus" => "1" "validSeconds" => 10 "generatedAt" => "20200320210755456" "ttm" => "110.09" ] ... ] -authorityList: [] -statementList: array:5 [ 0 => AurimasNiekis\GmoAozoraClient\Model\PaymentStatementEntry^ {#14 -raw: array:7 [ ... ] -data: DateTimeImmutable @1584706076 {#13 date: 2020-03-20 12:07:56.0 UTC (+00:00) } -remark: "Visa" -memo: null -amount: "400" -balance: "123456789" -accountEntryNumber: "123456" -creditDebitType: "2" } 1 => AurimasNiekis\GmoAozoraClient\Model\IncomeStatementEntry^ {#14 -raw: array:7 [ ... ] -data: DateTimeImmutable @1584706076 {#13 date: 2020-03-20 12:07:56.0 UTC (+00:00) } -remark: "Visa" -memo: null -amount: "123456789" -balance: "123456789" -accountEntryNumber: "123456" -creditDebitType: "1" } ... ] }
报表
普通存款报表
$statements = $client->ordinaryDepositStatement( DateTimeInterface $toDate = null, DateTimeInterface $fromDate = null, int $perPage = 2000 )
外币普通存款报表
$statements = $client->foreignOrdinaryDepositStatement( DateTimeInterface $toDate = null, DateTimeInterface $fromDate = null, int $perPage = 2000 )
定期存款报表
$statements = $client->termDepositStatement( DateTimeInterface $toDate = null, DateTimeInterface $fromDate = null, int $perPage = 2000 )
活期存款报表
$statements = $client->sweepAccountStatement( DateTimeInterface $toDate = null, DateTimeInterface $fromDate = null, int $perPage = 2000 )
原始报表
$statements = $client->rawStatement( string $type, array $options, DateTimeInterface $toDate = null, DateTimeInterface $fromDate = null, int $offset = 0, int $limit = 20 )
所有页面抓取的原始报表
$statements = $client->rawStatementAll( string $type, array $options, DateTimeInterface $toDate = null, DateTimeInterface $fromDate = null, int $perPage = 2000 )
这些函数的结果相同
array:100 [ 0 => AurimasNiekis\GmoAozoraClient\Model\PaymentStatementEntry^ {#14 -raw: array:7 [ ... ] -data: DateTimeImmutable @1584706076 {#13 date: 2020-03-20 12:07:56.0 UTC (+00:00) } -remark: "Visa" -memo: null -amount: "400" -balance: "123456789" -accountEntryNumber: "123456" -creditDebitType: "2" }, ... ]
Visa报表
$statements = $client->visaStatement( DateTimeInterface $toDate = null, DateTimeInterface $fromDate = null, int $perPage = 2000 )
array:100 [ 0 => AurimasNiekis\GmoAozoraClient\Model\VisaStatementEntry^ {#21 -raw: array:9 [ ... ] -date: DateTimeImmutable @1584274771 {#22 date: 2020-03-15 12:19:31.0 UTC (+00:00) } -usage: "AMAZON.CO.JP" -amount: "1234" -status: "1" -localCurrencyAmount: "0.0" -atmUseFee: null -currency: null -conversionRate: null -approvalNumber: "12345" } ... ]
测试
运行PHP样式检查器
$ composer cs-check
运行PHP样式修复器
$ composer cs-fix
贡献
请参阅 CONTRIBUTING 和 CONDUCT 了解详情。
许可
请参阅 许可文件 了解更多信息。