internetee-registry/app/controllers/repp/v1
oleghasjanov 618f2f5aed Fix: Align domain contact duplication logic and notifications
This commit refines the contact duplication checks and notification messages for domain creation and updates, ensuring consistency and addressing a bug in domain updates.

**Key Changes:**

*   **Consistent Duplicate Contact Handling:**
    *   The `check_for_cross_role_duplicates`, `remove_duplicate_contacts`, and `duplicate_contact?` methods are now more closely aligned between `DomainCreate` and `DomainUpdate` interactors.
    *   `DomainUpdate` now correctly uses `admin_contact_ids=` and `tech_contact_ids=` to assign filtered contacts. This resolves a `PG::UniqueViolation` error that occurred when trying to re-associate existing contacts using `_attributes=` methods.
    *   The `duplicate_contact?` method in `DomainCreate` was updated to match `DomainUpdate`, primarily checking for semantic duplicates based on attributes (name, ident, email, phone) rather than also including a `contact.code` check, which is more suitable for cross-role duplication.

*   **Standardized Notification Messages:**
    *   The `notify_about_removed_duplicates` method in both interactors now generates a more concise message: ". [Role] contact [CODE] was discarded as duplicate;" for each discarded contact.
    *   This message is appended to `domain.skipped_domain_contacts_validation`.

*   **EPP & REPP Response Updates:**
    *   The `message` method in `Repp::V1::DomainsController` now correctly appends `domain.skipped_domain_contacts_validation` to the "Command completed successfully" message, ensuring it appears in REPP JSON responses for both create and update.
    *   The EPP XML views (`app/views/epp/domains/create.xml.builder` and `app/views/epp/domains/success.xml.builder`) are updated to dynamically include `domain.skipped_domain_contacts_validation` in the `<msg>` tag.

*   **Model Attribute:**
    *   Added `skipped_domain_contacts_validation` as a string attribute to the `Domain` model to store these notification messages.

*   **Test Refinements (Implicit):**
    *   The related test suite for domain updates (`test/integration/epp/domain/base_test.rb`) was being updated to reflect these logic changes and assert the correct notification messages.

These changes improve the robustness and consistency of contact management during domain operations, providing clearer feedback to users about discarded duplicate contacts.
2025-07-31 14:03:29 +03:00
..
certificates feat: Implement P12 certificate generation improvements 2025-04-16 11:47:52 +03:00
domains Fixed domain add/remove contacts endpoints 2022-11-04 12:48:20 +02:00
registrar Fix poll messages crashing 2024-10-15 15:13:46 +03:00
accounts_controller.rb Added committed param to white ip 2023-07-07 16:05:06 +03:00
api_users_controller.rb Added endpoints for creating and downloading api user certificates 2023-06-28 15:48:40 +03:00
auctions_controller.rb Add response to REPP log 2020-11-17 13:00:47 +02:00
base_controller.rb fixed tests 2025-04-16 11:47:52 +03:00
certificates_controller.rb refactoring 2025-04-22 11:18:18 +03:00
contacts_controller.rb Merge pull request #2741 from internetee/disclose-phone-num-for-org-registrants 2025-01-31 17:52:57 +02:00
domains_controller.rb Fix: Align domain contact duplication logic and notifications 2025-07-31 14:03:29 +03:00
invoices_controller.rb Added endpoints for creating and downloading api user certificates 2023-06-28 15:48:40 +03:00
retained_domains_controller.rb Add response to REPP log 2020-11-17 13:00:47 +02:00
stats_controller.rb Improved stats query 2023-12-21 17:26:01 +02:00
white_ips_controller.rb Add admin mailers and tests to white_ips 2023-07-10 09:51:56 +03:00