public function getGwapPaymentData($payment) { $data = new Varien_Object(); if ($payment->getCcType()) { $data->setCcType($payment->getCcType()); } if ($payment->getCcOwner()) { $data->setCcOwner($payment->getCcOwner()); } if ($payment->getCcLast4()) { $data->setCcLast4($payment->getCcLast4()); } if (Mage::getModel('core/session')->getGwapCcCcNumber()) { $data->setCcNumber(Mage::getModel('core/session')->getGwapCcCcNumber()); } if (Mage::getModel('core/session')->getGwapCcId()) { $data->setCcCid(Mage::getModel('core/session')->getGwapCcId()); } if ($payment->getCcParcelas()) { $data->setCcParcelas($payment->getCcParcelas()); } if ($payment->getCcExpMonth()) { $data->setCcExpMonth($payment->getCcExpMonth()); } if ($payment->getCcExpYear()) { $data->setCcExpYear($payment->getCcExpYear()); } if ($payment->getAdditionalInformation('GwapBoletoType')) { $data->setGwapBoletoType($payment->getAdditionalInformation('GwapBoletoType')); } if ($payment->getAdditionalInformation('GwapCheckOneclick')) { $data->setGwapCcCheckOneclick($payment->getAdditionalInformation('GwapCheckOneclick')); } if ($payment->getAdditionalInformation('GwapOneclickSelected')) { $data->setGwapOneclickSelected($payment->getAdditionalInformation('GwapOneclickSelected')); } if ($payment->getAdditionalInformation('GwapSessionId')) { $data->setGwapSessionId($payment->getAdditionalInformation('GwapSessionId')); } Mage::getModel('core/session')->setGwapCcId(); Mage::getModel('core/session')->setGwapCcCcNumber(); if ($payment->getMethod() == 'gwap_2cc') { $data->setCcAmount($payment->getAdditionalInformation('gwapCcAmount')); $data->setCcType2($payment->getAdditionalInformation('gwapCcType2')); $data->setCcOwner2($payment->getAdditionalInformation('gwapCcOwner2')); $data->setCcLast4_2($payment->getAdditionalInformation('gwapCcLast4_2')); $data->setCcNumber2($payment->getAdditionalInformation('gwapCcNumber2')); $data->setCcParcelas2($payment->getAdditionalInformation('gwapCcParcelas2')); $data->setCcCid2($payment->getAdditionalInformation('gwapCcCid2')); $data->setCcExpMonth2($payment->getAdditionalInformation('gwapCcExpMonth2')); $data->setCcExpYear2($payment->getAdditionalInformation('gwapCcExpYear2')); $payment->setAdditionalInformation('gwapCcNumber2', ''); $payment->setAdditionalInformation('gwapCcCid2', ''); } if ($payment->getMethod() == 'gwap_oneclick') { $data->setCcType($payment->getAdditionalInformation('oneclickType')); } return $data; }
/** * Get a list of credit cards for the account * * @return array $cards|bool */ public function getCards() { if (!$this->getData('cards')) { $cards = array(); // Array to hold card objects $customer = Mage::getModel('customer/session')->getCustomer(); // echo $customer->getEntityId(); $cim_profile = Mage::getModel('paymentech/profile')->getCustomerProfile($customer->getEntityId()); if ($cim_profile) { /** * The Soap XML response may be a single stdClass or it may be an * array. We need to adjust it to make it uniform. */ if (is_array($cim_profile)) { $payment_profiles = $cim_profile; } else { $payment_profiles = array($cim_profile); } // Assign card objects to array foreach ($payment_profiles as $payment_profile) { try { if (isset($payment_profile->customerCountryCode)) { $country = $payment_profile->customerCountryCode; } else { $country = "US"; } $card = new Varien_Object(); $card->setCcNumber($payment_profile->ccAccountNum)->setId($payment_profile->id)->setCustomerRefNum($payment_profile->customerRefNum)->setName($payment_profile->customerName)->setAddress($payment_profile->customerAddress1)->setCity($payment_profile->customerCity)->setState($payment_profile->customerState)->setZip($payment_profile->customerZIP)->setCountry($country); $cards[] = $card; } catch (Exception $e) { } } } if (!empty($cards)) { $this->setData('cards', $cards); } else { $this->setData('cards', false); } } return $this->getData('cards'); }
/** * Updates customer account information with most current from Litle. * * @param Varien_Object $payment * @param DOMDocument $litleResponse */ public function accountUpdater(Varien_Object $payment, $litleResponse) { if ($this->getUpdater($litleResponse, 'newCardInfo') !== null) { $payment->setCcLast4(substr($this->getUpdater($litleResponse, 'newCardInfo', 'number'), -4)); $payment->setCcType($this->getUpdater($litleResponse, 'newCardInfo', 'type')); $payment->setCcExpDate($this->getUpdater($litleResponse, 'newCardInfo', 'expDate')); } elseif ($this->getUpdater($litleResponse, 'newCardTokenInfo') !== null) { $payment->setCcNumber($this->getUpdater($litleResponse, 'newCardTokenInfo', 'litleToken')); $payment->setCcLast4(substr($this->getUpdater($litleResponse, 'newCardTokenInfo', 'litleToken'), -4)); $payment->setCcType($this->getUpdater($litleResponse, 'newCardTokenInfo', 'type')); $payment->setCcExpDate($this->getUpdater($litleResponse, 'newCardTokenInfo', 'expDate')); } }