/**
* @param Market_OrderModel $order
* @param Market_PaymentFormModel $paymentForm
*
* @return CreditCard
*/
private function createCard(Market_OrderModel $order, Market_PaymentFormModel $paymentForm)
{
$card = new CreditCard();
$card->setFirstName($paymentForm->firstName);
$card->setLastName($paymentForm->lastName);
$card->setNumber($paymentForm->number);
$card->setExpiryMonth($paymentForm->month);
$card->setExpiryYear($paymentForm->year);
$card->setCvv($paymentForm->cvv);
if ($order->billingAddressId) {
$billingAddress = $order->billingAddress;
$card->setBillingAddress1($billingAddress->address1);
$card->setBillingAddress2($billingAddress->address2);
$card->setBillingCity($billingAddress->city);
$card->setBillingPostcode($billingAddress->zipCode);
$card->setBillingState($billingAddress->getStateText());
$card->setBillingCountry($billingAddress->getCountryText());
$card->setBillingPhone($billingAddress->phone);
}
if ($order->shippingAddressId) {
$shippingAddress = $order->shippingAddress;
$card->setShippingAddress1($shippingAddress->address1);
$card->setShippingAddress2($shippingAddress->address2);
$card->setShippingCity($shippingAddress->city);
$card->setShippingPostcode($shippingAddress->zipCode);
$card->setShippingState($shippingAddress->getStateText());
$card->setShippingCountry($shippingAddress->getCountryText());
$card->setShippingPhone($shippingAddress->phone);
$card->setCompany($shippingAddress->company);
}
$card->setEmail($order->email);
return $card;
}