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