Results 1 to 2 of 2
  1. #1
    Join Date
    Jun 2005
    Posts
    11
    Plugin Contributions
    0

    Default AuthorizeNet_AIM emulator/eprocessingnetwork observer plugin problem

    PHP 8.2 if that matters. USPS plugin installed.

    I just upgraded to 2.0.1 so I thought I would try to reset the credit card processor and do it the right way, as I've had a variety of plugins over the years. I removed all old plugins (ceon, etc) and so just have the base authorizenet_aim plugin activated and configured.

    Following directions from a comment within the plugin, it directed me to create an observer:
    Code:
    +++ includes/classes/observers/auto.authorizenet_aim.php
    <?php
    // An auto-loaded observer that enables switching processor to eprocessingnetwork
    class zcObserverAuthorizenetAim extends base{
      public function __construct(){
        $this->attach($this, array('NOTIFY_PAYMENT_AUTHNET_MODE_SELECTION'));
      }
    
      public function update(&$class, $eventID, $mode, &$p2, &$p3, &$p4, &$p5, &$p6, &$p7){
        error_log(print_r($class, true) . "\neventid".print_r($eventID, true). "\np2:".print_r($p2, true)."\nmode:".print_r($mode, true));
    
        if($eventID != "NOTIFY_PAYMENT_AUTHNET_MODE_SELECTION")
          return;
        
        if($mode == "AIM")
            $mode = "eProcessing";
      }
    }

    The problem is that the $mode parameter is read-only (even if I add an &) and the $class->mode variable is private, so the comment in the authorizenet_aim module appears to be incorrect.

    I can get it to work if I modify the core code directly:
    Code:
    Index: includes/modules/payment/authorizenet_aim.php
    ===================================================================
    --- includes/modules/payment/authorizenet_aim.php    (revision 30655)
    +++ includes/modules/payment/authorizenet_aim.php    (working copy)
    @@ -619,9 +619,9 @@
         }
     
         // set URL
    -    $this->mode = 'AIM';
    +    $this->mode = 'eProcessing';
    $this->notify('NOTIFY_PAYMENT_AUTHNET_MODE_SELECTION', $this->mode, $submit_data);
    But, it would be nice for the notify trigger to work correctly. I don't know if the right answer is to make the mode variable public or to pass in the parameter to the notify() as a second/third parameter so then it can be edited (and if that method is done) then the switch($this->mode) below would need to be changed as well.
    Last edited by jondaley; 27 Sep 2024 at 12:23 PM. Reason: turned on advanced editor for formatting.

  2. #2
    Join Date
    Jan 2004
    Posts
    66,419
    Blog Entries
    7
    Plugin Contributions
    277

    Default Re: AuthorizeNet_AIM emulator/eprocessingnetwork observer plugin problem

    Yes, it was intended that using $class->mode = 'whatever' would suffice. But you're right, the fact that it's a private property breaks that. I can't find the eProcessing observer I used to do that originally, so I don't know what hoop I used to get around that before.

    Three approaches you could take. All require editing the aim file though.

    - instead of private declare it public, so your observer can work
    - hard-code eprocessing instead of AIM, no observer required
    - pass another parameter, perhaps $new_mode. First set it to null before the notify call, then pass it in the notifier (receive in observer with &), and then after the notifier check if it's non-null and set $this->mode to $new_mode (again only if not null, since the observer will update it).

    Any of those will work.
    .

    Zen Cart - putting the dream of business ownership within reach of anyone!
    Donate to: DrByte directly or to the Zen Cart team as a whole

    Remember: Any code suggestions you see here are merely suggestions. You assume full responsibility for your use of any such suggestions, including any impact ANY alterations you make to your site may have on your PCI compliance.
    Furthermore, any advice you see here about PCI matters is merely an opinion, and should not be relied upon as "official". Official PCI information should be obtained from the PCI Security Council directly or from one of their authorized Assessors.

 

 

Similar Threads

  1. eProcessing Network - emulator problem
    By Darren Cubi in forum Addon Payment Modules
    Replies: 9
    Last Post: 8 Feb 2013, 09:51 PM
  2. Eprocessingnetwork issues
    By mysh in forum Addon Payment Modules
    Replies: 4
    Last Post: 29 Mar 2012, 08:21 PM
  3. Notifier/Observer problem editing Real World Example 1
    By dale88 in forum Templates, Stylesheets, Page Layout
    Replies: 23
    Last Post: 12 Mar 2010, 02:03 AM
  4. authorizenet_aim problem with test mode & CC#
    By Beau91324 in forum General Questions
    Replies: 2
    Last Post: 4 Mar 2010, 03:43 PM
  5. Authorize.net Emulator problem
    By rossi in forum General Questions
    Replies: 3
    Last Post: 25 Apr 2009, 06:42 AM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
disjunctive-egg
Zen-Cart, Internet Selling Services, Klamath Falls, OR