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; } }
public function execute() { switch ($_REQUEST['checkout_type']) { case 'cart': $paymentMethodID = $this->getParam('payment_method_id'); if (!$paymentMethodID) { $this->setError('', 'Payment_method_id is empty.'); } else { $actionInstance = ActionFactory::factory('KanCart.ShoppingCart.Checkout'); $actionInstance->init(); $actionInstance->execute(); $this->result = $actionInstance->getResult(); } break; case 'order': break; default: break; } }
require_once DIR_SYSTEM . 'library/customer.php'; require_once DIR_SYSTEM . 'library/currency.php'; require_once DIR_SYSTEM . 'library/tax.php'; require_once DIR_SYSTEM . 'library/weight.php'; require_once DIR_SYSTEM . 'library/cart.php'; } kc_include_once(KANCART_ROOT . '/ErrorHandler.php'); kc_include_once(KANCART_ROOT . '/configure.php'); kc_include_once(KANCART_ROOT . '/util/CryptoUtil.php'); kc_include_once(KANCART_ROOT . '/ActionFactory.php'); kc_include_once(KANCART_ROOT . '/ServiceFactory.php'); kc_include_once(KANCART_ROOT . '/KancartResult.php'); kc_include_once(KANCART_ROOT . '/Exceptions.php'); kc_include_once(KANCART_ROOT . '/common-functions.php'); kc_include_once(KANCART_ROOT . '/actions/BaseAction.php'); kc_include_once(KANCART_ROOT . '/actions/UserAuthorizedAction.php'); kc_include_once(KANCART_ROOT . '/services/BaseService.php'); kc_include_once(KANCART_ROOT . '/Logger.php'); try { $actionInstance = ActionFactory::factory(isset($_REQUEST['method']) ? $_REQUEST['method'] : ''); $actionInstance->init(); if ($actionInstance->validate()) { $actionInstance->execute(); } $result = $actionInstance->getResult(); die(json_encode($result->returnResult())); } catch (EmptyMethodException $e) { die('KanCart OpenAPI v' . API_VERSION . ' is installed on Opencart v' . KC_CART_VERSION . '. OpenCart Plugin v' . KANCART_PLUGIN_VERSION); } catch (Exception $e) { die(json_encode(array('result' => KancartResult::STATUS_FAIL, 'code' => KancartResult::ERROR_UNKNOWN_ERROR, 'info' => $e->getMessage() . ',' . $e->getTraceAsString()))); }