antonkomarev / php-funpay-sms-parser
FunPay Transaction Verification SMS Parser written for contrived emulator.
Fund package maintenance!
paypal.me/antonkomarev
Requires
- php: ^7.1
Requires (Dev)
- phpunit/phpunit: ^7.2
This package is auto-updated.
Last update: 2024-11-05 00:22:11 UTC
README
Introduction
PHP FunPay SMS Parser library allows to parse SMS messages from transaction confirmation gateway.
This package was developed as a part of an FunPay interview, I'm not affiliated with FunPay in any way.
Contents
Installation
Install as package
Pull in the package through Composer in your application:
$ composer install antonkomarev/php-funpay-sms-parser
Standalone
Clone or download project from PHP FunPay SMS Parser git repository.
$ git clone git@github.com:antonkomarev/php-funpay-sms-parser.git && cd ./php-funpay-sms-parser
Generate class autoload file and install PHPUnit.
$ composer install
Demo
Demo script could be executed using PHP CLI:
$ php public/demo.php
You could experiment with $message
variable value.
More examples could be found in tests/ParserTest.php
file.
Usage
Instantiate Parser
$message = ' Пароль: 0823 Спишется 100,85р. Перевод на счет 410017080996934 '; $parsedMessage = new \AK\FunPay\SmsParser\Parser($message);
Available Methods
Get Yandex.Money account number
$parsedMessage->account(): string
Get transaction money amount
$parsedMessage->moneyAmount(): float
Get confirmation pin-code
$parsedMessage->pin(): string
Exceptions
ParserException
(abstract)MoneyAmountNotFound
PinNotFound
YandexAccountNotFound
YandexAccountInvalid
Testing
Run the tests with:
$ vendor/bin/phpunit
Author
License
PHP FunPay SMS Parser
package is open-sourced software licensed under the MIT license by Anton Komarev.Decomposition
image licensed under Creative Commons 3.0 by Arthur Shlain.