86 lines
2.7 KiB
PHP
86 lines
2.7 KiB
PHP
<?php
|
|
|
|
namespace App\Command;
|
|
|
|
use Symfony\Component\Console\Command\Command;
|
|
use Symfony\Component\Console\Input\InputArgument;
|
|
use Symfony\Component\Console\Input\InputInterface;
|
|
use Symfony\Component\Console\Output\OutputInterface;
|
|
|
|
use App\Service\InsuranceConnector;
|
|
use App\Service\InsuranceDataValidator;
|
|
|
|
use App\Insurance\ClientData;
|
|
use App\Insurance\ClientType;
|
|
use App\Insurance\LineType;
|
|
|
|
class TestInsuranceConnectorCommand extends Command
|
|
{
|
|
protected $insurance;
|
|
protected $ins_validator;
|
|
|
|
protected function configure()
|
|
{
|
|
$this->setName('test:create-insurance-application')
|
|
->setDescription('Test create insurance application service.')
|
|
->setHelp('Test the create insurance application service.');
|
|
}
|
|
|
|
public function __construct(InsuranceConnector $insurance, InsuranceDataValidator $ins_validator)
|
|
{
|
|
$this->insurance = $insurance;
|
|
$this->ins_validator = $ins_validator;
|
|
|
|
parent::__construct();
|
|
}
|
|
|
|
protected function execute(InputInterface $input, OutputInterface $output)
|
|
{
|
|
$client_data = new ClientData();
|
|
|
|
// set client info part
|
|
$client_data->setClientType(ClientType::INDIVIDUAL)
|
|
->setFirstName('Test')
|
|
->setMiddleName('Resq')
|
|
->setSurname('Customer')
|
|
->setCorporateName('Customer, Test Resq');
|
|
|
|
// set the client contact info part
|
|
$client_data->setAddressNumber('113')
|
|
->setAddressStreet('Test Street')
|
|
->setAddressBuilding('Test Building')
|
|
->setAddressBarangay('Legaspi Village')
|
|
->setAddressCity('Makati City')
|
|
->setAddressProvince('Metro Manila')
|
|
->setZipcode(1200)
|
|
->setMobileNumber('09171234567')
|
|
->setEmailAddress('test.resq@gmail.com');
|
|
|
|
// set the car info part
|
|
$client_data->setMake('HYUNDAI')
|
|
->setModel('ACCENT')
|
|
->setSeries('1.4 A/T')
|
|
->setColor('PHANTOM BLACK')
|
|
->setPlateNumber('ABC1234')
|
|
->setMvFileNumber('123456789012345')
|
|
->setMotorNumber('E31TE-0075268')
|
|
->setSerialChassis('PA0SEF210K0075701')
|
|
->setYearModel('2020')
|
|
->setMvTypeID(1)
|
|
->setBodyType('SEDAN')
|
|
->setLine(LineType::PRIVATE_CAR)
|
|
->setPublic(false);
|
|
|
|
$error_message = $this->ins_validator->validateClientData($client_data);
|
|
if ($error_message == null)
|
|
{
|
|
$result = $this->insurance->processApplication($client_data);
|
|
|
|
error_log(json_encode($result));
|
|
}
|
|
else
|
|
error_log($error_message);
|
|
|
|
return 0;
|
|
}
|
|
}
|