/** * Construct a new profile request for the customer * * @param $payment * @param bool $forcedCustomerId * @return Varien_Object */ protected function _buildProfileRequest($payment, $forcedCustomerId = false) { $customer_id = $forcedCustomerId ? null : $this->getCustomer()->getId(); if (!$customer_id || !$this->isSavingCc()) { $customer_id = $payment->getOrder()->getIncrementId() . now(); // Make up a customer ID so we don't ever have duplicate issues $description = "Guest or Unsaved Card"; } else { $description = "Magento Customer ID: {$customer_id}"; } $customerRefNum = $this->getCustomer()->getChasePaymentechCustomerRefNum(); $billingAddress = $payment->getOrder()->getBillingAddress(); $customer = new Varien_Object(); $customer->setEmail($payment->getOrder()->getCustomerEmail())->setId($customer_id)->setDescription($description)->setCustomerRefNum($customerRefNum)->setFirstname($billingAddress->getFirstname())->setLastname($billingAddress->getLastname())->setCompany($billingAddress->getCompany())->setAddress($billingAddress->getStreet(true))->setCity($billingAddress->getCity())->setState($billingAddress->getRegion())->setZip($billingAddress->getPostcode())->setCountry($billingAddress->getCountryId()); $payment_profile = new Varien_Object(); $customer->setPaymentProfile($payment_profile); $customer->getPaymentProfile()->setCc($payment->getCcNumber())->setCcv($payment->getCcCid())->setExpiration(sprintf('%04d-%02d', $payment->getCcExpYear(), $payment->getCcExpMonth())); return $customer; }