PHP: $invoice->getItem(0)->getBillingPlanData("regnow_id"); This works fine in the Am_Paysystem_Regnow class, but wont work in Am_Paysystem_Transaction_Regnow class. How do I call this in the validateSource function so it returns true. PHP: class Am_Paysystem_Regnow extends Am_Paysystem_Abstract{ public function init() { parent::init(); $this->getDi()->billingPlanTable->customFields() ->add(new Am_CustomFieldText('regnow_id', "Regnow Product ID", "You must enter the product id of Regnow product.<br/>Must have the same settings as amember product.")); } public function _process(Invoice $invoice, Am_Request $request, Am_Paysystem_Result $result){$a->item = $invoice->getItem(0)->getBillingPlanData("regnow_id");}} PHP: abstract class Am_Paysystem_Transaction_Regnow extends Am_Paysystem_Transaction_Incoming{ public function validateSource() { $this->_checkIp($this->plugin->getConfig('ip')); if ($invoice->getItem(0)->getBillingPlanData("regnow_id"); != $this->request->get('item')) throw new Am_Exception_Paysystem_TransactionInvalid("Wrong [pc] passed, this transaction is not related to aMember?"); return true; }
Repeat Action Handling (return) Fatal error: Call to a member function getItem() on a non-object in/regnow.php on line 120
Im not sure I know what you mean. I tried I few things that failed miserably. As far as I can see I'm supposed to use this in validateSource() and validateTerms()? I tried and no dice. $this->invoice->getItem(0)->getBillingPlanData("regnow_id");
Move your check from validateSource to validateTerms: PHP: public function validateSource(){ $this->_checkIp($this->plugin->getConfig('ip')); return true; }public function validateTerms(){ if ($invoice->getItem(0)->getBillingPlanData("regnow_id"); != $this->request->get('item')) throw new Am_Exception_Paysystem_TransactionInvalid("Wrong [pc] passed, this transaction is not related to aMember?"); return true;}