Compare commits
12 Commits
contributi
...
master
Author | SHA1 | Date |
---|---|---|
|
37c9021e76 | |
|
2e0b42bfbd | |
|
3c7cd1173a | |
|
0c14ebb229 | |
|
0679a09d26 | |
|
2dd0c3d2a0 | |
|
21964e9665 | |
|
5afe8613e1 | |
|
c047f8da63 | |
|
9097f0bbd9 | |
|
3f44fbe5b0 | |
|
8e1f7869e2 |
|
@ -1,4 +1,4 @@
|
||||||
FROM php:8.3.11-fpm as php
|
FROM php:8.3.11-fpm AS php
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
RUN ls /app
|
RUN ls /app
|
||||||
RUN apt-get update
|
RUN apt-get update
|
||||||
|
|
|
@ -1,16 +1,17 @@
|
||||||
FROM composer:2.7.9 as composer
|
FROM composer:2.7.9 AS composer
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . /app
|
COPY . /app
|
||||||
RUN composer install --ignore-platform-reqs --no-dev
|
RUN composer install --ignore-platform-reqs --no-dev
|
||||||
RUN php artisan telescope:publish
|
RUN php artisan telescope:publish
|
||||||
RUN php artisan horizon:publish
|
RUN php artisan horizon:publish
|
||||||
|
|
||||||
FROM node:20.15.0-slim as node
|
FROM node:20.15.0-slim AS node
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . /app
|
COPY . /app
|
||||||
RUN npm install && npm run prod && npm run img && rm -R node_modules
|
RUN cd packages/adrema-form && npm ci && npm run build && rm -R node_modules && cd ../../
|
||||||
|
RUN npm ci && npm run prod && npm run img && rm -R node_modules
|
||||||
|
|
||||||
FROM nginx:1.21.6-alpine as nginx
|
FROM nginx:1.21.6-alpine AS nginx
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY --from=node /app /app
|
COPY --from=node /app /app
|
||||||
COPY --from=composer /app/public/vendor /app/public/vendor
|
COPY --from=composer /app/public/vendor /app/public/vendor
|
||||||
|
|
|
@ -1,14 +1,15 @@
|
||||||
FROM composer:2.7.9 as composer
|
FROM composer:2.7.9 AS composer
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . /app
|
COPY . /app
|
||||||
RUN composer install --ignore-platform-reqs --no-dev
|
RUN composer install --ignore-platform-reqs --no-dev
|
||||||
|
|
||||||
FROM node:20.15.0-slim as node
|
FROM node:20.15.0-slim AS node
|
||||||
WORKDIR /app
|
WORKDIR /app
|
||||||
COPY . /app
|
COPY . /app
|
||||||
RUN npm install && npm run prod && npm run img && rm -R node_modules
|
RUN cd packages/adrema-form && npm ci && npm run build && rm -R node_modules && cd ../../
|
||||||
|
RUN npm ci && npm run prod && npm run img && rm -R node_modules
|
||||||
|
|
||||||
FROM zoomyboy/adrema-base:latest as php
|
FROM zoomyboy/adrema-base:latest AS php
|
||||||
COPY --chown=www-data:www-data . /app
|
COPY --chown=www-data:www-data . /app
|
||||||
COPY --chown=www-data:www-data --from=node /app/public /app/public
|
COPY --chown=www-data:www-data --from=node /app/public /app/public
|
||||||
COPY --chown=www-data:www-data --from=composer /app/vendor /app/vendor
|
COPY --chown=www-data:www-data --from=composer /app/vendor /app/vendor
|
||||||
|
|
25
README.md
25
README.md
|
@ -32,16 +32,16 @@ Außerdem ist AdReMa auch problemlos auf Handys und Tablets bedienbar ("mobiles
|
||||||
|
|
||||||
## Installation des Produktivsystems
|
## Installation des Produktivsystems
|
||||||
|
|
||||||
1. Herunterladen der Beispiel Docker-Compose
|
1. Verschieben der Docker-Compose
|
||||||
|
|
||||||
```cmd
|
```cmd
|
||||||
curl https://git.zoomyboy.de/silva/adrema/raw/branch/master/docker-compose.prod.yml -o docker-compose.yml
|
mv docker-compose.prod.yml docker-compose.yml
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Herunterladen der Beispiel Environmentvariablen-Datei
|
2. Anwenden der Beispiel Environmentvariablen-Datei
|
||||||
|
|
||||||
```cmd
|
```cmd
|
||||||
curl https://git.zoomyboy.de/silva/adrema/raw/branch/master/.app.env.example -o .app.env
|
mv .app.env.example .app.env
|
||||||
```
|
```
|
||||||
|
|
||||||
3. In der `.app.env` notwendige Einstellungen vornehmen:
|
3. In der `.app.env` notwendige Einstellungen vornehmen:
|
||||||
|
@ -50,7 +50,8 @@ Außerdem ist AdReMa auch problemlos auf Handys und Tablets bedienbar ("mobiles
|
||||||
- Mail-Server Einstellungen `MAIL_PORT`, `MAIL_HOST`, `MAIL_USERNAME`, `MAIL_PASSWORD` und `MAIL_ENCRYPTION` anpassen
|
- Mail-Server Einstellungen `MAIL_PORT`, `MAIL_HOST`, `MAIL_USERNAME`, `MAIL_PASSWORD` und `MAIL_ENCRYPTION` anpassen
|
||||||
- `MAIL_FROM_NAME`: Der Name, der als Absender von E-Mails gesetzt wird (z.B. `Stamm Bipi Service`)
|
- `MAIL_FROM_NAME`: Der Name, der als Absender von E-Mails gesetzt wird (z.B. `Stamm Bipi Service`)
|
||||||
- `MAIL_FROM_ADDRESS`: Die dazu gehörige E-Mail-Adresse, die natürlich für antworten erreichbar sein sollte (z.B. `vorstand@stamm-bipi.de`)
|
- `MAIL_FROM_ADDRESS`: Die dazu gehörige E-Mail-Adresse, die natürlich für antworten erreichbar sein sollte (z.B. `vorstand@stamm-bipi.de`)
|
||||||
- `DB_PASSWORD` und `MYSQL_PASSWORD`: Mit dem selben sicheren Passwort für die Datenbank versehen
|
- `DB_PASSWORD` und `MYSQL_PASSWORD`: Mit dem selben neu erstellten, sicheren Passwort für die Datenbank versehen
|
||||||
|
- `MEILI_MASTER_KEY` Mit einem neu erstellten, sicheren Passwort versehen
|
||||||
- `USER_EMAIL` und `USER_PASSWORD`: Einstellen des standard Adrema Logins
|
- `USER_EMAIL` und `USER_PASSWORD`: Einstellen des standard Adrema Logins
|
||||||
|
|
||||||
4. Container zur Gennerierung des App-Key starten
|
4. Container zur Gennerierung des App-Key starten
|
||||||
|
@ -99,28 +100,22 @@ Bei dem Setup wird im Daten-Verzeichniss ein Ordner `./data/setup` angelegt. Hie
|
||||||
git clone https://git.zoomyboy.de/silva/adrema.git
|
git clone https://git.zoomyboy.de/silva/adrema.git
|
||||||
```
|
```
|
||||||
|
|
||||||
2. Kopieren der Beispiel Docker-Compose für das Entwickeln und nach Wünschen anpassen
|
2. Kopieren der Beispiel Environmentvariablen-Datei
|
||||||
|
|
||||||
```cmd
|
|
||||||
cp docker-compose.dev.yml docker-compose.yml
|
|
||||||
```
|
|
||||||
|
|
||||||
3. Kopieren der Beispiel Environmentvariablen-Datei
|
|
||||||
|
|
||||||
```cmd
|
```cmd
|
||||||
cp .app.env.example .app.env
|
cp .app.env.example .app.env
|
||||||
```
|
```
|
||||||
|
|
||||||
4. Submodule aktuallisieren
|
3. Submodule aktuallisieren
|
||||||
|
|
||||||
```cmd
|
```cmd
|
||||||
git submodule update --init
|
git submodule update --init
|
||||||
```
|
```
|
||||||
|
|
||||||
5. Container erstellen
|
4. Container erstellen
|
||||||
|
|
||||||
```cmd
|
```cmd
|
||||||
docker compose build
|
docker compose build
|
||||||
```
|
```
|
||||||
|
|
||||||
6. Mit Schritt 3 und den folgenden der [Installation des Produktivsystems](#installation-des-produktivsystems) fortfahren
|
5. Mit Schritt 3 und den folgenden der [Installation des Produktivsystems](#installation-des-produktivsystems) fortfahren
|
||||||
|
|
|
@ -61,7 +61,7 @@ class InsertMemberAction
|
||||||
}
|
}
|
||||||
|
|
||||||
return tap(Member::updateOrCreate(['nami_id' => $member->id], $payload), function ($insertedMember) use ($member) {
|
return tap(Member::updateOrCreate(['nami_id' => $member->id], $payload), function ($insertedMember) use ($member) {
|
||||||
$insertedMember->bankAccount()->updateOrCreate([
|
$insertedMember->bankAccount->update([
|
||||||
'iban' => $member->bankAccount->iban,
|
'iban' => $member->bankAccount->iban,
|
||||||
'bic' => $member->bankAccount->bic,
|
'bic' => $member->bankAccount->bic,
|
||||||
'blz' => $member->bankAccount->blz,
|
'blz' => $member->bankAccount->blz,
|
||||||
|
|
|
@ -48,7 +48,16 @@ class NamiPutMemberAction
|
||||||
'id' => $member->nami_id,
|
'id' => $member->nami_id,
|
||||||
'version' => $member->version,
|
'version' => $member->version,
|
||||||
'keepdata' => $member->keepdata,
|
'keepdata' => $member->keepdata,
|
||||||
'bankAccount' => BankAccount::from([]),
|
'bankAccount' => BankAccount::from([
|
||||||
|
'bankName' => $member->bankAccount->bank_name,
|
||||||
|
'id' => $member->bankAccount->nami_id,
|
||||||
|
'memberId' => $member->mitgliedsnr,
|
||||||
|
'iban' => $member->bankAccount->iban,
|
||||||
|
'bic' => $member->bankAccount->bic,
|
||||||
|
'blz' => $member->bankAccount->blz,
|
||||||
|
'person' => $member->bankAccount->person,
|
||||||
|
'accountNumber' => $member->bankAccount->account_number,
|
||||||
|
]),
|
||||||
]);
|
]);
|
||||||
$response = $api->putMember($namiMember, $activity ? $activity->nami_id : null, $subactivity ? $subactivity->nami_id : null);
|
$response = $api->putMember($namiMember, $activity ? $activity->nami_id : null, $subactivity ? $subactivity->nami_id : null);
|
||||||
Member::withoutEvents(function () use ($response, $member) {
|
Member::withoutEvents(function () use ($response, $member) {
|
||||||
|
|
|
@ -12,4 +12,6 @@ class BankAccount extends Model
|
||||||
use HasFactory;
|
use HasFactory;
|
||||||
|
|
||||||
public $guarded = [];
|
public $guarded = [];
|
||||||
|
|
||||||
|
public $primaryKey = 'member_id';
|
||||||
}
|
}
|
||||||
|
|
|
@ -9,7 +9,8 @@ use Zoomyboy\LaravelNami\Data\Member as NamiMember;
|
||||||
use Zoomyboy\LaravelNami\Data\MembershipEntry as NamiMembershipEntry;
|
use Zoomyboy\LaravelNami\Data\MembershipEntry as NamiMembershipEntry;
|
||||||
use Spatie\LaravelData\Attributes\DataCollectionOf;
|
use Spatie\LaravelData\Attributes\DataCollectionOf;
|
||||||
|
|
||||||
class FullMember extends Data {
|
class FullMember extends Data
|
||||||
|
{
|
||||||
/**
|
/**
|
||||||
* @param DataCollection<int, NamiCourse> $courses
|
* @param DataCollection<int, NamiCourse> $courses
|
||||||
* @param DataCollection<int, NamiMembershipEntry> $memberships
|
* @param DataCollection<int, NamiMembershipEntry> $memberships
|
||||||
|
@ -20,6 +21,6 @@ class FullMember extends Data {
|
||||||
public DataCollection $courses,
|
public DataCollection $courses,
|
||||||
#[DataCollectionOf(NamiMembershipEntry::class)]
|
#[DataCollectionOf(NamiMembershipEntry::class)]
|
||||||
public DataCollection $memberships,
|
public DataCollection $memberships,
|
||||||
) {}
|
) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -304,12 +304,17 @@ class Member extends Model implements Geolocatable
|
||||||
|
|
||||||
public static function booted()
|
public static function booted()
|
||||||
{
|
{
|
||||||
|
static::created(function (self $model): void {
|
||||||
|
$model->bankAccount()->create([]);
|
||||||
|
});
|
||||||
|
|
||||||
static::deleting(function (self $model): void {
|
static::deleting(function (self $model): void {
|
||||||
$model->memberships->each->delete();
|
$model->memberships->each->delete();
|
||||||
$model->courses->each->delete();
|
$model->courses->each->delete();
|
||||||
$model->invoicePositions->each(function ($position) {
|
$model->invoicePositions->each(function ($position) {
|
||||||
$position->delete();
|
$position->delete();
|
||||||
});
|
});
|
||||||
|
$model->bankAccount()->delete();
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -6,17 +6,10 @@ use App\Member\BankAccount;
|
||||||
use Illuminate\Database\Eloquent\Factories\Factory;
|
use Illuminate\Database\Eloquent\Factories\Factory;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @template TModel of \App\Member\BankAccount
|
* @extends Factory<BankAccount>
|
||||||
*
|
|
||||||
* @extends \Illuminate\Database\Eloquent\Factories\Factory<TModel>
|
|
||||||
*/
|
*/
|
||||||
class BankAccountFactory extends Factory
|
class BankAccountFactory extends Factory
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* The name of the factory's corresponding model.
|
|
||||||
*
|
|
||||||
* @var class-string<TModel>
|
|
||||||
*/
|
|
||||||
protected $model = BankAccount::class;
|
protected $model = BankAccount::class;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -27,7 +20,17 @@ class BankAccountFactory extends Factory
|
||||||
public function definition(): array
|
public function definition(): array
|
||||||
{
|
{
|
||||||
return [
|
return [
|
||||||
//
|
'bank_name' => $this->faker->name(),
|
||||||
|
'bic' => $this->faker->swiftBicNumber(),
|
||||||
|
'iban' => $this->faker->iban('DE'),
|
||||||
|
'blz' => $this->faker->name(),
|
||||||
|
'person' => $this->faker->name(),
|
||||||
|
'account_number' => $this->faker->name(),
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function inNami(int $namiId): self
|
||||||
|
{
|
||||||
|
return $this->state(['nami_id' => $namiId]);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -93,6 +93,13 @@ class MemberFactory extends Factory
|
||||||
return $this->state(['nami_id' => $namiId]);
|
return $this->state(['nami_id' => $namiId]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function withBankAccount(BankAccountFactory $factory): self
|
||||||
|
{
|
||||||
|
return $this->afterCreating(function ($member) use ($factory) {
|
||||||
|
$member->bankAccount->update($factory->make()->toArray());
|
||||||
|
});
|
||||||
|
}
|
||||||
|
|
||||||
public function sameFamilyAs(Member $member): self
|
public function sameFamilyAs(Member $member): self
|
||||||
{
|
{
|
||||||
return $this->state([
|
return $this->state([
|
||||||
|
|
|
@ -19,7 +19,8 @@ class UserSeeder extends Seeder
|
||||||
'email' => config('init.email'),
|
'email' => config('init.email'),
|
||||||
'email_verified_at' => now(),
|
'email_verified_at' => now(),
|
||||||
'password' => Hash::make(config('init.password')),
|
'password' => Hash::make(config('init.password')),
|
||||||
'name' => 'Adrema Benutzer',
|
'firstname' => 'Adrema',
|
||||||
|
'lastname' => 'Benutzer',
|
||||||
]);
|
]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -2,7 +2,6 @@ version: '3'
|
||||||
services:
|
services:
|
||||||
webservice:
|
webservice:
|
||||||
image: zoomyboy/adrema-webservice:latest
|
image: zoomyboy/adrema-webservice:latest
|
||||||
restart: always
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- php
|
- php
|
||||||
ports:
|
ports:
|
||||||
|
@ -12,7 +11,6 @@ services:
|
||||||
|
|
||||||
php:
|
php:
|
||||||
image: zoomyboy/adrema-app:latest
|
image: zoomyboy/adrema-app:latest
|
||||||
restart: always
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- db
|
- db
|
||||||
- redis
|
- redis
|
||||||
|
@ -38,7 +36,6 @@ services:
|
||||||
|
|
||||||
horizon:
|
horizon:
|
||||||
image: zoomyboy/adrema-app:latest
|
image: zoomyboy/adrema-app:latest
|
||||||
restart: always
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- php
|
- php
|
||||||
command: /bin/entrypoint horizon
|
command: /bin/entrypoint horizon
|
||||||
|
@ -62,7 +59,6 @@ services:
|
||||||
|
|
||||||
schedule:
|
schedule:
|
||||||
image: zoomyboy/adrema-app:latest
|
image: zoomyboy/adrema-app:latest
|
||||||
restart: always
|
|
||||||
depends_on:
|
depends_on:
|
||||||
- php
|
- php
|
||||||
command: /bin/entrypoint schedule
|
command: /bin/entrypoint schedule
|
||||||
|
@ -86,7 +82,6 @@ services:
|
||||||
|
|
||||||
db:
|
db:
|
||||||
image: mariadb:10.6.5
|
image: mariadb:10.6.5
|
||||||
restart: always
|
|
||||||
env_file:
|
env_file:
|
||||||
- .app.env
|
- .app.env
|
||||||
environment:
|
environment:
|
||||||
|
@ -98,7 +93,6 @@ services:
|
||||||
|
|
||||||
socketi:
|
socketi:
|
||||||
image: quay.io/soketi/soketi:89604f268623cf799573178a7ba56b7491416bde-16-debian
|
image: quay.io/soketi/soketi:89604f268623cf799573178a7ba56b7491416bde-16-debian
|
||||||
restart: always
|
|
||||||
environment:
|
environment:
|
||||||
SOKETI_DEFAULT_APP_ID: adremaid
|
SOKETI_DEFAULT_APP_ID: adremaid
|
||||||
SOKETI_DEFAULT_APP_KEY: adremakey
|
SOKETI_DEFAULT_APP_KEY: adremakey
|
||||||
|
@ -106,7 +100,6 @@ services:
|
||||||
|
|
||||||
redis:
|
redis:
|
||||||
image: redis:alpine3.18
|
image: redis:alpine3.18
|
||||||
restart: always
|
|
||||||
volumes:
|
volumes:
|
||||||
- ./data/redis:/data
|
- ./data/redis:/data
|
||||||
|
|
||||||
|
|
|
@ -7,11 +7,11 @@ use App\Actions\PullMembershipsAction;
|
||||||
use App\Activity;
|
use App\Activity;
|
||||||
use App\Confession;
|
use App\Confession;
|
||||||
use App\Country;
|
use App\Country;
|
||||||
use App\Fee;
|
use App\Gender;
|
||||||
use App\Group;
|
use App\Group;
|
||||||
use App\Member\Actions\NamiPutMemberAction;
|
use App\Member\Actions\NamiPutMemberAction;
|
||||||
|
use App\Member\BankAccount;
|
||||||
use App\Member\Member;
|
use App\Member\Member;
|
||||||
use App\Nationality;
|
|
||||||
use App\Payment\Subscription;
|
use App\Payment\Subscription;
|
||||||
use App\Region;
|
use App\Region;
|
||||||
use App\Subactivity;
|
use App\Subactivity;
|
||||||
|
@ -20,52 +20,130 @@ use Phake;
|
||||||
use Zoomyboy\LaravelNami\Fakes\MemberFake;
|
use Zoomyboy\LaravelNami\Fakes\MemberFake;
|
||||||
|
|
||||||
uses(DatabaseTransactions::class);
|
uses(DatabaseTransactions::class);
|
||||||
|
covers(NamiPutMemberAction::class);
|
||||||
|
|
||||||
it('testItPutsAMember', function (array $memberAttributes, array $storedAttributes) {
|
beforeEach(function () {
|
||||||
Fee::factory()->create();
|
|
||||||
$this->stubIo(PullMemberAction::class, fn ($mock) => $mock);
|
$this->stubIo(PullMemberAction::class, fn ($mock) => $mock);
|
||||||
$this->stubIo(PullMembershipsAction::class, fn ($mock) => $mock);
|
$this->stubIo(PullMembershipsAction::class, fn ($mock) => $mock);
|
||||||
|
Group::factory()->inNami(55)->create();
|
||||||
$this->withoutExceptionHandling()->login()->loginNami();
|
$this->withoutExceptionHandling()->login()->loginNami();
|
||||||
$country = Country::factory()->create();
|
|
||||||
$region = Region::factory()->create();
|
|
||||||
$nationality = Nationality::factory()->inNami(565)->create();
|
|
||||||
$subscription = Subscription::factory()->forFee()->create();
|
|
||||||
$group = Group::factory()->inNami(55)->create();
|
|
||||||
$confession = Confession::factory()->inNami(567)->create(['is_null' => true]);
|
|
||||||
app(MemberFake::class)->stores(55, 993);
|
app(MemberFake::class)->stores(55, 993);
|
||||||
$activity = Activity::factory()->hasAttached(Subactivity::factory()->name('Biber')->inNami(55))->name('Leiter')->inNami(6)->create();
|
Confession::factory()->inNami(567)->create(['is_null' => true]);
|
||||||
$subactivity = $activity->subactivities->first();
|
$activity = Activity::factory()->inNami(6)->create();
|
||||||
|
Subactivity::factory()->hasAttached($activity)->inNami(55)->create();
|
||||||
|
});
|
||||||
|
|
||||||
$member = Member::factory()
|
it('pulls member and memberships befre pushing', function () {
|
||||||
->for($country)
|
$member = Member::factory()->defaults()->create();
|
||||||
->for($subscription)
|
|
||||||
->for($region)
|
|
||||||
->for($nationality)
|
|
||||||
->for($group)
|
|
||||||
->emailBillKind()
|
|
||||||
->create($memberAttributes);
|
|
||||||
|
|
||||||
NamiPutMemberAction::run($member, $activity, $subactivity);
|
NamiPutMemberAction::run($member, Activity::first(), Subactivity::first());
|
||||||
|
|
||||||
app(MemberFake::class)->assertStored(55, [
|
|
||||||
'ersteTaetigkeitId' => 6,
|
|
||||||
'ersteUntergliederungId' => 55,
|
|
||||||
'konfessionId' => 567,
|
|
||||||
...$storedAttributes,
|
|
||||||
]);
|
|
||||||
$this->assertDatabaseHas('members', [
|
|
||||||
'nami_id' => 993,
|
|
||||||
]);
|
|
||||||
Phake::verify(app(PullMemberAction::class))->handle(55, 993);
|
Phake::verify(app(PullMemberAction::class))->handle(55, 993);
|
||||||
Phake::verify(app(PullMembershipsAction::class))->handle($member);
|
Phake::verify(app(PullMembershipsAction::class))->handle($member);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('sets nami id of member', function () {
|
||||||
|
$member = Member::factory()->defaults()->create();
|
||||||
|
|
||||||
|
NamiPutMemberAction::run($member, Activity::first(), Subactivity::first());
|
||||||
|
|
||||||
|
$this->assertDatabaseHas('members', ['nami_id' => 993]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('stores member attributes', function (array $memberAttributes, array $storedAttributes) {
|
||||||
|
$member = Member::factory()->defaults()->create($memberAttributes);
|
||||||
|
|
||||||
|
NamiPutMemberAction::run($member, Activity::first(), Subactivity::first());
|
||||||
|
|
||||||
|
app(MemberFake::class)->assertStored(55, $storedAttributes);
|
||||||
})->with([
|
})->with([
|
||||||
[
|
[['firstname' => 'Phi'], ['vorname' => 'Phi']],
|
||||||
['email_parents' => 'a@b.de'], ['emailVertretungsberechtigter' => 'a@b.de'],
|
[['lastname' => 'Phi'], ['nachname' => 'Phi']],
|
||||||
],
|
[['nickname' => 'Nick'], ['spitzname' => 'Nick']],
|
||||||
[
|
[['email' => 'a@b.de'], ['email' => 'a@b.de']],
|
||||||
['keepdata' => true], ['wiederverwendenFlag' => true],
|
[['zip' => '5566'], ['plz' => '5566']],
|
||||||
],
|
[['location' => 'SG'], ['ort' => 'SG']],
|
||||||
[
|
[['further_address' => 'SG'], ['nameZusatz' => 'SG']],
|
||||||
['keepdata' => false], ['wiederverwendenFlag' => false],
|
[['other_country' => 'SG'], ['staatsangehoerigkeitText' => 'SG']],
|
||||||
],
|
[['address' => 'Add'], ['strasse' => 'Add']],
|
||||||
|
[['main_phone' => '+49 212 5566234'], ['telefon1' => '+49 212 5566234']],
|
||||||
|
[['mobile_phone' => '+49 212 5566234'], ['telefon2' => '+49 212 5566234']],
|
||||||
|
[['work_phone' => '+49 212 5566234'], ['telefon3' => '+49 212 5566234']],
|
||||||
|
[['email_parents' => 'a@b.de'], ['emailVertretungsberechtigter' => 'a@b.de']],
|
||||||
|
[['keepdata' => true], ['wiederverwendenFlag' => true]],
|
||||||
|
[['keepdata' => false], ['wiederverwendenFlag' => false]],
|
||||||
|
fn () => [['joined_at' => now()], ['eintrittsdatum' => now()->format('Y-m-d') . ' 00:00:00']],
|
||||||
|
[['fax' => '555'], ['telefax' => '555']],
|
||||||
|
[[], ['konfessionId' => 567]],
|
||||||
|
[[], ['ersteTaetigkeitId' => 6]],
|
||||||
|
[[], ['ersteUntergliederungId' => 55]],
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
it('stores related models', function () {
|
||||||
|
Subscription::factory()->forFee(3)->create();
|
||||||
|
$member = Member::factory()->defaults()
|
||||||
|
->for(Country::factory()->inNami(1)->create())
|
||||||
|
->for(Region::factory()->inNami(2)->create())
|
||||||
|
->for(Gender::factory()->inNami(4)->create())
|
||||||
|
->create();
|
||||||
|
|
||||||
|
NamiPutMemberAction::run($member, Activity::first(), Subactivity::first());
|
||||||
|
|
||||||
|
app(MemberFake::class)->assertStored(55, ['regionId' => 2, 'landId' => 1, 'beitragsartId' => 3, 'geschlechtId' => 4]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('stores bank account with empty values', function () {
|
||||||
|
$member = Member::factory()->defaults()->create(['mitgliedsnr' => 56]);
|
||||||
|
|
||||||
|
NamiPutMemberAction::run($member, Activity::first(), Subactivity::first());
|
||||||
|
|
||||||
|
app(MemberFake::class)->assertStored(55, ['kontoverbindung' => json_encode([
|
||||||
|
'id' => '',
|
||||||
|
'zahlungsKonditionId' => null,
|
||||||
|
'mitgliedsNummer' => 56,
|
||||||
|
'institut' => '',
|
||||||
|
'kontoinhaber' => '',
|
||||||
|
'kontonummer' => '',
|
||||||
|
'bankleitzahl' => '',
|
||||||
|
'iban' => '',
|
||||||
|
'bic' => ''
|
||||||
|
])]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('updates existing member', function () {
|
||||||
|
app(MemberFake::class)->updatesSuccessfully(55, 103)->shows(55, 103);
|
||||||
|
$member = Member::factory()->defaults()->inNami(103)->create(['version' => 50]);
|
||||||
|
|
||||||
|
NamiPutMemberAction::run($member, Activity::first(), Subactivity::first());
|
||||||
|
|
||||||
|
app(MemberFake::class)->assertUpdated(55, 103, ['id' => 103, 'version' => 50]);
|
||||||
|
});
|
||||||
|
|
||||||
|
it('updates bank account with filled values', function () {
|
||||||
|
app(MemberFake::class)->updatesSuccessfully(55, 103)->shows(55, 103);
|
||||||
|
$member = Member::factory()->defaults()
|
||||||
|
->withBankAccount(BankAccount::factory()->inNami(30)->state([
|
||||||
|
'bank_name' => 'Stadt',
|
||||||
|
'bic' => 'SOLSDE33',
|
||||||
|
'iban' => 'DE50',
|
||||||
|
'blz' => 'ssss',
|
||||||
|
'person' => 'Pill',
|
||||||
|
'account_number' => 'ddf',
|
||||||
|
]))
|
||||||
|
->inNami(103)
|
||||||
|
->create(['mitgliedsnr' => 56]);
|
||||||
|
|
||||||
|
NamiPutMemberAction::run($member, Activity::first(), Subactivity::first());
|
||||||
|
|
||||||
|
app(MemberFake::class)->assertUpdated(55, 103, ['kontoverbindung' => json_encode([
|
||||||
|
'id' => 30,
|
||||||
|
'zahlungsKonditionId' => null,
|
||||||
|
'mitgliedsNummer' => 56,
|
||||||
|
'institut' => 'Stadt',
|
||||||
|
'kontoinhaber' => 'Pill',
|
||||||
|
'kontonummer' => 'ddf',
|
||||||
|
'bankleitzahl' => 'ssss',
|
||||||
|
'iban' => 'DE50',
|
||||||
|
'bic' => 'SOLSDE33'
|
||||||
|
])]);
|
||||||
|
});
|
||||||
|
|
Loading…
Reference in New Issue