dnhb/api-client

Hypotheekbond API客户端

1.7.1 2024-07-31 12:20 UTC

README

描述

Hypotheekbond API包装器

示例用法

构建API客户端

$auth = Dnhb\ApiClient\Auth\Auth::apiKey("your-api-key");
$client = new Client(new \GuzzleHttp\Client(), $auth);
$api = new Dnhb\ApiClient\Api($client);

简单用法

$constructionAddedValue = $api->calculation()->getConstructionAddedValue();

复杂请求

$fixedRatePeriods = [
    new PaymentFixedRatePeriodParameter(10, 2.65)
];
    
$loanParts = [
    new PaymentLoanpartParameter(
        new MortgageType(MortgageType::LINEAR),
        100000.0,
        1,
        $fixedRatePeriods
    )
];
    
$persons = [
    new PaymentPersonParameter(new DateTime('1980-01-01'), 15000),
    new PaymentPersonParameter(new DateTime('1985-01-01'), 35000)
];
    
$payments = $api->calculation()->getMortgagePayments($loanParts, 125000.0, $persons); 
$investment = $payments->getTotal()->getInvestment();
$firstMonthInterest = $response->getPayments()[0]->getInterest();
 

导入requests

$scope = new Scope('Scope');
    
$dossier = new DossierParameter('DossierParameter', $scope);
$dossier->createPerson('ApplicantParameter')
    ->setIsPrimaryContact(true)
    ->setLastName('LastName');
    
$dossierId = $api->import()->insertDossier($scope);

复杂导入请求

$scope = new Scope('Scope');
    
$address = new AddressParameter('Address', $scope);
$address->setPostalCode('1000AA')
    ->setHouseNumber('1')
    ->setStreet('Damrak')
    ->setCity('Amsterdam');
    
$dossier = new DossierParameter('DossierParameter', $scope);
$dossier->setClientStatus(new ClientStatus(ClientStatus::PROSPECT))
    ->setMaritalStatus(new MaritalStatus(MaritalStatus::MARRIED_PRENUPTIAL_AGREEMENT))
    ->setNote('This is a note')
    ->addCorrespondenceAddress($address);
    
$dossier->createHouse('HouseParameter')
    ->addAddress($address);
    
$dossier->createPerson('Person1')
    ->setIsPrimaryContact(true)
    ->setLastName('LastName');
    
$dossierId = $api->import()->insertDossier($scope);

以两种方式导入参数关系

$scope = new Scope('Scope');
    
$dossier = new DossierParameter('BasicDossier', $scope);
$dossier->createPerson('FirstPerson') // Note that createPerson returns a PersonParamater
    ->setIsPrimaryContact(true)
    ->setLastName('First');
    
$person = new PersonParameter('SecondPerson', $scope); // Note that you have to specify the scope
$person->setIsPrimaryContact(false)
    ->setLastName('Second');
        
$dossier->addPerson($person); // Note that you have to create the relation between the person and the dossier
    

第二种方式特别适用于可以用于不同参数对象的实体,例如AddressParameter,它可以与DossierParameter(addCorrespondenceAddress())和HouseParameter(addAddress())相关联