Documentation

ValidationConfigEntity
in package

Table of Contents

Constants

RULES  = [ //Value cannot be empty. Can be zero. 'notEmpty' => [ 'type', 'digitalService', 'paymentDate', 'toCountry', // to_country 'fromCountry', // from_country 'originalCurrency', ], //endNotEmpty //One or more of the nested array pairs must not be empty. The array keys of the pairs are arbitrary names. 'oneOrMore' => ['movementId' => [ 'invoiceNumber', // is_invoice 1 'transactionId', ]], //endOneOrMore //Must be a valid date string with Y-m-d format. Can be empty. 'checkDateFormat' => ['invoiceDate', 'paymentDate', 'shippingDate'], 'setDefault' => [ //'quantity' => 1, 'invoiceDate' => null, 'shippingDate' => null, 'deemedSupplier' => 'no', 'postponedImportVat' => 'no', 'channelId' => 'API', ], //Must be an integer. Can be empty. Cannot be float. 'isInteger' => [ // must be integer numerical, can be empty 'quantity', ], 'validatePriceMaxValue' => ['itemNetPrice', 'itemVatAmount', 'itemGrossUnitPrice', 'shippingPrice', 'discountAmount', 'shippingDiscount', 'productNetValue'], //Must be an integer or float. Can be empty. 'isFloatNumber' => ['itemNetPrice', 'itemVatAmount', 'shippingPrice', 'discountAmount', 'shippingDiscount', 'weight', 'itemGrossUnitPrice', 'productNetValue', 'itemVatRate'], 'validCommodityCode' => ['validCommodityCode'], //Must be positive or zero. Can be empty. 'positive' => ['quantity', 'itemVatRate', 'discountAmount', 'shippingPrice', 'shippingDiscount'], 'maxLength' => [['propertyName' => 'invoiceNumber', 'maxLength' => 255], ['propertyName' => 'transactionId', 'maxLength' => 255]], 'checkPostponed' => ['postponedImportVat'], 'checkDeemedSupplier' => ['deemedSupplier'], 'checkCustomerVatRate' => ['itemVatRate'], 'checkInvoiceNumberIsEmpty' => ['invoiceNumber'], 'checkIsYesOrNo' => ['deemedSupplier', 'postponedImportVat'], 'checkStrictYesOrNo' => ['digitalService'], 'validateImporter' => ['importer'], //Must be found in given repository. 'inTable' => ['Country' => ['propertyList' => ['toCountry', 'fromCountry', 'vatCountry', 'toVatCountry', 'fromVatCountry', 'toBillingCountry', 'fromBillingCountry'], 'repositoryClass' => 'countryRepository', 'inTablePropertyName' => 'isoCode2', 'exclude' => [0, 10]], 'Currency' => ['propertyList' => ['originalCurrency'], 'repositoryClass' => 'currencyRepository', 'inTablePropertyName' => 'three', 'exclude' => [0, 997, 998, 999]], 'Channel' => ['propertyList' => ['channelId'], 'repositoryClass' => 'channelRepository', 'inTablePropertyName' => 'alias', 'exclude' => [0]]], 'validate' => ['UserVat' => ['propertyList' => ['fromVatNumber', 'toVatNumber'], 'validationClass' => '\Vatjar\User\Model\UserVat', 'validationFunction' => 'parseThisVatid']], 'email' => ['toBillingEmail', 'fromBillingEmail'], 'hellotax' => [ // can be empty 'hellotaxProductId', ], 'dateRange' => ['onlyMinimum' => ['propertyList' => ['invoiceDate', 'shippingDate'], 'range' => ['minimum' => '1980-12-31', 'maximum' => false]], 'minumumAndMaximum' => ['propertyList' => ['paymentDate'], 'range' => ['minimum' => '1980-12-31', 'maximum' => ['method' => 'add', 'interval' => 'P1D']]]], 'between' => [ // can be empty '1to10000' => ['propertyList' => ['quantity'], 'range' => ['minimum' => 1, 'maximum' => 10000]], '1to100' => ['propertyList' => ['itemVatRate'], 'range' => ['min' => 0, 'max' => 100]], '9-3' => ['propertyList' => ['itemNetPrice', 'itemGrossUnitPrice'], 'range' => ['min' => -999999.999, 'max' => 999999.999]], ], 'conditional' => [ 'digitalService' => ['evaluate' => ['getPropertyValue' => 'digitalService'], 'case' => ['Yes' => ['validatePositiveDigitalService' => ['digitalService'], 'conditionalErrorCodes' => ['validatePositiveDigitalService' => 'ERROR_CODE_VALIDATION_POSITIVE_DIGITAL_SERVICE']], 'yes' => ['validatePositiveDigitalService' => ['digitalService'], 'conditionalErrorCodes' => ['validatePositiveDigitalService' => 'ERROR_CODE_VALIDATION_POSITIVE_DIGITAL_SERVICE']], 'No' => ['oneOrMore' => ['productId' => ['hellotaxProductId', 'sku']], 'conditionalErrorCodes' => ['oneOrMore' => 'ERROR_CODE_VALIDATION_ONE_OR_MORE']], 'no' => ['oneOrMore' => ['productId' => ['hellotaxProductId', 'sku']], 'conditionalErrorCodes' => ['oneOrMore' => 'ERROR_CODE_VALIDATION_ONE_OR_MORE']]]], 'type' => ['evaluate' => ['getPropertyValue' => 'type'], 'case' => ['refund' => ['notEmpty' => ['itemVatRate', 'channelId', 'toBillingName', 'vatCountry', 'itemGrossUnitPrice'], 'validVatRate' => ['itemVatRate'], 'validVatRateUntilDate' => ['itemVatRate'], 'floatNumber' => ['itemGrossUnitPrice'], 'strictNegative' => ['itemGrossUnitPrice'], 'conditionalErrorCodes' => ['negative' => 'ERROR_CODE_CONDITIONAL_VALIDATION_NEGATIVE_REFUND', 'notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATION_NOT_EMPTY_REFUND', 'floatNumber' => 'ERROR_CODE_CONDITIONAL_VALIDATION_FLOAT_NUMBER_REFUND', 'validVatRateUntilDate' => 'ERROR_CODE_CONDITIONAL_VALIDATION_VAT_RATE_MATCH_VAT_COUNTRY', 'strictNegative' => 'ERROR_CODE_CONDITIONAL_VALIDATION_STRICT_NEGATIVE_REFUND']], 'sale' => ['notEmpty' => ['itemVatRate', 'channelId', 'toBillingName', 'vatCountry', 'itemGrossUnitPrice'], 'validVatRate' => ['itemVatRate'], 'floatNumber' => ['itemGrossUnitPrice'], 'strictPositive' => ['itemGrossUnitPrice'], 'conditionalErrorCodes' => ['positive' => 'ERROR_CODE_CONDITIONAL_VALIDATION_POSITIVE_SALE', 'notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATION_NOT_EMPTY_SALE', 'floatNumber' => 'ERROR_CODE_CONDITIONAL_VALIDATION_FLOAT_NUMBER_SALE', 'validVatRate' => 'ERROR_CODE_CONDITIONAL_VALIDATION_VAT_RATE_MATCH_VAT_COUNTRY', 'strictPositive' => 'ERROR_CODE_CONDITIONAL_VALIDATION_STRICT_POSITIVE_SALE']], 'movement' => ['notEmpty' => ['productNetValue'], 'validVatRate' => ['itemVatRate'], 'conditionalErrorCodes' => ['notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATION_NOT_EMPTY_MOVEMENT']], 'expense' => ['notEmpty' => ['itemGrossUnitPrice', 'fromBillingName', 'invoiceNumber', 'toVatNumber'], 'validVatRate' => ['itemVatRate'], 'floatNumber' => ['itemGrossUnitPrice'], 'checkVatNumberForEuCountry' => ['proprerties' => ['country' => 'fromCountry', 'date' => 'paymentDate', 'vatNumber' => 'fromVatNumber']], 'conditionalErrorCodes' => ['notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATIONNOT_EMPTY_EXPENSE', 'floatNumber' => 'ERROR_CODE_CONDITIONAL_VALIDATIONFLOAT_NUMBER_EXPENSE', 'checkVatNumberForEuCountry' => 'ERROR_CODE_CONDITIONAL_VALIDATIONVAT_NUMBER_REQUIRED_FOR_EU_EXPENSE', 'strictPositive' => 'ERROR_CODE_CONDITIONAL_VALIDATION_STRICT_STRICT_POSITIVE_EXPENSE']], 'default' => ['invalidValue' => ['type'], 'conditionalErrorCodes' => ['invalidValue' => 'ERROR_CODE_INVALID_VALUE_IN_CELL']]]], //endType 'invoiceNumber' => ['evaluate' => ['notEmpty' => 'invoiceNumber'], 'case' => [1 => ['notEmpty' => ['itemVatRate', 'vatCountry'], 'conditionalErrorCodes' => ['notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATIONNOT_EMPTY_INVOICE_NUMBER']]]], //endInvoiceNumber 'toVatNumber' => ['evaluate' => ['notEmpty' => 'toVatNumber'], 'case' => [1 => ['notEmpty' => ['toVatCountry'], 'vatNumberWithVatCountry' => ['propertyList' => ['vatNumber' => 'toVatNumber', 'country' => 'toVatCountry', 'validationClass' => '\Vatjar\User\Model\UserVat', 'validationFunction' => 'parseThisVatid']], 'conditionalErrorCodes' => ['notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATION_NOT_EMPTY_VAT_NUMBER_COUNRTRY', 'vatNumberWithVatCountry' => 'ERROR_CODE_CONDITIONAL_VALIDATION_VAT_NUMBER_MATCH_VAT_COUNTRY']]]], //endToVatNumber 'fromVatNumber' => ['evaluate' => ['notEmpty' => 'fromVatNumber'], 'case' => [1 => ['notEmpty' => ['fromVatCountry'], 'vatNumberWithVatCountry' => ['propertyList' => ['vatNumber' => 'fromVatNumber', 'country' => 'fromVatCountry', 'validationClass' => '\Vatjar\User\Model\UserVat', 'validationFunction' => 'parseThisVatid']], 'conditionalErrorCodes' => ['notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATION_NOT_EMPTY_VAT_NUMBER_COUNRTRY', 'vatNumberWithVatCountry' => 'ERROR_CODE_CONDITIONAL_VALIDATION_VAT_NUMBER_MATCH_VAT_COUNTRY']]]], ], ]

Methods

getRules()  : mixed

Constants

RULES

public mixed RULES = [ //Value cannot be empty. Can be zero. 'notEmpty' => [ 'type', 'digitalService', 'paymentDate', 'toCountry', // to_country 'fromCountry', // from_country 'originalCurrency', ], //endNotEmpty //One or more of the nested array pairs must not be empty. The array keys of the pairs are arbitrary names. 'oneOrMore' => ['movementId' => [ 'invoiceNumber', // is_invoice 1 'transactionId', ]], //endOneOrMore //Must be a valid date string with Y-m-d format. Can be empty. 'checkDateFormat' => ['invoiceDate', 'paymentDate', 'shippingDate'], 'setDefault' => [ //'quantity' => 1, 'invoiceDate' => null, 'shippingDate' => null, 'deemedSupplier' => 'no', 'postponedImportVat' => 'no', 'channelId' => 'API', ], //Must be an integer. Can be empty. Cannot be float. 'isInteger' => [ // must be integer numerical, can be empty 'quantity', ], 'validatePriceMaxValue' => ['itemNetPrice', 'itemVatAmount', 'itemGrossUnitPrice', 'shippingPrice', 'discountAmount', 'shippingDiscount', 'productNetValue'], //Must be an integer or float. Can be empty. 'isFloatNumber' => ['itemNetPrice', 'itemVatAmount', 'shippingPrice', 'discountAmount', 'shippingDiscount', 'weight', 'itemGrossUnitPrice', 'productNetValue', 'itemVatRate'], 'validCommodityCode' => ['validCommodityCode'], //Must be positive or zero. Can be empty. 'positive' => ['quantity', 'itemVatRate', 'discountAmount', 'shippingPrice', 'shippingDiscount'], 'maxLength' => [['propertyName' => 'invoiceNumber', 'maxLength' => 255], ['propertyName' => 'transactionId', 'maxLength' => 255]], 'checkPostponed' => ['postponedImportVat'], 'checkDeemedSupplier' => ['deemedSupplier'], 'checkCustomerVatRate' => ['itemVatRate'], 'checkInvoiceNumberIsEmpty' => ['invoiceNumber'], 'checkIsYesOrNo' => ['deemedSupplier', 'postponedImportVat'], 'checkStrictYesOrNo' => ['digitalService'], 'validateImporter' => ['importer'], //Must be found in given repository. 'inTable' => ['Country' => ['propertyList' => ['toCountry', 'fromCountry', 'vatCountry', 'toVatCountry', 'fromVatCountry', 'toBillingCountry', 'fromBillingCountry'], 'repositoryClass' => 'countryRepository', 'inTablePropertyName' => 'isoCode2', 'exclude' => [0, 10]], 'Currency' => ['propertyList' => ['originalCurrency'], 'repositoryClass' => 'currencyRepository', 'inTablePropertyName' => 'three', 'exclude' => [0, 997, 998, 999]], 'Channel' => ['propertyList' => ['channelId'], 'repositoryClass' => 'channelRepository', 'inTablePropertyName' => 'alias', 'exclude' => [0]]], 'validate' => ['UserVat' => ['propertyList' => ['fromVatNumber', 'toVatNumber'], 'validationClass' => '\Vatjar\User\Model\UserVat', 'validationFunction' => 'parseThisVatid']], 'email' => ['toBillingEmail', 'fromBillingEmail'], 'hellotax' => [ // can be empty 'hellotaxProductId', ], 'dateRange' => ['onlyMinimum' => ['propertyList' => ['invoiceDate', 'shippingDate'], 'range' => ['minimum' => '1980-12-31', 'maximum' => false]], 'minumumAndMaximum' => ['propertyList' => ['paymentDate'], 'range' => ['minimum' => '1980-12-31', 'maximum' => ['method' => 'add', 'interval' => 'P1D']]]], 'between' => [ // can be empty '1to10000' => ['propertyList' => ['quantity'], 'range' => ['minimum' => 1, 'maximum' => 10000]], '1to100' => ['propertyList' => ['itemVatRate'], 'range' => ['min' => 0, 'max' => 100]], '9-3' => ['propertyList' => ['itemNetPrice', 'itemGrossUnitPrice'], 'range' => ['min' => -999999.999, 'max' => 999999.999]], ], 'conditional' => [ 'digitalService' => ['evaluate' => ['getPropertyValue' => 'digitalService'], 'case' => ['Yes' => ['validatePositiveDigitalService' => ['digitalService'], 'conditionalErrorCodes' => ['validatePositiveDigitalService' => 'ERROR_CODE_VALIDATION_POSITIVE_DIGITAL_SERVICE']], 'yes' => ['validatePositiveDigitalService' => ['digitalService'], 'conditionalErrorCodes' => ['validatePositiveDigitalService' => 'ERROR_CODE_VALIDATION_POSITIVE_DIGITAL_SERVICE']], 'No' => ['oneOrMore' => ['productId' => ['hellotaxProductId', 'sku']], 'conditionalErrorCodes' => ['oneOrMore' => 'ERROR_CODE_VALIDATION_ONE_OR_MORE']], 'no' => ['oneOrMore' => ['productId' => ['hellotaxProductId', 'sku']], 'conditionalErrorCodes' => ['oneOrMore' => 'ERROR_CODE_VALIDATION_ONE_OR_MORE']]]], 'type' => ['evaluate' => ['getPropertyValue' => 'type'], 'case' => ['refund' => ['notEmpty' => ['itemVatRate', 'channelId', 'toBillingName', 'vatCountry', 'itemGrossUnitPrice'], 'validVatRate' => ['itemVatRate'], 'validVatRateUntilDate' => ['itemVatRate'], 'floatNumber' => ['itemGrossUnitPrice'], 'strictNegative' => ['itemGrossUnitPrice'], 'conditionalErrorCodes' => ['negative' => 'ERROR_CODE_CONDITIONAL_VALIDATION_NEGATIVE_REFUND', 'notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATION_NOT_EMPTY_REFUND', 'floatNumber' => 'ERROR_CODE_CONDITIONAL_VALIDATION_FLOAT_NUMBER_REFUND', 'validVatRateUntilDate' => 'ERROR_CODE_CONDITIONAL_VALIDATION_VAT_RATE_MATCH_VAT_COUNTRY', 'strictNegative' => 'ERROR_CODE_CONDITIONAL_VALIDATION_STRICT_NEGATIVE_REFUND']], 'sale' => ['notEmpty' => ['itemVatRate', 'channelId', 'toBillingName', 'vatCountry', 'itemGrossUnitPrice'], 'validVatRate' => ['itemVatRate'], 'floatNumber' => ['itemGrossUnitPrice'], 'strictPositive' => ['itemGrossUnitPrice'], 'conditionalErrorCodes' => ['positive' => 'ERROR_CODE_CONDITIONAL_VALIDATION_POSITIVE_SALE', 'notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATION_NOT_EMPTY_SALE', 'floatNumber' => 'ERROR_CODE_CONDITIONAL_VALIDATION_FLOAT_NUMBER_SALE', 'validVatRate' => 'ERROR_CODE_CONDITIONAL_VALIDATION_VAT_RATE_MATCH_VAT_COUNTRY', 'strictPositive' => 'ERROR_CODE_CONDITIONAL_VALIDATION_STRICT_POSITIVE_SALE']], 'movement' => ['notEmpty' => ['productNetValue'], 'validVatRate' => ['itemVatRate'], 'conditionalErrorCodes' => ['notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATION_NOT_EMPTY_MOVEMENT']], 'expense' => ['notEmpty' => ['itemGrossUnitPrice', 'fromBillingName', 'invoiceNumber', 'toVatNumber'], 'validVatRate' => ['itemVatRate'], 'floatNumber' => ['itemGrossUnitPrice'], 'checkVatNumberForEuCountry' => ['proprerties' => ['country' => 'fromCountry', 'date' => 'paymentDate', 'vatNumber' => 'fromVatNumber']], 'conditionalErrorCodes' => ['notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATIONNOT_EMPTY_EXPENSE', 'floatNumber' => 'ERROR_CODE_CONDITIONAL_VALIDATIONFLOAT_NUMBER_EXPENSE', 'checkVatNumberForEuCountry' => 'ERROR_CODE_CONDITIONAL_VALIDATIONVAT_NUMBER_REQUIRED_FOR_EU_EXPENSE', 'strictPositive' => 'ERROR_CODE_CONDITIONAL_VALIDATION_STRICT_STRICT_POSITIVE_EXPENSE']], 'default' => ['invalidValue' => ['type'], 'conditionalErrorCodes' => ['invalidValue' => 'ERROR_CODE_INVALID_VALUE_IN_CELL']]]], //endType 'invoiceNumber' => ['evaluate' => ['notEmpty' => 'invoiceNumber'], 'case' => [1 => ['notEmpty' => ['itemVatRate', 'vatCountry'], 'conditionalErrorCodes' => ['notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATIONNOT_EMPTY_INVOICE_NUMBER']]]], //endInvoiceNumber 'toVatNumber' => ['evaluate' => ['notEmpty' => 'toVatNumber'], 'case' => [1 => ['notEmpty' => ['toVatCountry'], 'vatNumberWithVatCountry' => ['propertyList' => ['vatNumber' => 'toVatNumber', 'country' => 'toVatCountry', 'validationClass' => '\Vatjar\User\Model\UserVat', 'validationFunction' => 'parseThisVatid']], 'conditionalErrorCodes' => ['notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATION_NOT_EMPTY_VAT_NUMBER_COUNRTRY', 'vatNumberWithVatCountry' => 'ERROR_CODE_CONDITIONAL_VALIDATION_VAT_NUMBER_MATCH_VAT_COUNTRY']]]], //endToVatNumber 'fromVatNumber' => ['evaluate' => ['notEmpty' => 'fromVatNumber'], 'case' => [1 => ['notEmpty' => ['fromVatCountry'], 'vatNumberWithVatCountry' => ['propertyList' => ['vatNumber' => 'fromVatNumber', 'country' => 'fromVatCountry', 'validationClass' => '\Vatjar\User\Model\UserVat', 'validationFunction' => 'parseThisVatid']], 'conditionalErrorCodes' => ['notEmpty' => 'ERROR_CODE_CONDITIONAL_VALIDATION_NOT_EMPTY_VAT_NUMBER_COUNRTRY', 'vatNumberWithVatCountry' => 'ERROR_CODE_CONDITIONAL_VALIDATION_VAT_NUMBER_MATCH_VAT_COUNTRY']]]], ], ]

Methods


        
On this page

Search results