Abo Einmalprodukte und Bestätigung abschließen
Co-authored-by: Cursor <cursoragent@cursor.com>
This commit is contained in:
parent
2bdc9ada3c
commit
2269ce031f
57 changed files with 3647 additions and 371 deletions
|
|
@ -1,7 +1,72 @@
|
|||
<?php
|
||||
|
||||
use App\Models\Country;
|
||||
use App\Models\Product;
|
||||
use App\Models\Shipping;
|
||||
use App\Models\ShippingCountry;
|
||||
use App\Models\UserAbo;
|
||||
use App\User;
|
||||
use Illuminate\Support\Facades\DB;
|
||||
|
||||
uses(Tests\TestCase::class)->in('Feature/Incentive');
|
||||
uses(Tests\TestCase::class)->in('Feature/Sys');
|
||||
uses(Tests\TestCase::class)->in('Unit/Incentive');
|
||||
uses(Tests\TestCase::class)->in('Unit/Dhl');
|
||||
uses(Tests\TestCase::class)->in('Feature/PaymentDashboard');
|
||||
|
||||
if (! function_exists('makeShopEnv')) {
|
||||
function makeShopEnv(): void
|
||||
{
|
||||
$country = Country::create([
|
||||
'code' => 'DE', 'phone' => '49', 'en' => 'Germany', 'de' => 'Deutschland',
|
||||
'es' => 'Alemania', 'fr' => 'Allemagne', 'it' => 'Germania', 'ru' => 'Германия',
|
||||
]);
|
||||
$shipping = Shipping::create(['name' => 'Standard', 'active' => true]);
|
||||
ShippingCountry::create(['shipping_id' => $shipping->id, 'country_id' => $country->id]);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('makeMeAbo')) {
|
||||
function makeMeAbo(): UserAbo
|
||||
{
|
||||
$consultant = User::forceCreate([
|
||||
'email' => 'c-'.uniqid('', true).'@example.com',
|
||||
'password' => bcrypt('secret'),
|
||||
'lang' => 'de',
|
||||
]);
|
||||
|
||||
return UserAbo::create([
|
||||
'user_id' => $consultant->id,
|
||||
'shopping_user_id' => 1,
|
||||
'is_for' => 'me',
|
||||
'email' => $consultant->email,
|
||||
'payone_userid' => 900100,
|
||||
'clearingtype' => 'cc',
|
||||
'active' => true,
|
||||
'status' => 2,
|
||||
'abo_interval' => 5,
|
||||
'next_date' => now()->addDays(3),
|
||||
]);
|
||||
}
|
||||
}
|
||||
|
||||
if (! function_exists('makeProduct')) {
|
||||
function makeProduct(array $showOn, float $price = 119, float $tax = 19): Product
|
||||
{
|
||||
$now = now();
|
||||
$id = (int) DB::table('products')->insertGetId([
|
||||
'name' => 'P-'.uniqid('', true),
|
||||
'title' => 'Produkt',
|
||||
'active' => true,
|
||||
'price' => $price,
|
||||
'tax' => $tax,
|
||||
'weight' => 500,
|
||||
'points' => 7,
|
||||
'show_on' => json_encode($showOn),
|
||||
'created_at' => $now,
|
||||
'updated_at' => $now,
|
||||
]);
|
||||
|
||||
return Product::findOrFail($id);
|
||||
}
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue