Disable gateway refund options for GoCardless

This commit is contained in:
David Bomba 2022-04-27 09:05:16 +10:00
parent e7aedf1270
commit 654bf7a23f
8 changed files with 23 additions and 4 deletions

View File

@ -271,8 +271,10 @@ class CompanySettings extends BaseSettings
public $use_credits_payment = 'off'; //always, option, off //@implemented
public $hide_empty_columns_on_pdf = false;
public $email_from_name = '';
public $auto_archive_invoice_cancelled = false;
public static $casts = [
'auto_archive_invoice_cancelled' => 'bool',
'email_from_name' => 'string',
'show_all_tasks_client_portal' => 'string',
'entity_send_time' => 'int',

View File

@ -107,6 +107,8 @@ class ClientController extends BaseController
*/
public function index(ClientFilters $filters)
{
set_time_limit(45);
$clients = Client::filter($filters);
return $this->listResponse($clients);

View File

@ -119,6 +119,8 @@ class InvoiceController extends BaseController
*/
public function index(InvoiceFilters $filters)
{
set_time_limit(45);
$invoices = Invoice::filter($filters);
return $this->listResponse($invoices);

View File

@ -569,8 +569,6 @@ class BaseImport
'company' => $this->company,
];
nlog($this->company->company_users);
$nmo = new NinjaMailerObject;
$nmo->mailable = new ImportCompleted($this->company, $data);
$nmo->company = $this->company;

View File

@ -159,7 +159,7 @@ class Gateway extends StaticModel
break;
case 52:
return [
GatewayType::BANK_TRANSFER => ['refund' => true, 'token_billing' => true, 'webhooks' => [' ']], // GoCardless
GatewayType::BANK_TRANSFER => ['refund' => false, 'token_billing' => true, 'webhooks' => [' ']], // GoCardless
GatewayType::DIRECT_DEBIT => ['refund' => false, 'token_billing' => true, 'webhooks' => [' ']],
GatewayType::SEPA => ['refund' => false, 'token_billing' => true, 'webhooks' => [' ']],
GatewayType::INSTANT_BANK_PAY => ['refund' => false, 'token_billing' => true, 'webhooks' => [' ']],

View File

@ -186,7 +186,7 @@ class PaymentRepository extends BaseRepository {
TransactionLog::dispatch(TransactionEvent::PAYMENT_MADE, $transaction, $payment->company->db);
return $payment->fresh();
return $payment->refresh();
}
/**

View File

@ -52,6 +52,8 @@ class HandleCancellation extends AbstractService
//adjust client balance
$this->invoice->client->service()->updateBalance($adjustment)->save();
$this->invoice->service()->workFlow()->save();
event(new InvoiceWasCancelled($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
$transaction = [

View File

@ -546,6 +546,19 @@ class InvoiceService
event(new InvoiceWasArchived($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
}
if ($this->invoice->status_id == Invoice::STATUS_CANCELLED && $this->invoice->client->getSetting('auto_archive_invoice_cancelled')) {
/* Throws: Payment amount xxx does not match invoice totals. */
if ($this->invoice->trashed())
return $this;
$this->invoice->delete();
event(new InvoiceWasArchived($this->invoice, $this->invoice->company, Ninja::eventVars(auth()->user() ? auth()->user()->id : null)));
}
return $this;