This commit is contained in:
philipp lang 2021-04-10 00:28:19 +02:00
parent 2448a3df0b
commit a785e839b2
3 changed files with 31 additions and 8 deletions

View File

@ -165,6 +165,12 @@ class Api {
});
}
public function feesOf($groupid) {
return collect($this->http()->get(self::$url."/ica/rest/namiBeitrag/beitragsartmgl/gruppierung/{$groupid}")['data'])->map(function($fee) {
return Fee::fromNami($fee);
});
}
public function confessions(): Collection {
return collect($this->http()->get(self::$url."/ica/rest/baseadmin/konfession")['data'])->map(function($gender) {
return Confession::fromNami($gender);
@ -209,14 +215,6 @@ class Api {
// -------------------------------------
public function fees() {
$response = $this->client->get("/ica/rest/namiBeitrag/beitragsartmgl/gruppierung/{$this->user->getNamiGroupId()}", [
'cookies' => $this->cookie
]);
return json_decode((string)$response->getBody());
}
public function regions() {
$response = $this->client->get("/ica/rest/baseadmin/region", [
'cookies' => $this->cookie

21
src/Fee.php Normal file
View File

@ -0,0 +1,21 @@
<?php
namespace Zoomyboy\LaravelNami;
use Illuminate\Support\Arr;
use Illuminate\Database\Eloquent\Model;
class Fee extends Model {
protected $guarded = [];
public static function fromNami($item) {
$name = preg_replace('/DPSG Bundesverband 000000 \((.*?) - VERBANDSBEITRAG\)/', '\\1', $item['descriptor']);
return new self([
'name' => $name,
'id' => $item['id']
]);
}
}

View File

@ -28,6 +28,10 @@ class Group implements Arrayable {
return Nami::subgroupsOf($this->id);
}
public function fees() {
return Nami::feesOf($this->id);
}
public function members(): MemberCollection {
$members = Nami::membersOf($this->id);