本文整理汇总了PHP中Transaction类的典型用法代码示例。如果您正苦于以下问题:PHP Transaction类的具体用法?PHP Transaction怎么用?PHP Transaction使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Transaction类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: testSetExternalIdValid
public function testSetExternalIdValid()
{
$externalId = 'abc';
$customer = new Transaction();
$customer->setExternalId($externalId);
$this->assertEquals($externalId, $customer->getExternalId());
}
开发者ID:purchased-at,项目名称:sdk-php,代码行数:7,代码来源:TransactionTest.php
示例2: display
function display()
{
Load::model('transaction');
$Transaction = new Transaction();
$param['data'] = $Transaction->viewAll();
Load::view('request', $param);
}
开发者ID:etuyco,项目名称:v2.inlight-marketing,代码行数:7,代码来源:request.php
示例3: delete
public function delete()
{
$Transaction = new Transaction($this->data->id);
$Transaction->delete();
$go = '>auth/Transaction/formFind';
$this->renderPrompt('information', "Transaction [{$this->data->idTransaction}] removido.", $go);
}
开发者ID:elymatos,项目名称:expressive_fnbr,代码行数:7,代码来源:TransactionController.php
示例4: createSinkTransaction
function createSinkTransaction($ledgerEntries, $loginId, $txDate)
{
$txDateString = $txDate->format('m/d/Y');
$sinkTransaction = new Transaction();
$sinkTransaction->Init_transaction($loginId, "EOM auto-sink", $txDateString, $txDateString, '', NULL, NULL, NULL, NULL, 1, 0, 0, -1, 1, '', NULL, -1, -1, 0.0, $ledgerEntries, array());
return $sinkTransaction;
}
开发者ID:fedoracooper,项目名称:cooper-accounting-php,代码行数:7,代码来源:auto_sink.php
示例5: test
function test()
{
global $apiContext;
// IncludeConfig('paypal/bootstrap.php');
$payer = new Payer();
$payer->setPaymentMethod("paypal");
$item1 = new Item();
$item1->setName('Ground Coffee 40 oz')->setCurrency('USD')->setQuantity(1)->setPrice(7.5);
$item2 = new Item();
$item2->setName('Granola bars')->setCurrency('USD')->setQuantity(5)->setPrice(2);
$itemList = new ItemList();
$itemList->setItems(array($item1, $item2));
$details = new Details();
$details->setShipping(1.2)->setTax(1.3)->setSubtotal(17.5);
$amount = new Amount();
$amount->setCurrency("USD")->setTotal(20)->setDetails($details);
$transaction = new Transaction();
$transaction->setAmount($amount)->setItemList($itemList)->setDescription("Payment description")->setInvoiceNumber(uniqid());
$baseUrl = getBaseUrl();
$redirectUrls = new RedirectUrls();
$redirectUrls->setReturnUrl("{$baseUrl}/donate.php/execute_payment_test?success=true")->setCancelUrl("{$baseUrl}/donate.php/execute_payment_test?success=false");
$payment = new Payment();
$payment->setIntent("sale")->setPayer($payer)->setRedirectUrls($redirectUrls)->setTransactions(array($transaction));
$request = clone $payment;
try {
$payment->create($apiContext);
} catch (Exception $ex) {
ResultPrinter::printError("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", null, $request, $ex);
exit(1);
}
$approvalUrl = $payment->getApprovalLink();
ResultPrinter::printResult("Created Payment Using PayPal. Please visit the URL to Approve.", "Payment", "<a href='{$approvalUrl}' >{$approvalUrl}</a>", $request, $payment);
return $payment;
}
开发者ID:kayecandy,项目名称:secudev,代码行数:34,代码来源:donate.php
示例6: actionEarned
/**
* Get All notifications of a user.
*
* @author Kuldeep Dangi <[email protected]>
*/
public function actionEarned($userId)
{
$model = new Transaction();
$this->result['data'] = $model->getAmount($userId, array(5));
$this->result['success'] = true;
$this->sendResponse($this->result);
}
开发者ID:kuldeepro,项目名称:notesgen,代码行数:12,代码来源:NcashController.php
示例7: changeType
/**
* Override BundlableLabelableBaseModelWithAttributes::changeType() to update
* current location "subclass" (ie. type) value when type change is used.
* This should be invoked by any model that can be used to indicate object
* storage location. This includes, for now at least, ca_loans, ca_movements,
* ca_occurrences and ca_objects_x_storage_locations.
*
* @param mixed $pm_type The type_id or code to change the current type to
* @return bool True if change succeeded, false if error
*/
public function changeType($pm_type)
{
if (!$this->getPrimaryKey()) {
return false;
}
// row must be loaded
if (!($vb_already_in_transaction = $this->inTransaction())) {
$this->setTransaction($o_t = new Transaction($this->getDb()));
}
if ($vn_rc = parent::changeType($pm_type)) {
$o_db = $this->getDb();
$o_db->query("\n\t\t\t\t\tUPDATE ca_objects SET current_loc_subclass = ? \n\t\t\t\t\tWHERE \n\t\t\t\t\t\tcurrent_loc_class = ? AND current_loc_id = ?\n\t\t\t\t", array($this->get('type_id'), $this->tableNum(), $this->getPrimaryKey()));
if ($o_db->numErrors()) {
$this->errors = $o_db->errors;
if (!$vb_already_in_transaction) {
$o_t->rollback();
}
return false;
}
}
if (!$vb_already_in_transaction) {
$o_t->commit();
}
return $vn_rc;
}
开发者ID:idiscussforum,项目名称:providence,代码行数:35,代码来源:BaseObjectLocationModel.php
示例8: quantita_history
public static function quantita_history($isin, $username, $month_from)
{
$conn = Db::get_connection();
$transaction_factory = new Transaction();
$transactions = $transaction_factory->find_all(array('where_clause' => "`utente` = '{$conn->escape($username)}' " . "AND `isin` = '{$conn->escape($isin)}' " . "AND `data` >= '{$conn->escape($month_from)}' ", 'order_by' => '`data` DESC'));
// print_r($transactions);
$portfolio_stock_factory = new PortfolioStock();
$portfolio_stock = $portfolio_stock_factory->find_all(array('where_clause' => "`utente` = '{$conn->escape($username)}' " . "AND `isin` = '{$conn->escape($isin)}' "))[0];
// print_r($portfolio_stock);
$quantita_history = array();
$quantita_history[date('Y-m-d')] = $q = $portfolio_stock->quantita;
$i = 0;
do {
if ($transactions[$i]->azione == 'acquisto') {
$q -= $transactions[$i]->quantita;
} else {
$q += $transactions[$i]->quantita;
}
$quantita_history[$transactions[$i]->data] = $q;
$i++;
} while ($transactions[$i]->data > $_REQUEST['month-from']);
// print_r($quantita_history);
Db::close_connection($conn);
return $quantita_history;
}
开发者ID:emeraldion,项目名称:creso,代码行数:25,代码来源:portfolio_helper.php
示例9: actionCreate
/**
* Creates a new model.
* If creation is successful, the browser will be redirected to the 'view' page.
*/
public function actionCreate($for = null, $mass_id = null)
{
$model = new MassBooking();
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['MassBooking'])) {
$tr = Yii::app()->db->beginTransaction();
$acct = Account::get('Mass Bookings');
$trans = new Transaction();
$trans->type = 'credit';
$trans->account_id = $acct->id;
$trans->amount = $_POST['amount'];
$trans->created = Yii::app()->dateFormatter->formatDateTime(time(), 'short', 'medium');
$trans->creator = Yii::app()->user->id;
$trans->descr = "Mass booking";
if ($trans->save()) {
$model->attributes = $_POST['MassBooking'];
$model->trans_id = $trans->id;
if ($model->save()) {
$trans->saveAttributes(array('descr' => "Mass booking #" . $model->id));
$tr->commit();
$this->redirect(array('view', 'id' => $model->id));
return;
}
}
$tr->rollback();
}
$parms = array('model' => $model);
$parms['mass_dt'] = isset($for) ? $for : '';
$parms['mass_id'] = isset($mass_id) ? $mass_id : '';
$this->render('create', $parms);
}
开发者ID:srinidg,项目名称:stbennos-parish,代码行数:36,代码来源:MassBookingController.php
示例10: createCancellationRequest
/**
* @param Transaction $transaction
* @param DOMDocument $document
* @return \DOMElement
*/
private function createCancellationRequest($transaction, DOMDocument $document)
{
$requisicao = $document->createElementNS(self::NS, 'requisicao-cancelamento');
$requisicao->setAttribute('id', $transaction->getCancellationId());
$requisicao->setAttribute('versao', RequestSerializer::VERSION);
$this->createElementAndAppendWithNs($requisicao, 'tid', $transaction->tid);
$requisicao->appendChild($this->createDadosEc($transaction, $document));
return $requisicao;
}
开发者ID:moura137,项目名称:Webservice-1.5-php,代码行数:14,代码来源:CancellationRequestSerializer.php
示例11: validateTransaction
private static function validateTransaction(Transaction $transaction)
{
global $wpdb;
$transactionStatus = $transaction->getStatus();
$reference = $transaction->getReference();
if ($reference && function_exists('automatic_return')) {
automatic_return($transactionStatus, $reference);
}
}
开发者ID:nataliajulieta,项目名称:old,代码行数:9,代码来源:notification.php
示例12: actionIndex
public function actionIndex()
{
$user = Yii::app()->user->data();
if (Yii::app()->user->isGuest) {
$this->layout = '//layouts/landing';
$this->render('index');
} elseif ($user->isActivated()) {
if ($user->isVerified()) {
$buyform = new BuyBtcForm();
// $transactions = Transaction::model ()->findAllByAttributes(array('id_user' => $user->id, 'type' => 1));
$avail_balance_local = money_format('%.2n', count($user->balance) > 0 ? $user->balance->local : 0);
$avail_balance_usd = money_format('%.2n', count($user->balance) > 0 ? $user->balance->usd : 0);
$avail_balance_btc = money_format('%.2n', count($user->balance) > 0 ? $user->balance->btc : 0);
$request = Yii::app()->request;
$formData = $request->getPost(get_class($buyform), false);
if ($formData) {
$buyform->amount_btc = $formData['amount_btc'];
$buyform->amount_fiat = $formData['amount_fiat'];
$buyform->type_trans = $formData['type_trans'];
/*if ($buyform->hasErrors ()) {
}
else{
*/
if ($buyform->validate(array(''))) {
$tran = new Transaction();
$tran->id_user = $user->id;
$tran->status = 0;
if ($buyform->type_trans == "BUY") {
$tran->type = 4;
$tran->descr = "You purchased Bitcoins";
$tran->currency = "USD";
$tran->amount = $buyform->amount_btc;
} elseif ($buyform->type_trans == "SELL") {
$tran->type = 3;
$tran->descr = "You sold Bitcoins";
$tran->currency = "BTC";
$tran->amount = $buyform->amount_fiat;
} else {
Yii::app()->user->setFlash('error', Yii::t('translation', 'Error! Unable to create transaction'));
}
if (!$tran->save()) {
Yii::app()->user->setFlash('error', Yii::t('translation', 'Error! Unable to create transaction'));
}
} else {
Yii::app()->user->setFlash('error', Yii::t('translation', 'Error in the fields'));
}
}
$this->render('index-activated', compact('avail_balance_local', 'user', 'buyform', 'avail_balance_local', 'avail_balance_usd', 'avail_balance_btc'));
} else {
$this->render('notverified');
}
} else {
$this->render('index');
}
}
开发者ID:LumbaJack,项目名称:Mercado-BTX,代码行数:57,代码来源:BuysellController.php
示例13: actionAdmin
public function actionAdmin()
{
$model = new Transaction('search');
$model->unsetAttributes();
if (isset($_GET['Transaction'])) {
$model->setAttributes($_GET['Transaction']);
}
$this->render('admin', array('model' => $model));
}
开发者ID:shakyapranin,项目名称:IMS,代码行数:9,代码来源:TransactionController.php
示例14: getSum
/**
* Sum all Child Transactions
*
* Sum all Child Transactions related to one parent
*
* @param string $transaction_id is a long specifying a transaction
*
* @url GET /sum/{transaction_id}
*/
function getSum($transaction_id)
{
$trans = new Transaction();
$sum = $trans->getSumOfChildren($transaction_id);
if ($sum != 0) {
return $sum;
}
return array('status' => 'fail');
}
开发者ID:safaa-alnablsi,项目名称:Restful-API,代码行数:18,代码来源:Transactionservice.php
示例15: by_isin
function by_isin()
{
$conn = $this->get_connection();
$this->totale = 0;
$this->bilancio = 0;
$transaction_factory = new Transaction();
$this->transactions = $transaction_factory->find_by_query('SELECT `creso_transazioni`.`id`, `creso_transazioni`.`azione`, `creso_transazioni`.`negot_id`, `creso_transazioni`.`prezzo`, `creso_transazioni`.`quantita`, `creso_transazioni`.`isin`, `creso_titoli`.`title` ' . 'FROM `creso_transazioni` ' . 'LEFT JOIN `creso_titoli` ON `creso_transazioni`.`isin` = `creso_titoli`.`isin` ' . "WHERE `utente` = '{$conn->escape($_COOKIE['username'])}' " . "AND `creso_transazioni`.`isin` = '{$conn->escape($_GET['id'])}' " . "AND `azione` = 'vendita' " . 'GROUP BY `negot_id` ' . 'ORDER BY ' . sprintf('`%s` %s ', $this->get_sort('data'), $this->get_dir(TRUE)) . "LIMIT {$conn->escape($this->get_start())}, {$conn->escape($this->get_limit())}");
$this->_populate_transactions();
$this->render(array('action' => 'index'));
}
开发者ID:emeraldion,项目名称:creso,代码行数:10,代码来源:ricavi_controller.php
示例16: puserDailyPayment
public function puserDailyPayment()
{
$aTariffs = SettingTable::getAllTariffs();
$oBalanceSystem = BalanceSystem::getCurrentBalanceInstance();
$aPUsers = UserTable::getPUsersActive();
foreach ($aPUsers as $oPUser) {
$transaction = new Transaction();
$transaction->puserDailyPayment($oPUser, $oBalanceSystem, $aTariffs);
}
}
开发者ID:rollmax,项目名称:read2read,代码行数:10,代码来源:billing.class.php
示例17: createAction
public function createAction()
{
$this->logger->entering();
$paramTerms = $this->_getParam('terms');
$paramUser = $this->_getParam('user');
$this->logger->info('Validating user from params');
$validity = User::isValid($paramUser);
if ($paramTerms != 1 || !$validity) {
$this->logger->notice('Invalid User');
$this->flash->notice = "Please complete all fields and agree to the terms and conditions";
if (!$validity) {
foreach ($paramUser['errors'] as $k => $v) {
$this->flash->notice = $this->flash->notice . ", {$k} {$v}";
}
}
$this->logger->info('Loading view parameters');
$this->view->assign(array('title' => "New User", 'user' => $paramUser, 'states' => $this->states, 'terms' => $paramTerms));
$this->logger->info('Render view');
/* echo $this->view->render('applicationTemplate.phtml'); */
$this->render();
$this->logger->info('Clearing flash notice');
$this->flash->keep = 1;
unset($this->flash->notice);
} else {
$this->logger->info('Building a new user from request');
$users = new User();
$user = $users->fetchNew();
$paramUser = $users->filterColumns($paramUser);
$user->setFromArray($paramUser);
$this->logger->info('Inserting the user');
if ($user->save()) {
$this->logger->notice('Crediting signup bonus');
$transactions = new Transaction();
$transactions->signupUser($user);
$this->logger->notice('Sending welcome message');
$mail = new Zend_Mail();
$mail->setBodyText('Welcome to swaplady.');
$mail->setFrom('[email protected]', 'Some Sender');
$mail->addTo($user->email, $user->name);
$mail->setSubject('Welcome to Swaplady');
$mail->send();
$this->logger->notice('Marking as logged in');
$this->session->user_id = $user->id;
if (isset($this->flash->redirectedFrom)) {
$intendedAction = $this->flash->redirectedFrom;
$this->logger->info("Redirecting to intended action '{$intendedAction['controller']}::{$intendedAction['action']}'");
$this->_redirect('/' . $intendedAction['controller'] . '/' . $intendedAction['action']);
} else {
$this->logger->info("Redirecting to show user {$user->id}");
$this->_redirect("user/show/{$user->id}");
}
}
}
$this->logger->exiting();
}
开发者ID:josephholsten,项目名称:swaplady,代码行数:55,代码来源:UserController.php
示例18: testWritingATransactionWillReturnTransactionWithIdSet
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());
}
开发者ID:chippyash,项目名称:simple-accounts,代码行数:11,代码来源:JournalTest.php
示例19: report
public function report($wins, $opponentWins)
{
if (!$this->awaitingResult()) {
$msg = 'Tried to report when not awaiting result.';
throw new IllegalStateException($msg);
}
$t = new Transaction();
$entries = [$this->playerId => $wins, $this->opponentId => $opponentWins];
foreach ($entries as $playerId => $playerWins) {
$sql = 'UPDATE player_match SET wins = ' . Q($playerWins) . ' WHERE match_id = ' . Q($this->matchId) . ' AND player_id = ' . Q($playerId);
$t->execute($sql);
}
$t->commit();
}
开发者ID:jthemphill,项目名称:tournament,代码行数:14,代码来源:match.php
示例20: deleteWidget
function deleteWidget($id)
{
try {
$transaction = new Transaction();
$result = DAOFactory::getAfiliadoWidgetDAO()->delete($id);
$transaction->commit();
return $result;
} catch (Exception $e) {
print_r($e);
if ($transaction) {
$transaction->rollback();
}
return false;
}
}
开发者ID:randyibarrola,项目名称:active,代码行数:15,代码来源:widget.php
注:本文中的Transaction类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论