antonkomarev/php-funpay-sms-parser

FunPay Transaction Verification SMS Parser written for contrived emulator.

1.0.1 2018-07-04 12:51 UTC

This package is auto-updated.

Last update: 2024-12-05 00:31:01 UTC


README

ak-php-funpay-sms-parser

Releases Build Status StyleCI License

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