Merge pull request #8304 from turbo124/v5-develop

Fix for expense <> transaction decoupling
This commit is contained in:
David Bomba 2023-02-24 12:41:12 +11:00 committed by GitHub
commit 39206225a5
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
4 changed files with 7 additions and 13 deletions

View File

@ -12,7 +12,7 @@
namespace App\Http\Controllers;
use App\Factory\SchedulerFactory;
use App\Http\Requests\Task\DestroySchedulerRequest;
use App\Http\Requests\TaskScheduler\DestroySchedulerRequest;
use App\Http\Requests\TaskScheduler\CreateSchedulerRequest;
use App\Http\Requests\TaskScheduler\ShowSchedulerRequest;
use App\Http\Requests\TaskScheduler\StoreSchedulerRequest;

View File

@ -124,6 +124,10 @@ class Request extends FormRequest
$input['company_gateway_id'] = $this->decodePrimaryKey($input['company_gateway_id']);
}
if (array_key_exists('transaction_id', $input) && is_string($input['transaction_id'])) {
$input['transaction_id'] = $this->decodePrimaryKey($input['transaction_id']);
}
if (array_key_exists('category_id', $input) && is_string($input['category_id'])) {
$input['category_id'] = $this->decodePrimaryKey($input['category_id']);
}

View File

@ -22,6 +22,6 @@ class DestroySchedulerRequest extends Request
*/
public function authorize() : bool
{
return auth()->user()->isAdmin();
return auth()->user()->isAdmin() && $this->task_scheduler->company_id == auth()->user()->company()->id;
}
}

View File

@ -52,7 +52,6 @@ use App\PaymentDrivers\Stripe\PRZELEWY24;
use App\PaymentDrivers\Stripe\BankTransfer;
use App\PaymentDrivers\Stripe\Connect\Verify;
use App\PaymentDrivers\Stripe\ImportCustomers;
use App\PaymentDrivers\Stripe\UpdatePaymentMethods;
use App\Http\Requests\Payments\PaymentWebhookRequest;
use Laracasts\Presenter\Exceptions\PresenterException;
use App\PaymentDrivers\Stripe\Jobs\PaymentIntentWebhook;
@ -155,7 +154,7 @@ class StripePaymentDriver extends BaseDriver
if ($this->client
&& isset($this->client->country)
&& in_array($this->client->country->iso_3166_3, ['USA'])
&& (in_array($this->client->country->iso_3166_3, ['USA']) || ($this->client->gateway_tokens()->where('gateway_type_id', GatewayType::BANK_TRANSFER)->exists()))
) {
$types[] = GatewayType::BANK_TRANSFER;
}
@ -843,15 +842,6 @@ class StripePaymentDriver extends BaseDriver
$this->client = ClientGatewayToken::where('gateway_customer_reference', $customer)->client;
}
/**
* Pull all client payment methods and update
* the respective tokens in the system.
*/
public function updateAllPaymentMethods()
{
return (new UpdatePaymentMethods($this))->run();
}
/**
* Imports stripe customers and their payment methods
* Matches users in the system based on the $match_on_record