Paket 1: eine aktive Angebotsfassung und Bestellbezeichnung
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
1 parent
8cd382c357
commit
7820bececb
13 files changed
+529
-25
No files matched your search
@@ -0,0 +1,47 @@
|
||||
<?php
|
||||
|
||||
declare(strict_types=1);
|
||||
|
||||
use App\Domain\Catalog\LicenseArticle;
|
||||
use App\Domain\Catalog\Offer;
|
||||
use App\Domain\Catalog\OfferService;
|
||||
use App\Domain\Catalog\RightsProfileVersion;
|
||||
use Illuminate\Contracts\Console\Kernel;
|
||||
|
||||
if ($argc < 7) {
|
||||
fwrite(STDERR, "Aufruf: offer_activate_worker.php <db-pfad> <offer-id> <artikel-id> <rechte-id> <preis-cents> <delay-ms>\n");
|
||||
exit(2);
|
||||
}
|
||||
|
||||
$database = $argv[1];
|
||||
$offerId = (int) $argv[2];
|
||||
$articleId = (int) $argv[3];
|
||||
$rightsId = (int) $argv[4];
|
||||
$priceCents = (int) $argv[5];
|
||||
$delayMs = (int) $argv[6];
|
||||
|
||||
putenv('APP_ENV=testing');
|
||||
putenv('DB_CONNECTION=sqlite');
|
||||
putenv('DB_DATABASE='.$database);
|
||||
|
||||
require __DIR__.'/../../vendor/autoload.php';
|
||||
$app = require __DIR__.'/../../bootstrap/app.php';
|
||||
$app->make(Kernel::class)->bootstrap();
|
||||
|
||||
if ($delayMs > 0) {
|
||||
usleep($delayMs * 1000);
|
||||
}
|
||||
|
||||
$offers = app(OfferService::class);
|
||||
$offer = Offer::query()->findOrFail($offerId);
|
||||
$article = LicenseArticle::query()->findOrFail($articleId);
|
||||
$rights = RightsProfileVersion::query()->findOrFail($rightsId);
|
||||
|
||||
$offers->activate($offer, [
|
||||
['target' => $article, 'rights' => $rights],
|
||||
], [
|
||||
'grant_kind' => 'kauf',
|
||||
'price_cents' => $priceCents,
|
||||
]);
|
||||
|
||||
echo "ok\n";
|
||||
Reference in new issue
Block a user