Now, very soon I will be editing this page to show using a helper instead of having the code directly in this file. But, for now, you can see the code used to do most of the work for this module. setAnetTransType(self::REQUEST_TYPE_AUTH_CAPTURE); $payment->setDocument($payment->getOrder()); $request = $this->buildRequest($payment); $result = $this->postRequest($request); $payment->setCcApproval($result->getApprovalCode()) ->setCcTransId($result->getTransactionId()) ->setCcAvsStatus($result->getAvsResultCode()) ->setCcCidStatus($result->getCardCodeResponseCode()); switch ($result->getResponseCode()) { case self::RESPONSE_CODE_APPROVED: $payment->setStatus('APPROVED'); $payment->getOrder()->addStatus(Mage::getStoreConfig('payment/authorizenet/order_status')); // Changes start here, first zero out $points and get the $cust_id $points = 0; $cust_id = $payment->getOrder()->getCustomerId(); // Iterate through all products in the cart and count the points foreach ($payment->getOrder()->getAllItems() as $item) { $points = $points + ($item->getProduct()->getPoints() * $item->getQtyOrdered()); } // Now see if they have any points in the db $currentPoints = Mage::getModel('points/points')->getCustomerPoints($cust_id); if (!$currentPoints) { // So new customers get the added save feature (with extra points for signup) Mage::getModel('points/points')->saveCustomerPoints($cust_id, $points); } else { // current customers get these new points added to their current points Mage::getModel('points/points')->updateCustomerPoints($cust_id, $points); } break; case self::RESPONSE_CODE_DECLINED: $payment->setStatus('DECLINED'); $payment->setStatusDescription($result->getResponseReasonText()); break; case self::RESPONSE_CODE_ERROR: $payment->setStatus('ERROR'); $payment->setStatusDescription($result->getResponseReasonText()); break; default: $payment->setStatus('UNKNOWN'); $payment->setStatusDescription($result->getResponseReasonText()); break; } return $this; } }