mirror of
https://github.com/invoiceninja/invoiceninja.git
synced 2025-05-24 02:14:21 -04:00
Dynamically apply the mailgun endpoint
This commit is contained in:
parent
c6f7d14096
commit
a5fc80f408
@ -449,6 +449,8 @@ class CompanySettings extends BaseSettings
|
||||
|
||||
public $mailgun_domain = '';
|
||||
|
||||
public $mailgun_endpoint = 'api.mailgun.net'; //api.eu.mailgun.net
|
||||
|
||||
public $auto_bill_standard_invoices = false;
|
||||
|
||||
public $email_alignment = 'center'; // center , left, right
|
||||
@ -476,6 +478,7 @@ class CompanySettings extends BaseSettings
|
||||
public $sync_invoice_quote_columns = true;
|
||||
|
||||
public static $casts = [
|
||||
'mailgun_endpoint' => 'string',
|
||||
// 'client_initiated_payments_recurring'=> 'bool',
|
||||
'client_initiated_payments' => 'bool',
|
||||
'client_initiated_payments_minimum' => 'float',
|
||||
|
@ -128,7 +128,13 @@ class NinjaMailerJob implements ShouldQueue
|
||||
}
|
||||
|
||||
if ($this->client_mailgun_secret) {
|
||||
$mailer->mailgun_config($this->client_mailgun_secret, $this->client_mailgun_domain);
|
||||
|
||||
$endpoint = 'api.mailgun.net';
|
||||
|
||||
if(strpos($this->client_mailgun_secret, 'key') !== false)
|
||||
$endpoint = 'api.eu.mailgun.net';
|
||||
|
||||
$mailer->mailgun_config($this->client_mailgun_secret, $this->client_mailgun_domain, $endpoint);
|
||||
}
|
||||
|
||||
$mailer
|
||||
|
@ -101,12 +101,12 @@ class AppServiceProvider extends ServiceProvider
|
||||
return $this;
|
||||
});
|
||||
|
||||
Mailer::macro('mailgun_config', function (string $secret, string $domain) {
|
||||
Mailer::macro('mailgun_config', function (string $secret, string $domain, string $endpoint = 'api.mailgun.net') {
|
||||
Mailer::setSymfonyTransport(app('mail.manager')->createSymfonyTransport([
|
||||
'transport' => 'mailgun',
|
||||
'secret' => $secret,
|
||||
'domain' => $domain,
|
||||
'endpoint' => config('services.mailgun.endpoint'),
|
||||
'endpoint' => $endpoint,
|
||||
'scheme' => config('services.mailgun.scheme'),
|
||||
]));
|
||||
|
||||
@ -115,7 +115,6 @@ class AppServiceProvider extends ServiceProvider
|
||||
|
||||
/* Extension for custom mailers */
|
||||
|
||||
|
||||
/* Convenience helper for testing s*/
|
||||
ParallelTesting::setUpTestDatabase(function ($database, $token) {
|
||||
Artisan::call('db:seed');
|
||||
|
@ -233,7 +233,14 @@ class Email implements ShouldQueue
|
||||
}
|
||||
|
||||
if ($this->client_mailgun_secret) {
|
||||
$mailer->mailgun_config($this->client_mailgun_secret, $this->client_mailgun_domain);
|
||||
|
||||
$endpoint = 'api.mailgun.net';
|
||||
|
||||
if (strpos($this->client_mailgun_secret, 'key') !== false) {
|
||||
$endpoint = 'api.eu.mailgun.net';
|
||||
}
|
||||
|
||||
$mailer->mailgun_config($this->client_mailgun_secret, $this->client_mailgun_domain, $endpoint);
|
||||
}
|
||||
|
||||
/* Attempt the send! */
|
||||
|
@ -8776,7 +8776,7 @@ paths:
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
_method:
|
||||
type: string
|
||||
example: POST
|
||||
@ -12386,10 +12386,7 @@ paths:
|
||||
Archives the recurring invoice. The recurring invoice will not fire in this state.
|
||||
- `delete`
|
||||
Deletes a recurring invoice.
|
||||
|
||||
required: true
|
||||
ids:
|
||||
required: true
|
||||
type: array
|
||||
items:
|
||||
description: "Array of hashed IDs to be bulk 'actioned - ['D2J234DFA','D2J234DFA','D2J234DFA']"
|
||||
@ -13015,7 +13012,7 @@ components:
|
||||
name: include
|
||||
in: query
|
||||
description: Include child relations of the BankIntegration object. Format is comma separated.
|
||||
require: false
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
examples:
|
||||
|
@ -36,7 +36,7 @@
|
||||
name: include
|
||||
in: query
|
||||
description: Include child relations of the BankIntegration object. Format is comma separated.
|
||||
require: false
|
||||
required: false
|
||||
schema:
|
||||
type: string
|
||||
examples:
|
||||
|
@ -390,7 +390,7 @@
|
||||
multipart/form-data:
|
||||
schema:
|
||||
type: object
|
||||
properties:
|
||||
items:
|
||||
_method:
|
||||
type: string
|
||||
example: POST
|
||||
|
@ -333,10 +333,7 @@
|
||||
Archives the recurring invoice. The recurring invoice will not fire in this state.
|
||||
- `delete`
|
||||
Deletes a recurring invoice.
|
||||
|
||||
required: true
|
||||
ids:
|
||||
required: true
|
||||
type: array
|
||||
items:
|
||||
description: "Array of hashed IDs to be bulk 'actioned - ['D2J234DFA','D2J234DFA','D2J234DFA']"
|
||||
|
Loading…
x
Reference in New Issue
Block a user