mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2024-11-10 13:12:50 +01:00
Fixes for invoices which are not payable if archived
This commit is contained in:
parent
48c5c56a4a
commit
a8d148b0dc
@ -283,7 +283,7 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
$fee_total = $this->payment_hash->fee_total;
|
||||
|
||||
/*Hydrate invoices*/
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_invoices, 'invoice_id')))->get();
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_invoices, 'invoice_id')))->withTrashed()->get();
|
||||
|
||||
$invoices->each(function ($invoice) use ($fee_total) {
|
||||
if (collect($invoice->line_items)->contains('type_id', '3')) {
|
||||
@ -303,7 +303,7 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
*/
|
||||
public function unWindGatewayFees(PaymentHash $payment_hash)
|
||||
{
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->get();
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
||||
|
||||
$invoices->each(function ($invoice) {
|
||||
$invoice->service()->removeUnpaidGatewayFees();
|
||||
@ -384,7 +384,7 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
$nmo->company = $gateway->client->company;
|
||||
$nmo->settings = $gateway->client->company->settings;
|
||||
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->get();
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
||||
|
||||
$invoices->each(function ($invoice){
|
||||
|
||||
|
@ -271,7 +271,7 @@ class BasePaymentDriver
|
||||
public function attachInvoices(Payment $payment, PaymentHash $payment_hash): Payment
|
||||
{
|
||||
$paid_invoices = $payment_hash->invoices();
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($paid_invoices, 'invoice_id')))->get();
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($paid_invoices, 'invoice_id')))->withTrashed()->get();
|
||||
$payment->invoices()->sync($invoices);
|
||||
$payment->save();
|
||||
|
||||
@ -300,7 +300,7 @@ class BasePaymentDriver
|
||||
// $invoice_totals = array_sum(array_column($payment_invoices,'amount'));
|
||||
|
||||
/*Hydrate invoices*/
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_invoices, 'invoice_id')))->get();
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($payment_invoices, 'invoice_id')))->withTrashed()->get();
|
||||
|
||||
$invoices->each(function ($invoice) use ($fee_total) {
|
||||
if (collect($invoice->line_items)->contains('type_id', '3')) {
|
||||
|
@ -149,7 +149,7 @@ class BraintreePaymentDriver extends BaseDriver
|
||||
{
|
||||
$amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total;
|
||||
|
||||
$invoice = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->first();
|
||||
$invoice = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->withTrashed()->first();
|
||||
|
||||
if ($invoice) {
|
||||
$description = "Invoice {$invoice->number} for {$amount} for client {$this->client->present()->name()}";
|
||||
|
@ -198,7 +198,7 @@ class CheckoutComPaymentDriver extends BaseDriver
|
||||
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
|
||||
{
|
||||
$amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total;
|
||||
$invoice = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->first();
|
||||
$invoice = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->withTrashed()->first();
|
||||
|
||||
if ($invoice) {
|
||||
$description = "Invoice {$invoice->number} for {$amount} for client {$this->client->present()->name()}";
|
||||
|
@ -61,7 +61,7 @@ class CustomPaymentDriver extends BaseDriver
|
||||
|
||||
if (count($this->payment_hash->invoices()) > 0) {
|
||||
$invoice_id = $this->decodePrimaryKey($this->payment_hash->invoices()[0]->invoice_id);
|
||||
$invoice = Invoice::findOrFail($invoice_id);
|
||||
$invoice = Invoice::withTrashed()->find($invoice_id);
|
||||
|
||||
$variables = (new HtmlEngine($invoice->invitations->first()))->generateLabelsAndValues();
|
||||
}
|
||||
|
@ -199,7 +199,7 @@ class PayPalExpressPaymentDriver extends BaseDriver
|
||||
{
|
||||
|
||||
$_invoice = collect($this->payment_hash->data->invoices)->first();
|
||||
$invoice = Invoice::findOrFail($this->decodePrimaryKey($_invoice->invoice_id));
|
||||
$invoice = Invoice::withTrashed()->find($this->decodePrimaryKey($_invoice->invoice_id));
|
||||
|
||||
$line_item = collect($invoice->line_items)->first();
|
||||
|
||||
|
@ -52,7 +52,7 @@ class Charge
|
||||
public function tokenBilling(ClientGatewayToken $cgt, PaymentHash $payment_hash)
|
||||
{
|
||||
$amount = array_sum(array_column($payment_hash->invoices(), 'amount')) + $payment_hash->fee_total;
|
||||
$invoice = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->first();
|
||||
$invoice = Invoice::whereIn('id', $this->transformKeys(array_column($payment_hash->invoices(), 'invoice_id')))->withTrashed()->first();
|
||||
|
||||
if ($invoice) {
|
||||
$description = "Invoice {$invoice->number} for {$amount} for client {$this->stripe->client->present()->name()}";
|
||||
|
Loading…
Reference in New Issue
Block a user