/**
  * WPF Create method piggyback-ing the Magento's internal Authorize method
  *
  * @param Mage_Sales_Model_Order_Payment|Varien_Object $payment
  * @param String $amount
  * @return EMerchantPay_Genesis_Model_Checkout
  * @throws Mage_Core_Exception
  */
 public function order(Varien_Object $payment, $amount)
 {
     Mage::log('Checkout transaction for order #' . $payment->getOrder()->getIncrementId());
     try {
         $this->getHelper()->initClient($this->getCode());
         /** @var Mage_Sales_Model_Order $order */
         $order = $payment->getOrder();
         $billing = $order->getBillingAddress();
         $shipping = $order->getShippingAddress();
         $genesis = new \Genesis\Genesis('WPF\\Create');
         $genesis->request()->setTransactionId($this->getHelper()->genTransactionId($order->getIncrementId()))->setCurrency($order->getBaseCurrencyCode())->setAmount($amount)->setUsage($this->getHelper()->__('Magento Payment'))->setDescription($this->getHelper()->getItemList($order))->setCustomerPhone($billing->getTelephone())->setCustomerEmail($order->getCustomerEmail())->setNotificationUrl($this->getHelper()->getNotifyURL('checkout'))->setReturnSuccessUrl($this->getHelper()->getSuccessURL('checkout'))->setReturnFailureUrl($this->getHelper()->getFailureURL('checkout'))->setReturnCancelUrl($this->getHelper()->getCancelURL('checkout'))->setBillingFirstName($billing->getData('firstname'))->setBillingLastName($billing->getData('lastname'))->setBillingAddress1($billing->getStreet(1))->setBillingAddress2($billing->getStreet(2))->setBillingZipCode($billing->getPostcode())->setBillingCity($billing->getCity())->setBillingState($billing->getRegion())->setBillingCountry($billing->getCountry())->setShippingFirstName($shipping->getData('firstname'))->setShippingLastName($shipping->getData('lastname'))->setShippingAddress1($shipping->getStreet(1))->setShippingAddress2($shipping->getStreet(2))->setShippingZipCode($shipping->getPostcode())->setShippingCity($shipping->getCity())->setShippingState($shipping->getRegion())->setShippinCountry($shipping->getCountry())->setLanguage($this->getHelper()->getLocale());
         foreach ($this->getTransactionTypes() as $type) {
             $genesis->request()->addTransactionType($type);
         }
         $genesis->execute();
         $payment->setTransactionId($genesis->response()->getResponseObject()->unique_id)->setIsTransactionPending(true)->addTransaction(Mage_Sales_Model_Order_Payment_Transaction::TYPE_ORDER);
         $payment->setSkipTransactionCreation(true);
         // Save the redirect url with our
         $this->getHelper()->getCheckoutSession()->setEmerchantPayCheckoutRedirectUrl($genesis->response()->getResponseObject()->redirect_url);
     } catch (Exception $exception) {
         Mage::logException($exception);
         Mage::throwException($this->getHelper()->__($exception->getMessage()));
     }
     return $this;
 }