hexters / CoinPayment

Package to handle payment of cryptocurrency
https://www.coinpayments.net/index.php?ref=3dc0c5875304cc5cc1d98782c2741cb5
MIT License
73 stars 42 forks source link

Jobs not queuing? #84

Closed rinoj closed 1 year ago

rinoj commented 1 year ago

Hi, I have installed the package but can't figure out how to trigger a job. Do I have to manually dispatch the job or is it automatically done? I've commented the last line, I don't manage to figure this out.

public function store(Request $request)
{
    Validator::make($request->all(), [
        'amount' => ['required', 'integer'], // NEED TO FIX THIS
    ]);
    $account = Account::findOrFail($request['account']['id']);
    $amount = (int)$request['amount'];
    $account->deposits()->create([
        'amount' => $amount,
        'user_id' => $request['user']['id'],
    ]);

    $transaction['order_id'] = uniqid(); // invoice number
    $transaction['amountTotal'] = (FLOAT) $amount;
    $transaction['note'] = 'Transaction note';
    $transaction['buyer_name'] = auth()->user()->full_name;
    $transaction['buyer_email'] = auth()->user()->email;
    $transaction['redirect_url'] = url('/admin/deposits'); // When Transaction was comleted
    $transaction['cancel_url'] = url('/admin/deposits'); // When user click cancel link

    /*
    *   @required true
    *   @example first item
    */
    $transaction['items'][] = [
        'itemDescription' => 'Deposit',
        'itemPrice' => (FLOAT) $amount, // USD
        'itemQty' => (INT) 1,
        'itemSubtotalAmount' => (FLOAT) $amount // USD
    ];

    $transaction['payload'] = [
        'foo' => [
            'bar' => 'baz'
        ]
    ];

    $link = CoinPayment::generatelink($transaction);
    //$test = CoinpaymentListener::dispatch($transaction);
    return Inertia::location($link);
}
rinoj commented 1 year ago

Nevermind, had to fix the IPN url to get the jobs queued.