Beispiel #1
0
 public function getOrderStatusAndOrderId($tc_id)
 {
     $email = Mage::getStoreConfig('payment/totalcoin_configuration/client_email');
     $apikey = Mage::getStoreConfig('payment/totalcoin_configuration/client_apikey');
     $tc = new TCApi($email, $apikey);
     $data = $tc->get_ipn_info($tc_id);
     $order_detail = array();
     if ($data['IsOk']) {
         $order_detail['order_status'] = $this->get_last_order_status_from_transaction_history($data['Response']['TransactionHistories']);
         $order_detail['order_id'] = $data['Response']['MerchantReference'];
     }
     return $order_detail;
 }
Beispiel #2
0
 public function getUrl()
 {
     $data = array();
     $url = "/";
     $order_id = Mage::getSingleton('checkout/session')->getLastRealOrderId();
     $order = Mage::getModel('sales/order')->loadByIncrementId($order_id);
     $customer = Mage::getSingleton('customer/session')->getCustomer();
     $model = Mage::getModel('catalog/product');
     $email = Mage::getStoreConfig('payment/totalcoin_configuration/client_email');
     $apikey = Mage::getStoreConfig('payment/totalcoin_configuration/client_apikey');
     $merchant_id = Mage::getStoreConfig('payment/totalcoin_configuration/merchant_id');
     $country = Mage::getStoreConfig('payment/totalcoin_configuration/country');
     $currency = Mage::getStoreConfig('payment/totalcoin_configuration/currency');
     $methods = Mage::getStoreConfig('payment/totalcoin_configuration/methods');
     $description = '';
     foreach ($order->getAllVisibleItems() as $item) {
         $product = $model->loadByAttribute('sku', $item->getSku());
         $description .= $item->getName() . ' - Precio por Unidad: ' . (int) number_format($product->getFinalPrice(), 2, '.', '');
         $description .= ' - Cantidad: ' . (int) number_format($item->getQtyOrdered(), 0, '.', '') . ' | ';
     }
     $data['Description'] = rtrim($description, ' | ');
     $data['Reference'] = $order_id;
     $data['Site'] = "Magento";
     $data['Country'] = $country;
     $data['Currency'] = $currency;
     $data['Amount'] = number_format($order->subtotal, 2, '.', '');
     $data['Quantity'] = 1;
     $data['MerchantId'] = $merchant_id;
     $data['PaymentMethods'] = str_replace(",", "|", $methods);
     $tc = new TCApi($email, $apikey);
     $results = $tc->perform_checkout($data);
     if ($results) {
         $url = $results['URL'];
     }
     return $url;
 }