/**
  * Construct the SofortLib_TransactionData object
  * Collect every order's item and set it accordingly
  * TransactionData is used encapsulated in this class to retrieve information about the order's details
  * @return object SofortLib_TransactionData
  * @private
  */
 private function _setupTransactionData()
 {
     $SofortLib_TransactionData = new SofortLib_TransactionData($this->_configKey, $this->_apiUrl);
     $SofortLib_TransactionData->setTransaction($this->_transactionId);
     $SofortLib_TransactionData->sendRequest();
     if (!$SofortLib_TransactionData->getCount()) {
         return false;
     }
     $this->setStatus($SofortLib_TransactionData->getStatus());
     $this->setStatusReason($SofortLib_TransactionData->getStatusReason());
     $this->setStatusOfInvoice($SofortLib_TransactionData->getInvoiceStatus());
     $this->setInvoiceObjection($SofortLib_TransactionData->getInvoiceObjection());
     $this->setLanguageCode($SofortLib_TransactionData->getLanguageCode());
     $this->setTransaction($this->getTransactionId());
     $this->setTime($SofortLib_TransactionData->getTime());
     $this->setPaymentMethod($SofortLib_TransactionData->getPaymentMethod());
     $this->setInvoiceUrl($SofortLib_TransactionData->getInvoiceUrl());
     $this->setAmount($SofortLib_TransactionData->getAmount());
     $this->setAmountRefunded($SofortLib_TransactionData->getAmountRefunded());
     $itemArray = $SofortLib_TransactionData->getItems();
     // should there be any items, fetch them accordingly
     $this->_items = array();
     if (is_array($itemArray) && !empty($itemArray)) {
         foreach ($itemArray as $item) {
             $this->setItem($item['item_id'], $item['product_number'], $item['product_type'], $item['title'], $item['description'], $item['quantity'], $item['unit_price'], $item['tax']);
             $this->_amount += $item['unit_price'] * $item['quantity'];
         }
     }
     /*
      * set the state according to the state given by transaction information (status, status_reason, invoice_status)
      * @see $statusMask
      */
     $this->setState($this->_calcInvoiceStatusCode());
     return $SofortLib_TransactionData;
 }
Esempio n. 2
0
 private function _setupTransactionData()
 {
     $SofortLib_TransactionData = new SofortLib_TransactionData($this->_configKey, $this->_apiUrl);
     $SofortLib_TransactionData->setTransaction($this->_transactionId);
     $SofortLib_TransactionData->sendRequest();
     if (!$SofortLib_TransactionData->getCount()) {
         return false;
     }
     $this->setStatus($SofortLib_TransactionData->getStatus());
     $this->setStatusReason($SofortLib_TransactionData->getStatusReason());
     $this->setStatusOfInvoice($SofortLib_TransactionData->getInvoiceStatus());
     $this->setInvoiceObjection($SofortLib_TransactionData->getInvoiceObjection());
     $this->setLanguageCode($SofortLib_TransactionData->getLanguageCode());
     $this->setTransaction($this->getTransactionId());
     $this->setTime($SofortLib_TransactionData->getTime());
     $this->setPaymentMethod($SofortLib_TransactionData->getPaymentMethod());
     $this->setInvoiceUrl($SofortLib_TransactionData->getInvoiceUrl());
     $this->setAmount($SofortLib_TransactionData->getAmount());
     $this->setAmountRefunded($SofortLib_TransactionData->getAmountRefunded());
     $itemArray = $SofortLib_TransactionData->getItems();
     $this->_items = array();
     if (is_array($itemArray) && !empty($itemArray)) {
         foreach ($itemArray as $item) {
             $this->setItem($item['item_id'], $item['product_number'], $item['product_type'], $item['title'], $item['description'], $item['quantity'], $item['unit_price'], $item['tax']);
             $this->_amount += $item['unit_price'] * $item['quantity'];
         }
     }
     $this->setState($this->_calcInvoiceStatusCode());
     return $SofortLib_TransactionData;
 }