本文整理汇总了PHP中Payment::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Payment::model方法的具体用法?PHP Payment::model怎么用?PHP Payment::model使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Payment
的用法示例。
在下文中一共展示了Payment::model方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: actionProcess
public function actionProcess($id = null)
{
/* @var $payment Payment */
$payment = Payment::model()->findByPk($id);
if ($payment && $payment->module) {
$paymentSystem = Yii::app()->paymentManager->getPaymentSystemObject($payment->module);
if ($paymentSystem) {
$paymentSystem->processCheckout($payment, Yii::app()->getRequest());
}
} else {
throw new CHttpException(404);
}
}
示例2: actionProcess
/**
* @param null $id
* @throws CException
* @throws CHttpException
*/
public function actionProcess($id = null)
{
/* @var $payment Payment */
$payment = Payment::model()->findByPk($id);
if (!$payment && !$payment->module) {
throw new CHttpException(404);
}
/** @var PaymentSystem $paymentSystem */
if ($paymentSystem = Yii::app()->paymentManager->getPaymentSystemObject($payment->module)) {
$result = $paymentSystem->processCheckout($payment, Yii::app()->getRequest());
if ($result instanceof Order) {
$this->redirect(['/order/order/view', 'url' => $result->url]);
}
}
}
示例3: actionProcess
/**
* @param null $id
* @throws CException
* @throws CHttpException
*/
public function actionProcess($id = null)
{
/* @var $payment Payment */
$payment = Payment::model()->findByPk($id);
if (null === $payment && !$payment->module) {
throw new CHttpException(404);
}
/** @var PaymentSystem $paymentSystem */
if ($paymentSystem = Yii::app()->paymentManager->getPaymentSystemObject($payment->module)) {
$result = $paymentSystem->processCheckout($payment, Yii::app()->getRequest());
if ($result instanceof Order) {
Yii::app()->getUser()->setFlash(YFlashMessages::SUCCESS_MESSAGE, Yii::t('PaymentModule.payment', 'Success get pay info!'));
$this->redirect(['/order/order/view', 'url' => $result->url]);
}
}
}
示例4: getPaymentList
public function getPaymentList()
{
$map = array('is_valid' => 1);
$list = Payment::model()->findAllByAttributes($map);
if (empty($list)) {
return false;
}
$newList = array();
foreach ($list as $row) {
if ($row['is_plat'] == 1) {
$newList['plat'][] = $row->getAttributes();
} else {
$newList['bank'][] = $row->getAttributes();
}
}
return $newList;
}
示例5: actionUpdate
public function actionUpdate($id)
{
$model = $this->loadModel($id);
// Uncomment the following line if AJAX validation is needed
// $this->performAjaxValidation($model);
if (isset($_POST['Delivery'])) {
$model->attributes = $_POST['Delivery'];
if ($model->save()) {
Yii::app()->user->setFlash(yupe\widgets\YFlashMessages::SUCCESS_MESSAGE, Yii::t('DeliveryModule.delivery', 'Record updated!'));
if (!isset($_POST['submit-type'])) {
$this->redirect(['update', 'id' => $model->id]);
} else {
$this->redirect([$_POST['submit-type']]);
}
}
}
$payments = Payment::model()->published()->findAll(['order' => 'position']);
$this->render('update', ['model' => $model, 'payments' => $payments]);
}
示例6: actionCheckout
/**
* 订单确认页面
*/
public function actionCheckout()
{
$userId = $this->user_id;
if (empty($userId)) {
$this->redirect('/user/login');
}
$addList = Address::model()->getUserAddressList($userId);
$payList = Payment::model()->getPaymentList();
$plist = Cart::model()->getCartList($userId);
$couponlist = Coupon::model()->getUserUsingCouponList($userId);
if (empty($plist['list'])) {
$this->redirect('/?from=no_deal');
}
$viewData = array();
$viewData['addList'] = $addList;
$viewData['list'] = $plist['list'];
$viewData['total'] = $plist['total'];
$viewData['couponlist'] = $couponlist;
$viewData['payList'] = $payList;
$this->render('cart/checkout', $viewData);
}
示例7: actionChangeStatus
public function actionChangeStatus()
{
$res = array('statusCode' => 200, 'message' => '修改成功!');
try {
if (empty($_REQUEST['id'])) {
throw new Exception("数据错误,id不能为空!", 1);
}
$info = Payment::model()->findByPk($_REQUEST['id']);
if (empty($info)) {
throw new Exception('该支付记录不存在');
}
if ($info->is_valid != $_REQUEST['is_valid']) {
$info->is_valid = $_REQUEST['is_valid'];
$flag = $info->save();
if (!$flag) {
throw new exception('修改失败');
}
}
} catch (Exception $e) {
$res['statusCode'] = 300;
$res['message'] = '修改失败【' . $e->getMessage() . '】';
}
$res['callbackType'] = 'reloadTab';
$res['forwardUrl'] = '/manage/payment/index';
$this->ajaxDwzReturn($res);
}
示例8: BalancedCallback
public static function BalancedCallback($post)
{
Yii::import('application.extensions.vendor.autoload', true);
Httpful\Bootstrap::init();
Balanced\Bootstrap::init();
Balanced\Settings::$api_key = Yii::app()->params['balancedAPISecret'];
$log = "Received callback... \n";
try {
$data = json_decode($post);
if (!isset($data->type)) {
$log .= "Error parsing data: \n";
$log .= "Raw post: \n" . $post . "\n";
$log .= "Parsed data: \n" . print_r($data, true) . "\n";
throw new Exception("Error parsing data");
}
if ($data->type == 'debit.succeeded') {
try {
$log .= "Customer debit succeeded. Paying the host...\n";
$paymentID = $data->entity->meta->Payment_ID;
$log .= "Payment_ID: {$paymentID}\n";
$payment = Payment::model()->findByPk($paymentID);
$hostAmount = $payment->Amount * Yii::app()->params['HostPercentage'];
$log .= "Host's share is \${$hostAmount}\n";
// Convert to cents
$hostAmount *= 100;
$hostBankAccount = Balanced\BankAccount::get($payment->bankAccount->URI);
$credit = $hostBankAccount->credit($hostAmount);
$log .= 'Sent credit, response is: ' . print_r($credit, true) . "\n";
} catch (Exception $e) {
Mail::Instance()->Alert("Error crediting host account", print_r($e));
throw $e;
}
} else {
$log .= print_r($data, true) . "\n";
}
} catch (Exception $e) {
$log .= "\n" . print_r($e, true);
}
Yii::log($log, 'info', 'BalancedCallback');
}
示例9: actionUpdate
/**
* Updates a particular model.
* If update is successful, the browser will be redirected to the 'view' page.
* @param integer $id the ID of the model to be updated
*/
public function actionUpdate($id)
{
if (isset($_GET['sid'])) {
// Меняем статус, ajax
$sid = $_GET['sid'];
$model = $this->loadModel($id);
$model->status = $sid;
$model->save();
Yii::app()->end();
}
if (Yii::app()->request->isAjaxRequest) {
//echo 'test';
$data = Yii::app()->request->getRestParams();
$field = str_replace('Zakaz_', '', $data['elid']);
if (is_array($data)) {
$model = $this->loadModel($data['id']);
echo json_encode($model->{$field} = $data['data']);
echo json_encode($model->save());
echo json_encode($model->errors);
Yii::app()->end();
}
$this->renderPartial('_order_list_update');
Yii::app()->end();
}
Yii::app()->session['project_id'] = $id;
$model = $this->loadModel($id);
if (Yii::app()->request->getParam('close') == 'yes') {
$model->old_status = $model->status;
$model->status = 5;
$model->save(false);
$user = User::model()->findByPk($model->user_id);
if ($user->pid) {
$payed = Payment::model()->exists('order_id = :p1 AND payment_type = :p2', array(':p1' => $model->id, ':p2' => Payment::OUTCOMING_WEBMASTER));
if (!$payed) {
// Only first time
$webmaster = User::model()->with('profile')->findByPk($user->pid);
$openlog = WebmasterLog::model()->findByAttributes(array('order_id' => $model->id), 'action = :p1 OR action = :p2', array(':p1' => WebmasterLog::FIRST_ORDER, ':p2' => WebmasterLog::NON_FIRST_ORDER));
$webmasterlog = new WebmasterLog();
$webmasterlog->pid = $user->pid;
$webmasterlog->uid = $user->id;
$webmasterlog->date = date("Y-m-d");
$webmasterlog->order_id = $model->id;
if ($openlog->action == WebmasterLog::FIRST_ORDER) {
$webmasterlog->action = WebmasterLog::FINISH_FIRST_ORDER_SUCCESS;
} elseif ($openlog->action == WebmasterLog::NON_FIRST_ORDER) {
$webmasterlog->action = WebmasterLog::FINISH_NON_FIRST_ORDER_SUCCESS;
}
$webmasterlog->save();
// Pament for webmaster ~~~~~~~~~~~~~~~~~~~~~~~~~~
$payment = ProjectPayments::model()->find('order_id = :ORDER_ID', array(':ORDER_ID' => $model->id));
$manag = User::model()->findByPk(Yii::app()->user->id);
$buh = new Payment();
$buh->order_id = $model->id;
$buh->receive_date = date('Y-m-d');
$buh->theme = $model->title;
$buh->user = $webmaster->email;
$buh->details_ya = $webmaster->profile->yandex;
$buh->details_wm = $webmaster->profile->wmr;
$buh->details_bank = $webmaster->profile->bank_account;
$buh->payment_type = Payment::OUTCOMING_WEBMASTER;
$buh->manager = $manag->email;
//$buh->approve = 0;
$buh->method = 'Cash or Bank';
if ($openlog->action == WebmasterLog::FIRST_ORDER) {
$buh->summ = (double) $payment->project_price * Company::getWebmasterFirstOrderRate();
} elseif ($openlog->action == WebmasterLog::NON_FIRST_ORDER) {
$buh->summ = (double) $payment->project_price * Company::getWebmasterSecondOrderRate();
}
$buh->save();
}
}
$this->redirect(array('update', 'id' => $model->id));
} elseif (Yii::app()->request->getParam('open') == 'yes') {
$model->status = $model->old_status;
$model->save(false);
$this->redirect(array('update', 'id' => $model->id));
} elseif (Yii::app()->request->getParam('refound') == 'yes') {
$model->old_status = $model->status;
$model->status = 5;
$model->save(false);
$user = User::model()->findByPk($model->user_id);
// Refound ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
$manag = User::model()->findByPk(Yii::app()->user->id);
$payment = ProjectPayments::model()->find('order_id = :ORDER_ID', array(':ORDER_ID' => $model->id));
if ($payment && $payment->received > 0) {
$refound = $payment->received;
$payment->received = 0;
$payment->save();
$buh = new Payment();
$buh->order_id = $model->id;
$buh->receive_date = date('Y-m-d');
$buh->theme = $model->title;
$buh->user = $user->email;
$buh->summ = (double) $refound;
$buh->payment_type = Payment::OUTCOMING_CUSTOMER;
//.........这里部分代码省略.........
示例10: loadModel
/**
* Returns the data model based on the primary key given in the GET variable.
* If the data model is not found, an HTTP exception will be raised.
* @param integer the ID of the model to be loaded
*/
public function loadModel($id)
{
$model = Payment::model()->findByPk($id);
if ($model === null) {
throw new CHttpException(404, 'The requested page does not exist.');
}
return $model;
}
示例11:
</div>
<div class="row">
<div class="col-sm-12">
<div class="panel panel-default">
<div class="panel-heading">
<span class="panel-title"><?php
echo Yii::t('OrderModule.order', 'Payment');
?>
</span>
</div>
<div class="panel-body">
<div class="row">
<div class="col-sm-4">
<?php
echo $form->dropDownListGroup($model, 'payment_method_id', ['widgetOptions' => ['data' => CHtml::listData(Payment::model()->published()->findAll(), 'id', 'name'), 'htmlOptions' => ['empty' => Yii::t('OrderModule.order', 'Not selected')]]]);
?>
</div>
<div class="col-sm-2">
<br/>
<?php
echo $form->checkBoxGroup($model, 'paid');
?>
</div>
<div class="col-sm-6 text-right">
<br/>
<h4>
<?php
echo Yii::t('OrderModule.order', 'Total');
?>
: <?php
示例12: getLogsSumm
public static function getLogsSumm($pid, $start_date, $finish_date)
{
$sql_dates = "select * from \n\t\t\t(select adddate('1970-01-01',t4.i*10000 + t3.i*1000 + t2.i*100 + t1.i*10 + t0.i) `date` from\n\t\t\t (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t0,\n\t\t\t (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t1,\n\t\t\t (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t2,\n\t\t\t (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t3,\n\t\t\t (select 0 i union select 1 union select 2 union select 3 union select 4 union select 5 union select 6 union select 7 union select 8 union select 9) t4) v\n\t\t\twhere `date` between '{$start_date}' and '{$finish_date}'";
$sql_unigue = 'SELECT date as date0, COUNT(*) AS `unique` FROM ' . self::staticTableName() . ' WHERE pid = :pid AND action = ' . self::PARTNER_UNIQUE . ' AND date >= :start_date AND date <= :finish_date GROUP BY date';
$sql_sales_first = 'SELECT date as date1, COUNT(*) AS `sales_first` FROM ' . self::staticTableName() . ' WHERE pid = :pid AND action = ' . self::FULL_PAYMENT_4_FIRST_ORDER . ' AND date >= :start_date AND date <= :finish_date GROUP BY date';
$sql_sales_repeat = 'SELECT date as date2, COUNT(*) AS `sales_repeat` FROM ' . self::staticTableName() . ' WHERE pid = :pid AND action = ' . self::FULL_PAYMENT_4_NON_FIRST_ORDER . ' AND date >= :start_date AND date <= :finish_date GROUP BY date';
$sql_completed_first = 'SELECT date as date3, COUNT(*) AS `completed_first` FROM ' . self::staticTableName() . ' WHERE pid = :pid AND action = ' . self::FINISH_FIRST_ORDER_SUCCESS . ' AND date >= :start_date AND date <= :finish_date GROUP BY date';
$sql_completed_repeat = 'SELECT date as date4, COUNT(*) AS `completed_repeat` FROM ' . self::staticTableName() . ' WHERE pid = :pid AND action = ' . self::FINISH_NON_FIRST_ORDER_SUCCESS . ' AND date >= :start_date AND date <= :finish_date GROUP BY date';
$sql_profit = 'SELECT date as date5, SUM(summ) as `profit` FROM ' . self::staticTableName() . ' t51 LEFT OUTER JOIN ' . Payment::model()->tableName() . ' t52 ON t51.order_id = t52.order_id WHERE pid = :pid AND action = ' . self::FINISH_NON_FIRST_ORDER_SUCCESS . ' AND date >= :start_date AND date <= :finish_date AND payment_type = ' . Payment::OUTCOMING_WEBMASTER . ' GROUP BY date';
$sql = 'SELECT `date`, `unique`, `sales_first`, `sales_repeat`, `completed_first`, `completed_repeat`, `profit` FROM (' . $sql_dates . ') t LEFT OUTER JOIN (' . $sql_unigue . ') t0 ON date=date0 LEFT OUTER JOIN (' . $sql_sales_first . ') t1 ON date=date1 LEFT OUTER JOIN (' . $sql_sales_repeat . ') t2 ON date=date2 LEFT OUTER JOIN (' . $sql_completed_first . ') t3 ON date=date3 LEFT OUTER JOIN (' . $sql_completed_repeat . ') t4 ON date=date4 LEFT OUTER JOIN (' . $sql_profit . ') t5 ON date=date5';
$command = Yii::app()->db->createCommand($sql);
$command->bindParam(':pid', $pid, PDO::PARAM_INT);
$command->bindParam(":start_date", $start_date, PDO::PARAM_STR);
$command->bindParam(":finish_date", $finish_date, PDO::PARAM_STR);
return $command->queryAll();
}
示例13: actionCancelTransaction
public function actionCancelTransaction()
{
// Ajax approve in actionView
$this->_prepairJson();
$id = $this->_request->getParam('id');
$method = $this->_request->getParam('method');
if (!$method) {
$method = 'Cash';
}
$payment = Payment::model()->findByPk($id);
if (!$payment) {
$this->_response->setData(array('result' => false, 'message' => 'Not found'));
Yii::app()->end();
}
$this->_response->setData(array('result' => $payment->cancelPayment($method)));
$this->_response->send();
}
示例14: array
<td><?php
echo $v->challan->date_time_offence;
?>
</td>
<td><?php
echo $v->challan->name_person;
?>
</td>
<td><?php
echo CHtml::link('<i class="icon-eye-open"></i>', array('challanAssignments/viewchallan&id=' . $v->challan->id), array('class' => '', 'data-original-title' => 'View Challan', 'rel' => 'tooltip', 'target' => '_blank'));
?>
</td>
<td>
<?php
if ($v->status == "Paid") {
$payment = Payment::model()->findByAttributes(array("dispatch_id" => $v->id));
echo $payment->rupee . " Paid";
} else {
?>
<input type="text" id="rupee-<?php
echo $v->id;
?>
" style="width:100px;" />
<?php
}
?>
</td>
<td>
<?php
if ($v->status != "Paid") {
示例15:
<?php
echo $form->labelEx($model, 'last_update');
?>
<?php
echo $form->textField($model, 'last_update');
?>
<?php
echo $form->error($model, 'last_update');
?>
</div><!-- row -->
<label><?php
echo GxHtml::encode($model->getRelationLabel('payments'));
?>
</label>
<?php
echo $form->checkBoxList($model, 'payments', GxHtml::encodeEx(GxHtml::listDataEx(Payment::model()->findAllAttributes(null, true)), false, true));
?>
<label><?php
echo GxHtml::encode($model->getRelationLabel('rentals'));
?>
</label>
<?php
echo $form->checkBoxList($model, 'rentals', GxHtml::encodeEx(GxHtml::listDataEx(Rental::model()->findAllAttributes(null, true)), false, true));
?>
<?php
echo GxHtml::submitButton('Save');
$this->endWidget();
?>
</div><!-- form -->