admin-import3 throwing error: The service definition "ccRecordTable" does not exist.

Discussion in 'aMember Pro v.4' started by maximize, Feb 22, 2013.

  1. maximize

    maximize Member

    Joined:
    Mar 5, 2007
    Messages:
    108
    Can anyone offer a quick fix? Our site is in limbo. Its hard to go back and an we can't go forward because of this error. We're using 4.2.15

    Code:
    The service definition "ccRecordTable" does not exist.
     
    Exception InvalidArgumentException
    sfServiceContainerBuilder->getServiceDefinition [ library/Am/Di.php : 443 ]
    Am_Di->getServiceDefinition [ library/sf/sfServiceContainerBuilder.php : 80 ]
    sfServiceContainerBuilder->getService [ library/Am/Di.php : 281 ]
    Am_Di->getService [ library/sf/sfServiceContainer.php : 276 ]
    sfServiceContainer->__get [ application/default/controllers/AdminImport3Controller.php : 369 ]
    InvoiceCreator_AuthorizeCim->doWork [ application/default/controllers/AdminImport3Controller.php : 149 ]
    InvoiceCreator_Abstract->process [ application/default/controllers/AdminImport3Controller.php : 923 ]
    Am_Import_User3->insertPayments [ application/default/controllers/AdminImport3Controller.php : 886 ]
    Am_Import_User3->doWork
    call_user_func_array [ library/Am/App.php : 2252 ]
    Am_BatchProcessor->run [ application/default/controllers/AdminImport3Controller.php : 610 ]
    Am_Import_Abstract->run [ application/default/controllers/AdminImport3Controller.php : 1394 ]
    AdminImport3Controller->indexAction [ library/Am/Controller.php : 139 ]
    Am_Controller->_runAction [ library/Am/Controller.php : 116 ]
    Am_Controller->dispatch [ library/Zend/Controller/Dispatcher/Standard.php : 295 ]
    Zend_Controller_Dispatcher_Standard->dispatch [ library/Zend/Controller/Front.php : 954 ]
    Zend_Controller_Front->dispatch [ library/Am/App.php : 1682 ]
    Am_App->run [ index.php : 43 ]
    
  2. bfritton

    bfritton Certified aMember Developer

    Joined:
    Oct 26, 2009
    Messages:
    54
    @maximize,
    This is untested but try this:

    UPDATE: SEE POST BELOW

    Open up amember/application/default/controllers/AdminImport3Controller.php and place the following code within the run() function before everything else in that function:

    PHP:
    // Get an instance of the credit card controller class[/S]
    [S]        $ccController = new Am_Controller_CreditCard($this->_request$this->_response);[/S]
    [
    S]        // Load up the payment system plugin (in this case, authorize-cim)[/S]
    [S]        if(!class_exists('Am_Paysystem_AuthorizeCim'false)){[/S]
    [
    S]            Am_Di::getInstance()->plugins_payment->load('authorize-cim');[/S]
    [
    S]        }[/S]
    [
    S]        $authAimPlugin Am_Di::getInstance()->plugins_payment->get('authorize-cim');[/S]
    [
    S]        // Set the plugin on the controller[/S]
    [S]        $ccController->setPlugin($authAimPlugin);
  3. bfritton

    bfritton Certified aMember Developer

    Joined:
    Oct 26, 2009
    Messages:
    54
    Cancel the above - I forgot that creates a new instance of the ccController.

    At line 368 of application/default/controllers/AdminImport3Controller.php, Replace
    PHP:
    $storedCc Am_Di::getInstance()->ccRecordTable->findFirstByUserId($this->user->pk());
            if(!
    $storedCc){
                
    $storedCc Am_Di::getInstance()->CcRecordRecord;
                
    $storedCc->user_id $this->user->pk();
                
    $storedCc->cc_expire    =  '1237';
                
    $storedCc->cc_number '0000000000000000';
                
    $storedCc->cc $storedCc->maskCc(@$storedCc->cc_number);
                
    $storedCc->insert();
            }
    With this:
    PHP:
    // Get an instance of the credit card controller class
            
    $ccController = new Am_Controller_CreditCard($this->_request$this->_response);
            
    // Load up the payment system plugin (in this case, authorize-cim)
            
    if(!class_exists('Am_Paysystem_AuthorizeCim'false)){
                
    Am_Di::getInstance()->plugins_payment->load('authorize-cim');
            }
            
    $authAimPlugin Am_Di::getInstance()->plugins_payment->get('authorize-cim');
            
    // Set the plugin on the controller
            
    $ccController->setPlugin($authAimPlugin);
     
            
    // Blank cc record object
            
    $storedCc Am_Di::getInstance()->CcRecordRecord;
            
    $storedCc->user_id $this->user->pk();
            
    $storedCc->cc_expire    =  '1237';
            
    $storedCc->cc_number '0000000000000000';
            
    $storedCc->cc $storedCc->maskCc(@$storedCc->cc_number);
            
    $storedCc->insert();
     
            
    $result = new Am_Paysystem_Result();
            
    $ccController->plugin->storeCreditCard($storedCc$result);
    See if that works.
  4. alex

    alex aMember Pro Customer Staff Member

    Joined:
    Jan 24, 2004
    Messages:
    6,021
    It must be easier. In aMember v4, go to aMember CP -> Setup -> Plugins, enable "cc" module.
    Also enable payment plugins which you are going to use.
  5. bfritton

    bfritton Certified aMember Developer

    Joined:
    Oct 26, 2009
    Messages:
    54
    That would be wise too :D

Share This Page