Skip to content

Axa

Helper to add into your Axa product to help you with common scenarios/problems

Interface

Use

In your class definition add , AxaInterface after implements GeneralProductInterface
and in your section of uses (at the top) add

use BP\Products\Interfaces\AxaInterface;

Constants

// Wsdl urls
public const WSDL_TEST = 'https://ws.axastudiotest.axa.cz/ase/AxaStudioExtended.svc?wsdl';
public const WSDL_PROD = 'https://ws.axastudio.axa.cz/ase/AxaStudioExtended.svc?wsdl';

// Frequency constants
public const FREQUENCY_YEAR = 'Yearly';
public const FREQUENCY_HALF = 'TwiceYear';
public const FREQUENCY_QUARTER = 'Quarterly';

// Broker data
public const BROKER_COUNTRY = 'SVK';

public const TRUE = 'True';
public const FALSE = 'False';

// Used as ContractAction in CreateContract
public const CONTRACT_ACTION = 'CreateContractAndFinalPdfThanConfirmContract';

// Image with sign in base64 string
public const SIGN = '***';  // BASE64 format sign

Trait

Use

Right below your class definition add

use BP\Products\Traits\AxaTrait;

Methods

api(string $method, array $data = [])

/**
 * This function adds credentials to every api request
 *
 * @param string $method
 * @param array $data (optional)
 * @return mixed
 */

// Example
$result = $this->api('CreateContract', $this->data);

bool2string(bool $value): string

/**
 * Convert boolean value to string true/false
 *
 * @param bool $value
 * @return string
 */

// Example
    [
        'Base_MoreProductsDiscount' => $this->bool2string($this->discount('has_axa')),
    ]

countDecisiveTime(): int

/**
 * Count decisive time for bonus/malus
 *
 * @return integer
 */

// Example
    [
        'Pov_BonusMalusSK' => $this->countDecisiveTime(),
    ]

checkResponse($response): bool

/**
 * Helper to get errors from response
 *
 * @param mixed $response
 * @return bool
 */

// Example
    // Call
    $response = $this->callSoap($method, $data);

    // Check for errors
    if ($this->checkResponse($response)) {
        return $response;
    }
    return false;

date($date): string

/**
 * Convert input date to API specific format
 *
 * @param string $date
 * @return string
 */

// Example
protected function parseStart($date): string
{
    return $this->date($date);
}

getCredentials(): array

/**
 * Generate credential data for api call
 *
 * @return array
 */

// Example
$data['credentials'] = $this->getCredentials();

personIsCompany(Person|array $person): bool

/**
 * Check if person is company or person
 *
 * @param Person|array $person
 * @return boolean
 */

setEndpoints()

/**
 * Helper method to set api/wsdl endpoints
 *
 * @return void
 */

// Example
    public function initialize()
    {
        $this->setEndpoints();
    }

Parsers

Predefined parsers so you only call $this->value('field'); for these parsers and they will be parsed into right format
Don't redefine them if you doesn't need different outputs

Automatically parsed fields

  • Field::FUEL
  • Field::PAYMENT_FREQUENCY
  • Field::START
  • Field::VEHICLE_BRAND
  • Field::VEHICLE_MODEL
  • Field::VEHICLE_TYPE

Available parse method

  • parseCountry
  • parseProfession