Rollback gateway display functionality in client/group settings

This commit is contained in:
David Bomba 2023-11-10 15:01:51 +11:00
parent 526b899d28
commit de007b162f
3 changed files with 28 additions and 21 deletions

View File

@ -223,8 +223,12 @@ class PreviewPurchaseOrderController extends BaseController
{ {
/** @var \App\Models\User $user */ /** @var \App\Models\User $user */
$user = auth()->user(); $user = auth()->user();
$company = $user->company(); $company = $user->company();
$file_path = (new PreviewPdf('<html></html>', $company))->handle();
$response = Response::make($file_path, 200);
$response->header('Content-Type', 'application/pdf');
return $response;
MultiDB::setDb($company->db); MultiDB::setDb($company->db);

View File

@ -80,26 +80,25 @@ class PaymentMethod
return array_search($model->id, $transformed_ids); // this closure sorts for us return array_search($model->id, $transformed_ids); // this closure sorts for us
}); });
// nlog($this->gateways->count()); //2023-10-11 - Roll back, do not show any gateways, if they have been archived upstream.
// nlog(count($transformed_ids)); //removing this logic now to prevent any
// if($this->gateways->count() == 0 && count($transformed_ids) >=1) {
if($this->gateways->count() == 0 && count($transformed_ids) >=1) {
/** // /**
* This is a fallback in case a user archives some gateways that have been ordered preferentially. // * This is a fallback in case a user archives some gateways that have been ordered preferentially.
* // *
* If the user archives a parent gateway upstream, it may leave a client setting in a state where no payment gateways are available. // * If the user archives a parent gateway upstream, it may leave a client setting in a state where no payment gateways are available.
* // *
* In this case we fall back to all gateways. // * In this case we fall back to all gateways.
*/ // */
$this->gateways = CompanyGateway::query() // $this->gateways = CompanyGateway::query()
->with('gateway') // ->with('gateway')
->where('company_id', $this->client->company_id) // ->where('company_id', $this->client->company_id)
->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa') // ->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
->whereNull('deleted_at') // ->whereNull('deleted_at')
->where('is_deleted', false)->get(); // ->where('is_deleted', false)->get();
} // }
} else { } else {
$this->gateways = CompanyGateway::query() $this->gateways = CompanyGateway::query()

View File

@ -174,8 +174,12 @@ class AutoBillInvoice extends AbstractService
$amount = array_sum(array_column($this->used_credit, 'amount')); $amount = array_sum(array_column($this->used_credit, 'amount'));
$payment = PaymentFactory::create($this->invoice->company_id, $this->invoice->user_id); $payment = PaymentFactory::create($this->invoice->company_id, $this->invoice->user_id);
$payment->amount = $amount;
$payment->applied = $amount; $payment->amount = 0;
$payment->applied = 0;
// $payment->amount = $amount;
// $payment->applied = $amount;
$payment->client_id = $this->invoice->client_id; $payment->client_id = $this->invoice->client_id;
$payment->currency_id = $this->invoice->client->getSetting('currency_id'); $payment->currency_id = $this->invoice->client->getSetting('currency_id');
$payment->date = now()->addSeconds($this->invoice->company->timezone()->utc_offset)->format('Y-m-d'); $payment->date = now()->addSeconds($this->invoice->company->timezone()->utc_offset)->format('Y-m-d');