Ejemplo n.º 1
0
 public function testWritingATransactionWillReturnTransactionWithIdSet()
 {
     //txn before the write
     $this->assertNull($this->transaction->getId());
     $this->journalist->expects($this->once())->method('writeTransaction')->will($this->returnValue(new IntType(1)));
     $txn = $this->sut->write($this->transaction);
     //txn after the write
     $this->assertInstanceOf('SAccounts\\Transaction\\SimpleTransaction', $txn);
     $this->assertInstanceOf('Chippyash\\Type\\Number\\IntType', $txn->getId());
     $this->assertEquals(1, $txn->getId()->get());
 }
 public function save()
 {
     $Transaction = new Transaction($this->data->Transaction);
     $Transaction->save();
     $go = '>auth/Transaction/formObject/' . $Transaction->getId();
     $this->renderPrompt('information', 'OK', $go);
 }
Ejemplo n.º 3
0
 public static function fromTransaction(Transaction $transaction, PropelPDO $con = null)
 {
     $transactionId = $transaction->getId();
     $bookingData = array();
     $bookings = BookingQuery::create()->filterByTransactionId($transactionId)->find($con);
     foreach ($bookings as $booking) {
         $bookingData[] = self::from($booking, $con);
     }
     $clockingData = array();
     $clockings = ClockingQuery::create()->joinTransactionClocking()->joinWith('ClockingType')->add(TransactionClockingPeer::TRANSACTION_ID, $transactionId)->find($con);
     foreach ($clockings as $clocking) {
         $clockingData[] = self::from($clocking, $con) + array('Type' => self::from($clocking->getClockingType($con), $con));
     }
     return array('Start' => $transaction->getStart('U'), 'End' => $transaction->getEnd('U'), 'Bookings' => $bookingData, 'Clockings' => $clockingData, 'User' => self::from($transaction->getUserRelatedByUserId($con), $con)) + $transaction->toArray();
 }
Ejemplo n.º 4
0
 public static function forTransaction(Transaction $transaction, $url_success = '')
 {
     $u_id = $transaction->getIdReceiver();
     $u = UserTable::getInstance()->findOneById($u_id);
     switch ($u->getUtype()) {
         case 'puser':
             $onpay_login = SettingTable::getInstance()->findOneByName('pOnpayLogin')->getValue();
             $private_code = SettingTable::getInstance()->findOneByName('pApiCode')->getValue();
             break;
         case 'uuser':
             $onpay_login = SettingTable::getInstance()->findOneByName('uOnpayLogin')->getValue();
             $private_code = SettingTable::getInstance()->findOneByName('uApiCode')->getValue();
             break;
         default:
             throw new sfException('Неизвестный тип пользователя в транзакции при инициализации платежа OnPay');
             break;
     }
     return new OnPay($onpay_login, $private_code, $transaction->getId(), $transaction->getAmount(), $url_success);
 }
 public function testRollback_HasTransactionId_SendsDelete()
 {
     $transaction = new Transaction($this->client);
     $transaction->setId(321);
     $this->transport->expects($this->once())->method('delete')->with('/transaction/' . $transaction->getId())->will($this->returnValue(array("code" => 200)));
     $this->client->rollbackTransaction($transaction);
 }
Ejemplo n.º 6
0
 /**
  * Declares an association between this object and a Transaction object.
  *
  * @param             Transaction $v
  * @return TransactionClocking The current object (for fluent API support)
  * @throws PropelException
  */
 public function setTransaction(Transaction $v = null)
 {
     if ($v === null) {
         $this->setTransactionId(NULL);
     } else {
         $this->setTransactionId($v->getId());
     }
     $this->aTransaction = $v;
     // Add binding for other direction of this n:n relationship.
     // If this object has already been added to the Transaction object, it will not be re-added.
     if ($v !== null) {
         $v->addTransactionClocking($this);
     }
     return $this;
 }
Ejemplo n.º 7
0
 /**
  * Adds an object to the instance pool.
  *
  * Propel keeps cached copies of objects in an instance pool when they are retrieved
  * from the database.  In some cases -- especially when you override doSelect*()
  * methods in your stub classes -- you may need to explicitly add objects
  * to the cache in order to ensure that the same objects are always returned by doSelect*()
  * and retrieveByPK*() calls.
  *
  * @param      Transaction $obj A Transaction object.
  * @param      string $key (optional) key to use for instance map (for performance boost if key was already calculated externally).
  */
 public static function addInstanceToPool($obj, $key = null)
 {
     if (Propel::isInstancePoolingEnabled()) {
         if ($key === null) {
             $key = (string) $obj->getId();
         }
         // if key === null
         TransactionPeer::$instances[$key] = $obj;
     }
 }
Ejemplo n.º 8
0
 /**
  * Filter the query by a related Transaction object
  *
  * @param   Transaction|PropelObjectCollection $transaction The related object(s) to use as filter
  * @param     string $comparison Operator to use for the column comparison, defaults to Criteria::EQUAL
  *
  * @return                 TransactionClockingQuery The current query, for fluid interface
  * @throws PropelException - if the provided filter is invalid.
  */
 public function filterByTransaction($transaction, $comparison = null)
 {
     if ($transaction instanceof Transaction) {
         return $this->addUsingAlias(TransactionClockingPeer::TRANSACTION_ID, $transaction->getId(), $comparison);
     } elseif ($transaction instanceof PropelObjectCollection) {
         if (null === $comparison) {
             $comparison = Criteria::IN;
         }
         return $this->addUsingAlias(TransactionClockingPeer::TRANSACTION_ID, $transaction->toKeyValue('PrimaryKey', 'Id'), $comparison);
     } else {
         throw new PropelException('filterByTransaction() only accepts arguments of type Transaction or PropelCollection');
     }
 }
Ejemplo n.º 9
0
 /**
  * Exclude object from result
  *
  * @param   Transaction $transaction Object to remove from the list of results
  *
  * @return TransactionQuery The current query, for fluid interface
  */
 public function prune($transaction = null)
 {
     if ($transaction) {
         $this->addUsingAlias(TransactionPeer::ID, $transaction->getId(), Criteria::NOT_EQUAL);
     }
     return $this;
 }