mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
null safety not required
This commit is contained in:
parent
08432c70e0
commit
0a4d00158c
@ -39,7 +39,7 @@ class GoCardlessOAuthWebhookController extends Controller
|
||||
->whereJsonContains('config->account_id', $e['links.organisation'])
|
||||
->firstOrFail();
|
||||
|
||||
$current = $company_gateway->getConfig('__current');
|
||||
$current = $company_gateway->getConfigField('__current');
|
||||
|
||||
if ($current) {
|
||||
$company_gateway->setConfig($current);
|
||||
|
@ -425,7 +425,6 @@ class CompanyGateway extends BaseModel
|
||||
|
||||
$fee = 0;
|
||||
|
||||
|
||||
if ($fees_and_limits->adjust_fee_percent ?? false) {
|
||||
$adjusted_fee = 0;
|
||||
|
||||
@ -452,11 +451,7 @@ class CompanyGateway extends BaseModel
|
||||
} else {
|
||||
$fee += round(($amount * $fees_and_limits->fee_percent / 100), 2);
|
||||
}
|
||||
//elseif ($fees_and_limits->adjust_fee_percent) {
|
||||
// $fee += round(($amount / (1 - $fees_and_limits->fee_percent / 100) - $amount), 2);
|
||||
//} else {
|
||||
|
||||
//}
|
||||
}
|
||||
}
|
||||
/* Cap fee if we have to here. */
|
||||
@ -470,17 +465,14 @@ class CompanyGateway extends BaseModel
|
||||
if ($include_taxes) {
|
||||
if ($fees_and_limits->fee_tax_rate1) {
|
||||
$fee += round(($pre_tax_fee * $fees_and_limits->fee_tax_rate1 / 100), 2);
|
||||
// info("fee after adding fee tax 1 = {$fee}");
|
||||
}
|
||||
|
||||
if ($fees_and_limits->fee_tax_rate2) {
|
||||
$fee += round(($pre_tax_fee * $fees_and_limits->fee_tax_rate2 / 100), 2);
|
||||
// info("fee after adding fee tax 2 = {$fee}");
|
||||
}
|
||||
|
||||
if ($fees_and_limits->fee_tax_rate3) {
|
||||
$fee += round(($pre_tax_fee * $fees_and_limits->fee_tax_rate3 / 100), 2);
|
||||
// info("fee after adding fee tax 3 = {$fee}");
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -456,7 +456,7 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
|
||||
$invoice
|
||||
->ledger()
|
||||
->updateInvoiceBalance($adjustment, 'Adjustment for adding gateway fee');
|
||||
->updateInvoiceBalance($adjustment, 'Adjustment for adding gateway fee **Base Driver**');
|
||||
|
||||
$invoice->client->service()->calculateBalance();
|
||||
}
|
||||
|
@ -96,7 +96,7 @@ class DirectDebit implements MethodInterface, LivewireMethodInterface
|
||||
'session_token' => $session_token,
|
||||
'billing_request' => $response->id,
|
||||
'authorize_then_redirect' => true,
|
||||
'payment_hash' => $this->go_cardless->payment_hash?->hash,
|
||||
'payment_hash' => $this->go_cardless->payment_hash->hash,
|
||||
]),
|
||||
"exit_uri" => $exit_uri,
|
||||
"links" => [
|
||||
|
@ -65,7 +65,7 @@ class SEPA implements MethodInterface, LivewireMethodInterface
|
||||
'method' => GatewayType::SEPA,
|
||||
'session_token' => $session_token,
|
||||
'authorize_then_redirect' => true,
|
||||
'payment_hash' => $this->go_cardless->payment_hash?->hash,
|
||||
'payment_hash' => $this->go_cardless->payment_hash->hash,
|
||||
]),
|
||||
'prefilled_customer' => [
|
||||
'given_name' => auth()->guard('contact')->user()->client->present()->first_name(),
|
||||
|
@ -48,7 +48,7 @@ class PaymentMethod
|
||||
|
||||
$this->payment_urls = $pu->when($contains_both, function ($methods) {
|
||||
return $methods->reject(function ($item) {
|
||||
return $item['gateway_type_id'] == '29';
|
||||
return $item['gateway_type_id'] == '29'; //PayPal advanced credit cards, needs to be excluded here
|
||||
});
|
||||
})->toArray();
|
||||
|
||||
|
@ -51,7 +51,7 @@ class AddGatewayFee extends AbstractService
|
||||
|
||||
$invoice_items = collect($invoice_items)->filter(function ($item) {
|
||||
return $item->type_id != '3';
|
||||
});
|
||||
})->toArray();
|
||||
|
||||
$this->invoice->line_items = $invoice_items;
|
||||
|
||||
@ -92,8 +92,6 @@ class AddGatewayFee extends AbstractService
|
||||
/**Refresh Invoice values*/
|
||||
$this->invoice = $this->invoice->calc()->getInvoice();
|
||||
|
||||
nlog($this->invoice->line_items);
|
||||
|
||||
$new_balance = $this->invoice->balance;
|
||||
|
||||
if (floatval($new_balance) - floatval($balance) != 0) {
|
||||
|
@ -444,14 +444,22 @@ class InvoiceService
|
||||
return $this;
|
||||
}
|
||||
|
||||
$pre_count = count($this->invoice->line_items);
|
||||
$pre_count = count((array)$this->invoice->line_items);
|
||||
|
||||
$items = collect($this->invoice->line_items)
|
||||
->reject(function ($item) {
|
||||
return $item->type_id == '3';
|
||||
// $items = collect((array)$this->invoice->line_items)
|
||||
// ->reject(function ($item) {
|
||||
// return $item->type_id == '3';
|
||||
// })->toArray();
|
||||
|
||||
|
||||
$items = collect((array)$this->invoice->line_items)
|
||||
->filter(function ($item) {
|
||||
return $item->type_id != '3';
|
||||
})->toArray();
|
||||
|
||||
$this->invoice->line_items = array_values($items);
|
||||
$this->invoice->line_items = $items;
|
||||
|
||||
// $this->invoice->line_items = array_values($items);
|
||||
|
||||
$this->invoice = $this->invoice->calc()->getInvoice();
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user