Skip to content

Commit 4b262a5

Browse files
committed
Merge branch 'INTGRTNS-525-WHMCS-Domain-Module-Add-.RU-new-customer-Additional-data-Fields-Config' into INTGRTNS-526-REST-Client-PHP-Update-rest-client-php-library-for-new-.RU-customer-additional-data-fields
2 parents f1cbf49 + c1ba853 commit 4b262a5

2 files changed

Lines changed: 49 additions & 33 deletions

File tree

modules/registrars/openprovider/Controllers/Hooks/ShoppingCartController.php

Lines changed: 42 additions & 26 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,22 @@ class ShoppingCartController
1414
private const IN_NEXUS_DECLARATION_INDEX = 0;
1515

1616
// .RU / .xn--p1ai field indices
17-
private const RU_CONTACT_TYPE_INDEX = 8; // Contact Type (display only)
18-
private const RU_REGISTRANT_RESIDENCY_INDEX = 9; // Registrant Residency (display only)
19-
private const RU_MOBILE_PHONE_COUNTRY_CODE_INDEX = 10; // all
20-
private const RU_MOBILE_PHONE_NUMBER_INDEX = 11; // all
21-
private const RU_POSTAL_ADDRESS_CITY_INDEX = 12; // all
22-
private const RU_FIRST_NAME_CYRILLIC_INDEX = 18; // individual + ru
23-
private const RU_LAST_NAME_CYRILLIC_INDEX = 20; // individual + ru
24-
private const RU_COMPANY_NAME_CYRILLIC_INDEX = 32; // company + ru
25-
private const RU_COMPANY_NAME_LATIN_INDEX = 33; // company
26-
private const RU_LEGAL_ADDRESS_COUNTRY_CODE_INDEX = 34; // company
27-
private const RU_LEGAL_ADDRESS_POSTAL_CODE_INDEX = 35; // company
28-
private const RU_LEGAL_ADDRESS_CITY_INDEX = 36; // company
17+
private const RU_CONTACT_TYPE_INDEX = 8; // Contact Type (display only)
18+
private const RU_REGISTRANT_RESIDENCY_INDEX = 9; // Registrant Residency (display only)
19+
private const RU_MOBILE_PHONE_COUNTRY_CODE_INDEX = 10; // Mobile Phone CC all
20+
private const RU_MOBILE_PHONE_NUMBER_INDEX = 11; // Mobile Phone Number all
21+
private const RU_POSTAL_ADDRESS_CITY_INDEX = 12; // Postal Address City all
22+
private const RU_PASSPORT_SERIES_INDEX = 24; // Passport Series individual
23+
private const RU_PASSPORT_NUMBER_INDEX = 25; // Passport Number individual
24+
private const RU_PASSPORT_ISSUER_INDEX = 26; // Passport Issuer individual
25+
private const RU_PASSPORT_ISSUE_DATE_INDEX = 27; // Passport Issue Date individual
26+
private const RU_BIRTH_DATE_INDEX = 30; // Birth Date individual
27+
private const RU_COMPANY_NAME_CYRILLIC_INDEX = 32; // Company Name Cyrillic company + ru
28+
private const RU_COMPANY_NAME_LATIN_INDEX = 33; // Company Name Latin company
29+
private const RU_LEGAL_ADDRESS_COUNTRY_CODE_INDEX = 34; // Legal Address CC company
30+
private const RU_LEGAL_ADDRESS_POSTAL_CODE_INDEX = 35; // Legal Address PostCode company
31+
private const RU_LEGAL_ADDRESS_CITY_INDEX = 36; // Legal Address City company
32+
private const RU_TAX_PAYER_NUMBER_COMPANY_INDEX = 42; // Tax Payer Number INN company
2933

3034
private static array $itFieldsMap = [
3135
7 => 'companyRegistrationNumber',
@@ -263,10 +267,10 @@ private function validateRuContactTypeAtCheckout(array $vars): ?array
263267
$contactType = $effectiveContactType;
264268
}
265269

266-
// Validate shared mandatory fields (all contact types, all residencies)
270+
// [10–12] Starred fields: all contact types, all residencies
267271
$mobileCountryCode = trim((string) ($fields[self::RU_MOBILE_PHONE_COUNTRY_CODE_INDEX] ?? ''));
268-
$mobilePhoneNumber = trim((string) ($fields[self::RU_MOBILE_PHONE_NUMBER_INDEX] ?? ''));
269-
$postalCity = trim((string) ($fields[self::RU_POSTAL_ADDRESS_CITY_INDEX] ?? ''));
272+
$mobilePhoneNumber = trim((string) ($fields[self::RU_MOBILE_PHONE_NUMBER_INDEX] ?? ''));
273+
$postalCity = trim((string) ($fields[self::RU_POSTAL_ADDRESS_CITY_INDEX] ?? ''));
270274

271275
if ($mobileCountryCode === '' || $mobilePhoneNumber === '' || $postalCity === '') {
272276
$cartUrl = rtrim(Setting::getValue('SystemURL'), '/') . '/cart.php?a=confdomains';
@@ -276,36 +280,48 @@ private function validateRuContactTypeAtCheckout(array $vars): ?array
276280
];
277281
}
278282

279-
// Individual + Russian resident: First and Last Name in Cyrillic are required
280-
if ($contactType === 'individual' && $residency === 'ru') {
281-
$firstNameCyrillic = trim((string) ($fields[self::RU_FIRST_NAME_CYRILLIC_INDEX] ?? ''));
282-
$lastNameCyrillic = trim((string) ($fields[self::RU_LAST_NAME_CYRILLIC_INDEX] ?? ''));
283-
284-
if ($firstNameCyrillic === '' || $lastNameCyrillic === '') {
283+
// [24–28, 30] Starred fields: individual contacts (any residency)
284+
if ($contactType === 'individual') {
285+
$passportSeries = trim((string) ($fields[self::RU_PASSPORT_SERIES_INDEX] ?? ''));
286+
$passportNumber = trim((string) ($fields[self::RU_PASSPORT_NUMBER_INDEX] ?? ''));
287+
$passportIssuer = trim((string) ($fields[self::RU_PASSPORT_ISSUER_INDEX] ?? ''));
288+
$passportIssueDate = trim((string) ($fields[self::RU_PASSPORT_ISSUE_DATE_INDEX] ?? ''));
289+
$birthDate = trim((string) ($fields[self::RU_BIRTH_DATE_INDEX] ?? ''));
290+
291+
if (
292+
$passportSeries === '' || $passportNumber === '' || $passportIssuer === ''
293+
|| $passportIssueDate === '' || $birthDate === ''
294+
) {
285295
$cartUrl = rtrim(Setting::getValue('SystemURL'), '/') . '/cart.php?a=confdomains';
286296
return [
287-
'error' => 'To register ' . $domainName . ' as a Russian resident individual, First Name and Last Name in Cyrillic are required. '
297+
'error' => 'To register ' . $domainName . ' as an Individual, Passport Series, Passport Number, Passport Issuer, '
298+
. 'Passport Issue Date, and Birth Date are required. '
288299
. 'Please <a href="' . $cartUrl . '">go back to the domain configuration step</a> and fill in the required fields.',
289300
];
290301
}
291302
}
292303

293-
// Company contacts: Latin name and legal address are required (all residencies)
304+
// [33–36, 42] Starred fields: company contacts (any residency)
294305
if ($contactType === 'company') {
295306
$companyNameLatin = trim((string) ($fields[self::RU_COMPANY_NAME_LATIN_INDEX] ?? ''));
296307
$legalCountryCode = trim((string) ($fields[self::RU_LEGAL_ADDRESS_COUNTRY_CODE_INDEX] ?? ''));
297308
$legalPostalCode = trim((string) ($fields[self::RU_LEGAL_ADDRESS_POSTAL_CODE_INDEX] ?? ''));
298309
$legalCity = trim((string) ($fields[self::RU_LEGAL_ADDRESS_CITY_INDEX] ?? ''));
310+
$taxPayerNumber = trim((string) ($fields[self::RU_TAX_PAYER_NUMBER_COMPANY_INDEX] ?? ''));
299311

300-
if ($companyNameLatin === '' || $legalCountryCode === '' || $legalPostalCode === '' || $legalCity === '') {
312+
if (
313+
$companyNameLatin === '' || $legalCountryCode === '' || $legalPostalCode === ''
314+
|| $legalCity === '' || $taxPayerNumber === ''
315+
) {
301316
$cartUrl = rtrim(Setting::getValue('SystemURL'), '/') . '/cart.php?a=confdomains';
302317
return [
303-
'error' => 'To register ' . $domainName . ' as a Company, Company Name (Latin), Legal Address Country Code, Postal Code, and City are required. '
318+
'error' => 'To register ' . $domainName . ' as a Company, Company Name (Latin), Legal Address Country Code, '
319+
. 'Postal Code, City, and Tax Payer Number (INN) are required. '
304320
. 'Please <a href="' . $cartUrl . '">go back to the domain configuration step</a> and complete the required Company fields.',
305321
];
306322
}
307323

308-
// Company + Russian resident: Company Name in Cyrillic is additionally required
324+
// [32] Company Name in Cyrillic additionally required for Russian residents
309325
if ($residency === 'ru') {
310326
$companyNameCyrillic = trim((string) ($fields[self::RU_COMPANY_NAME_CYRILLIC_INDEX] ?? ''));
311327

modules/registrars/openprovider/configuration/additionalfields.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -309,7 +309,7 @@ function op_addConsentField(array &$additionaldomainfields, string $tld, bool $r
309309

310310
// --- Individual-only fields ---
311311
[
312-
"Name" => "First Name in Cyrillic (Individual – Russian) *",
312+
"Name" => "First Name in Cyrillic (Individual – Russian)",
313313
"LangVar" => "ruFirstNameCyrillic",
314314
"Type" => "text",
315315
"Required" => false,
@@ -331,7 +331,7 @@ function op_addConsentField(array &$additionaldomainfields, string $tld, bool $r
331331
"op_name" => "middleNameCyrillic",
332332
],
333333
[
334-
"Name" => "Last Name in Cyrillic (Individual – Russian) *",
334+
"Name" => "Last Name in Cyrillic (Individual – Russian)",
335335
"LangVar" => "ruLastNameCyrillic",
336336
"Type" => "text",
337337
"Required" => false,
@@ -375,7 +375,7 @@ function op_addConsentField(array &$additionaldomainfields, string $tld, bool $r
375375
"op_name" => "lastNameLatin",
376376
],
377377
[
378-
"Name" => "Passport Series (Individual)",
378+
"Name" => "Passport Series (Individual) *",
379379
"LangVar" => "ruPassportSeries",
380380
"Type" => "text",
381381
"Required" => false,
@@ -386,7 +386,7 @@ function op_addConsentField(array &$additionaldomainfields, string $tld, bool $r
386386
"op_name" => "passportSeries",
387387
],
388388
[
389-
"Name" => "Passport Number (Individual)",
389+
"Name" => "Passport Number (Individual) *",
390390
"LangVar" => "ruPassportNumber",
391391
"Type" => "text",
392392
"Required" => false,
@@ -397,7 +397,7 @@ function op_addConsentField(array &$additionaldomainfields, string $tld, bool $r
397397
"op_name" => "passportNumber",
398398
],
399399
[
400-
"Name" => "Passport Issuer (Individual)",
400+
"Name" => "Passport Issuer (Individual) *",
401401
"LangVar" => "ruPassportIssuer",
402402
"Type" => "text",
403403
"Required" => false,
@@ -408,7 +408,7 @@ function op_addConsentField(array &$additionaldomainfields, string $tld, bool $r
408408
"op_name" => "passportIssuer",
409409
],
410410
[
411-
"Name" => "Passport Issue Date (Individual)",
411+
"Name" => "Passport Issue Date (Individual) *",
412412
"LangVar" => "ruPassportIssueDate",
413413
"Type" => "text",
414414
"Required" => false,
@@ -441,7 +441,7 @@ function op_addConsentField(array &$additionaldomainfields, string $tld, bool $r
441441
"op_name" => "passportExpiryDate",
442442
],
443443
[
444-
"Name" => "Birth Date (Individual)",
444+
"Name" => "Birth Date (Individual) *",
445445
"LangVar" => "ruBirthDate",
446446
"Type" => "text",
447447
"Required" => false,

0 commit comments

Comments
 (0)