myagmarsurensedjav/simple-payment

A simple Qpay implementation for Laravel applications.

v0.5.1 2023-12-19 14:43 UTC

README

Latest Version on Packagist GitHub Tests Action Status GitHub Code Style Action Status Total Downloads

Installation

You can install the package via composer:

composer require myagmarsurensedjav/simple-payment

And run the following installer command

php artisan simple-payment:install

You can publish the config file with:

php artisan vendor:publish --tag="simple-payment-config"

This is the contents of the published config file:

<?php

// config for MyagmarsurenSedjav/SimplePayment
return [
    'default' => env('SIMPLE_PAYMENT_DEFAULT', 'qpay'),

    'drivers' => [
        'qpay' => [
            'env' => env('QPAY_ENV', 'fake'),
            'username' => env('QPAY_USERNAME'),
            'password' => env('QPAY_PASSWORD'),
            'invoice_code' => env('QPAY_INVOICE_CODE'),
        ],
        'golomt' => [
            'env' => env('GOLOMT_ENV', 'fake'),
            'access_token' => env('GOLOMT_ACCESS_TOKEN'),
            'hash_key' => env('GOLOMT_HASH_KEY'),
        ],
    ],

    'user_model' => 'App\Models\User',

    'notification_middleware' => [
        // 'api'
    ],

    'return_middlewares' => [
        // 'web'
    ],
];

Optionally, you can publish the views using

php artisan vendor:publish --tag="simple-payment-views"

Usage

MyagmarsurenSedjav\SimplePayment\Contracts\Payable interface should be implemented by the model that will be paid.

use MyagmarsurenSedjav\SimplePayment\Facades\SimplePayment;

Route::get('/invoices/{invoice}/payment', function (Invoice $invoice) {
    return SimplePayment::create($invoice);
});

If you need specific driver, you can use driver method.

SimplePayment::driver('socialpay')->create($invoice);

Testing

composer test

Changelog

Please see CHANGELOG for more information on what has changed recently.

Contributing

Please see CONTRIBUTING for details.

Security Vulnerabilities

Please review our security policy on how to report security vulnerabilities.

Credits

License

The MIT License (MIT). Please see License File for more information.