本文整理汇总了PHP中ServiceFactory类的典型用法代码示例。如果您正苦于以下问题:PHP ServiceFactory类的具体用法?PHP ServiceFactory怎么用?PHP ServiceFactory使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了ServiceFactory类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的PHP代码示例。
示例1: execute
public function execute()
{
$checkoutService = ServiceFactory::factory('Checkout');
$couponCode = $_REQUEST['coupon_id'];
$checkoutService->updateCoupon($couponCode);
$this->setSuccess($checkoutService->detail());
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:7,代码来源:update_action.php
示例2: execute
public function execute()
{
switch ($_REQUEST['checkout_type']) {
case 'cart':
if ($_REQUEST['payment_method_id'] == 'paypal') {
$actionInstance = ActionFactory::factory('KanCart.ShoppingCart.PayPalWPS.Done');
$actionInstance->init();
$actionInstance->execute();
$this->result = $actionInstance->getResult();
} else {
$kancartPaymentService = ServiceFactory::factory('KancartPayment');
list($result, $order_id) = $kancartPaymentService->kancartPaymentDone($_REQUEST['order_id'], $_REQUEST['custom_kc_comments'], $_REQUEST['payment_status']);
if ($result === TRUE) {
$orderService = ServiceFactory::factory('Order');
$info = $orderService->getPaymentOrderInfoById($order_id);
$this->setSuccess($info);
} else {
$this->setError('0xFFFF', $order_id);
}
}
case 'order':
break;
default:
break;
}
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:26,代码来源:done_action.php
示例3: execute
public function execute()
{
$userService = ServiceFactory::factory('User');
$username = is_null($this->getParam('uname')) ? '' : trim($this->getParam('uname'));
if (empty($username)) {
$this->setError(KancartResult::ERROR_USER_INPUT_PARAMETER, 'User name is empty.');
return;
}
$encryptedPassword = is_null($this->getParam('pwd')) ? '' : trim($this->getParam('pwd'));
$password = CryptoUtil::Crypto($encryptedPassword, 'AES-256', KANCART_APP_SECRET, false);
if (!$password) {
$this->setError(KancartResult::ERROR_USER_INPUT_PARAMETER, 'Password is empty.');
return;
}
$loginInfo = array('email' => $username, 'password' => $password);
$login = $userService->login($loginInfo);
if (is_string($login)) {
$this->setError(KancartResult::ERROR_USER_INPUT_PARAMETER, $login);
return;
}
$cacheKey = $this->customer->getCustomerGroupId() . '-' . $this->config->get('config_customer_price');
if ($this->config->get('config_tax')) {
$query = $this->db->query("SELECT gz.geo_zone_id FROM " . DB_PREFIX . "geo_zone gz LEFT JOIN " . DB_PREFIX . "zone_to_geo_zone z2gz ON (z2gz.geo_zone_id = gz.geo_zone_id) WHERE (z2gz.country_id = '0' OR z2gz.country_id = '" . (int) $this->customer->country_id . "') AND (z2gz.zone_id = '0' OR z2gz.zone_id = '" . (int) $this->customer->zone_id . "')");
if ($query->num_rows) {
$cacheKey .= '-1-' . $query->row['geo_zone_id'];
} else {
$cacheKey .= '-1-0';
}
} else {
$cacheKey .= '-0-0';
}
$info = array('sessionkey' => md5($username . uniqid(mt_rand(), true)), 'cachekey' => $cacheKey);
$this->setSuccess($info);
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:34,代码来源:login_action.php
示例4: execute
public function execute()
{
$orderId = $this->getParam('order_id');
$orderService = ServiceFactory::factory('Order');
$oneOrderInfo = $orderService->getOneOrderInfoById($orderId);
$this->setSuccess(array('order' => $oneOrderInfo));
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:7,代码来源:get_action.php
示例5: execute
public function execute()
{
$cartItemId = $this->getParam('cart_item_id');
$cartService = ServiceFactory::factory('ShoppingCart');
$cartService->remove($cartItemId);
$this->setSuccess($cartService->get());
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:7,代码来源:remove_action.php
示例6: execute
public function execute()
{
$userService = ServiceFactory::factory('User');
$username = is_null($this->getParam('email')) ? '' : trim($this->getParam('email'));
$enCryptedPassword = is_null($this->getParam('pwd')) ? '' : trim($this->getParam('pwd'));
$password = CryptoUtil::Crypto($enCryptedPassword, 'AES-256', KANCART_APP_SECRET, false);
$this->language->load('account/register');
if (strlen(utf8_decode($username)) > 96 || !preg_match('/^[_a-z0-9-]+(\\.[_a-z0-9-]+)*@[a-z0-9-]+(\\.[a-z0-9-]+)*(\\.[a-z]{2,3})$/i', $username)) {
$this->setError(KancartResult::ERROR_USER_INVALID_USER_DATA, $this->language->get('error_email'));
return;
}
if (strlen($password) < 4 || strlen($password) > 20) {
$this->setError(KancartResult::ERROR_USER_INVALID_USER_DATA, $this->language->get('error_password'));
return;
}
$firstname = is_null($this->getParam('firstname')) ? '' : trim($this->getParam('firstname'));
$lastname = is_null($this->getParam('lastname')) ? '' : trim($this->getParam('lastname'));
$telephone = is_null($this->getParam('telephone')) ? '' : trim($this->getParam('telephone'));
$regisetInfo = array('firstname' => $firstname, 'lastname' => $lastname, 'email' => $username, 'telephone' => $telephone, 'password' => $password);
if (!$userService->register($regisetInfo)) {
$this->setError(KancartResult::ERROR_USER_INVALID_USER_DATA, $msg);
return;
}
// succed registering
$this->setSuccess();
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:26,代码来源:register_action.php
示例7: execute
public function execute()
{
if (!$this->cart->hasProducts()) {
$this->setSuccess(array('redirect_to_page' => 'shopping_cart', 'messages' => array('Shopping Cart is empty.')));
return;
}
$this->setSuccess(ServiceFactory::factory('Checkout')->detail());
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:8,代码来源:detail_action.php
示例8: getUser
protected function getUser()
{
$userId = $this->getSession()->get('userId');
if (!$userId) {
return null;
}
$user = \ServiceFactory::getInstance()->getUserRepository()->findOneById($userId);
return $user;
}
开发者ID:edefine,项目名称:simple,代码行数:9,代码来源:AbstractController.php
示例9: fromJSON
public static function fromJSON($s)
{
$url = self::translateURL($s->url);
//if ($s->type == 'Service')
$service = ServiceFactory::newService($s->name, @$s->cmd, $url);
//elseif ($s->type == 'ServiceWeb')
// $service = ServiceFactory::newServiceWeb($s->name, $url);
return $service;
}
开发者ID:Reeska,项目名称:restinpi,代码行数:9,代码来源:servicefactory.lib.php
示例10: execute
public function execute()
{
$order_id = $this->session->data['order_id'];
$paypalWpsService = ServiceFactory::factory('PaypalWps');
$paypalWpsService->paypalWpsDone();
$tx = max($_REQUEST['tx'], $_REQUEST['txn_id']);
$orderService = ServiceFactory::factory('Order');
$info = $orderService->getPaymentOrderInfoById($order_id, $tx);
$this->setSuccess($info);
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:10,代码来源:done_action.php
示例11: load
public function load()
{
$manager = \ServiceFactory::getInstance()->getEntityManager();
$admin = $this->createAdmin('FirstName', 'LastName', '[email protected]', 'password');
$manager->save($admin);
for ($i = 1; $i <= self::USERS_TO_CREATE; $i++) {
$user = $this->createUser("FirstName {$i}", "LastName {$i}", "email{$i}@address.com", "password{$i}");
$manager->save($user);
}
}
开发者ID:edefine,项目名称:simple,代码行数:10,代码来源:UserFixture.php
示例12: execute
public function execute()
{
$userService = ServiceFactory::factory('User');
$address = prepare_address();
$updateResult = $userService->updateAddress($address);
if ($updateResult === true) {
$this->setSuccess();
return;
}
$this->setError(KancartResult::ERROR_USER_INPUT_PARAMETER, join(',', $updateResult));
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:11,代码来源:update_action.php
示例13: run
public function run()
{
$serviceFactory = \ServiceFactory::getInstance();
$request = $serviceFactory->getRequest();
$serviceFactory->getDispatcher()->dispatch('kernel.request', new RequestEvent($request));
$controllerPath = sprintf('Controller\\%sController', $request->getControllerName());
$actionMethod = sprintf('%sAction', $request->getActionName());
$actionDispatcher = new ActionDispatcher();
$response = $actionDispatcher->dispatch($controllerPath, $actionMethod);
$responseHandler = new ResponseHandler();
$responseHandler->handle($response);
}
开发者ID:edefine,项目名称:framework,代码行数:12,代码来源:Bootstrap.php
示例14: getProducts
/**
* get products information
* @param type $cart
* @return array
* @author hujs
*/
public function getProducts()
{
$currency = $this->currency->getCode();
$items = array();
$productService = ServiceFactory::factory('Product');
$products = $this->cart->getProducts();
foreach ($products as $product) {
$productInfo = $productService->getProduct($product['product_id']);
$item = array('cart_item_id' => $product['key'], 'cart_item_key' => '', 'item_id' => $product['product_id'], 'item_title' => $productInfo['item_title'] . (!$product['stock'] ? '<font color = \'red\'>***' : ''), 'thumbnail_pic_url' => $productInfo['thumbnail_pic_url'], 'currency' => $currency, 'item_price' => $this->format($this->tax->calculate($product['price'], $product['tax_class_id'], $this->config->get('config_tax'))), 'qty' => $product['quantity'], 'display_attributes' => $this->getDisplayAttributes($product['option']), 'item_url' => $productInfo['item_url'], 'short_description' => $productInfo['short_description']);
$items[] = $item;
}
return $items;
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:19,代码来源:ShoppingCartService.php
示例15: execute
public function execute()
{
$userService = ServiceFactory::factory('User');
$addressBookId = intval($this->getParam('address_book_id'));
if ($addressBookId) {
$result = $userService->deleteAddress($addressBookId);
if (true === $result) {
$this->setSuccess();
return;
}
$this->setError(KancartResult::ERROR_USER_INPUT_PARAMETER, join(',', $result));
}
$this->setError(KancartResult::ERROR_USER_INPUT_PARAMETER, 'Address book is empty');
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:14,代码来源:remove_action.php
示例16: execute
public function execute()
{
$username = is_null($this->getParam('email')) ? '' : trim($this->getParam('email'));
if (strlen($username) == 0) {
$this->setError(KancartResult::ERROR_USER_INPUT_PARAMETER);
return;
}
$response = array();
$response['nick_is_exist'] = "false";
$response['uname_is_exist'] = "false";
$userService = ServiceFactory::factory('User');
if ($userService->checkEmailExists($username)) {
$response['uname_is_exist'] = "true";
}
$this->setSuccess($response);
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:16,代码来源:isexists_action.php
示例17: execute
public function execute()
{
$itemId = $this->getParam('item_id');
$rating = is_null($this->getParam('rating')) ? 5 : intval($this->getParam('rating'));
if ($rating > 5) {
$rating = 5;
} elseif ($rating < 0) {
$rating = 0;
}
$content = is_null($this->getParam('content')) ? '' : htmlspecialchars(substr(trim($this->getParam('content')), 0, 1000));
$reviewService = ServiceFactory::factory('Review');
if ($reviewService->addReview($itemId, $content, $rating)) {
$this->setSuccess();
} else {
$this->setError('', 'add review to this product failed.');
}
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:17,代码来源:add_action.php
示例18: getOrderInfos
/** new
* get user orders information
* @param type $userId
* @return type
* @author hujs
*/
public function getOrderInfos(array $parameter)
{
$orderInfos = array();
$userId = $parameter['customer_id'];
$pageNo = $parameter['page_no'];
$pageSize = $parameter['page_size'];
$orders = $this->getOrderList($pageNo, $pageSize);
foreach ($orders as $order) {
$orderItem = array();
$this->initOrderDetail($orderItem, $order);
$orderItem['price_infos'] = $this->getPriceInfos($orderItem, $order);
$orderItem['order_items'] = $this->getOrderItems($order);
$orderItem['order_status'] = ServiceFactory::factory('Store')->getOrderStatauses();
$orderInfos[] = $orderItem;
}
return array('total_results' => $this->getUserOrderCounts($userId), 'orders' => $orderInfos);
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:23,代码来源:OrderService.php
示例19: placeOrder
public function placeOrder($method)
{
$this->session->data['payment_method'] = array('id' => 'mobile', 'title' => $method, 'sort_order' => 1);
$paypal = ServiceFactory::factory('PaypalWps');
list($result, $mesg) = $paypal->placeOrder();
$order_id = $this->session->data['order_id'];
$this->load->model('checkout/order');
if ($result === true) {
$comments = 'From mobile payment ' . $method;
$this->model_checkout_order->confirm($this->session->data['order_id'], $this->config->get('config_order_status_id'), $comments);
$paypal->paypalWpsDone();
return array(true, $order_id, array());
} else {
$message = is_array($mesg) ? join('<br>', $mesg) : $mesg;
return array(false, $order_id, $message);
}
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:17,代码来源:KancartPaymentService.php
示例20: execute
public function execute()
{
$cartItemId = $this->getParam('cart_item_id');
$qty = intval($this->getParam('qty')) > 0 ? intval($this->getParam('qty')) : 1;
$cartService = ServiceFactory::factory('ShoppingCart');
if (method_exists($cartService, 'checkMinimunOrder')) {
$error = $cartService->checkMinimunOrder(intval($cartItemId), $qty);
} else {
$error = array();
}
if (is_array($error) && sizeof($error) == 0) {
$cartService->update($cartItemId, $qty);
$result = $cartService->get();
} else {
$result = $cartService->get();
$result['messages'] = $error;
}
$this->setSuccess($result);
}
开发者ID:jemmy655,项目名称:OpenCart-API-service-by-Kancart.com-Mobile,代码行数:19,代码来源:update_action.php
注:本文中的ServiceFactory类示例整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论