Domain Plugin Question

Discussion in 'Installation and "How-To" Questions' started by AlexsanderR, May 3, 2015.

  1. AlexsanderR

    AlexsanderR Kilo Poster

    Messages:
    56
    Hi,

    We've implemented OBAS plugin for domain name registration and need to inform an additional data to Registrar which is registered on customer creation.
    We've modified the shop webpage in order to store it on account information without the need of presenting the option to customer to edit the forms for contact creation, since we will be using the account information and default contact creation in order to simplify theirs domain registrations.

    (Nevertheless, we have created the form handling for the contact creation for registrations from the OBAS, which works fine, there we're able to store the contacts_extdata and use it properly.)

    Now we are having the following issue:

    Although the original contact contains the information needed for registration (in account_ext_attr field, and in vat_number (not used), too, just for safe...) as we can see on the validate_data log below, it seems it is not the same parameter passed to register_domain where some data is missing, avoiding the correct registration:

    Validation function:

    [2015/05/03 15:46:50] [INFO] [4801] [HSPC::MT::plugin::DM::Sul::validate_data] Passou por validate_data: $VAR1 = [
    'domain',
    'teste55.com.br',
    'action',
    'register',
    'contacts',
    {
    'owner' => {
    'org_name' => 'Sr. Alex Ruiz',
    'is_corporate' => '0',
    'fname' => 'Alex',
    'state' => 'PR',
    'email' => 'my.email@gmail.com',
    'city' => 'Curitiba',
    'fax' => '|||',
    'address' => 'Francisco',
    'gender' => 'M',
    'country' => 'BR',
    'vat_number' => '709.787.869-04',
    'account_ext_attr' => {
    'br_customer_document' => '709.787.869-04'
    },
    'house_num' => '',
    'phone' => '55|41|99999999|',
    'house_suff' => '',
    'address2' => '123',
    'zip' => '83030-290',
    'lname' => 'Ruiz'
    }
    },
    'contacts_ids',
    {
    'owner' => undef
    },
    'contacts_extdata',
    {
    'owner' => {}
    },
    'domain_extdata',
    undef,
    'config',
    {

    ...Registration function

    [2015/05/03 15:47:22] [INFO] [4801] [HSPC::MT::plugin::DM::Sul::register_domain] $VAR1 = [
    'domain',
    'teste55.com.br',
    'period',
    1,
    'nses',
    [
    {
    'ip' => '177.21.244.118',
    'hostname' => 'dn1.hostgenio.com.br'
    },
    {
    'ip' => '177.21.244.119',
    'hostname' => 'dn2.hostgenio.com.br'
    }
    ],
    'contacts',
    {
    'owner' => {
    'org_name' => 'Sr. Alex Ruiz',
    'is_corporate' => '0',
    'fname' => 'Alex',
    'state' => 'PR',
    'email' => 'my.email@gmail.com',
    'city' => 'Curitiba',
    'fax' => '|||',
    'address' => 'Francisco Dalla',
    'gender' => undef,
    'country' => 'BR',
    'vat_number' => undef,
    'account_ext_attr' => undef,
    'house_num' => undef,
    'phone' => '55|41|99999999|',
    'house_suff' => undef,
    'address2' => undef,
    'zip' => '83030-290',
    'lname' => 'Ruiz'
    }
    },
    'contacts_extdata',
    {
    'owner' => undef
    },
    'contacts_ids',
    {
    'owner' => '160'
    },
    'domain_extdata',
    undef,
    'config',
    {


    Please, observe some fields are undef (like vat_number and address2 among others) if compared to the same contact observed on the validation function.

    Please, let me know any hint on how to continue this analysis. I'm really stuck on this now.

    If it's more complicated and too specific for the forum, please let me know if a need to open a ticket.

    Thanks,
    Alex
     
  2. Vadim Ivanov

    Vadim Ivanov Kilo Poster

    Messages:
    36
    Dear Alex,

    In the Plug-ins Development of the OBAS SDK you can find the base contact fields that are processed and saved in 'contacts' structure during the domain registration. All the additional contact information should be stored in contacts_extdata structure, these are address2 and vat_number in your case.
     
  3. AlexsanderR

    AlexsanderR Kilo Poster

    Messages:
    56
    Hi Vadim,

    Thanks a lot for your quick answer.

    Actually, we are storing the additional information into the contacts_extdata field using the edit_contact_form and collect_contacts_data, what works fine when the contact is created via the OBAS panel at a domain registration.

    The problem is on the store...
    I`d like to create the default contact which will be used to register the domain with the contacts_extdata filled with two extra information from the account (which are extended attributes form the account, too), but I'm not certain where this could be done.

    The idea is to keep it transparent to customer, in order to reduce complexity on registration. Since the customer already provided the parameters on the account creation.

    I believe it would be on the plan_configuration.html.php, on function add_new_contact(json), but have no idea how.

    Maybe if you could get some snippet or example on how to start this, it would help a lot. :)

    So, please, let me know if you need something else for better understanding the issue and help me to go further on this.

    Thanks,
    Alex
     
  4. Vadim Ivanov

    Vadim Ivanov Kilo Poster

    Messages:
    36
    Alex,

    Account extended attributes for a contact are not filled when the register_domain() function is called. We submitted the Feature request that will be implemented in OBAS 4.6 release.
    As a workaround you can store data from account_ext_attr to the contacts_extdata upon contact creating to get them back in register_domain().
     
    Last edited: May 6, 2015
  5. AlexsanderR

    AlexsanderR Kilo Poster

    Messages:
    56
    Hi Vadim,

    Thanks again.

    Please, could you point out (a code snippet would help) on which part of the process I'd copy it (and have access to it) because I've attempted this on different moments of registration with no success. Should this be done on the plugin functions or on the store webpage php files?

    Thanks,
    Alex
     
  6. Vadim Ivanov

    Vadim Ivanov Kilo Poster

    Messages:
    36
    Alex,

    Contacts data and contacts ext data are saved in collect_contacts_data() function of your plugin presentation module. You collect the form values and assign the required params to contacts_extdata hash. Further your saved data will be available in register_domain() function in contacts_extdata input parameter. See any domain plugin as an example.
     
  7. AlexsanderR

    AlexsanderR Kilo Poster

    Messages:
    56
    Hi Vadim,

    The problem is that the collect_contacts_data() is only called if a contact is created or updated (the contacts_extdata is filled there). If the owner is used, it is not called.
    Is another place on the store we can force the call of the collect_contacts_data()?

    Thanks,
    Alex
     
  8. Vadim Ivanov

    Vadim Ivanov Kilo Poster

    Messages:
    36
    Alex, please explain what do you mean?
     
  9. AlexsanderR

    AlexsanderR Kilo Poster

    Messages:
    56
    Hi Vadim,

    That means that on the domain registration the option of using account contact is selected (actually its radio is selected by default). The owner contact is used and the form for contact creation is not called, hence the collect_contacts_data() is not called, as well. So, at least it is what I can see from the hspc logs (I've debug level activated).
     
  10. Vadim Ivanov

    Vadim Ivanov Kilo Poster

    Messages:
    36
    I see, you mean "Use my account data for all domain contacts" option. I confused it with the owner contact type.
    However the validate_data() is called anyway. Here you can save account_ext_attr to contacts_extdata by calling the set_contact_extdata().
     
  11. AlexsanderR

    AlexsanderR Kilo Poster

    Messages:
    56
    Hi Vadim,

    Yes, I thought it, too! :)
    I did it, but it didn't work, with no clue on logs.
    Maybe I'm using it on the wrong way.

    Please, could you give some example of the set_contact_extdata() on a working snippet code?

    Thanks,
    Alex
     
  12. AlexsanderR

    AlexsanderR Kilo Poster

    Messages:
    56
    Hi Vadim,

    I believe it should be something like this, right?
    Code:
            $contact_extdata->{addressn} = $addressn;
            $contact_extdata->{addressc} = '';
            $contact_extdata->{br_customer_document} = $br_customer_document;
    
            #Store Contact Extended Data
            set_contact_extdata (domain=>$domain, contact_type=>'owner', contact_extdata=>$contact_extdata);
    
            #log("Error List: ".Dumper($error_list));
        log("Leaving validate_data: ".Dumper(\@_));
    
    I'm having some issues on my test bet to test it now, but I believe it should work, right?

    Thanks,
    Alex
     
  13. Vadim Ivanov

    Vadim Ivanov Kilo Poster

    Messages:
    36
    Hi Alex,

    Yes all right, it should work.
     
  14. AlexsanderR

    AlexsanderR Kilo Poster

    Messages:
    56
    Hi Vadim,

    Unfortunately it didn't work.

    On calling set_contact_extdata() the validate_data() is interrupted, affecting even the purchase process (store stuck on closing the cart).

    Here the result on hspc.log

    [2015/05/08 19:26:03] [DEBUG] [6627] [HSPC::MT::DM::ContactsFactory::_find_plugin_by_hp_and_domain] TRACE [02]: . -> HSPC::MT::DM::ContactsFactory->_find_plugin_by_hp_and_domain ()
    [2015/05/08 19:26:03] [DEBUG] [6627] [HSPC::Logger::sw_trace] TRACE [02]: . +> HSPC::MT::DM::ContactsFactory->find_contact_extdata ()
    [2015/05/08 19:26:03] [DEBUG] [6627] [HSPC::MT::DM::ContactsFactory::find_contact_extdata] TRACE [02]: . -> HSPC::MT::DM::ContactsFactory->find_contact_extdata ()
    [2015/05/08 19:26:03] [INFO] [6627] [HSPC::MT::plugin::DM::Sul::validate_data] $VAR1 = undef;

    [2015/05/08 19:26:03] [INFO] [6627] [HSPC::MT::plugin::DM::Sul::validate_data] Before calling set_contact_extdata for domain:'xyzxyz.edu.br'
    [2015/05/08 19:26:03] [INFO] [6627] [HSPC::MT::plugin::DM::Sul::validate_data] $VAR1 = {
    'addressc' => '',
    'addressn' => '362',
    'br_customer_document' => '709.787.869-04'
    };

    [2015/05/08 19:26:03] [DEBUG] [6627] [SOAP::Server::handle] TRACE [01]: -> HSPC::MT::DM::ContactsFactory->validate_data_for_domain ()


    Here the code snippet:
    Code:
        $contact_extdata->{addressn} = $addressn;
        $contact_extdata->{addressc} = '';
        $contact_extdata->{br_customer_document} = $br_customer_document;
    
        log("Before calling set_contact_extdata for domain:'$domain'");
        log(Dumper($contact_extdata));
           
        #Store Contact Extended Data
        set_contact_extdata (domain=>$domain, contact_type=>'owner', contact_extdata=>$contact_extdata);
    
        #log("Error List: ".Dumper($error_list));
        log("Leaving validate_data: ".Dumper(\@_));
       
        return {
            is_valid         => @{$error_list} eq 0,
            error_list     => $error_list,
        };
    If you want, I can send you the implementation, privately.

    Thanks,
    Alex
     
  15. AlexsanderR

    AlexsanderR Kilo Poster

    Messages:
    56
    Hi Vadim,

    With set_domain_extdata() same issue. Data is not stored and validate_data() aborts, with no error.

    Code:
        $my_domain_extdata->{addressn} = $addressn;
        $my_domain_extdata->{addressc} = '';
        $my_domain_extdata->{br_customer_document} = $br_customer_document;
    
        log("Before calling set_domain_extdata for domain:'$domain'");
        log(Dumper($my_domain_extdata));
       
        #Store Domain Extended Data
        set_domain_extdata (domain=>$domain, domain_extdata=>$my_domain_extdata);
    
    Do you think it is a bug on API or something is missing on code?

    BTW, reference is added at the beginning of file:
    Code:
    use HSPC::PluginToolkit::DM qw(get_domain_extdata set_domain_extdata get_contact set_contact_extdata);
    
    Thanks,
    Alex
     
  16. AlexsanderR

    AlexsanderR Kilo Poster

    Messages:
    56
    Hi! Any tip?

    Thanks,
    Alex
     
  17. AlexsanderR

    AlexsanderR Kilo Poster

    Messages:
    56
    Hello!

    Anyone can give a help here?
    Should I open a bug for this?
     
  18. Vadim Ivanov

    Vadim Ivanov Kilo Poster

    Messages:
    36
    Hi Alex,
    I'm afraid it is not possible to save contact extdata when there is not yet domain record in data base. So it occurs on the first validation step.
    Please wait till the 4.6 OBAS release where we add filling the account_ext_attr on register_domain() call.
     
  19. AlexsanderR

    AlexsanderR Kilo Poster

    Messages:
    56
    Hi Vadim,

    Thank you for the answer.

    Please, is there a forecast for 4.6 release?
     
  20. FedorK

    FedorK Mega Poster

    Messages:
    224
    Hello,
    We expect release 4.6 version in Q3 2015.

    Thank you.
     

Share This Page