vanta / b2pos-soap-client
Soap client for b2pos
0.1
2023-10-29 16:02 UTC
Requires
- php: ^8.1
- ext-libxml: *
- ext-simplexml: *
- brick/phonenumber: ^0.4|^0.5
- doctrine/annotations: ^2.0
- guzzlehttp/psr7: ^2.6
- moneyphp/money: ^4.2
- phpdocumentor/reflection-docblock: ^5.3
- psr/http-client: ^1.0
- symfony/property-access: ^6.2
- symfony/serializer: ^6.2
- yiisoft/http: ^1.2
Requires (Dev)
- friendsofphp/php-cs-fixer: ^3.26
- guzzlehttp/guzzle: ^7.8
- nyholm/psr7: ^1.8
- phpstan/extension-installer: ^1.3
- phpstan/phpstan: ^1.10
- phpstan/phpstan-symfony: ^1.3
- symfony/http-client: ^6.3
- symfony/var-dumper: ^6.3
README
Клиент для интеграции с сервисом api.b2pos.ru
Установка
Минимальная версия PHP: 8.1
- Запустите команду
composer require vanta/b2pos-soap-client
- Установите psr совместимый клиент
Особенности работы с клиентом
- Сервис работает только с 1 валютой - RUB
- В параметр конструктора Money передаем суммы в копейках
Пример использования:
<?php declare(strict_types=1); $psr18Client = new Psr18Client(); $soapClientBuilder = SoapClientBuilder::create($psr18Client, 'yourUserId', 'yourUserToken'); $request = new NewLoanApplicationRequestShort( userInn: '123456789012', lastname: 'clientLastName', firstname: 'clientFirstName', secondname: 'clientSecondName', phoneNumber: PhoneNumber::parse('+79611234567'), comment: 'someComment', firstPaymentAmount: new MoneyPositiveOrZero('15000000'), russianPassportDocument: new RussianPassportDocument( new RussianPassportSeries('1234'), new RussianPassportNumber('123456'), ), loanPeriodInMonths: 10, requestId:'someRequestId', pointOfSaleId: '123', loanType: LoanTypeShort::LOAN, basketProducts: [new BasketProduct( 'someBasketProductName', new MoneyPositiveOrZero('15000000'), 'someBasketProductModel', 'someBasketProductBrand', )], ); $response = $soapClientBuilder ->createLoanApplicationClient() ->newLoanApplicationShort($request) ;