dpsoft/mehr4-payment

Payment package for mehr4

This package's canonical repository appears to be gone and the package has been frozen as a result.

v2.0 2020-07-12 09:57 UTC

This package is auto-updated.

Last update: 2021-11-21 06:15:27 UTC


README

Latest Version on Packagist Total Downloads

Payment solution for mehr4

Installation

You can install the package via composer:

composer require dpsoft/mehr4-payment

Usage

1- Use command to install package:

php artisan mehr4-payment:install

2- Add AuthViaMobile trait to User model:

use Dpsoft\Mehr4Payment\AuthViaMobile;

class User extends Authenticatable
{
    use AuthViaMobile;

}

3- To obtain course selling url:

\Mehr4Payment::courseBuyUrl($course);

4- Register nova tool in NovaServiceProvider.php:

public function tools()
{
    return [
        new Dpsoft\Mehr4Payment\Mehr4PaymentTool()
    ];
}

5- Config banks gateway information in config/mehr4-payment.php:

<?php

return [
    'code_expiration_time' => env('MOBILE_AUTH_EXP_TIME', 1800),
    'code_in_time'         => env('CODE_IN_TIME', 60),
    'kavenegar'            => [
        'api_key' => env('KAVENEGAR_API_KEY'),
        'sender'  => env('KAVENEGAR_SENDER'),
    ],
    'gateways'=>[
      \Dpsoft\Mehr4Payment\Payment\Mellat::class,
      \Dpsoft\Mehr4Payment\Payment\Parsian::class,
      \Dpsoft\Mehr4Payment\Payment\Saderat::class,
      \Dpsoft\Mehr4Payment\Payment\Payir::class
    ],
    'payment'              => [
        // saderat bank info see: https://www.sepehrpay.com/ig/
        'saderat' => [
            'terminal_id' => env('SADERAT_TERMINAL_ID'),
        ],
        'parsian' => [
            'pin' => env('PARSIAN_PIN_ID'),
        ],
        'mellat'  => [
            'terminal_id' => env('MELLAT_TERMINAL_ID'),
            'user_name'   => env('MELLAT_USER_NAME'),
            'password'    => env('MELLAT_PASSWORD'),
        ],
        'payir'  => [
            'api_key' => env('PAYIR_API_KEY')
        ]
    ],
];

Updating

After any update dont forget to run php artisan mehr4-payment:publish command.

Testing

composer test

Security

If you discover any security related issues, please email sadeghpm@gmail.com instead of using the issue tracker.

Credits