wildan99/global-pay

GlobalPay bundle

Installs: 10

Dependents: 0

Suggesters: 0

Security: 0

Stars: 0

Watchers: 1

Forks: 0

Open Issues: 0

Type:symfony-bundle

0.7 2024-03-29 09:50 UTC

This package is auto-updated.

Last update: 2024-03-29 12:42:51 UTC


README

Installation

Install the package

composer req wildan99/global-pay

Add to config/bundles.php

Daniil\GlobalPayBundle\GlobalPayBundle::class => ['all' => true],

Copy routes

/vendor/wildan99/global-pay/config/routes/global_pay.yaml to config/routes/global_pay.yaml

Run in console

php bin/console doctrine:migrations:diff
php bin/console doctrine:migrations:migrate --no-interaction

Add next lines to your .env file

###> GlobalPay ###
GLOBAL_PAY_URL=<get it in GlobalPay>
GLOBAL_PAY_AUTH_URL=<get it in GlobalPay>
GLOBAL_PAY_SERVICE_ID=<get it in GlobalPay>
GLOBAL_PAY_CLIENT_ID=<get it in GlobalPay>
GLOBAL_PAY_GRANT_TYPE=<get it in GlobalPay>
GLOBAL_PAY_SCOPE=<get it in GlobalPay>
GLOBAL_PAY_CLIENT_SECRET=<get it in GlobalPay>
GLOBAL_PAY_USERNAME=<get it in GlobalPay>
GLOBAL_PAY_PASSWORD=<get it in GlobalPay>

###< GlobalPay ###

How to use

You need to use this service in construct method of class

Example of simple using

class MyClass 
{
    public function __construct(private \Daniil\GlobalPayBundle\Service\Client $client) 
    {
    }
    
    public function prepare(): void
    {
        $this->client->prepare(new PrepareRequest(shopTransactionId: 'test', sum: 1000, currency: Currency::UZS, description: ''))
    }
}