Announcement

Collapse
No announcement yet.

Write and Read from $::Session

Collapse
X
 
  • Filter
  • Time
  • Show
Clear All
new posts

    #16
    Here you go guys

    Go to Session.pm file, which is located under Original.

    We'll requre to edit some field, to be able read and write values from the xml and store it in session, for further processing:

    starting from line: 30
    # XML main entry names
    #
    $Session::XML_ROOT = 'SessionFile'; # the root XML entry
    $Session::XML_URLINFO = 'URLInfo';
    $Session::XML_CHECKOUTINFO = 'CheckoutInfo';
    $Session::XML_SHOPPINGCART = 'ShoppingCart';

    add your own XML_NODE, where you'll be locating your values, I potentially required to store Client's Credit Card details, thus I named it:

    $Session::XML_CCDETAILS = "CCDetails";

    then in Init Base structure, line 138
    add your initialization of the node
    $Self->{_SESSIONINFO}->SetTextNode($Session::XML_CCDETAILS, "");

    then you need to creat a function, which will return you the node object, we need our node XML_CCDETAILS, thus add anywhere

    sub GetCCInfo
    {
    my $Self = shift;
    return $Self->{_SESSIONINFO}->GetChildNode($Session::XML_CCDETAILS);
    }

    and we need to write two other functions, for writing and reading, which will be storing our values under XML_CCDETAILS node, and retrieve them later.

    Writing function:


    sub SetCCValue
    {
    my $Self = shift;
    my $CCParam = shift;
    my $CCValue = shift;

    $Self->GetCCInfo()->SetTextNode($CCParam, $CCValue);
    }

    as you see, takes two arguments, CCParam , which is the name of the param, and CCValue - Value of the object.

    To retrieve your values, we need to create read function:

    sub GetCCValue
    {
    my $Self = shift;
    my $CCParam = shift;
    my $CCValue = $Self->GetCCInfo()->GetChildNode($CCParam)->GetNodeValue();
    return $CCValue;
    }

    you can add additional checkings for pottnetional null and etc.

    That's it, that all changes you are making to Session.pl, then at any place, in OrderScripting, or PSP templates, you have an access to $::Session
    because it is initialized by Actinic, and is Global.

    So, to Store the values we need, just simply writing:

    $::Session->SetCCValue('CCNumber','1231231232');
    $::Session->SetCCValue('TEST1','one two three');
    $::Session->SetCCValue('TEST2','gold');

    you'll have this values in your *.session file:
    <CCDetails>
    <CCNumber>1231231232</CCNumber>
    <TEST1>one two three</TEST1>
    <TEST2>gold</TEST2>
    </CCDetails>


    to retrieve them back:

    use my $variable = $::Session->GetCCValue('CCNumber');
    where $variable will have the value 1231231232;

    YOu can do encryption and whatever you want. So Use it

    And remember, try do the minimum changes in system files, 'cause this potentially gives you the possibilty to experience troubles after updating Actinic version.

    Comment


      #17
      This is very interesting but I'm concerned as to how this may affect PCI-DSS compliance by saving credit card info on the hosting server, as well of course with what is done with the information later and how it is managed.

      Comment


        #18
        3D Security payment

        Well I agree with you in some part, but when you'll be implementing 3d security payment integration, you'll have to store all this details in your system, cause this system requires several request with the same data to be posted, you don't want a user to enter his CC details twice, you can encrypt the information in the xml, also you can erase it after transaction - whether it's successfull or not.

        Comment


          #19
          What is your purpose for needing to do this? Are you writing a PSP integration that is not supported by Actinic that doesn't support 3D? Most PSPs support 3D already within their own systems.

          Comment


            #20
            Definitely.

            Comment

            Working...
            X