require '../../config/config.inc.php'; require_once dirname(__FILE__) . "/class/fidbagWebService.php"; $token = Tools::encrypt(Tools::getValue('customer')); if (Tools::getValue('token') !== $token) { die("0"); } elseif (!Tools::getValue('Civility') || !Tools::getValue('LastName') || !Tools::getValue('FirstName') || !Tools::getValue('Email') || !Tools::getValue('ZipCode') || !Tools::getValue('Password') || !Tools::getValue('LanguageCode')) { die("0"); } else { $arg = array(); $chif = array(); $arg['MerchantCode'] = Configuration::get('FIDBAG_MERCHANT_CODE'); foreach ($_POST as $key => $value) { $arg[$key] = $value; } $chif[] = Configuration::get('FIDBAG_MERCHANT_CODE'); $chif[] = Tools::safeOutput(Tools::getValue('Email')); $chif[] = Tools::safeOutput(Tools::getValue('LanguageCode')); $webService = new FidbagWebService(); try { $return = $webService->action('CreateFidBagAccountWithTempCardAndFullAddressAndExternalToken', $arg, $chif); if ($return != null && isset($return->CreateFidBagAccountWithTempCardAndFullAddressAndExternalTokenResult)) { $json_return = Tools::jsonDecode($return->CreateFidBagAccountWithTempCardAndFullAddressAndExternalTokenResult); die($return->CreateFidBagAccountWithTempCardAndFullAddressAndExternalTokenResult); } else { die("0"); } } catch (Exception $e) { die($e->getMessage()); } }
$id_cart = (int) Tools::getValue('cart'); $cart = new Cart($id_cart); $currency = new Currency((int) $cart->id_currency); $token = Tools::encrypt(Tools::getValue('customer')); if (Tools::getValue('token') !== $token || $cart->id_customer != Tools::getValue('customer')) { die(Tools::jsonEncode(array('error' => true, 'type' => 'user', 'value' => '0'))); } $create = true; unset($_POST['cart']); /** * Get Fid'Bag account information **/ $fidbag_user = new FidbagUser($cart->id_customer); $webService = new FidbagWebService(); $fidbag_user->getFidBagUser(); $return = $webService->action('GetImmediateRebateAmount', array('CardNumber' => $fidbag_user->getCardNumber(), 'MerchantCode' => Configuration::get('FIDBAG_MERCHANT_CODE'))); $json_return = Tools::jsonDecode($return->GetImmediateRebateAmountResult); $max_amount = $json_return->ImmediateRebateAmount; if (_PS_VERSION_ >= '1.5') { $context = Context::getContext(); $context->cart = $cart; $context->currency = $currency; } /** * Check for errors **/ $cart_total = $cart->getOrderTotal(); $discounts_total = $cart->getOrderTotal(true, Cart::ONLY_DISCOUNTS); $shipping_total = $cart->getOrderTotal(true, Cart::ONLY_SHIPPING); if ($amount > (double) $json_return->ImmediateRebateAmount) { $value = $max_amount . ' ' . $currency->sign;
* @copyright 2007-20131 PrestaShop SA * @version Release: $Revision: 9844 $ * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) * International Registered Trademark & Property of PrestaShop SA */ require '../../config/config.inc.php'; require_once dirname(__FILE__) . "/class/fidbagWebService.php"; require_once dirname(__FILE__) . "/class/fidbagUser.php"; $cart = new Cart((int) Tools::getValue('cart')); $token = Tools::encrypt((int) Tools::getValue('customer')); if (Tools::getValue('token') !== $token || !Tools::getValue('login') || !Tools::getValue('password') || (int) $cart->id_customer != (int) Tools::getValue('customer')) { die("0"); } else { $webService = new FidbagWebService(); try { $return = $webService->action('LoginUserWithMerchantCodeAndExternalToken', array('Login' => Tools::getValue('login'), 'Password' => Tools::getValue('password'), 'MerchantCode' => Configuration::get('FIDBAG_MERCHANT_CODE')), array('Login' => Tools::getValue('login'), 'Password' => Tools::getValue('password'))); if ($return != null && isset($return->LoginUserWithMerchantCodeAndExternalTokenResult)) { $json_return = Tools::jsonDecode($return->LoginUserWithMerchantCodeAndExternalTokenResult); if ($json_return->returnInfos->mCode != 0) { echo Tools::jsonEncode($json_return->returnInfos); } else { $fidbag_user = new FidbagUser((int) Tools::getValue('customer')); if (!$fidbag_user->getFidBagUser()) { $fidbag_user->createFidBagUser(); } $fidbag_user->setIdCart((int) Tools::getValue('cart')); $fidbag_cardnumber = $json_return->fidcardInformations->FidBagCardNumber; if (empty($fidbag_cardnumber)) { $create_temp_fidcard_arg = array('MerchantCode' => Configuration::get('FIDBAG_MERCHANT_CODE'), 'Email' => Tools::getValue('login')); $return_temp_fidcard_creation = $webService->action('CreateTempFidCard', $create_temp_fidcard_arg, $create_temp_fidcard_arg); if ($return_temp_fidcard_creation != null && isset($return_temp_fidcard_creation->CreateTempFidCardResult)) {
<?php require '../../config/config.inc.php'; require_once _PS_MODULE_DIR_ . "/fidbag/class/fidbagWebService.php"; foreach ($_POST as $key => $value) { if ($keyk == "MerchantCode") { $arg[$key] = Configuration::get('FIDBAG_MERCHANT_CODE'); } else { $arg[$key] = Tools::safeOutput($value); } } $webService = new FidbagWebService(); $return = $webService->action('LostPassword', $arg); $result = 'LostPasswordResult'; $json_return = Tools::jsonDecode($return->{$result}); echo $json_return;
public function hookOrderDetailDisplayed($params) { if (!$this->_activeVerification()) { return false; } $fidBagUser = new FidbagUser($params['order']->id_customer); if (!$fidBagUser) { return false; } $smarty = Context::getContext()->smarty; $webService = new FidbagWebService(); $fidBagUser->getFidBagUser(); $return = $webService->action('GetFidBagCardInformations', array('MerchantCode' => Configuration::get('FIDBAG_MERCHANT_CODE'), 'FidCardNumber' => $fidBagUser->getCardNumber())); if ($return != null) { $json_return = Tools::jsonDecode($return->GetFidBagCardInformationsResult); $smarty->assign('fidbag', $json_return); } return $this->display(__FILE__, 'views/templates/hook/order.tpl'); }