https://github.com/antonkomarev/php-funpay-sms-parser
FunPay Transaction Confirmation SMS Parser written for contrived emulator.
https://github.com/antonkomarev/php-funpay-sms-parser
emulator parser php sms transaction verification
Last synced: about 1 year ago
JSON representation
FunPay Transaction Confirmation SMS Parser written for contrived emulator.
- Host: GitHub
- URL: https://github.com/antonkomarev/php-funpay-sms-parser
- Owner: antonkomarev
- License: mit
- Created: 2018-07-03T02:19:03.000Z (almost 8 years ago)
- Default Branch: master
- Last Pushed: 2019-09-04T12:27:41.000Z (almost 7 years ago)
- Last Synced: 2025-02-13T15:49:36.622Z (over 1 year ago)
- Topics: emulator, parser, php, sms, transaction, verification
- Language: PHP
- Homepage:
- Size: 17.6 KB
- Stars: 2
- Watchers: 3
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# PHP FunPay SMS Parser

## 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](#installation)
- [Install as composer package](#install-as-package)
- [Standalone](#standalone)
- [Demo](#demo)
- [Usage](#usage)
- [Instantiate Parser](#instantiate-parser)
- [Available Methods](#available-methods)
- [Exceptions](#exceptions)
- [Testing](#testing)
- [Author](#author)
- [License](#license)
## Installation
### Install as package
Pull in the package through Composer in your application:
```sh
$ composer install antonkomarev/php-funpay-sms-parser
```
### Standalone
Clone or download project from [PHP FunPay SMS Parser git repository](https://github.com/antonkomarev/php-funpay-sms-parser).
```sh
$ git clone git@github.com:antonkomarev/php-funpay-sms-parser.git && cd ./php-funpay-sms-parser
```
Generate class autoload file and install PHPUnit.
```sh
$ composer install
```
## Demo
Demo script could be executed using PHP CLI:
```sh
$ php public/demo.php
```
You could experiment with `$message` variable value.
More examples could be found in `tests/ParserTest.php` file.
## Usage
### Instantiate Parser
```php
$message = '
Пароль: 0823
Спишется 100,85р.
Перевод на счет 410017080996934
';
$parsedMessage = new \AK\FunPay\SmsParser\Parser($message);
```
### Available Methods
#### Get Yandex.Money account number
```php
$parsedMessage->account(): string
```
#### Get transaction money amount
```php
$parsedMessage->moneyAmount(): float
```
#### Get confirmation pin-code
```php
$parsedMessage->pin(): string
```
### Exceptions
- `ParserException` (abstract)
- `MoneyAmountNotFound`
- `PinNotFound`
- `YandexAccountNotFound`
- `YandexAccountInvalid`
## Testing
Run the tests with:
```sh
$ vendor/bin/phpunit
```
## Author
| 
Anton Komarev |
| :---: |
## License
- `PHP FunPay SMS Parser` package is open-sourced software licensed under the [MIT license](LICENSE) by [Anton Komarev].
- `Decomposition` image licensed under [Creative Commons 3.0](https://creativecommons.org/licenses/by/3.0/us/) by Arthur Shlain.
[Anton Komarev]: https://komarev.com