Ejemplo n.º 1
0
 public function payEmail()
 {
     $options = self::getOptions();
     $options['merchant'] = $this->gatewayModel->username;
     $options['passwd'] = $this->gatewayModel->shared_secret;
     $dp = new DragonpayRequest($options);
     $dp->set('txnid', $this->attemptModel->attempt_id);
     $dp->set('amount', number_format($this->attemptModel->amount, 2, '.', ''));
     $dp->set('ccy', 'PHP');
     //$this->campaignModel->currency_id);
     $dp->set('description', $this->campaignModel->profile->descriptor_name);
     $dp->set('email', $this->customerModel->email);
     $dp->set('param1', $this->attemptModel->attempt_id);
     //$dp->set('mode', '1');
     //Change Attempt Status to inprogress
     Attempt::setAttemptStatus($this->attemptModel, Attempt::INPROGRESS_STATUS);
     //or submitted?
     $this->_paymetnResponse->redirectUrl = $dp->redirectUrl();
     //Set success status to response
     $this->_paymetnResponse->status = PaymentAPIResponse::SUCCESS_STATUS;
     $this->_paymetnResponse->attemptModel = $this->attemptModel;
     $this->_paymetnResponse->paymentModel = $this->paymentModel;
     OrderLog::createLog(0, $this->orderModel->order_id, 22, $this->attemptModel->amount . ' ' . $this->campaignModel->currency_id);
     return true;
 }
Ejemplo n.º 2
0
 public function getReportActions()
 {
     $where = $this->unsetWhereKey('actions');
     $sql = "SELECT COUNT(*) as `count`, ol.`action`\n                FROM `order_logs` as ol\n                JOIN `users` as u USING(`user_id`)\n                WHERE ?p\n                GROUP BY ol.`action`";
     $result = self::$_msql->getall($sql, $where);
     $allActions = OrderLog::getActions();
     foreach ($result as $k => $v) {
         $t = isset($allActions[$v['action']]) ? $allActions[$v['action']] : 'no_name';
         $result[$k]['name'] = __('order_log_' . $t);
     }
     return $result;
 }
Ejemplo n.º 3
0
 public function packageSent()
 {
     //$dt = new DateTime();
     $this->sent = 'NOW():sql';
     //$dt->format('Y-m-d H:i:s');//?
     $this->update();
     // update order status
     foreach ($this->orders as $o) {
         $o->status = 'sent';
         $o->update();
         OrderLog::createLog(0, $o->order_id, 19);
     }
 }
Ejemplo n.º 4
0
 /**
  * 添加订单日志
  * @param $data
  */
 public function addOrderLog($data)
 {
     if (empty($data)) {
         throw new exception('数据不能为空!');
     } elseif (!$data['order_id']) {
         throw new exception('订单号不能为空!');
     } elseif (!$data['type']) {
         throw new exception('日志类型不能为空!');
     }
     $m = new OrderLog();
     $m->order_id = $data['order_id'];
     $m->admin_id = isset($data['admin_id']) ? $data['admin_id'] : 0;
     $m->admin_name = isset($data['admin_name']) ? $data['admin_name'] : '管理员';
     $m->phone = isset($data['phone']) ? $data['phone'] : '';
     $m->type = $data['type'];
     $m->msg = isset($data['msg']) ? $data['msg'] : '';
     $m->is_show = isset($data['is_show']) ? $data['is_show'] : 1;
     $m->add_time = time();
     $flag = $m->save();
     if (empty($flag)) {
         throw new exception('添加订单日志失败!', 500);
     }
     return true;
 }
Ejemplo n.º 5
0
 public function index()
 {
     $response = new ActionResponse();
     $customerOrder = CustomerOrder::getInstanceById($this->request->get('id'), true, array('User', 'Currency'));
     $logs = array();
     foreach (OrderLog::getRecordSetByOrder($customerOrder, null, array('User'))->toArray() as $entry) {
         if (!$entry['oldValue']) {
             $entry['oldValue'] = array();
         }
         if (!$entry['newValue']) {
             $entry['newValue'] = array();
         }
         if ($entry['action'] != OrderLog::ACTION_REMOVED_WITH_SHIPMENT) {
             $logs[] = $entry;
             $logs[count($logs) - 1]['items'] = array();
         } else {
             $logs[count($logs) - 1]['items'][] = $entry;
         }
     }
     $response->set('defaultCurrencyCode', $this->application->getDefaultCurrencyCode());
     $response->set('logs', $logs);
     return $response;
 }
Ejemplo n.º 6
0
 public function payCreditCard()
 {
     fb('PSPaymentBillsService');
     $options = $this->gatewayModel->getAttributes();
     $options['url'] = $this->_paymentOptions['payUrl'];
     if (self::$isTest) {
         /* $options ['username']= '******';
            $options ['shared_secret']= 'ZFksGze8o7URmtfRqBl3';
            $options ['routing_number']= '15132';*/
     }
     if (strlen($this->billingAddressModel->fullAddress) < 2) {
         $this->billingAddressModel->fullAddress = 'Address: ' . $this->billingAddressModel->fullAddress;
     }
     if (strlen($this->shippingAddressModel->phone) < 2) {
         $this->shippingAddressModel->phone = '0' . $this->shippingAddressModel->phone;
     }
     $transaction = new PBS($options);
     $transaction->set('orderNo', $this->attemptModel->getrequest_id('pb'));
     $transaction->set('orderCurrency', $this->campaignModel->currency_id);
     $transaction->set('orderAmount', number_format($this->attemptModel->amount, 2));
     $transaction->set('paymentMethod', 'Credit Card');
     $transaction->set('cardNo', $this->paymentModel->cc_number);
     $transaction->set('cardExpireMonth', $this->paymentModel->exp_date_month_formatted);
     $transaction->set('cardExpireYear', $this->paymentModel->exp_date_year_formatted);
     // send cvv if the billing circle = 0
     if ($this->orderModel->billing_cycle == 0) {
         $transaction->set('cardSecurityCode', $this->paymentModel->cc_cvv);
     }
     $transaction->set('issuingBank', 'Bank');
     $transaction->set('customerID', 'HLTH' . $this->attemptModel->attempt_id);
     $transaction->set('firstName', $this->billingAddressModel->fname);
     $transaction->set('lastName', $this->billingAddressModel->lname);
     $transaction->set('email', $this->customerModel->email);
     $transaction->set('ip', $this->orderModel->ip_formatted);
     $transaction->set('phone', $this->shippingAddressModel->phone);
     $transaction->set('country', strtoupper($this->billingAddressModel->country_id));
     $transaction->set('state', $this->billingAddressModel->state_id);
     $transaction->set('city', $this->billingAddressModel->city);
     $transaction->set('address', $this->billingAddressModel->fullAddress);
     $transaction->set('zip', $this->billingAddressModel->zip);
     $transaction->set('remark', '');
     //$signsrc = htmlspecialchars($transaction->merNo.$transaction->gatewayNo.$transaction->orderNo.$transaction->orderCurrency.$transaction->orderAmount.$transaction->customerID.$transaction->firstName.$transaction->lastName.$transaction->cardNo.$transaction->cardExpireYear.$transaction->cardExpireMonth.$transaction->cardSecurityCode.$transaction->email.$transaction->signkey);
     //$transaction->set('signInfo',hash('sha256',$signsrc));
     $transaction->sale();
     fb($transaction);
     // Submit the request
     try {
         $response = $transaction->execute();
     } catch (Exception $e) {
         $this->attemptError(array('error_processing_request'));
         return false;
     }
     fb($response);
     $xml = new DOMDocument();
     $xml->loadXML($response);
     fb($xml);
     // properly formed response?
     if (!$xml->getElementsByTagName("orderStatus")->item(0)) {
         $this->_paymetnResponse->addAlert('An error occurred');
         $this->attemptError(array('error' => 'unknown error'));
         return false;
     }
     // Fill and save attempt Model
     if ($xml->getElementsByTagName("tradeNo")->item(0) && $xml->getElementsByTagName("tradeNo")->item(0)->nodeValue) {
         //$this->attemptModel->tracking_number = (self::$isTest) ? substr($xml->getElementsByTagName("tradeNo")->item(0)->nodeValue,1) : $xml->getElementsByTagName("tradeNo")->item(0)->nodeValue;
         $this->attemptModel->custom_data = json_encode(array('tradeNo' => $xml->getElementsByTagName("tradeNo")->item(0)->nodeValue));
         $this->attemptModel->tracking_number = substr($xml->getElementsByTagName("tradeNo")->item(0)->nodeValue, 15);
     }
     $this->attemptModel->status_note = $xml->getElementsByTagName("orderInfo")->item(0)->nodeValue;
     //Transaction status:
     /*-2 => 'To be confirmed',
     		-1 => 'Pending',
     		 0 => 'Failure',
     		 1 => 'Success',*/
     $status = $xml->getElementsByTagName("orderStatus")->item(0)->nodeValue;
     //fb($status);
     // Check the status
     switch ($status) {
         case 1:
             $this->attemptModel->status = Attempt::SUCCESS_STATUS;
             $this->_paymetnResponse->status = PaymentAPIResponse::SUCCESS_STATUS;
             break;
         case -2:
         case -1:
             $this->attemptModel->status = Attempt::SUBMITED_STATUS;
             $this->_paymetnResponse->status = PaymentAPIResponse::SUCCESS_STATUS;
             break;
         case 0:
             fb('its been declined!!!');
             $this->attemptModel->status = Attempt::DECLINED_STATUS;
             $this->_paymetnResponse->status = PaymentAPIResponse::ERROR_STATUS;
             $this->_paymetnResponse->addAlert($xml->getElementsByTagName("orderInfo")->item(0)->nodeValue);
             $this->attemptError(array('error' => $xml->getElementsByTagName("orderInfo")->item(0)->nodeValue));
             return false;
             break;
         default:
             $this->attemptModel->status = Attempt::DECLINED_STATUS;
             $this->_paymetnResponse->status = PaymentAPIResponse::ERROR_STATUS;
             $this->_paymetnResponse->addAlert($xml->getElementsByTagName("orderInfo")->item(0)->nodeValue);
             $this->attemptError(array('error' => $xml->getElementsByTagName("orderInfo")->item(0)->nodeValue));
             return false;
             break;
     }
     if (!$this->attemptModel->save()) {
         fb('attempt save failed');
         fb($this->attemptModel->getErrors());
         fb($this->attemptModel->tracking_number);
     }
     //Set success status to response
     $this->_paymetnResponse->status = PaymentAPIResponse::SUCCESS_STATUS;
     $this->_paymetnResponse->attemptModel = $this->attemptModel;
     $this->_paymetnResponse->paymentModel = $this->paymentModel;
     OrderLog::createLog(0, $this->orderModel->order_id, 22, $this->attemptModel->amount . ' ' . $this->campaignModel->currency_id);
     return true;
 }
Ejemplo n.º 7
0
 public function voidCreditCard()
 {
     fb('Argus void');
     $options = $this->gatewayModel->getAttributes();
     $options['url'] = $this->_paymentOptions['curlUrl'];
     $successAttemptModel = Attempt::getSuccessAttempt($this->orderModel->order_id);
     $successCustomData = json_decode($successAttemptModel->custom_data, true);
     if (self::$isTest) {
         $options['username'] = '******';
         $options['shared_secret'] = 'ZFksGze8o7URmtfRqBl3';
         $options['routing_number'] = '16724';
     }
     $transaction = new Argus($options);
     if (isset($successCustomData['po_id'])) {
         $transaction->set('request_ref_po_id', $successCustomData['po_id']);
     }
     $transaction->void();
     $response = $transaction->execute();
     $aResponse = $response['response'];
     fb($transaction);
     fb($response);
     if (!isset($aResponse['TRANS_STATUS_NAME']) || $aResponse['TRANS_STATUS_NAME'] != self::STATUS_APPROVED) {
         $aErrors = array();
         $rFields = array('SERVICE_RESPONSE', 'SERVICE_ADVICE', 'PROCESSOR_RESPONSE', 'PROCESSOR_ADVICE', 'INDUSTRY_RESPONSE', 'INDUSTRY_ADVICE');
         foreach ($rFields as $itemField) {
             if (isset($aResponse[$itemField]) && $aResponse[$itemField]) {
                 $aErrors[$itemField] = $aResponse[$itemField];
             }
         }
         fb($aErrors);
         $this->attemptError($aErrors);
         return false;
     }
     // Fill and save attempt Model
     $this->attemptModel->status = Attempt::SUCCESS_STATUS;
     if (isset($aResponse['TRANS_ID']) && $aResponse['TRANS_ID']) {
         $this->attemptModel->tracking_number = $aResponse['TRANS_ID'];
     }
     if (isset($aResponse['PROC_NAME'])) {
         $this->attemptModel->status_note = 'Response: ' . $aResponse['PROC_NAME'];
     }
     $customDate = array();
     $cFields = array('PO_ID', 'BATCH_ID', 'PMT_L4', 'PMT_ID', 'PO_LI_ID_1', 'PO_LI_PROD_ID_1');
     foreach ($cFields as $itemcField) {
         if (isset($aResponse[$itemcField]) && $aResponse[$itemcField]) {
             $customDate[$itemcField] = $aResponse[$itemcField];
         }
     }
     if ($customDate) {
         $this->attemptModel->custom_data = json_encode($customDate);
     }
     $this->attemptModel->save();
     //Set success status to response
     $this->_paymetnResponse->status = PaymentAPIResponse::SUCCESS_STATUS;
     $this->_paymetnResponse->attemptModel = $this->attemptModel;
     $this->_paymetnResponse->paymentModel = $this->paymentModel;
     OrderLog::createLog(0, $this->orderModel->order_id, 3, $this->attemptModel->amount . ' ' . $this->campaignModel->currency_id);
     return true;
 }
Ejemplo n.º 8
0
 /**
  * 订单详情
  */
 public function actionOrder()
 {
     $userId = $this->user_id;
     if (empty($userId)) {
         $this->redirect('/user/login');
     }
     $orderSn = addslashes(trim($_REQUEST['ordersn']));
     try {
         $oInfo = Order::model()->getUserOrderInfoBySn($userId, $orderSn);
         if (empty($oInfo) || !$oInfo['id']) {
             $this->redirect('/?from=no_order');
         }
         $orderProduct = OrderProduct::model()->getOrderProductByOrderId($oInfo['id']);
         $status = Order::model()->getOrderStatusForUserPage($oInfo);
         $logs = OrderLog::model()->findAllByAttributes(array('order_id' => $oInfo['id']));
     } catch (exception $e) {
         $this->redirect('/?from=order_error');
     }
     $viewData = array();
     $viewData['info'] = $oInfo;
     $viewData['status'] = $status;
     $viewData['logs'] = $logs;
     $viewData['orderProduct'] = $orderProduct;
     $this->render('/user/order', $viewData);
 }
Ejemplo n.º 9
0
 /**
  * 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 = OrderLog::model()->findByPk($id);
     if ($model === null) {
         throw new CHttpException(404, 'The requested page does not exist.');
     }
     return $model;
 }
Ejemplo n.º 10
0
     @(include_once '../../ws/class/ipayment.class.php');
     @(include_once '../../ws/class/payment.class.php');
     @(include_once '../../ws/class/raven_config_demo.php');
     @(include_once '../../ws/class/ravenrequest.class.php');
     @(include_once '../../ws/class/payment_' . $orderModel->payment_type . '.class.php');
     $paymentSystem = Payment::getPaymentSystem($orderModel);
     try {
         if ($paymentSystem->setRefund($countRefunded)) {
             $jobModel->done();
             $saveOrder = new Order();
             $saveOrder->order_id = $jobModel->order_id;
             $saveOrder->payment_total = $orderModel->payment_total - $countRefunded;
             echo $saveOrder->payment_total . '<br>';
             $saveOrder->setIsNewRecord(false);
             $saveOrder->save(false);
             OrderLog::createLog(0, $jobModel->order_id, 13, $countRefunded);
         } else {
             $jobModel->setStatusError(json_encode($paymentSystem->geterrors()));
         }
     } catch (Exception $e) {
         $jobModel->setStatusError($e->getMessage());
     }
     break;
 case 'mail':
     $mailArray = unserialize($jobModel->content);
     $smtpModel = new Smtp();
     $smtpModel->fillFromDbPk((int) $mailArray['smtp_id']);
     $mail = new PHPMailer();
     $mail->IsSMTP();
     $mail->IsHTML(true);
     $mail->CharSet = 'UTF-8';
Ejemplo n.º 11
0
 protected function attemptError($errors)
 {
     //Change Attempt Status to decline and save status note
     $this->attemptModel->status = Attempt::DECLINED_STATUS;
     $this->attemptModel->status_note = implode(',', $errors);
     $this->attemptModel->save();
     foreach ($errors as $key => $error) {
         $this->_paymetnResponse->addError($key, $error);
     }
     //$this->_paymetnResponse->addAlert('error_processing_your_request');
     $this->_paymetnResponse->status = PaymentAPIResponse::ERROR_STATUS;
     $this->_paymetnResponse->attemptModel = $this->attemptModel;
     $this->_paymetnResponse->paymentModel = $this->paymentModel;
     OrderLog::createLog(0, $this->orderModel->order_id, 21, implode(',', $errors));
 }
Ejemplo n.º 12
0
 protected function afterDelete()
 {
     $orderLog = new OrderLog();
     $orderLog->op_name = 'delete';
     $orderLog->log_text = serialize($this);
     $orderLog->order_id = $this->order_id;
     $orderLog->result = 'success';
     $orderLog->save();
 }
Ejemplo n.º 13
0
 public function voidCreditCard()
 {
     fb('PayPal void');
     Attempt::setAttemptStatus($this->attemptModel, Attempt::INPROGRESS_STATUS);
     $successAttemptModel = Attempt::getSuccessAttempt($this->orderModel->order_id);
     $successAttemptCustomData = json_decode($successAttemptModel->custom_data, true);
     $options = array('username' => $this->gatewayModel->username, 'password' => $this->gatewayModel->routing_number, 'signature' => $this->gatewayModel->shared_secret);
     $transaction = new PayPal($options);
     if (self::$isTest) {
         $transaction->setIsProduction(false);
     }
     $transaction->set('TRANSACTIONID', $successAttemptCustomData['tracking_number']);
     $transaction->void();
     try {
         $response = $transaction->execute();
         fb($response);
     } catch (Exception $e) {
         $aErrors = array('Error processing your request');
         $this->attemptError($aErrors);
         return false;
     }
     if (!is_array($response) || !isset($response['ACK'])) {
         // payment server errors
         $aErrors = array('Error processing your request');
         $this->attemptError($aErrors);
         return false;
     }
     if (in_array($response['ACK'], array(Paypal::STATUS_SUCCESS, Paypal::STATUS_SUCCESS_WITH_WARNING))) {
         $this->attemptModel->status = Attempt::SUCCESS_STATUS;
         $this->_paymetnResponse->status = PaymentAPIResponse::SUCCESS_STATUS;
     } else {
         $this->attemptModel->status = Attempt::DECLINED_STATUS;
         $this->_paymetnResponse->status = PaymentAPIResponse::ERROR_STATUS;
     }
     //Save custom data
     $customData = array();
     if (isset($response['TRANSACTIONID'])) {
         $customData['tracking_number'] = $response['REFUNDTRANSACTIONID'];
     }
     if (isset($response['CORRELATIONID'])) {
         $customData['correlation_id'] = $response['CORRELATIONID'];
     }
     if (isset($response['REFUNDSTATUS'])) {
         $customData['refund_status'] = $response['REFUNDSTATUS'];
     }
     if (isset($response['PENDINGREASON'])) {
         $customData['pending_reason'] = $response['PENDINGREASON'];
     }
     if ($customData) {
         $this->attemptModel->custom_data = json_encode($customData);
     }
     //Save status_note
     $errors = array();
     if (isset($response['L_ERRORCODE0'])) {
         $errors[] = 'Code: ' . $response['L_ERRORCODE0'];
     }
     if (isset($response['L_LONGMESSAGE0'])) {
         $errors[] = 'Message: ' . $response['L_LONGMESSAGE0'];
     }
     if ($errors) {
         $this->attemptModel->status_note = implode('. ', $errors);
     }
     $this->attemptModel->save();
     //Set success status to response
     $this->_paymetnResponse->attemptModel = $this->attemptModel;
     $this->_paymetnResponse->paymentModel = $this->paymentModel;
     OrderLog::createLog(0, $this->orderModel->order_id, 13, $this->attemptModel->amount . ' ' . $this->campaignModel->currency_id);
     return true;
 }
Ejemplo n.º 14
0
 public function voidCreditCard()
 {
     $successAttemptModel = Attempt::getSuccessAttempt($this->orderModel->order_id);
     $transaction = new NmiDirectPost(array('nmi_user' => $this->gatewayModel->username, 'nmi_password' => $this->gatewayModel->shared_secret));
     $transaction->void($successAttemptModel->tracking_number);
     $result = $transaction->execute();
     fb($result);
     // if error
     if ($result['response'] != 1 || !isset($result['response_code']) || $result['response_code'] != 100) {
         $aErrors = array('Response: ' . $result['responsetext'], ' Code: ' . $result['response_code']);
         if (isset(Nmi::$responseCodes[$result['response_code']])) {
             array_push($aErrors, ' Text:' . Nmi::$responseCodes[$result['response_code']]);
         }
         $this->attemptError($aErrors);
         return false;
     }
     // Fill and save attempt Model
     $this->attemptModel->status = Attempt::SUCCESS_STATUS;
     if (isset($result['transactionid']) && $result['transactionid']) {
         $this->attemptModel->tracking_number = $result['transactionid'];
     }
     $this->attemptModel->status_note = 'Response: ' . $result['responsetext'] . ', Code: ' . $result['response_code'];
     if (isset(Nmi::$responseCodes[$result['response_code']])) {
         $this->attemptModel->status_note .= ' Text:' . Nmi::$responseCodes[$result['response_code']];
     }
     if (isset($result['authcode']) && $result['authcode']) {
         $this->attemptModel->custom_data = json_encode(array('authcode' => $result['authcode']));
     }
     $this->attemptModel->save();
     //Set success status to response
     $this->_paymetnResponse->status = PaymentAPIResponse::SUCCESS_STATUS;
     $this->_paymetnResponse->attemptModel = $this->attemptModel;
     $this->_paymetnResponse->paymentModel = $this->paymentModel;
     OrderLog::createLog(0, $this->orderModel->order_id, 3, $this->attemptModel->amount . ' ' . $this->campaignModel->currency_id);
     return true;
 }
Ejemplo n.º 15
0
 public function fulfillmentAction()
 {
     $clearArray = array('fulfillment_id', 'o_status');
     $this->filter($clearArray);
     if (!isset($this->params['r_dates'])) {
         $today = date("d.m.Y");
         $this->params['r_dates'] = $today . '-' . $today;
     }
     if (!isset($this->params['show_orders'])) {
         $this->params['show_orders'] = 0;
     }
     $pagination = new Pagination(array('action' => $this->action, 'controller' => $this->controller, 'params' => $this->params, 'ajax' => true));
     $showOrders = AF::get($this->params, 'show_orders') ? true : false;
     if ($showOrders && isset($this->params['from']) && in_array($this->params['from'], Fulfillment::orderSType())) {
         switch ($this->params['from']) {
             case 'shippable_orders':
                 $this->params['o_status'] = implode(',', array(Order::STATUS_OK, Order::STATUS_SENT));
                 $this->params['o_flag'] = Order::FlAG_PAID;
                 $this->params['o_not_flag'] = Order::FlAG_TEST;
                 break;
             case 'shippable_products':
                 $this->params['o_status'] = implode(',', array(Order::STATUS_OK, Order::STATUS_SENT));
                 $this->params['o_flag'] = Order::FlAG_PAID;
                 $this->params['o_not_flag'] = Order::FlAG_TEST;
                 break;
             case 'orders_pending_post':
                 $this->params['o_status'] = implode(',', array(Order::STATUS_OK));
                 $this->params['o_flag'] = Order::FlAG_PAID;
                 $this->params['o_not_flag'] = Order::FlAG_TEST;
                 break;
             case 'orders_sent_to_fulfillment':
                 $this->params['o_status'] = implode(',', array(Order::STATUS_SENT));
                 $this->params['o_flag'] = Order::FlAG_PAID;
                 $this->params['o_not_flag'] = Order::FlAG_TEST;
                 break;
             case 'orders_pending_tracking':
                 $this->params['o_status'] = implode(',', array(Order::STATUS_SENT, Order::STATUS_SHIPPED));
                 $this->params['o_flag'] = Order::FlAG_PAID;
                 $this->params['p_tracking_number'] = '';
                 $this->params['o_not_flag'] = Order::FlAG_TEST;
                 break;
             case 'shipped_orders':
                 $this->params['o_status'] = implode(',', array(Order::STATUS_SHIPPED));
                 $this->params['o_flag'] = Order::FlAG_PAID;
                 $this->params['o_not_flag'] = Order::FlAG_TEST;
                 break;
             case 'returned_orders':
                 $this->params['o_status'] = implode(',', array(Order::STATUS_RETURNED));
                 $this->params['o_not_flag'] = Order::FlAG_TEST;
                 break;
         }
     }
     $models = AFActiveDataProvider::models('Fulfillment', $this->params, $pagination);
     if ($showOrders) {
         $dataProvider = $models->getStatusReportByOrder();
         $total = null;
         $fields = array('order_id_link', 'created_formatted', 'shippable_products', 'return_reason_formatted', 'status');
     } else {
         $dataProvider = $models->getStatusReport();
         $total = $models->getTotalReport();
         $fields = array('fulfillment_formatted', 'shippable_orders_link', 'shippable_products_link', 'orders_pending_post_link', 'orders_sent_to_fulfillment_link', 'orders_pending_tracking_link', 'shipped_orders_link', 'returned_orders_link');
     }
     $filterFields = OrderLog::$FilterFields = $models->getoutFilterFields($clearArray, array('r_dates'));
     $fulfillments = $models->getReportFulfillments();
     // set ajax table
     if (AF::isAjaxRequestModels()) {
         $this->view->includeFile('_fulfillment_table', array('application', 'views', 'reports'), array('access' => $this->access, 'controller' => $this->controller, 'dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields, 'total' => $total[0], 'fields' => $fields, 'ajax' => true, 'fulfillments' => $fulfillments));
         die;
     }
     if (isset($this->params['download_csv'])) {
         $csvField = $fields;
         $changeArray = array('shippable_orders_link' => 'shippable_orders', 'shippable_products_link' => 'shippable_products', 'orders_pending_post_link' => 'orders_pending_post', 'orders_sent_to_fulfillment_link' => 'orders_sent_to_fulfillment', 'orders_pending_tracking_link' => 'orders_pending_tracking', 'shipped_orders_link' => 'shipped_orders', 'returned_orders_link' => 'returned_orders', 'order_id_link' => 'order_id', 'return_reason_formatted' => 'return_reason');
         foreach ($changeArray as $k => $v) {
             $key = array_search($k, $csvField);
             if ($key || $key === 0) {
                 $csvField[$key] = $v;
             }
         }
         Csv::printDataProviderCsv($dataProvider, $csvField, 'fulfillment_report');
     }
     Assets::css('jquery-ui');
     Assets::js('//code.jquery.com/ui/1.10.3/jquery-ui.js');
     Assets::js('dateRange/jquery.daterange');
     Assets::js('ajax_table');
     $this->render('fulfillment', array('dataProvider' => $dataProvider, 'pagination' => $pagination, 'filterFields' => $filterFields, 'fields' => $fields, 'fulfillments' => $fulfillments, 'total' => $total[0]));
 }
Ejemplo n.º 16
0
 function deleteAction()
 {
     $id = AF::get($_POST, 'id', 0);
     $modelsID = explode(',', $id);
     $errors = FALSE;
     foreach ($modelsID as $id) {
         $model = new Order();
         if ($model->fillFromDbPk($id)) {
             $orderDeleteModel = new OrderDelete();
             $orderDeleteModel->fillFromArray($model->getAttributes());
             if ($orderDeleteModel->save()) {
                 if (!$model->delete()) {
                     $errors = true;
                 }
             } else {
                 $errors = true;
             }
             OrderLog::createLog($this->user->user_id, $id, 25);
         } else {
             $errors = TRUE;
         }
         if ($model->getErrors()) {
             $errors = TRUE;
         }
         unset($model);
     }
     if (isset($_POST['ajax'])) {
         AF::setJsonHeaders('json');
         if ($errors) {
             Message::echoJsonError(__('order_no_deleted'));
         } else {
             Message::echoJsonSuccess(__('order_deleted'));
         }
     }
 }
Ejemplo n.º 17
0
 private function logShipment($oldValue, $newValue, $orderArray)
 {
     $action = OrderLog::ACTION_STATUSCHANGE;
     if (!$oldValue) {
         $action = OrderLog::ACTION_ADD;
     } else {
         if (!$newValue) {
             $action = OrderLog::ACTION_REMOVE;
         }
     }
     $logEntry = OrderLog::getNewInstance(OrderLog::TYPE_SHIPMENT, $action, $oldValue, $newValue, $this->oldOrder['totalAmount'], $orderArray['totalAmount'], $this->user, $this->currentOrder);
     $logEntry->save();
     return $logEntry;
 }
Ejemplo n.º 18
0
 public function showOp($log_id)
 {
     $logOp = OrderLog::model()->findByPk($log_id);
     $users = Users::model()->findByPk($logOp->user_id);
     $op = $users->username . ' ' . $logOp->op_name . " order " . $logOp->order_id;
     return $op;
 }
Ejemplo n.º 19
0
 /**
  * 订单【关闭】
  */
 public function actionCloseOrder()
 {
     $res = array('statusCode' => 200, 'message' => '关闭成功!');
     try {
         $oInfo = Order::model()->findByPk($_REQUEST['id']);
         if (empty($oInfo)) {
             throw new exception('订单不存在!');
         } elseif (!in_array($oInfo['order_status'], array(6))) {
             throw new exception('订单状态错误!');
         }
         $oInfo->order_status = 7;
         $oInfo->update_time = time();
         $flag = $oInfo->save();
         if (empty($flag)) {
             throw new exception('订单关闭失败!', 500);
         }
         $logData = array();
         $logData['order_id'] = $oInfo->id;
         $logData['type'] = 'AdminClosed';
         $logData['msg'] = '您的订单已经超过退换货时间,已关闭该交易!';
         OrderLog::model()->addOrderLog($logData);
     } catch (exception $e) {
         $res['statusCode'] = 300;
         $res['message'] = '关闭失败!【' . $e->getMessage() . '】';
     }
     $res['callbackType'] = 'reloadTab';
     $res['forwardUrl'] = '/manage/order/index';
     $this->ajaxDwzReturn($res);
 }
Ejemplo n.º 20
0
 public function bsReturn($attempt_id = null, $status = null)
 {
     // We only want to process CHARGE and DECLINE at the moment
     if (!$attempt_id || !$status || !in_array($status, array('CHARGE', 'DECLINE'))) {
         return false;
     }
     //get Attempt
     $attemptModel = Attempt::model()->with('order.status')->findByPk($attempt_id);
     if (!$attemptModel) {
         return false;
     }
     // set attempt status
     $attemptModel->status = $status == 'CHARGE' ? Attempt::SUCCESS_STATUS : Attempt::DECLINED_STATUS;
     $attemptModel->status_note = $status == 'CHARGE' ? 'Approved' : $attemptModel->status_note;
     $attemptModel->save();
     $this->order = clone $attemptModel->order;
     if ($status == 'CHARGE') {
         $this->order->status = 'ok';
         $this->order->removeFlags('salvage');
         $this->order->addFlags('paid');
         $this->order->payment_total = $this->order->amount_product + $this->order->amount_shipping;
         $this->order->save();
         if ($this->order->billing_cycle == 0) {
             $this->finalizeOrder();
         }
         OrderLog::createLog(0, $this->order->order_id, 22, $this->order->payment_total . ' ' . $this->order->campaign->currency_id);
     } else {
         $this->declinedOrder();
     }
 }
Ejemplo n.º 21
0
 /**
  * 订单日志
  */
 public function actionLogs()
 {
     $order_id = $_POST['order_id'];
     $log_list = OrderLog::model()->findAll('rel_id = :order_id', array(':order_id' => $order_id));
     foreach ($log_list as $v) {
         $item['op_name'] = $v->op_name;
         $item['alttime'] = $v->alttime;
         $item['bill_type'] = $v->bill_type;
         $item['behavior'] = Params::BehaviorStatus($v->behavior);
         $item['result'] = $v->result === 'SUCCESS' ? '成功' : '失败';
         $log_text = unserialize($v->log_text);
         $item['txt_key'] = $log_text[0]['txt_key'];
         $item_list[] = $item;
     }
     echo $this->renderPartial('_order_logs', array('item_list' => $item_list), true);
 }
Ejemplo n.º 22
0
 public function voidCreditCard()
 {
     $successAttemptModel = Attempt::getSuccessAttempt($this->orderModel->order_id);
     if (!$successAttemptModel) {
         //it need to test
         Attempt::setAttemptStatus($this->attemptModel, Attempt::UNKNOWN_STATUS);
         $this->_paymetnResponse->status = PaymentAPIResponse::ERROR_STATUS;
         return false;
     }
     $pacnetOptions = $this->gatewayModel->getAttributes();
     //$pacnetOptions['currency_id']=$this->campaignModel->currency_id;
     $pacnetOptions['isTest'] = self::$isTest;
     // Create and populate a request object
     $pymtReq = new RavenRequest('void', $pacnetOptions);
     $pymtReq->set('RequestID', $this->attemptModel->getrequest_id('pn'));
     $pymtReq->set('TrackingNumber', $successAttemptModel->tracking_number);
     $pymtReq->set('PymtType', self::CC_DEBIT);
     Attempt::setAttemptStatus($this->attemptModel, Attempt::INPROGRESS_STATUS);
     // Submit the request
     try {
         //Send request
         $pymtResp = $pymtReq->send();
     } catch (Exception $e) {
         //Change Attempt Status to unknown
         Attempt::setAttemptStatus($this->attemptModel, Attempt::UNKNOWN_STATUS);
         $this->_paymetnResponse->addError('error_processing_request');
         $this->_paymetnResponse->addAlert('error_processing_your_request');
         $this->_paymetnResponse->status = PaymentAPIResponse::ERROR_STATUS;
         return false;
     }
     $errors = array();
     if ($pymtResp->get('httpStatus') == 'timeout') {
         $respReq = new RavenRequest('response', $this->gatewayModel->getAttributes());
         $respReq->set('RequestID', $pymtReq->get('RequestID'));
         $pymtResp = $respReq->send();
     }
     if ($pymtResp->get('httpStatus') != 200) {
         $this->_paymetnResponse->addAlert('error_processing_your_request');
         $errors['httpStatus'] = $pymtResp->get('httpStatus');
     }
     if ($pymtResp->get('ErrorCode')) {
         $errorCode = strtolower($pymtResp->get('ErrorCode'));
         $this->_paymetnResponse->addAlert($pymtResp->get('Message'));
         if (!in_array($errorCode, $errors)) {
             $errors['ErrorCode'] = $errorCode;
         }
     }
     if ($errors) {
         //Change Attempt Status to decline
         Attempt::setAttemptStatus($this->attemptModel, Attempt::DECLINED_STATUS);
         foreach ($errors as $key => $error) {
             $this->_paymetnResponse->addError($key, $error);
         }
         $this->_paymetnResponse->status = PaymentAPIResponse::ERROR_STATUS;
         OrderLog::createLog(0, $this->orderModel->order_id, 21, implode(',', $errors));
         return false;
     }
     // Fill and save attempt Model
     $this->attemptModel->status = Attempt::SUCCESS_STATUS;
     $this->attemptModel->tracking_number = $pymtResp->get('TrackingNumber');
     $this->attemptModel->status_note = $pymtResp->get('Status') ? $pymtResp->get('Status') : '';
     $this->attemptModel->amount = $pymtResp->get('FormattedAmount');
     $this->attemptModel->save();
     //Set success status to response
     $this->_paymetnResponse->status = PaymentAPIResponse::SUCCESS_STATUS;
     return true;
 }
Ejemplo n.º 23
0
 public static function createLog($userID, $orderID, $action, $notes = null, $amount = null)
 {
     $userID = (int) $userID;
     $orderID = (int) $orderID;
     if (!isset(self::$_actions[$action])) {
         return false;
     }
     $orderLogModel = new OrderLog();
     $orderLogModel->user_id = $userID;
     $orderLogModel->order_id = $orderID;
     $orderLogModel->action = $action;
     $orderLogModel->notes = $notes ? $notes : '';
     if ($amount) {
         $orderLogModel->amount = $amount;
     }
     $orderLogModel->save();
 }
Ejemplo n.º 24
0
                'orderID' => $orderID,
            ));
            ?>
        </div>
    </div>
<?}?>

<?if($access->actionAccess('view_table')){?>
    <!--
    <form class="search-form" method="post">

        <select name="action[]" multiple id="logs_filter_action" class="chosen-select select-xlarge" data-placeholder="<?php 
echo __('choose_action');
?>
">
            <?foreach(OrderLog::getActions() as $key => $value){?>
                <option value="<?php 
echo $key;
?>
" <?if(in_array($key, $FilterFields['action'])){?>selected=""<?}?>><?php 
echo __('order_log_' . $value);
?>
</option>
            <?}?>
        </select>

        <select name="user_id" id="logs_filter_user_id" class="chosen-select select-xlarge">
            <option value=""><?php 
echo __('choose_user_id');
?>
</option>
Ejemplo n.º 25
0
 public function voidCreditCard()
 {
     $successAttemptModel = Attempt::getSuccessAttempt($this->orderModel->order_id);
     $successAttemptCustomData = json_decode($successAttemptModel->custom_data, true);
     if (self::$isTest) {
         //Approved / Successful Action
         //$successAttemptCustomData['tracking_number'] = '44444444-1D500CFBC1CAEA888888-00000001';
         //Declined / Forbidden Action
         //$successAttemptCustomData['tracking_number'] = '44444444-1D500CFBC1CAEA888888-00000002';
         //Error (general error)
         //$successAttemptCustomData['tracking_number'] = '44444444-1D500CFBC1CAEA888888-00000003';
     }
     $transaction = new AldraPay(array('merchantID' => $this->gatewayModel->username, 'passCode' => $this->gatewayModel->shared_secret));
     $transaction->set('transactionID', $successAttemptCustomData['tracking_number']);
     $transaction->void();
     try {
         $result = $transaction->execute();
         fb($result);
     } catch (Exception $e) {
         $aErrors = array('Error processing your request');
         $this->attemptError($aErrors);
         return false;
     }
     if (!$result) {
         // payment server errors
         $aErrors = array('Error processing your request');
         $this->attemptError($aErrors);
         return false;
     }
     // if not approved
     if (!isset($result['responseCode']) || !in_array($result['responseCode'], array(1, 7))) {
         //decline error
         $error = isset($result['reasonCodeString']) ? $result['reasonCodeString'] : 'Error processing your request';
         if (isset($result['transaction']['transactionID'])) {
             $this->attemptModel->custom_data = json_encode(array('tracking_number' => $result['transaction']['transactionID']));
         }
         $this->attemptError(array($error));
         return false;
     }
     switch ($result['responseCode']) {
         case '1':
             $this->attemptModel->status = Attempt::SUCCESS_STATUS;
             break;
         case '7':
             $this->attemptModel->status = Attempt::SUBMITED_STATUS;
             break;
     }
     if (isset($result['transaction']['transactionID'])) {
         //the field tracking_number DECIMAL(16,0)
         $this->attemptModel->custom_data = json_encode(array('tracking_number' => $result['transaction']['transactionID']));
     }
     $this->attemptModel->status_note = '';
     if ($result['responseCodeString']) {
         $this->attemptModel->status_note .= $result['responseCodeString'];
     }
     if ($result['reasonCodeString']) {
         $this->attemptModel->status_note .= ' (' . $result['reasonCodeString'] . ')';
     }
     $this->attemptModel->save();
     //Set success status to response
     $this->_paymetnResponse->status = PaymentAPIResponse::SUCCESS_STATUS;
     $this->_paymetnResponse->attemptModel = $this->attemptModel;
     $this->_paymetnResponse->paymentModel = $this->paymentModel;
     OrderLog::createLog(0, $this->orderModel->order_id, 13, $this->attemptModel->amount . ' ' . $this->campaignModel->currency_id);
     return true;
 }
Ejemplo n.º 26
0
 /**
  * 取消订单接口
  */
 public function cancelOrder($userId, $order_sn)
 {
     if (empty($userId)) {
         throw new exception('用户未登陆!', 2);
     }
     if (empty($order_sn)) {
         throw new exception('参数错误!');
     }
     $oInfo = Order::model()->findByAttributes(array('order_sn' => $order_sn));
     if (empty($oInfo)) {
         throw new exception('订单不存在!');
     } elseif ($oInfo['user_id'] != $userId) {
         throw new exception('订单错误!');
     } elseif (!in_array($oInfo['order_status'], array(0, 1))) {
         throw new exception('订单状态错误!');
     }
     //更新订单状态
     $oInfo->order_status = 9;
     $oInfo->update_time = time();
     $flag = $oInfo->save();
     if (empty($flag)) {
         throw new exception('订单保存错误!', 500);
     }
     //库存恢复
     $this->dealWithCancelOrderProductStock($oInfo['id']);
     //添加订单日志
     $m = new OrderLog();
     $m->order_id = $oInfo->id;
     $m->admin_id = '管理员';
     $m->admin_name = '管理员';
     $m->phone = '';
     $m->type = 'UserCanced';
     $m->msg = '您的订单已取消!';
     $m->is_show = 1;
     $m->add_time = time();
     $flag = $m->save();
     if (empty($flag)) {
         throw new exception('订单取消失败!', 500);
     }
     return false;
 }
Ejemplo n.º 27
0
 public function cancelRetries($user_id = 0)
 {
     $this->removeFlags(Order::FlAG_RETRY);
     $this->model_uset_id = $user_id;
     if ($this->save(false)) {
         OrderLog::createLog($user_id, $this->order_id, 23);
         return true;
     }
     return false;
 }
Ejemplo n.º 28
0
            <?foreach($actions as $value){?>
                <option value="<?php 
echo $value['action'];
?>
" <?if(in_array($value['action'], $filterFields['actions'])){?>selected=""<?}?>><?php 
echo $value['name'];
?>
 (<?php 
echo $item['count'];
?>
)</option>
            <?}?>
        </select>

        <select name="show_by" class="chosen-select select-medium af_select_ajax">
            <?foreach(OrderLog::sortBy() as $value){?>
                <option value="<?php 
echo $value;
?>
" <?if($filterFields['show_by'] == $value){?>selected="selected"<?}?>><?php 
echo __('by_' . $value);
?>
</option>
            <?}?>
        </select>

        <button type="button" class="btn btn-small btn-set ajax_submit_form hide" ><i class="icon-search"></i> <?php 
echo __('search');
?>
</button>
        <button type="button" class="btn btn-small btn-set ajax_clear_form"><i class="icon-remove"></i> <?php 
Ejemplo n.º 29
0
 private static function parserCsvFiles($downloadFilePath)
 {
     $header = NULL;
     $data = array();
     if (($handle = fopen($downloadFilePath, 'r')) !== FALSE) {
         while (($row = fgetcsv($handle, 1000, ',')) !== FALSE) {
             if (!$header) {
                 $header = $row;
             } else {
                 $data[] = array_combine($header, $row);
             }
         }
         fclose($handle);
     }
     $db = SafeMySQL::getInstance();
     echo '<pre>';
     print_r($db->getConn());
     echo '</pre>';
     foreach ($data as $orderArray) {
         if (isset($orderArray['Tracking Number']) && isset($orderArray['Order Id'])) {
             /*
              * Old query
             $sql = "UPDATE `orders` SET `tracking_number`=?s, `status`='shipped'
                     WHERE (`order_id`=?i OR `ship_with`=?i) AND `status` = 'sent'";
             */
             $sql = "UPDATE `packages_orders` AS `po`\n                    JOIN `packages` AS `p` USING (`package_id`)\n                    LEFT JOIN `orders` AS `o` ON `o`.`order_id` = `po`.`order_id` AND `o`.`status` IN ('ok', 'sent')\n                    SET `p`.`tracking_number` = ?s, `o`.`status` = 'shipped'\n                    WHERE `package_id` =\n                    (SELECT `package_id` FROM `packages_orders` AS `p1` WHERE `p1`.`order_id`=?i LIMIT 1)";
             $orderID = (int) $orderArray['Order Id'];
             echo $sql . '<hr>';
             $db->query($sql, $orderArray['Tracking Number'], $orderID);
             if ($db->affectedRows() > 0) {
                 Event::setEvents($orderID, 9);
                 OrderLog::createLog(0, $orderID, 20);
             }
         }
     }
 }
Ejemplo n.º 30
0
<?php

include_once '../settings/autoload.php';
$msql = SafeMySQL::getInstance();
$sql = "SELECT *\n        FROM `fulfillments` as f\n        WHERE f.`active` = 1";
$setFulfillment = $msql->getAll($sql);
if (!$setFulfillment) {
    die;
}
foreach ($setFulfillment as $fulfillment) {
    $fulfillmentModel = new Fulfillment();
    $fulfillmentModel->fillFromArray($fulfillment);
    $sql = "(\n                SELECT o.*, o.`created` as 'order_created', p.*, s.*, sc.`shipcat_code`, sc.`shipcat_name`, g.`gateway_id`, g.`alias`, opn.`card_number`, opn.`expiry_date`, `countries1`.`country_name` AS `country_name`, `countries2`.`country_name` AS `billing_country_name`, `states1`.`state_name` AS `state_name`, `states2`.`state_name` AS `billing_state_name`\n                FROM `orders` AS o\n                JOIN `campaigns` AS c ON o.`campaign_id` = c.`campaign_id`\n                JOIN `orders_pn` AS opn ON o.`order_id` = opn.`order_id`\n                JOIN `products` AS p ON o.`product_id` = p.`product_id`\n                LEFT JOIN `shipping` AS s ON o.`shipping_id` = s.`shipping_id`\n                LEFT JOIN `shipcat` AS sc ON s.`shipcat_id` = sc.`shipcat_id`\n                LEFT JOIN `gateways` AS g ON c.`gateway_id` = g.`gateway_id`\n                LEFT JOIN `countries` AS `countries1` ON o.`country_id` = `countries1`.`country_id`\n                LEFT JOIN `countries` AS `countries2` ON o.`billing_country_id` = `countries2`.`country_id`\n                LEFT JOIN `states` AS `states1` ON o.`country_id` = `states1`.`country_id` AND o.`state_id` = `states1`.`state_code`\n                LEFT JOIN `states` AS `states2` ON o.`billing_country_id` = `states2`.`country_id` AND o.`billing_state_id` = `states2`.`state_code`\n                WHERE o.`status` = 'ok' AND c.`fulfillment_id` = ?i)\n                UNION\n                (\n                    SELECT o.*, o.`created` as 'order_created', p.*, s.*, sc.`shipcat_code`, sc.`shipcat_name`, NULL, NULL, NULL, NULL, `countries1`.`country_name` AS `country_name`, `countries2`.`country_name` AS `billing_country_name`, `states1`.`state_name` AS `state_name`, `states2`.`state_name` AS `billing_state_name`\n                    FROM `orders` AS o\n                    JOIN `campaigns` AS c ON o.`campaign_id` = c.`campaign_id`\n                    JOIN `products` AS p ON o.`product_id` = p.`product_id`\n                    LEFT JOIN `shipping` AS s ON o.`shipping_id` = s.`shipping_id`\n                    LEFT JOIN `shipcat` AS sc ON s.`shipcat_id` = sc.`shipcat_id`\n                    LEFT JOIN `countries` AS `countries1` ON o.`country_id` = `countries1`.`country_id`\n                    LEFT JOIN `countries` AS `countries2` ON o.`billing_country_id` = `countries2`.`country_id`\n                    LEFT JOIN `states` AS `states1` ON o.`country_id` = `states1`.`country_id` AND o.`state_id` = `states1`.`state_code`\n                    LEFT JOIN `states` AS `states2` ON o.`billing_country_id` = `states2`.`country_id` AND o.`billing_state_id` = `states2`.`state_code`\n                    WHERE `status` = 'upsell' AND `ship_with` IN (\n                    SELECT `order_id`\n                    FROM `orders` AS o\n                    WHERE o.`status` = 'ok' AND c.`fulfillment_id` = ?i\n                )\n            )\n            ORDER BY `order_id`";
    $orders = $msql->getInd('order_id', $sql, $fulfillmentModel->fulfillment_id, $fulfillmentModel->fulfillment_id);
    if (!$orders) {
        continue;
    }
    $filePath = OrderFTP::createFtpOrders($orders, $fulfillmentModel);
    $fulfillmentModel->filePath = $filePath;
    if ($fulfillmentModel->uploadToFulfillment()) {
        $sql = "UPDATE `orders` as o\n                JOIN `campaigns` AS c ON o.`campaign_id` = c.`campaign_id`\n                JOIN `orders_pn` AS opn ON o.`order_id` = opn.`order_id`\n                JOIN `products` AS p ON o.`product_id` = p.`product_id`\n                LEFT JOIN `shipping` AS s ON o.`shipping_id` = s.`shipping_id`\n                LEFT JOIN `shipcat` AS sc ON s.`shipcat_id` = sc.`shipcat_id`\n                LEFT JOIN `gateways` AS g ON c.`gateway_id` = g.`gateway_id`\n                SET o.`status` = 'sent'\n                WHERE o.`status` = 'ok' AND o.`order_id` IN(?a)";
        $msql->query($sql, OrderFTP::$updateOrders);
        foreach (OrderFTP::$updateOrders as $orderID) {
            OrderLog::createLog(0, $orderID, 19);
        }
    }
}