mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-07 18:27:16 -04:00
Merge pull request #6835 from turbo124/v5-develop
Fixes for statements.
This commit is contained in:
commit
9e69752971
@ -62,7 +62,7 @@ class ClientPaymentFailureObject
|
|||||||
/* Init a new copy of the translator*/
|
/* Init a new copy of the translator*/
|
||||||
$t = app('translator');
|
$t = app('translator');
|
||||||
/* Set the locale*/
|
/* Set the locale*/
|
||||||
App::setLocale($this->company->getLocale());
|
App::setLocale($this->client->locale());
|
||||||
/* Set customized translations _NOW_ */
|
/* Set customized translations _NOW_ */
|
||||||
$t->replace(Ninja::transformTranslations($this->company->settings));
|
$t->replace(Ninja::transformTranslations($this->company->settings));
|
||||||
|
|
||||||
|
@ -378,12 +378,30 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
$this->payment_hash
|
$this->payment_hash
|
||||||
);
|
);
|
||||||
|
|
||||||
if (!is_null($this->payment_hash)) {
|
SystemLogger::dispatch(
|
||||||
|
$gateway->payment_hash,
|
||||||
|
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
||||||
|
SystemLog::EVENT_GATEWAY_ERROR,
|
||||||
|
$gateway::SYSTEM_LOG_TYPE,
|
||||||
|
$gateway->client,
|
||||||
|
$gateway->client->company,
|
||||||
|
);
|
||||||
|
|
||||||
|
throw new PaymentFailed($error, $e->getCode());
|
||||||
|
}
|
||||||
|
|
||||||
|
public function clientPaymentFailureMailer($error)
|
||||||
|
{
|
||||||
|
nlog("outside");
|
||||||
|
|
||||||
|
if ($this->payment_hash && is_array($this->payment_hash->invoices())) {
|
||||||
|
|
||||||
|
nlog("inside");
|
||||||
|
|
||||||
$nmo = new NinjaMailerObject;
|
$nmo = new NinjaMailerObject;
|
||||||
$nmo->mailable = new NinjaMailer((new ClientPaymentFailureObject($gateway->client, $error, $gateway->client->company, $this->payment_hash))->build());
|
$nmo->mailable = new NinjaMailer((new ClientPaymentFailureObject($this->client, $error, $this->client->company, $this->payment_hash))->build());
|
||||||
$nmo->company = $gateway->client->company;
|
$nmo->company = $this->client->company;
|
||||||
$nmo->settings = $gateway->client->company->settings;
|
$nmo->settings = $this->client->company->settings;
|
||||||
|
|
||||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->withTrashed()->get();
|
||||||
|
|
||||||
@ -405,16 +423,6 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
|
|
||||||
}
|
}
|
||||||
|
|
||||||
SystemLogger::dispatch(
|
|
||||||
$gateway->payment_hash,
|
|
||||||
SystemLog::CATEGORY_GATEWAY_RESPONSE,
|
|
||||||
SystemLog::EVENT_GATEWAY_ERROR,
|
|
||||||
$gateway::SYSTEM_LOG_TYPE,
|
|
||||||
$gateway->client,
|
|
||||||
$gateway->client->company,
|
|
||||||
);
|
|
||||||
|
|
||||||
throw new PaymentFailed($error, $e->getCode());
|
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -176,6 +176,8 @@ class CreditCard
|
|||||||
|
|
||||||
PaymentFailureMailer::dispatch($this->checkout->client, $response->response_summary, $this->checkout->client->company, $this->checkout->payment_hash->data->value);
|
PaymentFailureMailer::dispatch($this->checkout->client, $response->response_summary, $this->checkout->client->company, $this->checkout->payment_hash->data->value);
|
||||||
|
|
||||||
|
$this->checkout->clientPaymentFailureMailer($response->status);
|
||||||
|
|
||||||
return $this->processUnsuccessfulPayment($response);
|
return $this->processUnsuccessfulPayment($response);
|
||||||
}
|
}
|
||||||
} catch (CheckoutHttpException $e) {
|
} catch (CheckoutHttpException $e) {
|
||||||
|
@ -219,7 +219,9 @@ class Statement
|
|||||||
*/
|
*/
|
||||||
protected function getInvoices(): Collection
|
protected function getInvoices(): Collection
|
||||||
{
|
{
|
||||||
return Invoice::where('company_id', $this->client->company_id)
|
return Invoice::withTrashed()
|
||||||
|
->where('is_deleted', false)
|
||||||
|
->where('company_id', $this->client->company_id)
|
||||||
->where('client_id', $this->client->id)
|
->where('client_id', $this->client->id)
|
||||||
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL, Invoice::STATUS_PAID])
|
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL, Invoice::STATUS_PAID])
|
||||||
->whereBetween('date', [$this->options['start_date'], $this->options['end_date']])
|
->whereBetween('date', [$this->options['start_date'], $this->options['end_date']])
|
||||||
@ -234,7 +236,9 @@ class Statement
|
|||||||
*/
|
*/
|
||||||
protected function getPayments(): Collection
|
protected function getPayments(): Collection
|
||||||
{
|
{
|
||||||
return Payment::with('client.country','invoices')
|
return Payment::withTrashed()
|
||||||
|
->with('client.country','invoices')
|
||||||
|
->where('is_deleted', false)
|
||||||
->where('company_id', $this->client->company_id)
|
->where('company_id', $this->client->company_id)
|
||||||
->where('client_id', $this->client->id)
|
->where('client_id', $this->client->id)
|
||||||
->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment::STATUS_PARTIALLY_REFUNDED, Payment::STATUS_REFUNDED])
|
->whereIn('status_id', [Payment::STATUS_COMPLETED, Payment::STATUS_PARTIALLY_REFUNDED, Payment::STATUS_REFUNDED])
|
||||||
@ -286,7 +290,8 @@ class Statement
|
|||||||
$from = $ranges[0];
|
$from = $ranges[0];
|
||||||
$to = $ranges[1];
|
$to = $ranges[1];
|
||||||
|
|
||||||
$amount = Invoice::where('client_id', $this->client->id)
|
$amount = Invoice::withTrashed()
|
||||||
|
->where('client_id', $this->client->id)
|
||||||
->where('company_id', $this->client->company_id)
|
->where('company_id', $this->client->company_id)
|
||||||
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
|
->whereIn('status_id', [Invoice::STATUS_SENT, Invoice::STATUS_PARTIAL])
|
||||||
->where('balance', '>', 0)
|
->where('balance', '>', 0)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user