Code Coverage |
||||||||||
Lines |
Functions and Methods |
Classes and Traits |
||||||||
| Total | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
CRAP | |
0.00% |
0 / 1 |
| Messages | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
2 | |
0.00% |
0 / 1 |
| install | |
0.00% |
0 / 15 |
|
0.00% |
0 / 1 |
2 | |||
| 1 | <?php |
| 2 | /** |
| 3 | * Jingga |
| 4 | * |
| 5 | * PHP Version 8.1 |
| 6 | * |
| 7 | * @package Modules\Billing\Admin\Install |
| 8 | * @copyright Dennis Eichhorn |
| 9 | * @license OMS License 2.0 |
| 10 | * @version 1.0.0 |
| 11 | * @link https://jingga.app |
| 12 | */ |
| 13 | declare(strict_types=1); |
| 14 | |
| 15 | namespace Modules\Billing\Admin\Install; |
| 16 | |
| 17 | use Modules\Billing\Models\SettingsEnum; |
| 18 | use phpOMS\Application\ApplicationAbstract; |
| 19 | use phpOMS\Message\Http\HttpRequest; |
| 20 | use phpOMS\Message\Http\HttpResponse; |
| 21 | use phpOMS\Uri\HttpUri; |
| 22 | |
| 23 | /** |
| 24 | * Media class. |
| 25 | * |
| 26 | * @package Modules\Billing\Admin\Install |
| 27 | * @license OMS License 2.0 |
| 28 | * @link https://jingga.app |
| 29 | * @since 1.0.0 |
| 30 | */ |
| 31 | class Messages |
| 32 | { |
| 33 | /** |
| 34 | * Install media providing |
| 35 | * |
| 36 | * @param ApplicationAbstract $app Application |
| 37 | * @param string $path Module path |
| 38 | * |
| 39 | * @return void |
| 40 | * |
| 41 | * @since 1.0.0 |
| 42 | */ |
| 43 | public static function install(ApplicationAbstract $app, string $path) : void |
| 44 | { |
| 45 | $messages = \Modules\Messages\Admin\Installer::installExternal($app, ['path' => __DIR__ . '/Messages.install.json']); |
| 46 | |
| 47 | /** @var \Modules\Admin\Controller\ApiController $module */ |
| 48 | $module = $app->moduleManager->get('Admin'); |
| 49 | |
| 50 | $settings = [ |
| 51 | [ |
| 52 | 'id' => null, |
| 53 | 'name' => SettingsEnum::BILLING_CUSTOMER_EMAIL_TEMPLATE, |
| 54 | 'content' => (string) $messages['email_template'][0]['id'], |
| 55 | 'module' => 'Billing', |
| 56 | ], |
| 57 | ]; |
| 58 | |
| 59 | $response = new HttpResponse(); |
| 60 | $request = new HttpRequest(new HttpUri('')); |
| 61 | |
| 62 | $request->header->account = 1; |
| 63 | $request->setData('settings', \json_encode($settings)); |
| 64 | |
| 65 | $module->apiSettingsSet($request, $response); |
| 66 | } |
| 67 | } |