Ejemplo n.º 1
0
 /**
  * Adds data to model based on an Invoice that has been retrieved from
  * BitPay's API
  *
  * @param Bitpay\Invoice $invoice
  * @return Bitpay_Core_Model_Invoice
  */
 public function prepareWithBitpayInvoice($invoice)
 {
     if (false === isset($invoice) || true === empty($invoice)) {
         \Mage::helper('bitpay')->debugData('[ERROR] In Bitpay_Core_Model_Invoice::prepareWithBitpayInvoice(): Missing or empty $invoice parameter.');
         throw new \Exception('In Bitpay_Core_Model_Invoice::prepareWithBitpayInvoice(): Missing or empty $invoice parameter.');
     }
     $this->addData(array('id' => $invoice->getId(), 'url' => $invoice->getUrl(), 'pos_data' => $invoice->getPosData(), 'status' => $invoice->getStatus(), 'btc_price' => $invoice->getBtcPrice(), 'price' => $invoice->getPrice(), 'currency' => $invoice->getCurrency()->getCode(), 'order_id' => $invoice->getOrderId(), 'invoice_time' => intval($invoice->getInvoiceTime() / 1000), 'expiration_time' => intval($invoice->getExpirationTime() / 1000), 'current_time' => intval($invoice->getCurrentTime() / 1000), 'btc_paid' => $invoice->getBtcPaid(), 'rate' => $invoice->getRate(), 'exception_status' => $invoice->getExceptionStatus()));
     return $this;
 }