mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-07-09 03:14:30 -04:00
commit
0faeb63ba3
8
.github/workflows/phpunit.yml
vendored
8
.github/workflows/phpunit.yml
vendored
@ -12,8 +12,8 @@ jobs:
|
|||||||
runs-on: ${{ matrix.operating-system }}
|
runs-on: ${{ matrix.operating-system }}
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
operating-system: ['ubuntu-18.04', 'ubuntu-20.04']
|
operating-system: ['ubuntu-18.04', 'ubuntu-20.04', 'ubuntu-22.04']
|
||||||
php-versions: ['7.4','8.0','8.1']
|
php-versions: ['8.1']
|
||||||
phpunit-versions: ['latest']
|
phpunit-versions: ['latest']
|
||||||
|
|
||||||
env:
|
env:
|
||||||
@ -107,7 +107,3 @@ jobs:
|
|||||||
env:
|
env:
|
||||||
DB_PORT: ${{ job.services.mysql.ports[3306] }}
|
DB_PORT: ${{ job.services.mysql.ports[3306] }}
|
||||||
PHP_CS_FIXER_IGNORE_ENV: true
|
PHP_CS_FIXER_IGNORE_ENV: true
|
||||||
|
|
||||||
- name: Run php-cs-fixer
|
|
||||||
run: |
|
|
||||||
PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix
|
|
||||||
|
@ -40,7 +40,8 @@ class RecurringInvoicesCron
|
|||||||
public function handle() : void
|
public function handle() : void
|
||||||
{
|
{
|
||||||
/* Get all invoices where the send date is less than NOW + 30 minutes() */
|
/* Get all invoices where the send date is less than NOW + 30 minutes() */
|
||||||
nlog('Sending recurring invoices '.Carbon::now()->format('Y-m-d h:i:s'));
|
$start = Carbon::now()->format('Y-m-d h:i:s');
|
||||||
|
nlog('Sending recurring invoices '.$start);
|
||||||
|
|
||||||
if (! config('ninja.db.multi_db_enabled')) {
|
if (! config('ninja.db.multi_db_enabled')) {
|
||||||
$recurring_invoices = RecurringInvoice::where('next_send_date', '<=', now()->toDateTimeString())
|
$recurring_invoices = RecurringInvoice::where('next_send_date', '<=', now()->toDateTimeString())
|
||||||
@ -119,5 +120,8 @@ class RecurringInvoicesCron
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
nlog("Recurring invoice send duration " . $start . " - " . Carbon::now()->format('Y-m-d h:i:s'));
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -100,7 +100,7 @@ class NinjaMailerJob implements ShouldQueue
|
|||||||
$this->nmo->mailable->replyTo($this->company->owner()->email, $this->company->owner()->present()->name());
|
$this->nmo->mailable->replyTo($this->company->owner()->email, $this->company->owner()->present()->name());
|
||||||
}
|
}
|
||||||
|
|
||||||
// $this->nmo->mailable->tag($this->company->company_key);
|
$this->nmo->mailable->tag($this->company->company_key);
|
||||||
|
|
||||||
//send email
|
//send email
|
||||||
try {
|
try {
|
||||||
|
@ -41,7 +41,7 @@ class PaymentFailedMailer implements ShouldQueue
|
|||||||
|
|
||||||
public ?PaymentHash $payment_hash;
|
public ?PaymentHash $payment_hash;
|
||||||
|
|
||||||
public string $error;
|
public $error;
|
||||||
|
|
||||||
public Company $company;
|
public Company $company;
|
||||||
|
|
||||||
@ -55,7 +55,7 @@ class PaymentFailedMailer implements ShouldQueue
|
|||||||
* @param $company
|
* @param $company
|
||||||
* @param $amount
|
* @param $amount
|
||||||
*/
|
*/
|
||||||
public function __construct(?PaymentHash $payment_hash, Company $company, Client $client, string $error)
|
public function __construct(?PaymentHash $payment_hash, Company $company, Client $client, $error)
|
||||||
{
|
{
|
||||||
$this->payment_hash = $payment_hash;
|
$this->payment_hash = $payment_hash;
|
||||||
$this->client = $client;
|
$this->client = $client;
|
||||||
@ -70,6 +70,10 @@ class PaymentFailedMailer implements ShouldQueue
|
|||||||
*/
|
*/
|
||||||
public function handle()
|
public function handle()
|
||||||
{
|
{
|
||||||
|
if(!is_string($this->error)){
|
||||||
|
$this->error = "Payment failed, no reason given.";
|
||||||
|
}
|
||||||
|
|
||||||
//Set DB
|
//Set DB
|
||||||
MultiDB::setDb($this->company->db);
|
MultiDB::setDb($this->company->db);
|
||||||
App::setLocale($this->client->locale());
|
App::setLocale($this->client->locale());
|
||||||
|
@ -127,7 +127,7 @@ class SendRecurring implements ShouldQueue
|
|||||||
$invoice->invitations->each(function ($invitation) use ($invoice) {
|
$invoice->invitations->each(function ($invitation) use ($invoice) {
|
||||||
if ($invitation->contact && ! $invitation->contact->trashed() && strlen($invitation->contact->email) >= 1 && $invoice->client->getSetting('auto_email_invoice')) {
|
if ($invitation->contact && ! $invitation->contact->trashed() && strlen($invitation->contact->email) >= 1 && $invoice->client->getSetting('auto_email_invoice')) {
|
||||||
try {
|
try {
|
||||||
EmailEntity::dispatch($invitation, $invoice->company)->delay(10);
|
EmailEntity::dispatch($invitation, $invoice->company)->delay(rand(10,20));
|
||||||
} catch (\Exception $e) {
|
} catch (\Exception $e) {
|
||||||
nlog($e->getMessage());
|
nlog($e->getMessage());
|
||||||
}
|
}
|
||||||
@ -140,13 +140,13 @@ class SendRecurring implements ShouldQueue
|
|||||||
if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $invoice->auto_bill_enabled) {
|
if ($invoice->client->getSetting('auto_bill_date') == 'on_send_date' && $invoice->auto_bill_enabled) {
|
||||||
nlog("attempting to autobill {$invoice->number}");
|
nlog("attempting to autobill {$invoice->number}");
|
||||||
// $invoice->service()->autoBill();
|
// $invoice->service()->autoBill();
|
||||||
AutoBill::dispatch($invoice, $this->db)->delay(20);
|
AutoBill::dispatch($invoice, $this->db)->delay(rand(30,40));
|
||||||
|
|
||||||
} elseif ($invoice->client->getSetting('auto_bill_date') == 'on_due_date' && $invoice->auto_bill_enabled) {
|
} elseif ($invoice->client->getSetting('auto_bill_date') == 'on_due_date' && $invoice->auto_bill_enabled) {
|
||||||
if ($invoice->due_date && Carbon::parse($invoice->due_date)->startOfDay()->lte(now()->startOfDay())) {
|
if ($invoice->due_date && Carbon::parse($invoice->due_date)->startOfDay()->lte(now()->startOfDay())) {
|
||||||
nlog("attempting to autobill {$invoice->number}");
|
nlog("attempting to autobill {$invoice->number}");
|
||||||
// $invoice->service()->autoBill();
|
// $invoice->service()->autoBill();
|
||||||
AutoBill::dispatch($invoice, $this->db)->delay(20);
|
AutoBill::dispatch($invoice, $this->db)->delay(rand(30,40));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,12 +96,9 @@ class InvoiceEmailEngine extends BaseEmailEngine
|
|||||||
|
|
||||||
if (is_array($this->template_data) && array_key_exists('subject', $this->template_data) && strlen($this->template_data['subject']) > 0) {
|
if (is_array($this->template_data) && array_key_exists('subject', $this->template_data) && strlen($this->template_data['subject']) > 0) {
|
||||||
$subject_template = $this->template_data['subject'];
|
$subject_template = $this->template_data['subject'];
|
||||||
nlog('subject = template data');
|
|
||||||
} elseif (strlen($this->client->getSetting('email_subject_'.$this->reminder_template)) > 0) {
|
} elseif (strlen($this->client->getSetting('email_subject_'.$this->reminder_template)) > 0) {
|
||||||
$subject_template = $this->client->getSetting('email_subject_'.$this->reminder_template);
|
$subject_template = $this->client->getSetting('email_subject_'.$this->reminder_template);
|
||||||
nlog('subject = settings var');
|
|
||||||
} else {
|
} else {
|
||||||
nlog('subject = default template '.'email_subject_'.$this->reminder_template);
|
|
||||||
$subject_template = EmailTemplateDefaults::getDefaultTemplate('email_subject_'.$this->reminder_template, $this->client->locale());
|
$subject_template = EmailTemplateDefaults::getDefaultTemplate('email_subject_'.$this->reminder_template, $this->client->locale());
|
||||||
// $subject_template = $this->client->getSetting('email_subject_'.$this->reminder_template);
|
// $subject_template = $this->client->getSetting('email_subject_'.$this->reminder_template);
|
||||||
}
|
}
|
||||||
|
@ -115,12 +115,12 @@ class TemplateEmail extends Mailable
|
|||||||
'company' => $company,
|
'company' => $company,
|
||||||
'whitelabel' => $this->client->user->account->isPaid() ? true : false,
|
'whitelabel' => $this->client->user->account->isPaid() ? true : false,
|
||||||
'logo' => $this->company->present()->logo($settings),
|
'logo' => $this->company->present()->logo($settings),
|
||||||
])
|
]);
|
||||||
->withSymfonyMessage(function ($message) use ($company) {
|
// ->withSymfonyMessage(function ($message) use ($company) {
|
||||||
$message->getHeaders()->addTextHeader('Tag', $company->company_key);
|
// $message->getHeaders()->addTextHeader('Tag', $company->company_key);
|
||||||
$message->invitation = $this->invitation;
|
// $message->invitation = $this->invitation;
|
||||||
})
|
//});
|
||||||
->tag($company->company_key);
|
// ->tag($company->company_key);
|
||||||
|
|
||||||
/*In the hosted platform we need to slow things down a little for Storage to catch up.*/
|
/*In the hosted platform we need to slow things down a little for Storage to catch up.*/
|
||||||
|
|
||||||
|
@ -109,12 +109,12 @@ class VendorTemplateEmail extends Mailable
|
|||||||
'company' => $this->company,
|
'company' => $this->company,
|
||||||
'whitelabel' => $this->vendor->user->account->isPaid() ? true : false,
|
'whitelabel' => $this->vendor->user->account->isPaid() ? true : false,
|
||||||
'logo' => $this->company->present()->logo($settings),
|
'logo' => $this->company->present()->logo($settings),
|
||||||
])
|
]);
|
||||||
->withSymfonyMessage(function ($message) {
|
//->withSymfonyMessage(function ($message) {
|
||||||
$message->getHeaders()->addTextHeader('Tag', $this->company->company_key);
|
// $message->getHeaders()->addTextHeader('Tag', $this->company->company_key);
|
||||||
$message->invitation = $this->invitation;
|
// $message->invitation = $this->invitation;
|
||||||
})
|
//});
|
||||||
->tag($this->company->company_key);
|
// ->tag($this->company->company_key);
|
||||||
|
|
||||||
if(Ninja::isHosted() && $this->invitation){
|
if(Ninja::isHosted() && $this->invitation){
|
||||||
|
|
||||||
|
@ -431,6 +431,10 @@ class BaseDriver extends AbstractPaymentDriver
|
|||||||
|
|
||||||
public function sendFailureMail($error)
|
public function sendFailureMail($error)
|
||||||
{
|
{
|
||||||
|
if(is_object($error)){
|
||||||
|
$error = 'Payment Aborted';
|
||||||
|
}
|
||||||
|
|
||||||
if (! is_null($this->payment_hash)) {
|
if (! is_null($this->payment_hash)) {
|
||||||
$this->unWindGatewayFees($this->payment_hash);
|
$this->unWindGatewayFees($this->payment_hash);
|
||||||
}
|
}
|
||||||
|
@ -156,7 +156,6 @@ class CreditCard
|
|||||||
'zip' => $this->paytrace->client->postal_code,
|
'zip' => $this->paytrace->client->postal_code,
|
||||||
];
|
];
|
||||||
|
|
||||||
nlog($data);
|
|
||||||
}
|
}
|
||||||
|
|
||||||
public function paymentView($data)
|
public function paymentView($data)
|
||||||
|
@ -89,15 +89,11 @@ class PaytracePaymentDriver extends BaseDriver
|
|||||||
|
|
||||||
public function refund(Payment $payment, $amount, $return_client_response = false)
|
public function refund(Payment $payment, $amount, $return_client_response = false)
|
||||||
{
|
{
|
||||||
// $cgt = ClientGatewayToken::where('company_gateway_id', $payment->company_gateway_id)
|
|
||||||
// ->where('gateway_type_id', $payment->gateway_type_id)
|
|
||||||
// ->first();
|
|
||||||
|
|
||||||
$data = [
|
$data = [
|
||||||
'amount' => $amount,
|
'amount' => $amount,
|
||||||
//'customer_id' => $cgt->token,
|
|
||||||
'transaction_id' => $payment->transaction_reference,
|
'transaction_id' => $payment->transaction_reference,
|
||||||
'integrator_id' => '959195xd1CuC',
|
'integrator_id' => $this->company_gateway->getConfigField('integratorId'),
|
||||||
];
|
];
|
||||||
|
|
||||||
$response = $this->gatewayRequest('/v1/transactions/refund/for_transaction', $data);
|
$response = $this->gatewayRequest('/v1/transactions/refund/for_transaction', $data);
|
||||||
|
@ -167,6 +167,17 @@ class CreditCard
|
|||||||
$this->stripe->client->company,
|
$this->stripe->client->company,
|
||||||
);
|
);
|
||||||
|
|
||||||
|
//If the user has come from a subscription double check here if we need to redirect.
|
||||||
|
//08-08-2022
|
||||||
|
if($payment->invoices()->whereHas('subscription')->exists()){
|
||||||
|
$subscription = $payment->invoices()->first()->subscription;
|
||||||
|
|
||||||
|
if($subscription && array_key_exists('return_url', $subscription->webhook_configuration) && strlen($subscription->webhook_configuration['return_url']) >=1)
|
||||||
|
return redirect($subscription->webhook_configuration['return_url']);
|
||||||
|
|
||||||
|
}
|
||||||
|
//08-08-2022
|
||||||
|
|
||||||
return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]);
|
return redirect()->route('client.payments.show', ['payment' => $this->stripe->encodePrimaryKey($payment->id)]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user