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

57 lines
1.4 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
*
2023-01-28 23:21:40 +01:00
* @copyright Copyright (c) 2023. Invoice Ninja LLC (https://invoiceninja.com)
2021-05-05 06:29:58 +02:00
*
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\Support\Facades\Cache;
class WePayController extends BaseController
{
use MakesHash;
2021-05-05 06:29:58 +02:00
/**
* Initialize WePay Signup.
*/
public function signup(string $token)
{
2022-06-15 06:38:22 +02:00
// return render('gateways.wepay.signup.finished');
2021-05-05 06:29:58 +02:00
$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;
2022-10-05 02:21:55 +02:00
$data['user_company'] = $company;
2024-01-14 05:05:00 +01:00
2022-10-05 02:21:55 +02:00
// $data['company_key'] = $company->company_key;
// $data['db'] = $company->db;
2021-05-05 06:29:58 +02:00
2024-01-14 05:05:00 +01:00
$wepay_driver = new WePayPaymentDriver(new CompanyGateway(), null, null);
2021-05-05 06:29:58 +02:00
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
}