diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index 54a8d00c..e6cb6432 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -13,4 +13,6 @@ jobs: composer_require_extra: phpunit/phpunit:^9.5 silverstripe/silverstripe-omnipay:dev-main - php-http/discovery:^1.18.1 + php-http/discovery:^1.19.4 + symfony/http-foundation:^6.4.4 + moneyphp/money:^4.5.0 diff --git a/example_config.yml b/example_config.yml index d819e75d..6a122138 100644 --- a/example_config.yml +++ b/example_config.yml @@ -6,6 +6,12 @@ SilverShop\Checkout\CheckoutConfig: member_creation_enabled: true membership_required: true +# Send a bcc copy of order & status change emails to the administrator +SilverShop\Checkout\OrderEmailNotifier: + bcc_confirmation_to_admin: true + bcc_receipt_to_admin: true + bcc_status_change_to_admin: true + SilverStripe\Control\Email\Email: admin_email: example@example.com diff --git a/src/Checkout/OrderEmailNotifier.php b/src/Checkout/OrderEmailNotifier.php index 2c307792..be228aba 100644 --- a/src/Checkout/OrderEmailNotifier.php +++ b/src/Checkout/OrderEmailNotifier.php @@ -23,13 +23,34 @@ class OrderEmailNotifier use Injectable; use Configurable; + /** + * bcc Confirmation Emails to Admin + * + * @var boolean + */ + private static $bcc_confirmation_to_admin = false; + + /** + * bcc Receipt Emails to Admin + * + * @var boolean + */ + private static $bcc_receipt_to_admin = false; + + /** + * bcc Status Change Emails to Admin + * + * @var boolean + */ + private static $bcc_status_change_to_admin = false; + /** * @var Order $order */ protected $order; /** - * @var bool + * @var boolean */ protected $debugMode = false; @@ -244,6 +265,10 @@ public function sendStatusChange($title, $note = null) ] ); + if (self::config()->bcc_status_change_to_admin) { + $email->setBcc(Email::config()->admin_email); + } + if ($this->debugMode) { $result = $this->debug($email); } else {