1
0
mirror of https://github.com/invoiceninja/invoiceninja.git synced 2024-11-10 21:22:58 +01:00
invoiceninja/app/Http/Controllers/WePayController.php

55 lines
1.3 KiB
PHP
Raw Normal View History

2021-05-05 06:29:58 +02:00
<?php
/**
* Invoice Ninja (https://invoiceninja.com).
*
* @link https://github.com/invoiceninja/invoiceninja source repository
*
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
*
2021-06-21 07:10:20 +02:00
* @license https://www.elastic.co/licensing/elastic-license
2021-05-05 06:29:58 +02:00
*/
namespace App\Http\Controllers;
use App\Libraries\MultiDB;
2021-06-13 14:49:43 +02:00
use App\Models\Company;
2021-05-05 06:29:58 +02:00
use App\Models\CompanyGateway;
use App\Models\User;
use App\PaymentDrivers\WePayPaymentDriver;
use App\Utils\Traits\MakesHash;
use Illuminate\Http\Request;
use Illuminate\Support\Facades\Cache;
class WePayController extends BaseController
{
use MakesHash;
2021-06-11 09:45:41 +02:00
2021-05-05 06:29:58 +02:00
/**
* Initialize WePay Signup.
*/
public function signup(string $token)
{
$hash = Cache::get($token);
2021-06-11 09:45:41 +02:00
MultiDB::findAndSetDbByCompanyKey($hash['company_key']);
$user = User::findOrFail($hash['user_id']);
$company = Company::where('company_key', $hash['company_key'])->firstOrFail();
2021-05-05 06:29:58 +02:00
2021-05-05 08:21:37 +02:00
$data['user_id'] = $user->id;
2021-06-11 09:45:41 +02:00
$data['company'] = $company;
2021-05-05 06:29:58 +02:00
$wepay_driver = new WePayPaymentDriver(new CompanyGateway, null, null);
return $wepay_driver->setup($data);
}
2021-06-11 09:39:51 +02:00
public function finished()
{
return render('gateways.wepay.signup.finished');
}
2021-05-05 06:29:58 +02:00
}