<?php

namespace App\Domain\PaymentGateway\Services;

class QiwiService
{
    public static function payments_link($amount, $order, $user)
    {
        $publicKey = env('QIWI_PUBLIC');
        $SECRET_KEY = env('QIWI_SECRET');

        $billPayments = new \Qiwi\Api\BillPayments($SECRET_KEY);
        $success_url = env('APP_URL') . '/qiwi-to-payments/status/' . $order->number;

        $params = [
            'publicKey' => $publicKey,
            'amount' => $amount,
            'billId' => $order->number,
            'successUrl' => $success_url,
            'email' => $user->email,
            'comment' => 'Пополнение баланса',
        ];

        return $billPayments->createPaymentForm($params);

    }
}
