/** * @param int $timestamp * @param InkRouter_Models_OrderInfo $orderInfo * @return mixed * @throws InkRouter_Exceptions_InkRouterNotAvailableException|InkRouter_Exceptions_AuthenticationException|InkRouter_Exceptions_ProcessingException|InkRouter_Exceptions_RejectionException */ public function createOrder($timestamp, InkRouter_Models_OrderInfo $orderInfo) { $this->connect(); try { return $this->soapClient->createOrder(array('arg0' => $this->printCustomerId, 'arg1' => $this->secretKey, 'arg2' => $timestamp, 'arg3' => $orderInfo->pack(true)))->return; } catch (SoapFault $e) { throw InkRouter_Exceptions_SoapFaultAdapter::valueOf($e)->getException(); } }
public function actionCreateOrder() { $bookId = Yii::app()->request->getParam('book_id'); $count = Yii::app()->request->getParam('count'); $bookInfo = ''; if (!empty($bookId) && !empty($count)) { $client = new SoapClient($this->baseUrl . '/index.php/orders/quote'); $bookInfo = $client->createOrder($bookId, $count); } $this->render('order_create', array('info' => $bookInfo)); }
public function makeRequestSoap($params) { // Test server url: http://packandship-ws-test.kiala.com/psws-web-1.0.0/order?wsdl $client = new SoapClient(Configuration::get('KIALASMALL_WS_URL'), array('trace' => true, 'exceptions' => false)); $result = $client->createOrder($params); if (isset($result->trackingNumber)) { return $result->trackingNumber; } else { // Uncomment for debug mode /* p('KIALASMALL error - [SOAP]: '.$result->getMessage() .' [faultCode]: '.(isset($result->detail->orderFault->faultCode) ? $result->detail->orderFault->faultCode : '') .' [message]: '.(isset($result->detail->orderFault->message) ? $result->detail->orderFault->message : '') ); echo htmlentities($client->__getLastRequest()); die(); */ Logger::addLog('KIALASMALL error - [SOAP]: ' . $result->getMessage() . ' [faultCode]: ' . $result->detail->orderFault->faultCode . ' [message]: ' . $result->detail->orderFault->message, 4, 1, null, null, true); } return false; }
/** * @see EPSInterface::createOrder() */ public function createOrder($sessionId, $order) { try { $createOrderStdObject = new stdClass(); $createOrderStdObject->sessionId = $sessionId; $createOrderStdObject->order = $order->toStdClass(); $response = parent::createOrder($createOrderStdObject); $arrCreateOrder = array(); if (isset($response->return)) { $arrStdCreateOrder = $response->return; if (is_array($arrStdCreateOrder)) { for ($i = 0; $i < count($arrStdCreateOrder); $i++) { $arrCreateOrder[$i] = new ResultOrderPickingInfo($arrStdCreateOrder[$i]); } } else { $arrCreateOrder[0] = new ResultOrderPickingInfo($arrStdCreateOrder); } } return $arrCreateOrder; } catch (SoapFault $sf) { throw new ServerException($sf); } }
/** * Hooks on process_checkout() * * While the order is processed, use the data to create a Dolibarr order via webservice * * @return void */ public function dolibarr_create_order() { /* * We use non WSDL mode to workaround Dolibarr broken declaration marking all the fields as required * when they're not. */ try { $soap_client = new SoapClient(null, array('location' => $this->ws_endpoint . self::ORDER_ENDPOINT, 'uri' => 'http://www.dolibar.org/ns/')); } catch (SoapFault $exception) { $this->logger->add('doliwoo', $exception->getMessage()); // Do nothing. return; } $order = new Dolibarr_Order(); // Fill this array with all data required to create an order in Dolibarr $user_id = get_current_user_id(); if ('' == $user_id) { // default to the generic user $thirdparty_id = $this->settings->dolibarr_generic_id; } else { $thirdparty_id = get_user_meta($user_id, 'dolibarr_id', true); } if ('' != $thirdparty_id) { $order->thirdparty_id = intval($thirdparty_id); } else { if (get_user_meta($user_id, 'billing_company', true) == '') { update_user_meta($user_id, 'billing_company', $_POST['billing_company']); } $this->dolibarr_create_thirdparty_if_not_exists($user_id); $order->thirdparty_id = intval(get_user_meta($user_id, 'dolibarr_id', true)); } $order->date = date('Ymd'); $order->status = 1; $this->create_order_lines($order); try { $result = $soap_client->createOrder($this->ws_auth, $order); } catch (SoapFault $exception) { $this->logger->add('doliwoo', 'createOrder request:' . $exception->getMessage()); // Do nothing. return; } if (!('OK' == $result['result']->result_code)) { $this->logger->add('doliwoo', 'createOrder response: ' . $result['result']->result_code . ': ' . $result['result']->result_label); // Do nothing return; } }