当前位置: 首页>>代码示例>>PHP>>正文


PHP Gateway::model方法代码示例

本文整理汇总了PHP中Gateway::model方法的典型用法代码示例。如果您正苦于以下问题:PHP Gateway::model方法的具体用法?PHP Gateway::model怎么用?PHP Gateway::model使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Gateway的用法示例。


在下文中一共展示了Gateway::model方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。

示例1: updateAction

 function updateAction()
 {
     $model = new Profile();
     if (isset($_POST['ajax'])) {
         // Add method to profile
         if (isset($_POST['model']) && $_POST['model'] == 'profiles_methods') {
             $profileMethod = new ProfileMethod();
             @$this->performAjaxValidation($profileMethod);
             // Uncomment the line if AJAX validation is needed
             if ($_POST['action'] == 'create') {
                 $profileMethod->fillFromArray($_POST, TRUE);
             } elseif ($_POST['action'] == 'update') {
                 $methodID = (int) AF::get($_POST, 'method_id');
                 $profileID = (int) AF::get($_POST, 'profile_id');
                 $profileMethod = ProfileMethod::model()->findByPk(array('method_id' => $methodID, 'profile_id' => $profileID));
                 $profileMethod->fillFromArray($_POST);
             }
             if ($profileMethod->method_id == Method::METHOD_CC) {
                 if (isset($_POST['flags']['filter']) && $_POST['flags']['filter']) {
                     if (!$profileMethod->flags) {
                         $profileMethod->flags = '';
                     }
                     @$profileMethod->addFlags('filter');
                 } else {
                     $profileMethod->removeFlags('filter');
                 }
             }
             if (!$profileMethod->flags) {
                 $profileMethod->flags = '';
             }
             if ($profileMethod->save()) {
                 $link = AF::link(array('profiles' => 'update'), array('id' => $profileMethod->profile_id));
                 Message::echoJson('success', array('redirect' => $link));
             } else {
                 Message::echoJsonError(__('profile_method_not_' . $_POST['action'] . 'd') . '. ' . $profileMethod->errors2string);
             }
         }
         if (isset($_POST['getprofilemethodinfo'])) {
             $methodID = (int) AF::get($_POST, 'method_id');
             $profileID = (int) AF::get($_POST, 'profile_id');
             $methods = Method::model()->cache()->findAllInArray();
             //$model = ProfileMethod::model()->find("profiles_methods_id=:profiles_methods_id", array(':profiles_methods_id'=>$id));
             $model = ProfileMethod::model()->findByPk(array('method_id' => $methodID, 'profile_id' => $profileID));
             echo $this->view->includeFile('_methods_form', array('application', 'views', 'profiles'), array('action' => 'update', 'ajax' => TRUE, 'popup' => TRUE, 'methodModel' => $model, 'methods' => $methods));
             die;
         }
     }
     if (isset($_POST['model'])) {
         // Change profile_name
         if ($_POST['model'] == 'profile') {
             if (isset($_POST['ajax'])) {
                 $this->performAjaxValidation($model);
                 // Uncomment the line if AJAX validation is needed
                 $model->fillFromArray($_POST, FALSE);
                 $model->user_id_updated = $this->user->user_id;
                 $model->updated = 'NOW():sql';
                 $model->model_uset_id = $this->user->user_id;
                 if ($model->save()) {
                     $link = AF::link(array('profiles' => 'update'), array('id' => $model->PkValue));
                     Message::echoJson('success', array('redirect' => $link));
                 } else {
                     Message::echoJsonError(__('profile_no_updated'));
                 }
                 die;
             }
             $this->redirect();
             die;
         }
         // Add gateway to profile
         if ($_POST['model'] == 'profiles_gateways') {
             $profileGateway = new ProfileGateway();
             $this->performAjaxValidation($profileGateway);
             // Uncomment the line if AJAX validation is needed
             $profileGateway->fillFromArray($_POST, TRUE);
             $profileGateway->addGateway();
         }
     }
     $id = AF::get($this->params, 'id', FALSE);
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params));
     $models = AFActiveDataProvider::models('ProfileGateway', $this->params, $pagination);
     $profile_methods = ProfileMethod::model()->getProfileMethodsByProfile($id);
     //$method_ids = '0';
     if ($profile_methods) {
         foreach ($profile_methods as $key => $value) {
             $method_id_array[] = $value['method_id'];
         }
         $method_ids = implode(',', $method_id_array);
     }
     $methods = Method::model()->cache()->findAllInArray();
     $gateways = Gateway::model()->getGateways();
     if (!$id) {
         throw new AFHttpException(0, 'no_id');
     }
     if (!$model->findByPk($id)) {
         throw new AFHttpException(0, 'incorrect_id');
     }
     //for create profile method
     $modelProfileMethod = new ProfileMethod();
     $modelProfileMethod->profile_id = $model->profile_id;
     Assets::js('jquery.form');
//.........这里部分代码省略.........
开发者ID:,项目名称:,代码行数:101,代码来源:

示例2: payOrder

 /**
  * @return PaymentAPIResponse
  */
 public function payOrder($order, $price)
 {
     $this->_paymetnResponse->clear();
     if (!$this->initOrder($order)) {
         return $this->_paymetnResponse;
     }
     $this->attemptModel = new Attempt();
     $this->attemptModel->getLastOrderAttempt($this->orderModel->order_id, Attempt::DEBIT_TYPE);
     // if in inprogress status, update status
     if (in_array($this->attemptModel->status, array(Attempt::SUBMITED_STATUS, Attempt::INPROGRESS_STATUS))) {
         $this->updateStatusAttempt();
     }
     //Set response params
     $this->_paymetnResponse->attemptModel = $this->attemptModel;
     $this->_paymetnResponse->paymentModel = $this->paymentModel;
     if (!$this->attemptModel->attempt_id || in_array($this->attemptModel->status, array(Attempt::NEW_STATUS, Attempt::DECLINED_STATUS, Attempt::UNKNOWN_STATUS))) {
         $payAttempt = 1;
         $gatewayAttemptArray = array();
         $currentGatewayID = $this->gatewayModel->gateway_id;
         // Trying to pay via several gateways
         do {
             if ($payAttempt > 1) {
                 $gatewayModel = Gateway::model()->findByPk($this->gatewayModel->next_id);
                 // if empty or we have tried this gateway yet, then return response
                 if (!$gatewayModel || in_array($gatewayModel->gateway_id, $gatewayAttemptArray)) {
                     break;
                 }
                 $this->gatewayModel = $gatewayModel;
                 $this->_ps->setModel($this->gatewayModel);
             }
             $this->createAttempt(Attempt::DEBIT_TYPE, $price);
             $this->payAttempt();
             $gatewayAttemptArray[] = $currentGatewayID = $this->gatewayModel->gateway_id;
             $payAttempt++;
         } while ($this->_paymetnResponse->attemptStatus == Attempt::DECLINED_STATUS && $this->gatewayModel->next_id);
         // rewrite gateway_id by order if changed
         if ($this->orderModel->gateway_id != $currentGatewayID) {
             $this->orderModel->gateway_id = $currentGatewayID;
             $this->orderModel->save();
         }
     } elseif (in_array($this->attemptModel->status, array(Attempt::SUCCESS_STATUS, Attempt::CHARGEBACK_STATUS))) {
         //return success
         $this->_paymetnResponse->status = PaymentAPIResponse::SUCCESS_STATUS;
     } elseif (in_array($this->attemptModel->status, array(Attempt::SUBMITED_STATUS, Attempt::INPROGRESS_STATUS))) {
         //return status
         $this->_paymetnResponse->status = PaymentAPIResponse::SUCCESS_STATUS;
     } else {
         //unknown error
         $this->_paymetnResponse->status = PaymentAPIResponse::ERROR_STATUS;
         $this->_paymetnResponse->addError('unknown_error');
     }
     return $this->_paymetnResponse;
 }
开发者ID:,项目名称:,代码行数:56,代码来源:

示例3: ucfirst

 @include_once '../../ws/class/payment.class.php';
 @include_once '../../ws/class/payment_'.$orderModel->payment_type.'.class.php';
 $paymentSystem = Payment::getPaymentSystem($orderModel);
 */
 $paymentModelName = 'Order' . ucfirst($orderModel->payment_type);
 $paymentModel = new $paymentModelName();
 $paymentModel->fillFromDbPk($orderModel->order_id);
 $newPaymentModel = new $paymentModelName();
 $newPaymentModel->setIsNewRecord(false);
 $newPaymentModel->order_id = $orderModel->order_id;
 $newPaymentModel->request_id = base_convert($orderModel->order_id . time(), 10, 36);
 $newPaymentModel->save(false);
 //if Pacnet
 @(include_once '../../ws/class/raven_config_demo.class.php');
 @(include_once '../../ws/class/ravenrequest.class.php');
 $gateway = Gateway::model()->findByPk($orderModel->gateway_id)->getAttributes();
 $arrayNote1 = unserialize(NoteBase64::decode($paymentModel->note1));
 //if test credit card
 if ($arrayNote1['ccn'] == Config::TESTCREDITCARDNUMBER || $paymentModel->pn_status == 'test') {
     $newPaymentModel->pn_status = 'test';
     $newPaymentModel->save(false);
     $orderModel->status = 'ok';
     //$orderModel->recurring_next = 'NULL:sql';
     $orderModel->payment_total = $orderModel->amount_product + $orderModel->amount_shipping;
     $orderModel->save(false);
     continue;
 }
 if (!$arrayNote1['ccn'] || !$arrayNote1['ccc'] || !$paymentModel->currency || !$paymentModel->pn_payment_type || !$paymentModel->expiry_date || !$orderModel->fullAmountCent) {
     $newPaymentModel->pn_status = 'error';
     $newPaymentModel->save(false);
     $orderModel->status = 'error';
开发者ID:,项目名称:,代码行数:31,代码来源:

示例4: crmInit

 public function crmInit($post)
 {
     $this->wsType = 'x1';
     $this->intervalCheck = false;
     $this->campaign = new Campaign();
     // is this a valid campaign?
     if (!$this->campaign->fillfromDbPk($post['campaign_id'])) {
         // if(!$campaign->getPkValue())
         $this->apiError('This is not a valid request');
     }
     $this->post = $post;
     $this->post['user_ip'] = '127.0.0.1';
     if (!isset($this->post['is_payment']) || !$this->post['is_payment']) {
         $this->isPayment = false;
     }
     if ($this->isPayment) {
         // determine ps
         $gateway = Gateway::model()->fillFromDbPk($this->post['gateway_id']);
         if ($gateway->gateway_id) {
             $this->post['ps'] = $gateway->system_code;
         }
     }
     if (isset($this->post['customer_id']) && $this->post['customer_id']) {
         $this->newCustomer = false;
     }
 }
开发者ID:,项目名称:,代码行数:26,代码来源:


注:本文中的Gateway::model方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。