Improve bunq import.

This commit is contained in:
James Cole
2018-03-10 20:25:42 +01:00
parent 85dc1263ea
commit 0c2b35e542
13 changed files with 490 additions and 299 deletions

View File

@@ -114,6 +114,19 @@ class UserCompany extends BunqObject
$this->sectorOfIndustry = $data['sector_of_industry'] ?? '';
$this->counterBankIban = $data['counter_bank_iban'];
$this->name = $data['name'];
// TODO alias
// TODO avatar
// TODO daily_limit_without_confirmation_login
// TODO notification_filters
// TODO address_main
// TODO address_postal
// TODO director_alias
// TODO ubo
// TODO customer
// TODO customer_limit
// TODO billing_contract
// TODO pack_membership
}
/**
@@ -123,4 +136,32 @@ class UserCompany extends BunqObject
{
return $this->id;
}
/**
* @return array
*/
public function toArray(): array
{
$data = [
'id' => $this->id,
'created' => $this->created->format('Y-m-d H:i:s.u'),
'updated' => $this->updated->format('Y-m-d H:i:s.u'),
'status' => $this->status,
'sub_status' => $this->subStatus,
'public_uuid' => $this->publicUuid,
'display_name' => $this->displayName,
'public_nick_name' => $this->publicNickName,
'language' => $this->language,
'region' => $this->region,
'session_timeout' => $this->sessionTimeout,
'version_terms_of_service' => $this->versionTos,
'chamber_of_commerce_number' => $this->cocNumber,
'type_of_business_entity' => $this->typeOfBusinessEntity,
'sector_of_industry' => $this->sectorOfIndustry,
'counter_bank_iban' => $this->counterBankIban,
'name' => $this->name,
];
return $data;
}
}

View File

@@ -120,8 +120,13 @@ class UserPerson extends BunqObject
public function __construct(array $data)
{
if (0 === count($data)) {
$this->created = new Carbon;
$this->updated = new Carbon;
$this->dateOfBirth = new Carbon;
return;
}
$this->id = intval($data['id']);
$this->created = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['created']);
$this->updated = Carbon::createFromFormat('Y-m-d H:i:s.u', $data['updated']);
@@ -148,14 +153,14 @@ class UserPerson extends BunqObject
$this->documentType = $data['document_type'];
$this->documentCountry = $data['document_country_of_issuance'];
// create aliases
// create avatar
// create daily limit
// create notification filters
// create address main, postal
// document front, back attachment
// customer, customer_limit
// billing contracts
// TODO create aliases
// TODO create avatar
// TODO create daily limit
// TODO create notification filters
// TODO create address main, postal
// TODO document front, back attachment
// TODO customer, customer_limit
// TODO billing contracts
}
/**
@@ -165,4 +170,40 @@ class UserPerson extends BunqObject
{
return $this->id;
}
/**
* @return array
*/
public function toArray(): array
{
$data = [
'id' => $this->id,
'created' => $this->created->format('Y-m-d H:i:s.u'),
'updated' => $this->updated->format('Y-m-d H:i:s.u'),
'status' => $this->status,
'sub_status' => $this->subStatus,
'public_uuid' => $this->publicUuid,
'display_name' => $this->displayName,
'public_nick_name' => $this->publicNickName,
'language' => $this->language,
'region' => $this->region,
'session_timeout' => $this->sessionTimeout,
'first_name' => $this->firstName,
'middle_name' => $this->middleName,
'last_name' => $this->lastName,
'legal_name' => $this->legalName,
'tax_resident' => $this->taxResident,
'date_of_birth' => $this->dateOfBirth->format('Y-m-d'),
'place_of_birth' => $this->placeOfBirth,
'country_of_birth' => $this->countryOfBirth,
'nationality' => $this->nationality,
'gender' => $this->gender,
'version_terms_of_service' => $this->versionTos,
'document_number' => $this->documentNumber,
'document_type' => $this->documentType,
'document_country_of_issuance' => $this->documentCountry,
];
return $data;
}
}