mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
2c86fcb8b7
@ -54,4 +54,22 @@ class EmailFailure
|
||||
* @var string
|
||||
*/
|
||||
public $string_metric6 = '';
|
||||
|
||||
/**
|
||||
* The counter
|
||||
* set to 1.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $int_metric1 = 1;
|
||||
|
||||
/**
|
||||
* Company Key
|
||||
* @var string
|
||||
*/
|
||||
public $string_metric7 = '';
|
||||
|
||||
public function __construct($string_metric7) {
|
||||
$this->string_metric7 = $string_metric7;
|
||||
}
|
||||
}
|
||||
|
76
app/DataMapper/Analytics/EmailSuccess.php
Normal file
76
app/DataMapper/Analytics/EmailSuccess.php
Normal file
@ -0,0 +1,76 @@
|
||||
<?php
|
||||
/**
|
||||
* Invoice Ninja (https://invoiceninja.com).
|
||||
*
|
||||
* @link https://github.com/invoiceninja/invoiceninja source repository
|
||||
*
|
||||
* @copyright Copyright (c) 2021. Invoice Ninja LLC (https://invoiceninja.com)
|
||||
*
|
||||
* @license https://opensource.org/licenses/AAL
|
||||
*/
|
||||
|
||||
namespace App\DataMapper\Analytics;
|
||||
|
||||
class EmailSuccess
|
||||
{
|
||||
|
||||
/**
|
||||
* The type of Sample.
|
||||
*
|
||||
* Monotonically incrementing counter
|
||||
*
|
||||
* - counter
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $type = 'mixed_metric';
|
||||
|
||||
/**
|
||||
* The name of the counter.
|
||||
* @var string
|
||||
*/
|
||||
public $name = 'job.success.email';
|
||||
|
||||
/**
|
||||
* The datetime of the counter measurement.
|
||||
*
|
||||
* date("Y-m-d H:i:s")
|
||||
*
|
||||
* @var DateTime
|
||||
*/
|
||||
public $datetime;
|
||||
|
||||
/**
|
||||
* The Class failure name
|
||||
* set to 0.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $string_metric5 = '';
|
||||
|
||||
/**
|
||||
* The exception string
|
||||
* set to 0.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $string_metric6 = '';
|
||||
|
||||
/**
|
||||
* The counter
|
||||
* set to 1.
|
||||
*
|
||||
* @var string
|
||||
*/
|
||||
public $int_metric1 = 1;
|
||||
|
||||
/**
|
||||
* Company Key
|
||||
* @var string
|
||||
*/
|
||||
public $string_metric7 = '';
|
||||
|
||||
public function __construct($string_metric7) {
|
||||
$this->string_metric7 = $string_metric7;
|
||||
}
|
||||
}
|
@ -12,6 +12,7 @@
|
||||
namespace App\Jobs\Mail;
|
||||
|
||||
use App\DataMapper\Analytics\EmailFailure;
|
||||
use App\DataMapper\Analytics\EmailSuccess;
|
||||
use App\Events\Invoice\InvoiceWasEmailedAndFailed;
|
||||
use App\Events\Payment\PaymentWasEmailedAndFailed;
|
||||
use App\Jobs\Mail\NinjaMailerObject;
|
||||
@ -180,6 +181,8 @@ class NinjaMailerJob implements ShouldQueue
|
||||
$message->getHeaders()->addTextHeader('GmailToken', $token);
|
||||
});
|
||||
|
||||
LightLogs::create(new EmailSuccess($this->nmo->company_key->company_key))
|
||||
->batch();
|
||||
}
|
||||
|
||||
private function logMailError($errors, $recipient_object)
|
||||
@ -198,7 +201,7 @@ class NinjaMailerJob implements ShouldQueue
|
||||
nlog('mailer job failed');
|
||||
nlog($exception->getMessage());
|
||||
|
||||
$job_failure = new EmailFailure();
|
||||
$job_failure = new EmailFailure($this->nmo->company->company_key);
|
||||
$job_failure->string_metric5 = get_parent_class($this);
|
||||
$job_failure->string_metric6 = $exception->getMessage();
|
||||
|
||||
|
@ -269,15 +269,37 @@ class CompanyGateway extends BaseModel
|
||||
*/
|
||||
public function calcGatewayFeeLabel($amount, Client $client, $gateway_type_id = GatewayType::CREDIT_CARD) :string
|
||||
{
|
||||
$label = '';
|
||||
$label = ' ';
|
||||
|
||||
$fee = $this->calcGatewayFee($amount, $gateway_type_id);
|
||||
|
||||
if ($fee > 0) {
|
||||
$fee = Number::formatMoney(round($fee, 2), $client);
|
||||
$label = ' - '.$fee.' '.ctrans('texts.fee');
|
||||
// if ($fee > 0) {
|
||||
// $fee = Number::formatMoney(round($fee, 2), $client);
|
||||
// $label = ' - '.$fee.' '.ctrans('texts.fee');
|
||||
// }
|
||||
|
||||
if($fee > 0) {
|
||||
|
||||
$fees_and_limits = $this->fees_and_limits->{$gateway_type_id};
|
||||
|
||||
if(strlen($fees_and_limits->fee_percent) >=1)
|
||||
$label .= $fees_and_limits->fee_percent . '%';
|
||||
|
||||
if(strlen($fees_and_limits->fee_amount) >=1){
|
||||
|
||||
if(strlen($label) > 1) {
|
||||
|
||||
$label .= ' + ' . Number::formatMoney($fees_and_limits->fee_amount, $client);
|
||||
|
||||
}else {
|
||||
$label .= Number::formatMoney($fees_and_limits->fee_amount, $client);
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
}
|
||||
|
||||
|
||||
return $label;
|
||||
}
|
||||
|
||||
|
@ -271,7 +271,7 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
|
||||
$invoices->each(function ($invoice) use ($fee_total) {
|
||||
if (collect($invoice->line_items)->contains('type_id', '3')) {
|
||||
$invoice->service()->toggleFeesPaid()->save();
|
||||
$invoice->service()->toggleFeesPaid()->deletePdf()->save();
|
||||
$invoice->client->service()->updateBalance($fee_total)->save();
|
||||
$invoice->ledger()->updateInvoiceBalance($fee_total, "Gateway fee adjustment for invoice {$invoice->number}");
|
||||
}
|
||||
@ -370,6 +370,12 @@ class BaseDriver extends AbstractPaymentDriver
|
||||
|
||||
$invoices = Invoice::whereIn('id', $this->transformKeys(array_column($this->payment_hash->invoices(), 'invoice_id')))->get();
|
||||
|
||||
$invoices->each(function ($invoice){
|
||||
|
||||
$invoice->service()->deletePdf();
|
||||
|
||||
});
|
||||
|
||||
$invoices->first()->invitations->each(function ($invitation) use ($nmo){
|
||||
|
||||
if ($invitation->contact->send_email && $invitation->contact->email) {
|
||||
|
Loading…
x
Reference in New Issue
Block a user