/**
  * 
  * @param \ifirma\InvoiceAbstract $invoice
  * @throws IfirmaException
  * @return ConnectorAbstract
  */
 private static function _getInvoiceConnectorTypeBasedOnInvoice(InvoiceAbstract $invoice)
 {
     require_once dirname(__FILE__) . '/../Invoice/Invoice.php';
     require_once dirname(__FILE__) . '/../Invoice/InvoiceSend.php';
     require_once dirname(__FILE__) . '/../Invoice/InvoiceBill.php';
     require_once dirname(__FILE__) . '/../Invoice/InvoiceProforma.php';
     $invoiceType = get_class($invoice);
     switch ($invoiceType) {
         case Invoice::getType():
         case InvoiceResponse::getType():
             return new ConnectorInvoice();
             break;
         case InvoiceBill::getType():
         case InvoiceBillResponse::getType():
             return new ConnectorInvoiceBill();
             break;
         case InvoiceProforma::getType():
         case InvoiceProformaResponse::getType():
             return new ConnectorInvoiceProforma();
             break;
         case InvoiceSend::getType():
         case InvoiceSendResponse::getType():
             return new ConnectorInvoiceSend();
             break;
         default:
             throw new IfirmaException(sprintf("Unsupported invoice type: %s", $invoiceType));
             break;
     }
 }
Пример #2
0
 /**
  * 
  * @param int $id
  * @return InvoiceBill
  * @throws IfirmaException
  */
 public static function get($id)
 {
     $bill = new InvoiceBillResponse();
     $bill->disableSendMethod();
     ConnectorAbstract::factory($bill)->receive($id);
     return $bill;
 }
Пример #3
0
 /**
  * 
  * @param int $id
  * @return InvoiceBill
  * @throws IfirmaException
  */
 public static function get($id)
 {
     require_once dirname(__FILE__) . '/InvoiceBillResponse.php';
     $bill = new InvoiceBillResponse();
     $bill->disableSendMethod();
     ConnectorAbstract::factory($bill)->receive($id);
     return $bill;
 }