-----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEbXCAeh4tnJbE5ao1VRlr7kRfYEkFAmFwGZIACgkQVRlr7kRf
 YEk3Wgv+PE7pPt3iW7NagmOJr+7amapJkbDixyOolHTHD+0KoR0RFki7mGGzSEe8
 f3dE/tD6QN57hKj6rEvjK4BgA9r/PE7C/ioMYnNL447x2WN8gwgH1AI/yN6n7txv
 FRVAnO8xzh77RlWKxJHK4h8R/yeRcJiBiafhVKlBhe0GP9IMJN4hxdlTk67V/I42
 evt/5Gss4EcXo5mBzAJvBuRtwRc66MhxBA8Airb4Wx/D2C5Wbph8MDKHpclaP4Zn
 yooYMwJwvvq3yH59CCaI5JKzK90ESa0q4uRSd1Pk8f332wrUVLf4ApGwdqldt3Q1
 F8ZttmzLqSabbqBVv0EEv/eoiUmzBP2XY8K+lROn3/K7sQg1UFJbc6n9y4GUFl3r
 wo45UTVUGqQaE8Oioz2OrXA6IJca8QwBBa9hNnO3iRmTrQOmneOrImqZVht8NoYc
 cOyUAHB73y91pagAMF95y1JxVSTvFhMV8sT2FruDIwx/mJgTZAVVonb/zh7N5/dR
 DezjSUtw
 =ZKP8
 -----END PGP SIGNATURE-----
gpgsig -----BEGIN PGP SIGNATURE-----
 
 iQGzBAABCgAdFiEEbXCAeh4tnJbE5ao1VRlr7kRfYEkFAmFwGZ4ACgkQVRlr7kRf
 YEmUTQv9Ehg/qVGd5u+u+z0eDF5kUvme/Ks5XoKX1BznpbP+PdlV/pyF2PW8Uzwd
 dV+notGbNco9m0+SArDOpPblXfQOo3d+Jf2vzXgQfW6gp757mOGTygdYi0aDfF0q
 8jQBV4nQ+/yhOIGWvJI2zWF9jbPJPjq5XV+UPm6dJOm9L55eXvHX/GeIv+bJxkaX
 QFFBOaI766ysL+HnV+0E3FvRRXCDnqyzteZKIK0kJVrT0tqhDNGnyzh7Vqk6cCsL
 5yV9zhvyw8aYrfDB5T16yyqWXrz4hnkOvBGfecLz/SiexzPzyIj8l6U0+Sz7bpOy
 Xs5155WAq9qxVWLoU8r6ArMlEHOyz/cFxGaj8wqRcH5487lpnweOYFUZXlJz2sVQ
 t+AAMLHPOTmcPft/rBDwd8CIYKRYgEwd5VvTOgMTCGUz6i+gCP23WXLyCkvZ8DbL
 O3JChfV0F7aq70XQvuz79ntCL3IAw7SKyVzNr6w+1SkYcUNBAaSOLTANXYFG4OqO
 rI6ROOk+
 =YT3I
 -----END PGP SIGNATURE-----

Merge tag '2.2.1'

2.2.1
This commit is contained in:
Jérémy Munsch 2021-10-20 15:29:02 +02:00
commit c27c7dd1e7
8 changed files with 320 additions and 297 deletions

View file

@ -1,5 +1,5 @@
{
"version": "2.2.0",
"version": "2.2.1",
"tokenTimeout": 60,
"apiRequestRatePerMinute": 256,
"servicesDBCache": 10

View file

@ -2,6 +2,16 @@
All notable changes to `CRM CLient V2` will be documented in this file.
# version 2.2.1
- Fixed fill methods on models to handle all enums + arrays
- Changed validation on customer, city minimum is now 2 chars,
firstname and lastname min are now 1 char, phone min 10 has been removed,
other validations are made on backend side such as limit countries,
right now limit is FR, BE, NL.
Anyway dont forget to handle ValidationException which returns crm message.
- Include Drom Com to allowed countries
- Update Country enum to remove '-' chars
# version 2.2.0
- Fixed Utils.php getResquest method
- Changed Arcadia mails, add customer parameters for these calls

View file

@ -8,15 +8,15 @@ use Kwaadpepper\Enum\BaseEnum;
* Liste de Pays
* @source https://datahub.io/core/country-list Data Hub country list
* @method static self afghanistan()
* @method static self aland-islands()
* @method static self alandIslands()
* @method static self albania()
* @method static self algeria()
* @method static self american-samoa()
* @method static self americanSamoa()
* @method static self andorra()
* @method static self angola()
* @method static self anguilla()
* @method static self antarctica()
* @method static self antigua-and-barbuda()
* @method static self antiguaAndBarbuda()
* @method static self argentina()
* @method static self armenia()
* @method static self aruba()
@ -33,59 +33,59 @@ use Kwaadpepper\Enum\BaseEnum;
* @method static self benin()
* @method static self bermuda()
* @method static self bhutan()
* @method static self bolivia-plurinational-state-of()
* @method static self bonaire-sint-eustatius-and-saba()
* @method static self bosnia-and-herzegovina()
* @method static self boliviaPlurinationalStateOf()
* @method static self bonaireSintEustatiusAndSaba()
* @method static self bosniaAndHerzegovina()
* @method static self botswana()
* @method static self bouvet-island()
* @method static self bouvetIsland()
* @method static self brazil()
* @method static self british-indian-ocean-territory()
* @method static self brunei-darussalam()
* @method static self britishIndianOceanTerritory()
* @method static self bruneiDarussalam()
* @method static self bulgaria()
* @method static self burkina-faso()
* @method static self burkinaFaso()
* @method static self burundi()
* @method static self cambodia()
* @method static self cameroon()
* @method static self canada()
* @method static self cape-verde()
* @method static self cayman-islands()
* @method static self central-african-republic()
* @method static self capeVerde()
* @method static self caymanIslands()
* @method static self centralAfricanRepublic()
* @method static self chad()
* @method static self chile()
* @method static self china()
* @method static self christmas-island()
* @method static self cocos-keeling-islands()
* @method static self christmasIsland()
* @method static self cocosKeelingIslands()
* @method static self colombia()
* @method static self comoros()
* @method static self congo()
* @method static self congo-the-democratic-republic-of-the()
* @method static self cook-islands()
* @method static self costa-rica()
* @method static self cote-divoire()
* @method static self congoTheDemocraticRepublicOfThe()
* @method static self cookIslands()
* @method static self costaRica()
* @method static self coteDivoire()
* @method static self croatia()
* @method static self cuba()
* @method static self curacao()
* @method static self cyprus()
* @method static self czech-republic()
* @method static self czechRepublic()
* @method static self denmark()
* @method static self djibouti()
* @method static self dominica()
* @method static self dominican-republic()
* @method static self dominicanRepublic()
* @method static self ecuador()
* @method static self egypt()
* @method static self el-salvador()
* @method static self equatorial-guinea()
* @method static self elSalvador()
* @method static self equatorialGuinea()
* @method static self eritrea()
* @method static self estonia()
* @method static self ethiopia()
* @method static self falkland-islands-malvinas()
* @method static self faroe-islands()
* @method static self falklandIslandsMalvinas()
* @method static self faroeIslands()
* @method static self fiji()
* @method static self finland()
* @method static self france()
* @method static self french-guiana()
* @method static self french-polynesia()
* @method static self french-southern-territories()
* @method static self frenchGuiana()
* @method static self frenchPolynesia()
* @method static self frenchSouthernTerritories()
* @method static self gabon()
* @method static self gambia()
* @method static self georgia()
@ -100,21 +100,21 @@ use Kwaadpepper\Enum\BaseEnum;
* @method static self guatemala()
* @method static self guernsey()
* @method static self guinea()
* @method static self guinea-bissau()
* @method static self guineaBissau()
* @method static self guyana()
* @method static self haiti()
* @method static self heard-island-and-mcdonald-islands()
* @method static self holy-see-vatican-city-state()
* @method static self heardIslandAndMcdonaldIslands()
* @method static self holySeeVaticanCityState()
* @method static self honduras()
* @method static self hong-kong()
* @method static self hongKong()
* @method static self hungary()
* @method static self iceland()
* @method static self india()
* @method static self indonesia()
* @method static self iran-islamic-republic-of()
* @method static self iranIslamicRepublicOf()
* @method static self iraq()
* @method static self ireland()
* @method static self isle-of-man()
* @method static self isleOfMan()
* @method static self israel()
* @method static self italy()
* @method static self jamaica()
@ -124,11 +124,11 @@ use Kwaadpepper\Enum\BaseEnum;
* @method static self kazakhstan()
* @method static self kenya()
* @method static self kiribati()
* @method static self korea-democratic-peoples-republic-of()
* @method static self korea-republic-of()
* @method static self koreaDemocraticPeoplesRepublicOf()
* @method static self koreaRepublicOf()
* @method static self kuwait()
* @method static self kyrgyzstan()
* @method static self lao-peoples-democratic-republic()
* @method static self laoPeoplesDemocraticRepublic()
* @method static self latvia()
* @method static self lebanon()
* @method static self lesotho()
@ -138,21 +138,21 @@ use Kwaadpepper\Enum\BaseEnum;
* @method static self lithuania()
* @method static self luxembourg()
* @method static self macao()
* @method static self macedonia-the-former-yugoslav-republic-of()
* @method static self macedoniaTheFormerYugoslavRepublicOf()
* @method static self madagascar()
* @method static self malawi()
* @method static self malaysia()
* @method static self maldives()
* @method static self mali()
* @method static self malta()
* @method static self marshall-islands()
* @method static self marshallIslands()
* @method static self martinique()
* @method static self mauritania()
* @method static self mauritius()
* @method static self mayotte()
* @method static self mexico()
* @method static self micronesia-federated-states-of()
* @method static self moldova-republic-of()
* @method static self micronesiaFederatedStatesOf()
* @method static self moldovaRepublicOf()
* @method static self monaco()
* @method static self mongolia()
* @method static self montenegro()
@ -164,95 +164,95 @@ use Kwaadpepper\Enum\BaseEnum;
* @method static self nauru()
* @method static self nepal()
* @method static self netherlands()
* @method static self new-caledonia()
* @method static self new-zealand()
* @method static self newCaledonia()
* @method static self newZealand()
* @method static self nicaragua()
* @method static self niger()
* @method static self nigeria()
* @method static self niue()
* @method static self norfolk-island()
* @method static self northern-mariana-islands()
* @method static self norfolkIsland()
* @method static self northernMarianaIslands()
* @method static self norway()
* @method static self oman()
* @method static self pakistan()
* @method static self palau()
* @method static self palestine-state-of()
* @method static self palestineStateOf()
* @method static self panama()
* @method static self papua-new-guinea()
* @method static self papuaNewGuinea()
* @method static self paraguay()
* @method static self peru()
* @method static self philippines()
* @method static self pitcairn()
* @method static self poland()
* @method static self portugal()
* @method static self puerto-rico()
* @method static self puertoRico()
* @method static self qatar()
* @method static self reunion()
* @method static self romania()
* @method static self russian-federation()
* @method static self russianFederation()
* @method static self rwanda()
* @method static self saint-barthelemy()
* @method static self saint-helena-ascension-and-tristan-da-cunha()
* @method static self saint-kitts-and-nevis()
* @method static self saint-lucia()
* @method static self saint-martin-french-part()
* @method static self saint-pierre-and-miquelon()
* @method static self saint-vincent-and-the-grenadines()
* @method static self saintBarthelemy()
* @method static self saintHelenaAscensionAndTristanDaCunha()
* @method static self saintKittsAndNevis()
* @method static self saintLucia()
* @method static self saintMartinFrenchPart()
* @method static self saintPierreAndMiquelon()
* @method static self saintVincentAndTheGrenadines()
* @method static self samoa()
* @method static self san-marino()
* @method static self sao-tome-and-principe()
* @method static self saudi-arabia()
* @method static self sanMarino()
* @method static self saoTomeAndPrincipe()
* @method static self saudiArabia()
* @method static self senegal()
* @method static self serbia()
* @method static self seychelles()
* @method static self sierra-leone()
* @method static self sierraLeone()
* @method static self singapore()
* @method static self sint-maarten-dutch-part()
* @method static self sintMaartenDutchPart()
* @method static self slovakia()
* @method static self slovenia()
* @method static self solomon-islands()
* @method static self solomonIslands()
* @method static self somalia()
* @method static self south-africa()
* @method static self south-georgia-and-the-south-sandwich-islands()
* @method static self south-sudan()
* @method static self southAfrica()
* @method static self southGeorgiaAndTheSouthSandwichIslands()
* @method static self southSudan()
* @method static self spain()
* @method static self sri-lanka()
* @method static self sriLanka()
* @method static self sudan()
* @method static self suriname()
* @method static self svalbard-and-jan-mayen()
* @method static self svalbardAndJanMayen()
* @method static self swaziland()
* @method static self sweden()
* @method static self switzerland()
* @method static self syrian-arab-republic()
* @method static self taiwan-province-of-china()
* @method static self syrianArabRepublic()
* @method static self taiwanProvinceOfChina()
* @method static self tajikistan()
* @method static self tanzania-united-republic-of()
* @method static self tanzaniaUnitedRepublicOf()
* @method static self thailand()
* @method static self timor-leste()
* @method static self timorLeste()
* @method static self togo()
* @method static self tokelau()
* @method static self tonga()
* @method static self trinidad-and-tobago()
* @method static self trinidadAndTobago()
* @method static self tunisia()
* @method static self turkey()
* @method static self turkmenistan()
* @method static self turks-and-caicos-islands()
* @method static self turksAndCaicosIslands()
* @method static self tuvalu()
* @method static self uganda()
* @method static self ukraine()
* @method static self united-arab-emirates()
* @method static self united-kingdom()
* @method static self united-states()
* @method static self united-states-minor-outlying-islands()
* @method static self unitedArabEmirates()
* @method static self unitedKingdom()
* @method static self unitedStates()
* @method static self unitedStatesMinorOutlyingIslands()
* @method static self uruguay()
* @method static self uzbekistan()
* @method static self vanuatu()
* @method static self venezuela-bolivarian-republic-of()
* @method static self viet-nam()
* @method static self virgin-islands-british()
* @method static self virgin-islands-us()
* @method static self wallis-and-futuna()
* @method static self western-sahara()
* @method static self venezuelaBolivarianRepublicOf()
* @method static self vietNam()
* @method static self virginIslandsBritish()
* @method static self virginIslandsUs()
* @method static self wallisAndFutuna()
* @method static self westernSahara()
* @method static self yemen()
* @method static self zambia()
* @method static self zimbabwe()
@ -266,15 +266,15 @@ class Country extends BaseEnum
{
return [
'afghanistan' => 1,
'aland-islands' => 2,
'alandIslands' => 2,
'albania' => 3,
'algeria' => 4,
'american-samoa' => 5,
'americanSamoa' => 5,
'andorra' => 6,
'angola' => 7,
'anguilla' => 8,
'antarctica' => 9,
'antigua-and-barbuda' => 10,
'antiguaAndBarbuda' => 10,
'argentina' => 11,
'armenia' => 12,
'aruba' => 13,
@ -291,59 +291,59 @@ class Country extends BaseEnum
'benin' => 24,
'bermuda' => 25,
'bhutan' => 26,
'bolivia-plurinational-state-of' => 27,
'bonaire-sint-eustatius-and-saba' => 28,
'bosnia-and-herzegovina' => 29,
'boliviaPlurinationalStateOf' => 27,
'bonaireSintEustatiusAndSaba' => 28,
'bosniaAndHerzegovina' => 29,
'botswana' => 30,
'bouvet-island' => 31,
'bouvetIsland' => 31,
'brazil' => 32,
'british-indian-ocean-territory' => 33,
'brunei-darussalam' => 34,
'britishIndianOceanTerritory' => 33,
'bruneiDarussalam' => 34,
'bulgaria' => 35,
'burkina-faso' => 36,
'burkinaFaso' => 36,
'burundi' => 37,
'cambodia' => 38,
'cameroon' => 39,
'canada' => 40,
'cape-verde' => 41,
'cayman-islands' => 42,
'central-african-republic' => 43,
'capeVerde' => 41,
'caymanIslands' => 42,
'centralAfricanRepublic' => 43,
'chad' => 44,
'chile' => 45,
'china' => 46,
'christmas-island' => 47,
'cocos-keeling-islands' => 48,
'christmasIsland' => 47,
'cocosKeelingIslands' => 48,
'colombia' => 49,
'comoros' => 50,
'congo' => 51,
'congo-the-democratic-republic-of-the' => 52,
'cook-islands' => 53,
'costa-rica' => 54,
'cote-divoire' => 55,
'congoTheDemocraticRepublicOfThe' => 52,
'cookIslands' => 53,
'costaRica' => 54,
'coteDivoire' => 55,
'croatia' => 56,
'cuba' => 57,
'curacao' => 58,
'cyprus' => 59,
'czech-republic' => 60,
'czechRepublic' => 60,
'denmark' => 61,
'djibouti' => 62,
'dominica' => 63,
'dominican-republic' => 64,
'dominicanRepublic' => 64,
'ecuador' => 65,
'egypt' => 66,
'el-salvador' => 67,
'equatorial-guinea' => 68,
'elSalvador' => 67,
'equatorialGuinea' => 68,
'eritrea' => 69,
'estonia' => 70,
'ethiopia' => 71,
'falkland-islands-malvinas' => 72,
'faroe-islands' => 73,
'falklandIslandsMalvinas' => 72,
'faroeIslands' => 73,
'fiji' => 74,
'finland' => 75,
'france' => 76,
'french-guiana' => 77,
'french-polynesia' => 78,
'french-southern-territories' => 79,
'frenchGuiana' => 77,
'frenchPolynesia' => 78,
'frenchSouthernTerritories' => 79,
'gabon' => 80,
'gambia' => 81,
'georgia' => 82,
@ -358,21 +358,21 @@ class Country extends BaseEnum
'guatemala' => 91,
'guernsey' => 92,
'guinea' => 93,
'guinea-bissau' => 94,
'guineaBissau' => 94,
'guyana' => 95,
'haiti' => 96,
'heard-island-and-mcdonald-islands' => 97,
'holy-see-vatican-city-state' => 98,
'heardIslandAndMcdonaldIslands' => 97,
'holySeeVaticanCityState' => 98,
'honduras' => 99,
'hong-kong' => 100,
'hongKong' => 100,
'hungary' => 101,
'iceland' => 102,
'india' => 103,
'indonesia' => 104,
'iran-islamic-republic-of' => 105,
'iranIslamicRepublicOf' => 105,
'iraq' => 106,
'ireland' => 107,
'isle-of-man' => 108,
'isleOfMan' => 108,
'israel' => 109,
'italy' => 110,
'jamaica' => 111,
@ -382,11 +382,11 @@ class Country extends BaseEnum
'kazakhstan' => 115,
'kenya' => 116,
'kiribati' => 117,
'korea-democratic-peoples-republic-of' => 118,
'korea-republic-of' => 119,
'koreaDemocraticPeoplesRepublicOf' => 118,
'koreaRepublicOf' => 119,
'kuwait' => 120,
'kyrgyzstan' => 121,
'lao-peoples-democratic-republic' => 122,
'laoPeoplesDemocraticRepublic' => 122,
'latvia' => 123,
'lebanon' => 124,
'lesotho' => 125,
@ -396,21 +396,21 @@ class Country extends BaseEnum
'lithuania' => 129,
'luxembourg' => 130,
'macao' => 131,
'macedonia-the-former-yugoslav-republic-of' => 132,
'macedoniaTheFormerYugoslavRepublicOf' => 132,
'madagascar' => 133,
'malawi' => 134,
'malaysia' => 135,
'maldives' => 136,
'mali' => 137,
'malta' => 138,
'marshall-islands' => 139,
'marshallIslands' => 139,
'martinique' => 140,
'mauritania' => 141,
'mauritius' => 142,
'mayotte' => 143,
'mexico' => 144,
'micronesia-federated-states-of' => 145,
'moldova-republic-of' => 146,
'micronesiaFederatedStatesOf' => 145,
'moldovaRepublicOf' => 146,
'monaco' => 147,
'mongolia' => 148,
'montenegro' => 149,
@ -422,95 +422,95 @@ class Country extends BaseEnum
'nauru' => 155,
'nepal' => 156,
'netherlands' => 157,
'new-caledonia' => 158,
'new-zealand' => 159,
'newCaledonia' => 158,
'newZealand' => 159,
'nicaragua' => 160,
'niger' => 161,
'nigeria' => 162,
'niue' => 163,
'norfolk-island' => 164,
'northern-mariana-islands' => 165,
'norfolkIsland' => 164,
'northernMarianaIslands' => 165,
'norway' => 166,
'oman' => 167,
'pakistan' => 168,
'palau' => 169,
'palestine-state-of' => 170,
'palestineStateOf' => 170,
'panama' => 171,
'papua-new-guinea' => 172,
'papuaNewGuinea' => 172,
'paraguay' => 173,
'peru' => 174,
'philippines' => 175,
'pitcairn' => 176,
'poland' => 177,
'portugal' => 178,
'puerto-rico' => 179,
'puertoRico' => 179,
'qatar' => 180,
'reunion' => 181,
'romania' => 182,
'russian-federation' => 183,
'russianFederation' => 183,
'rwanda' => 184,
'saint-barthelemy' => 185,
'saint-helena-ascension-and-tristan-da-cunha' => 186,
'saint-kitts-and-nevis' => 187,
'saint-lucia' => 188,
'saint-martin-french-part' => 189,
'saint-pierre-and-miquelon' => 190,
'saint-vincent-and-the-grenadines' => 191,
'saintBarthelemy' => 185,
'saintHelenaAscensionAndTristanDaCunha' => 186,
'saintKittsAndNevis' => 187,
'saintLucia' => 188,
'saintMartinFrenchPart' => 189,
'saintPierreAndMiquelon' => 190,
'saintVincentAndTheGrenadines' => 191,
'samoa' => 192,
'san-marino' => 193,
'sao-tome-and-principe' => 194,
'saudi-arabia' => 195,
'sanMarino' => 193,
'saoTomeAndPrincipe' => 194,
'saudiArabia' => 195,
'senegal' => 196,
'serbia' => 197,
'seychelles' => 198,
'sierra-leone' => 199,
'sierraLeone' => 199,
'singapore' => 200,
'sint-maarten-dutch-part' => 201,
'sintMaartenDutchPart' => 201,
'slovakia' => 202,
'slovenia' => 203,
'solomon-islands' => 204,
'solomonIslands' => 204,
'somalia' => 205,
'south-africa' => 206,
'south-georgia-and-the-south-sandwich-islands' => 207,
'south-sudan' => 208,
'southAfrica' => 206,
'southGeorgiaAndTheSouthSandwichIslands' => 207,
'southSudan' => 208,
'spain' => 209,
'sri-lanka' => 210,
'sriLanka' => 210,
'sudan' => 211,
'suriname' => 212,
'svalbard-and-jan-mayen' => 213,
'svalbardAndJanMayen' => 213,
'swaziland' => 214,
'sweden' => 215,
'switzerland' => 216,
'syrian-arab-republic' => 217,
'taiwan-province-of-china' => 218,
'syrianArabRepublic' => 217,
'taiwanProvinceOfChina' => 218,
'tajikistan' => 219,
'tanzania-united-republic-of' => 220,
'tanzaniaUnitedRepublicOf' => 220,
'thailand' => 221,
'timor-leste' => 222,
'timorLeste' => 222,
'togo' => 223,
'tokelau' => 224,
'tonga' => 225,
'trinidad-and-tobago' => 226,
'trinidadAndTobago' => 226,
'tunisia' => 227,
'turkey' => 228,
'turkmenistan' => 229,
'turks-and-caicos-islands' => 230,
'turksAndCaicosIslands' => 230,
'tuvalu' => 231,
'uganda' => 232,
'ukraine' => 233,
'united-arab-emirates' => 234,
'united-kingdom' => 235,
'united-states' => 236,
'united-states-minor-outlying-islands' => 237,
'unitedArabEmirates' => 234,
'unitedKingdom' => 235,
'unitedStates' => 236,
'unitedStatesMinorOutlyingIslands' => 237,
'uruguay' => 238,
'uzbekistan' => 239,
'vanuatu' => 240,
'venezuela-bolivarian-republic-of' => 241,
'viet-nam' => 242,
'virgin-islands-british' => 243,
'virgin-islands-us' => 244,
'wallis-and-futuna' => 245,
'western-sahara' => 246,
'venezuelaBolivarianRepublicOf' => 241,
'vietNam' => 242,
'virginIslandsBritish' => 243,
'virginIslandsUs' => 244,
'wallisAndFutuna' => 245,
'westernSahara' => 246,
'yemen' => 247,
'zambia' => 248,
'zimbabwe' => 249
@ -521,15 +521,15 @@ class Country extends BaseEnum
{
return [
'afghanistan' => 'Afghanistan',
'aland-islands' => 'Åland Islands',
'alandIslands' => 'Åland Islands',
'albania' => 'Albania',
'algeria' => 'Algeria',
'american-samoa' => 'American Samoa',
'americanSamoa' => 'American Samoa',
'andorra' => 'Andorra',
'angola' => 'Angola',
'anguilla' => 'Anguilla',
'antarctica' => 'Antarctica',
'antigua-and-barbuda' => 'Antigua and Barbuda',
'antiguaAndBarbuda' => 'Antigua and Barbuda',
'argentina' => 'Argentina',
'armenia' => 'Armenia',
'aruba' => 'Aruba',
@ -546,59 +546,59 @@ class Country extends BaseEnum
'benin' => 'Benin',
'bermuda' => 'Bermuda',
'bhutan' => 'Bhutan',
'bolivia-plurinational-state-of' => 'Bolivia, Plurinational State of',
'bonaire-sint-eustatius-and-saba' => 'Bonaire, Sint Eustatius and Saba',
'bosnia-and-herzegovina' => 'Bosnia and Herzegovina',
'boliviaPlurinationalStateOf' => 'Bolivia, Plurinational State of',
'bonaireSintEustatiusAndSaba' => 'Bonaire, Sint Eustatius and Saba',
'bosniaAndHerzegovina' => 'Bosnia and Herzegovina',
'botswana' => 'Botswana',
'bouvet-island' => 'Bouvet Island',
'bouvetIsland' => 'Bouvet Island',
'brazil' => 'Brazil',
'british-indian-ocean-territory' => 'British Indian Ocean Territory',
'brunei-darussalam' => 'Brunei Darussalam',
'britishIndianOceanTerritory' => 'British Indian Ocean Territory',
'bruneiDarussalam' => 'Brunei Darussalam',
'bulgaria' => 'Bulgaria',
'burkina-faso' => 'Burkina Faso',
'burkinaFaso' => 'Burkina Faso',
'burundi' => 'Burundi',
'cambodia' => 'Cambodia',
'cameroon' => 'Cameroon',
'canada' => 'Canada',
'cape-verde' => 'Cape Verde',
'cayman-islands' => 'Cayman Islands',
'central-african-republic' => 'Central African Republic',
'capeVerde' => 'Cape Verde',
'caymanIslands' => 'Cayman Islands',
'centralAfricanRepublic' => 'Central African Republic',
'chad' => 'Chad',
'chile' => 'Chile',
'china' => 'China',
'christmas-island' => 'Christmas Island',
'cocos-keeling-islands' => 'Cocos (Keeling) Islands',
'christmasIsland' => 'Christmas Island',
'cocosKeelingIslands' => 'Cocos (Keeling) Islands',
'colombia' => 'Colombia',
'comoros' => 'Comoros',
'congo' => 'Congo',
'congo-the-democratic-republic-of-the' => 'Congo, the Democratic Republic of the',
'cook-islands' => 'Cook Islands',
'costa-rica' => 'Costa Rica',
'cote-divoire' => 'Côte d\'Ivoire',
'congoTheDemocraticRepublicOfThe' => 'Congo, the Democratic Republic of the',
'cookIslands' => 'Cook Islands',
'costaRica' => 'Costa Rica',
'coteDivoire' => 'Côte d\'Ivoire',
'croatia' => 'Croatia',
'cuba' => 'Cuba',
'curacao' => 'Curaçao',
'cyprus' => 'Cyprus',
'czech-republic' => 'Czech Republic',
'czechRepublic' => 'Czech Republic',
'denmark' => 'Denmark',
'djibouti' => 'Djibouti',
'dominica' => 'Dominica',
'dominican-republic' => 'Dominican Republic',
'dominicanRepublic' => 'Dominican Republic',
'ecuador' => 'Ecuador',
'egypt' => 'Egypt',
'el-salvador' => 'El Salvador',
'equatorial-guinea' => 'Equatorial Guinea',
'elSalvador' => 'El Salvador',
'equatorialGuinea' => 'Equatorial Guinea',
'eritrea' => 'Eritrea',
'estonia' => 'Estonia',
'ethiopia' => 'Ethiopia',
'falkland-islands-malvinas' => 'Falkland Islands (Malvinas)',
'faroe-islands' => 'Faroe Islands',
'falklandIslandsMalvinas' => 'Falkland Islands (Malvinas)',
'faroeIslands' => 'Faroe Islands',
'fiji' => 'Fiji',
'finland' => 'Finland',
'france' => 'France',
'french-guiana' => 'French Guiana',
'french-polynesia' => 'French Polynesia',
'french-southern-territories' => 'French Southern Territories',
'frenchGuiana' => 'French Guiana',
'frenchPolynesia' => 'French Polynesia',
'frenchSouthernTerritories' => 'French Southern Territories',
'gabon' => 'Gabon',
'gambia' => 'Gambia',
'georgia' => 'Georgia',
@ -613,21 +613,21 @@ class Country extends BaseEnum
'guatemala' => 'Guatemala',
'guernsey' => 'Guernsey',
'guinea' => 'Guinea',
'guinea-bissau' => 'Guinea-Bissau',
'guineaBissau' => 'GuineaBissau',
'guyana' => 'Guyana',
'haiti' => 'Haiti',
'heard-island-and-mcdonald-islands' => 'Heard Island and McDonald Islands',
'holy-see-vatican-city-state' => 'Holy See (Vatican City State)',
'heardIslandAndMcdonaldIslands' => 'Heard Island and McDonald Islands',
'holySeeVaticanCityState' => 'Holy See (Vatican City State)',
'honduras' => 'Honduras',
'hong-kong' => 'Hong Kong',
'hongKong' => 'Hong Kong',
'hungary' => 'Hungary',
'iceland' => 'Iceland',
'india' => 'India',
'indonesia' => 'Indonesia',
'iran-islamic-republic-of' => 'Iran, Islamic Republic of',
'iranIslamicRepublicOf' => 'Iran, Islamic Republic of',
'iraq' => 'Iraq',
'ireland' => 'Ireland',
'isle-of-man' => 'Isle of Man',
'isleOfMan' => 'Isle of Man',
'israel' => 'Israel',
'italy' => 'Italy',
'jamaica' => 'Jamaica',
@ -637,11 +637,11 @@ class Country extends BaseEnum
'kazakhstan' => 'Kazakhstan',
'kenya' => 'Kenya',
'kiribati' => 'Kiribati',
'korea-democratic-peoples-republic-of' => 'Korea, Democratic People\'s Republic of',
'korea-republic-of' => 'Korea, Republic of',
'koreaDemocraticPeoplesRepublicOf' => 'Korea, Democratic People\'s Republic of',
'koreaRepublicOf' => 'Korea, Republic of',
'kuwait' => 'Kuwait',
'kyrgyzstan' => 'Kyrgyzstan',
'lao-peoples-democratic-republic' => 'Lao People\'s Democratic Republic',
'laoPeoplesDemocraticRepublic' => 'Lao People\'s Democratic Republic',
'latvia' => 'Latvia',
'lebanon' => 'Lebanon',
'lesotho' => 'Lesotho',
@ -651,21 +651,21 @@ class Country extends BaseEnum
'lithuania' => 'Lithuania',
'luxembourg' => 'Luxembourg',
'macao' => 'Macao',
'macedonia-the-former-yugoslav-republic-of' => 'Macedonia, the Former Yugoslav Republic of',
'macedoniaTheFormerYugoslavRepublicOf' => 'Macedonia, the Former Yugoslav Republic of',
'madagascar' => 'Madagascar',
'malawi' => 'Malawi',
'malaysia' => 'Malaysia',
'maldives' => 'Maldives',
'mali' => 'Mali',
'malta' => 'Malta',
'marshall-islands' => 'Marshall Islands',
'marshallIslands' => 'Marshall Islands',
'martinique' => 'Martinique',
'mauritania' => 'Mauritania',
'mauritius' => 'Mauritius',
'mayotte' => 'Mayotte',
'mexico' => 'Mexico',
'micronesia-federated-states-of' => 'Micronesia, Federated States of',
'moldova-republic-of' => 'Moldova, Republic of',
'micronesiaFederatedStatesOf' => 'Micronesia, Federated States of',
'moldovaRepublicOf' => 'Moldova, Republic of',
'monaco' => 'Monaco',
'mongolia' => 'Mongolia',
'montenegro' => 'Montenegro',
@ -677,95 +677,95 @@ class Country extends BaseEnum
'nauru' => 'Nauru',
'nepal' => 'Nepal',
'netherlands' => 'Netherlands',
'new-caledonia' => 'New Caledonia',
'new-zealand' => 'New Zealand',
'newCaledonia' => 'New Caledonia',
'newZealand' => 'New Zealand',
'nicaragua' => 'Nicaragua',
'niger' => 'Niger',
'nigeria' => 'Nigeria',
'niue' => 'Niue',
'norfolk-island' => 'Norfolk Island',
'northern-mariana-islands' => 'Northern Mariana Islands',
'norfolkIsland' => 'Norfolk Island',
'northernMarianaIslands' => 'Northern Mariana Islands',
'norway' => 'Norway',
'oman' => 'Oman',
'pakistan' => 'Pakistan',
'palau' => 'Palau',
'palestine-state-of' => 'Palestine, State of',
'palestineStateOf' => 'Palestine, State of',
'panama' => 'Panama',
'papua-new-guinea' => 'Papua New Guinea',
'papuaNewGuinea' => 'Papua New Guinea',
'paraguay' => 'Paraguay',
'peru' => 'Peru',
'philippines' => 'Philippines',
'pitcairn' => 'Pitcairn',
'poland' => 'Poland',
'portugal' => 'Portugal',
'puerto-rico' => 'Puerto Rico',
'puertoRico' => 'Puerto Rico',
'qatar' => 'Qatar',
'reunion' => 'Réunion',
'romania' => 'Romania',
'russian-federation' => 'Russian Federation',
'russianFederation' => 'Russian Federation',
'rwanda' => 'Rwanda',
'saint-barthelemy' => 'Saint Barthélemy',
'saint-helena-ascension-and-tristan-da-cunha' => 'Saint Helena, Ascension and Tristan da Cunha',
'saint-kitts-and-nevis' => 'Saint Kitts and Nevis',
'saint-lucia' => 'Saint Lucia',
'saint-martin-french-part' => 'Saint Martin (French part)',
'saint-pierre-and-miquelon' => 'Saint Pierre and Miquelon',
'saint-vincent-and-the-grenadines' => 'Saint Vincent and the Grenadines',
'saintBarthelemy' => 'Saint Barthélemy',
'saintHelenaAscensionAndTristanDaCunha' => 'Saint Helena, Ascension and Tristan da Cunha',
'saintKittsAndNevis' => 'Saint Kitts and Nevis',
'saintLucia' => 'Saint Lucia',
'saintMartinFrenchPart' => 'Saint Martin (French part)',
'saintPierreAndMiquelon' => 'Saint Pierre and Miquelon',
'saintVincentAndTheGrenadines' => 'Saint Vincent and the Grenadines',
'samoa' => 'Samoa',
'san-marino' => 'San Marino',
'sao-tome-and-principe' => 'Sao Tome and Principe',
'saudi-arabia' => 'Saudi Arabia',
'sanMarino' => 'San Marino',
'saoTomeAndPrincipe' => 'Sao Tome and Principe',
'saudiArabia' => 'Saudi Arabia',
'senegal' => 'Senegal',
'serbia' => 'Serbia',
'seychelles' => 'Seychelles',
'sierra-leone' => 'Sierra Leone',
'sierraLeone' => 'Sierra Leone',
'singapore' => 'Singapore',
'sint-maarten-dutch-part' => 'Sint Maarten (Dutch part)',
'sintMaartenDutchPart' => 'Sint Maarten (Dutch part)',
'slovakia' => 'Slovakia',
'slovenia' => 'Slovenia',
'solomon-islands' => 'Solomon Islands',
'solomonIslands' => 'Solomon Islands',
'somalia' => 'Somalia',
'south-africa' => 'South Africa',
'south-georgia-and-the-south-sandwich-islands' => 'South Georgia and the South Sandwich Islands',
'south-sudan' => 'South Sudan',
'southAfrica' => 'South Africa',
'southGeorgiaAndTheSouthSandwichIslands' => 'South Georgia and the South Sandwich Islands',
'southSudan' => 'South Sudan',
'spain' => 'Spain',
'sri-lanka' => 'Sri Lanka',
'sriLanka' => 'Sri Lanka',
'sudan' => 'Sudan',
'suriname' => 'Suriname',
'svalbard-and-jan-mayen' => 'Svalbard and Jan Mayen',
'svalbardAndJanMayen' => 'Svalbard and Jan Mayen',
'swaziland' => 'Swaziland',
'sweden' => 'Sweden',
'switzerland' => 'Switzerland',
'syrian-arab-republic' => 'Syrian Arab Republic',
'taiwan-province-of-china' => 'Taiwan, Province of China',
'syrianArabRepublic' => 'Syrian Arab Republic',
'taiwanProvinceOfChina' => 'Taiwan, Province of China',
'tajikistan' => 'Tajikistan',
'tanzania-united-republic-of' => 'Tanzania, United Republic of',
'tanzaniaUnitedRepublicOf' => 'Tanzania, United Republic of',
'thailand' => 'Thailand',
'timor-leste' => 'Timor-Leste',
'timorLeste' => 'TimorLeste',
'togo' => 'Togo',
'tokelau' => 'Tokelau',
'tonga' => 'Tonga',
'trinidad-and-tobago' => 'Trinidad and Tobago',
'trinidadAndTobago' => 'Trinidad and Tobago',
'tunisia' => 'Tunisia',
'turkey' => 'Turkey',
'turkmenistan' => 'Turkmenistan',
'turks-and-caicos-islands' => 'Turks and Caicos Islands',
'turksAndCaicosIslands' => 'Turks and Caicos Islands',
'tuvalu' => 'Tuvalu',
'uganda' => 'Uganda',
'ukraine' => 'Ukraine',
'united-arab-emirates' => 'United Arab Emirates',
'united-kingdom' => 'United Kingdom',
'united-states' => 'United States',
'united-states-minor-outlying-islands' => 'United States Minor Outlying Islands',
'unitedArabEmirates' => 'United Arab Emirates',
'unitedKingdom' => 'United Kingdom',
'unitedStates' => 'United States',
'unitedStatesMinorOutlyingIslands' => 'United States Minor Outlying Islands',
'uruguay' => 'Uruguay',
'uzbekistan' => 'Uzbekistan',
'vanuatu' => 'Vanuatu',
'venezuela-bolivarian-republic-of' => 'Venezuela, Bolivarian Republic of',
'viet-nam' => 'Viet Nam',
'virgin-islands-british' => 'Virgin Islands, British',
'virgin-islands-us' => 'Virgin Islands, U.S.',
'wallis-and-futuna' => 'Wallis and Futuna',
'western-sahara' => 'Western Sahara',
'venezuelaBolivarianRepublicOf' => 'Venezuela, Bolivarian Republic of',
'vietNam' => 'Viet Nam',
'virginIslandsBritish' => 'Virgin Islands, British',
'virginIslandsUs' => 'Virgin Islands, U.S.',
'wallisAndFutuna' => 'Wallis and Futuna',
'westernSahara' => 'Western Sahara',
'yemen' => 'Yemen',
'zambia' => 'Zambia',
'zimbabwe' => 'Zimbabwe'

View file

@ -257,15 +257,6 @@ class ArcadiaMailDefault extends CrmClientModel
public function __construct(array $properties = [])
{
parent::__construct();
if (count(self::$validation['state_order']) < 2) {
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
self::$validation['state_order'][] = function ($attribute, $value, $fail) {
if (!is_object($value) or !\in_array($value, ArcadiaOrderType::toArray())) {
$type = \gettype($value);
$fail("State order ($type)$value is not in ArcadiaOrderType enum list");
}
};
}
$this->fill($properties);
return $this;
}
@ -315,9 +306,10 @@ class ArcadiaMailDefault extends CrmClientModel
{
if (isset($properties['state_order'])) {
try {
$properties['state_order'] = (\is_int($properties['state_order']) or
\ctype_digit($properties['state_order'])) ?
ArcadiaOrderType::make((int)$properties['state_order']) : $properties['state_order'];
$properties['state_order'] = (\is_object($properties['state_order']) and
get_class($properties['country']) === ArcadiaOrderType::class) ?
$properties['state_order']->value : (ctype_digit($properties['state_order']) ?
(int)$properties['state_order'] : $properties['state_order']);
} catch (TypeError $e) {
// cast anyway
$properties['state_order'] = (int)$properties['state_order'];

View file

@ -5,6 +5,7 @@ namespace LDC\LDCCRM\Models;
use LDC\LDCCRM\Enums\ApiStatus;
use LDC\LDCCRM\Enums\ArcadiaOrderType;
use LDC\LDCCRM\Utils;
use TypeError;
/**
* This class represents the customer info with
@ -263,6 +264,30 @@ class ArcadiaMailGame extends CrmClientModel
return $out;
}
/**
* Fill data into this model
* using validation rules
*
* @param array $properties
* @return void
* @throws TypeError if any valid is not validated
*/
public function fill(array $properties)
{
if (isset($properties['state_order'])) {
try {
$properties['state_order'] = (\is_object($properties['state_order']) and
get_class($properties['country']) === ArcadiaOrderType::class) ?
$properties['state_order']->value : (ctype_digit($properties['state_order']) ?
(int)$properties['state_order'] : $properties['state_order']);
} catch (TypeError $e) {
// cast anyway
$properties['state_order'] = (int)$properties['state_order'];
}
}
parent::fill($properties);
}
// PUBLIC METHODS
/**

View file

@ -7,6 +7,7 @@ use JsonSerializable;
use Kwaadpepper\Enum\BaseEnum;
use LDC\LDCCRM\Enums\ArcadiaOrderType;
use LDC\LDCCRM\Enums\Country;
use LDC\LDCCRM\Enums\QuestionType;
use LDC\LDCCRM\Exceptions\ValidationException;
use LDC\LDCCRM\Transport\ApiInterface;
use LDC\LDCCRM\Utils;
@ -122,6 +123,10 @@ abstract class CrmClientModel implements JsonSerializable
{
if (count($properties)) {
foreach ($properties as $field => $value) {
$type = $this->getPropType($field);
if (!$this->checkFieldType($type, $value)) {
throw new TypeError("Wrong type for $field");
}
$this->validateValue($field, $value);
$this->updatedValues[$field] = $value;
self::setRawProperty($this, $field, $value);
@ -204,6 +209,13 @@ abstract class CrmClientModel implements JsonSerializable
return \is_object($value) and (get_class($value) === Country::class or
\in_array(Country::class, \class_parents($value)));
}
case '\\' . QuestionType::class:
try {
$value = \is_int($value) ? QuestionType::make($value) : $value;
} finally {
return \is_object($value) and (get_class($value) === QuestionType::class or
\in_array(QuestionType::class, \class_parents($value)));
}
case '\\' . ArcadiaOrderType::class:
try {
$value = \is_int($value) ? ArcadiaOrderType::make($value) : $value;
@ -214,6 +226,8 @@ abstract class CrmClientModel implements JsonSerializable
case 'bool':
$value = \is_int($value) ? (bool)$value : $value;
return \is_bool($value);
case 'array':
return \is_array($value);
case 'string':
return \is_string($value);
case 'int':
@ -237,7 +251,8 @@ abstract class CrmClientModel implements JsonSerializable
$docComment = $propReflection->getDocComment();
preg_match_all('/@var ([\w_\x5c]+)/', $docComment, $matches);
if (isset($matches[1][0]) and in_array($matches[1][0], [
'string', 'int', 'bool', '\\' . Country::class, '\\' . ArcadiaOrderType::class
'string', 'int', 'bool', 'array', '\\' . Country::class, '\\' . ArcadiaOrderType::class,
'\\' . QuestionType::class
], true)) {
return $matches[1][0];
}

View file

@ -267,14 +267,14 @@ class Customer extends CrmClientModel
protected static $validation = [
'hashcode' => 'required|uuid',
'email' => 'required|email',
'firstname' => 'required|string|min:2|max:255',
'lastname' => 'required|string|min:2|max:255',
'firstname' => 'required|string|min:1|max:255',
'lastname' => 'required|string|min:1|max:255',
'password' => 'required|min:8|max:255|mixedCase|containDigit|containSymbol',
'birth_date' => 'required|date_format:Y-m-d',
'phone' => 'sometimes|string|min:10|max:255',
'phone' => 'sometimes|string|max:255',
'address' => 'sometimes|string|max:255',
'address2' => 'sometimes|string|max:255',
'city' => 'sometimes|string|max:255',
'city' => 'sometimes|string|min:2|max:255',
'postcode' => 'sometimes|string|max:255',
'country' => ['sometimes'],
'opt_in' => 'required|bool',
@ -285,15 +285,6 @@ class Customer extends CrmClientModel
public function __construct(array $properties = [])
{
parent::__construct();
if (!is_array(self::$validation['password'])) {
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
self::$validation['country'][] = function ($attribute, $value, $fail) {
if (!is_object($value) or !\in_array($value, Country::toArray())) {
$type = \gettype($value);
$fail("Country ($type)$value is not in Country enum list");
}
};
}
$this->fill($properties);
return $this;
}
@ -343,8 +334,10 @@ class Customer extends CrmClientModel
{
if (isset($properties['country'])) {
try {
$properties['country'] = (\is_int($properties['country']) or \ctype_digit($properties['country'])) ?
Country::make((int)$properties['country']) : $properties['country'];
$properties['country'] = (\is_object($properties['country']) and
get_class($properties['country']) === Country::class) ?
$properties['country']->value : (ctype_digit($properties['country']) ?
(int)$properties['country'] : $properties['country']);
} catch (TypeError $e) {
// cast anyway
$properties['country'] = (int)$properties['country'];

View file

@ -25,13 +25,6 @@ use TypeError;
class Question extends CrmClientModel
{
/**
* Is true if this model was not filled from crm
*
* @var boolean
*/
private $isNew = true;
/**
* The question id
*
@ -68,7 +61,9 @@ class Question extends CrmClientModel
/**
* The question answers
*
* @var \LDC\LDCCRM\Models\Answer[]
* \LDC\LDCCRM\Models\Answer
*
* @var array
*/
private $answers = [];
@ -96,15 +91,6 @@ class Question extends CrmClientModel
public function __construct(array $properties = [])
{
parent::__construct();
if (count(self::$validation['type']) < 2) {
// phpcs:ignore Generic.CodeAnalysis.UnusedFunctionParameter.FoundInExtendedClassBeforeLastUsed
self::$validation['type'][] = function ($attribute, $value, $fail) {
if (!is_object($value) or !\in_array($value, QuestionType::toArray())) {
$type = \gettype($value);
$fail("Question type ($type)$value is not in QuestionType enum list");
}
};
}
$this->fill($properties);
return $this;
}
@ -154,8 +140,10 @@ class Question extends CrmClientModel
{
if (isset($properties['type'])) {
try {
$properties['type'] = (\is_int($properties['type']) or \ctype_digit($properties['type'])) ?
QuestionType::make((int)$properties['type']) : $properties['type'];
$properties['type'] = (\is_object($properties['type']) and
get_class($properties['type']) === QuestionType::class) ?
$properties['type']->value : (ctype_digit($properties['type']) ?
(int)$properties['type'] : $properties['type']);
} catch (TypeError $e) {
// cast anyway
$properties['type'] = (int)$properties['type'];