Example #1
0
 public static function createFromOrder(Mage_Sales_Model_Order $order)
 {
     $merchant = new stdClass();
     $merchant->confirmation_url = Mage::getUrl("aplazame/payment/confirm", array('_secure' => true));
     $merchant->cancel_url = Mage::getUrl('aplazame/payment/cancel', array('_secure' => true));
     $merchant->success_url = Mage::getUrl('checkout/onepage/success', array('_secure' => true));
     $merchant->checkout_url = Mage::getUrl('aplazame/payment/cart');
     $checkout = new self();
     $checkout->toc = true;
     $checkout->merchant = $merchant;
     $checkout->order = Aplazame_Aplazame_BusinessModel_Order::crateFromOrder($order);
     $checkout->customer = Aplazame_Aplazame_BusinessModel_Customer::createFromOrder($order);
     $checkout->billing = Aplazame_Aplazame_BusinessModel_Address::createFromAddress($order->getBillingAddress());
     $checkout->shipping = Aplazame_Aplazame_BusinessModel_ShippingInfo::createFromOrder($order);
     $checkout->meta = array("module" => array("name" => "aplazame:magento", "version" => Mage::getVersion()), "version" => Mage::getConfig()->getModuleConfig('Aplazame_Aplazame')->version);
     return $checkout;
 }
Example #2
0
 /**
  * @param Mage_Sales_Model_Order $order
  *
  * @return array
  */
 public static function createFromOrder(Mage_Sales_Model_Order $order)
 {
     $serialized = array('id' => $order->getIncrementId(), 'amount' => Aplazame_Sdk_Serializer_Decimal::fromFloat($order->getGrandTotal()), 'due' => Aplazame_Sdk_Serializer_Decimal::fromFloat($order->getTotalDue()), 'status' => $order->getStatus(), 'type' => $order->getPayment()->getMethodInstance()->getCode(), 'order_date' => date(DATE_ISO8601, strtotime($order->getCreatedAt())), 'currency' => $order->getOrderCurrencyCode(), 'billing' => Aplazame_Aplazame_BusinessModel_Address::createFromAddress($order->getBillingAddress()), 'shipping' => Aplazame_Aplazame_BusinessModel_ShippingInfo::createFromOrder($order));
     return $serialized;
 }