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 */
$user = auth()->user();
$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);

View File

@ -80,26 +80,25 @@ class PaymentMethod
return array_search($model->id, $transformed_ids); // this closure sorts for us
});
// nlog($this->gateways->count());
// nlog(count($transformed_ids));
if($this->gateways->count() == 0 && count($transformed_ids) >=1) {
//2023-10-11 - Roll back, do not show any gateways, if they have been archived upstream.
//removing this logic now to prevent any
// 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.
*
* 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.
*/
$this->gateways = CompanyGateway::query()
->with('gateway')
->where('company_id', $this->client->company_id)
->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
->whereNull('deleted_at')
->where('is_deleted', false)->get();
// /**
// * 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.
// *
// * In this case we fall back to all gateways.
// */
// $this->gateways = CompanyGateway::query()
// ->with('gateway')
// ->where('company_id', $this->client->company_id)
// ->where('gateway_key', '!=', '54faab2ab6e3223dbe848b1686490baa')
// ->whereNull('deleted_at')
// ->where('is_deleted', false)->get();
}
// }
} else {
$this->gateways = CompanyGateway::query()

View File

@ -174,8 +174,12 @@ class AutoBillInvoice extends AbstractService
$amount = array_sum(array_column($this->used_credit, 'amount'));
$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->currency_id = $this->invoice->client->getSetting('currency_id');
$payment->date = now()->addSeconds($this->invoice->company->timezone()->utc_offset)->format('Y-m-d');