Store iban and bic
This commit is contained in:
parent
793f916581
commit
2e010aece1
|
@ -84,6 +84,9 @@ class MemberRequest extends FormRequest
|
|||
'salutation' => '',
|
||||
'comment' => '',
|
||||
'keepdata' => 'boolean',
|
||||
'bank_account' => 'array|exclude',
|
||||
'bank_account.iban' => 'nullable|string|max:255',
|
||||
'bank_account.bic' => 'nullable|string|max:255',
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -94,6 +97,7 @@ class MemberRequest extends FormRequest
|
|||
'group_id' => Group::where('nami_id', $settings->default_group_id)->firstOrFail()->id,
|
||||
]);
|
||||
$member->updatePhoneNumbers()->save();
|
||||
$member->bankAccount->update($this->input('bank_account'));
|
||||
|
||||
if ($this->input('has_nami')) {
|
||||
$this->storeFreshMemberInNami($member);
|
||||
|
|
|
@ -23,6 +23,12 @@ use Zoomyboy\LaravelNami\Fakes\MemberFake;
|
|||
|
||||
uses(DatabaseTransactions::class);
|
||||
|
||||
beforeEach(function () {
|
||||
Confession::factory()->create(['is_null' => true]);
|
||||
PullMemberAction::shouldRun();
|
||||
PullMembershipsAction::shouldRun();
|
||||
});
|
||||
|
||||
it('can store a member', function () {
|
||||
app(MemberFake::class)->stores(55, 103);
|
||||
Fee::factory()->create();
|
||||
|
@ -34,9 +40,6 @@ it('can store a member', function () {
|
|||
$activity = Activity::factory()->inNami(89)->create();
|
||||
$subactivity = Subactivity::factory()->inNami(90)->create();
|
||||
$subscription = Subscription::factory()->forFee()->create();
|
||||
Confession::factory()->create(['is_null' => true]);
|
||||
PullMemberAction::shouldRun();
|
||||
PullMembershipsAction::shouldRun();
|
||||
|
||||
$response = $this
|
||||
->from('/member/create')
|
||||
|
@ -85,6 +88,28 @@ it('can store a member', function () {
|
|||
]);
|
||||
});
|
||||
|
||||
it('can store iban and bic', function () {
|
||||
app(MemberFake::class)->stores(55, 103);
|
||||
Fee::factory()->create();
|
||||
$this->withoutExceptionHandling()->login()->loginNami();
|
||||
|
||||
$this->post('/member', MemberStoreRequestFactory::new()->create([
|
||||
'bank_account.iban' => '666',
|
||||
'bank_account.bic' => 'SOLSDE',
|
||||
]))->assertSessionHasNoErrors();
|
||||
|
||||
$this->assertDatabaseHas('bank_accounts', [
|
||||
'iban' => '666',
|
||||
'bic' => 'SOLSDE',
|
||||
'member_id' => Member::first()->id,
|
||||
]);
|
||||
|
||||
app(MemberFake::class)->assertStored(55, function ($payload) {
|
||||
$bank = json_decode($payload['kontoverbindung'], true);
|
||||
return $bank['iban'] === '666' && $bank['bic'] === 'SOLSDE';
|
||||
});
|
||||
});
|
||||
|
||||
it('testItStoresWiederverwendenFlag', function () {
|
||||
app(MemberFake::class)->stores(55, 103);
|
||||
Fee::factory()->create();
|
||||
|
@ -92,9 +117,6 @@ it('testItStoresWiederverwendenFlag', function () {
|
|||
$activity = Activity::factory()->inNami(89)->create();
|
||||
$subactivity = Subactivity::factory()->inNami(90)->create();
|
||||
$subscription = Subscription::factory()->forFee()->create();
|
||||
$confesstion = Confession::factory()->create(['is_null' => true]);
|
||||
PullMemberAction::shouldRun();
|
||||
PullMembershipsAction::shouldRun();
|
||||
|
||||
$this
|
||||
->from('/member/create')
|
||||
|
|
|
@ -2,9 +2,11 @@
|
|||
|
||||
namespace Tests\RequestFactories;
|
||||
|
||||
use App\Activity;
|
||||
use App\Country;
|
||||
use App\Nationality;
|
||||
use App\Payment\Subscription;
|
||||
use App\Subactivity;
|
||||
use Worksome\RequestFactories\RequestFactory;
|
||||
|
||||
class MemberStoreRequestFactory extends RequestFactory
|
||||
|
@ -14,8 +16,14 @@ class MemberStoreRequestFactory extends RequestFactory
|
|||
$country = Country::factory()->create();
|
||||
$nationality = Nationality::factory()->create();
|
||||
$subscription = Subscription::factory()->forFee()->create();
|
||||
$activity = Activity::factory()->inNami(89)->create();
|
||||
$subactivity = Subactivity::factory()->inNami(90)->create();
|
||||
|
||||
return [
|
||||
'bank_account' => [
|
||||
'iban' => '',
|
||||
'bic' => '',
|
||||
],
|
||||
'address' => 'Bavert 50',
|
||||
'birthday' => '2013-02-19',
|
||||
'children_phone' => '+49 176 70512778',
|
||||
|
@ -47,6 +55,8 @@ class MemberStoreRequestFactory extends RequestFactory
|
|||
'country_id' => $country->id,
|
||||
'nationality_id' => $nationality->id,
|
||||
'subscription_id' => $subscription->id,
|
||||
'first_activity_id' => $activity->id,
|
||||
'first_subactivity_id' => $subactivity->id,
|
||||
];
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue