From 5c26fe90c9fa0cadab44ca00648354510a294e83 Mon Sep 17 00:00:00 2001 From: tkasparaitis Date: Fri, 23 Jan 2015 17:34:44 +0200 Subject: [PATCH 1/6] Upgrade to paysera Bug fixes --- README.md | 2 +- mokejimai/config.xml | 13 - mokejimai/controllers/front/callback.php | 50 - mokejimai/controllers/front/cancel.php | 12 - mokejimai/controllers/front/payment.php | 72 - mokejimai/controllers/front/redirect.php | 71 - mokejimai/controllers/front/validation.php | 22 - mokejimai/img/logo-en.png | Bin 9163 -> 0 bytes mokejimai/img/logo-lt.png | Bin 8151 -> 0 bytes mokejimai/img/order-logo.gif | Bin 923 -> 0 bytes mokejimai/logo.gif | Bin 1209 -> 0 bytes mokejimai/mokejimai.php | 280 -- mokejimai/translations/en.php | 18 - mokejimai/translations/lt.php | 35 - mokejimai/translations/ru.php | 4 - .../vendor/webtopay/libwebtopay/.hgignore | 25 - mokejimai/vendor/webtopay/libwebtopay/.hgtags | 9 - .../vendor/webtopay/libwebtopay/WebToPay.php | 2397 ----------------- .../views/templates/front/configuration.tpl | 66 - .../templates/front/payment_execution.tpl | 152 -- mokejimai/views/templates/front/redirect.tpl | 16 - mokejimai/views/templates/hook/payment.tpl | 7 - .../views/templates/hook/payment_return.tpl | 15 - 23 files changed, 1 insertion(+), 3265 deletions(-) delete mode 100755 mokejimai/config.xml delete mode 100755 mokejimai/controllers/front/callback.php delete mode 100755 mokejimai/controllers/front/cancel.php delete mode 100755 mokejimai/controllers/front/payment.php delete mode 100755 mokejimai/controllers/front/redirect.php delete mode 100755 mokejimai/controllers/front/validation.php delete mode 100755 mokejimai/img/logo-en.png delete mode 100755 mokejimai/img/logo-lt.png delete mode 100755 mokejimai/img/order-logo.gif delete mode 100755 mokejimai/logo.gif delete mode 100755 mokejimai/mokejimai.php delete mode 100755 mokejimai/translations/en.php delete mode 100755 mokejimai/translations/lt.php delete mode 100755 mokejimai/translations/ru.php delete mode 100755 mokejimai/vendor/webtopay/libwebtopay/.hgignore delete mode 100755 mokejimai/vendor/webtopay/libwebtopay/.hgtags delete mode 100755 mokejimai/vendor/webtopay/libwebtopay/WebToPay.php delete mode 100755 mokejimai/views/templates/front/configuration.tpl delete mode 100755 mokejimai/views/templates/front/payment_execution.tpl delete mode 100755 mokejimai/views/templates/front/redirect.tpl delete mode 100755 mokejimai/views/templates/hook/payment.tpl delete mode 100755 mokejimai/views/templates/hook/payment_return.tpl diff --git a/README.md b/README.md index 2bd0b41..bd3c454 100644 --- a/README.md +++ b/README.md @@ -6,7 +6,7 @@ Paysera.com payment gateway plugin for PrestaShop Requirements ------------ -- PrestaShop 1.5.x +- PrestaShop 1.6.x Installation ------------ diff --git a/mokejimai/config.xml b/mokejimai/config.xml deleted file mode 100755 index ebec24e..0000000 --- a/mokejimai/config.xml +++ /dev/null @@ -1,13 +0,0 @@ - - - mokejimai - - - - - - Are you sure you want to delete your details? - 1 - 1 - - \ No newline at end of file diff --git a/mokejimai/controllers/front/callback.php b/mokejimai/controllers/front/callback.php deleted file mode 100755 index 46dd67b..0000000 --- a/mokejimai/controllers/front/callback.php +++ /dev/null @@ -1,50 +0,0 @@ - $this->module->project_id, - 'sign_password' => $this->module->signature, - )); - - if ($response['status'] == 1) { - $Order = new Order($response['orderid']); - $orderAmount = $Order->getOrdersTotalPaid(); - $cartCurrency = Currency::getCurrency($Order->id_currency); - - if (intval(number_format($response['amount'], 0, '', '')) < intval(number_format(($orderAmount * 100), 0, '', ''))) { - exit('Bad amount: ' . $response['amount']); - } - - if ($response['currency'] != $cartCurrency['iso_code']) { - exit('Bad currency: ' . $response['currency']); - } - - $history = new OrderHistory(); - $history->id_order = $response['orderid']; - $history->changeIdOrderState((int)Configuration::get('PS_OS_PAYMENT'), $response['orderid']); - $history->addWithemail(true, array( - 'order_name' => $response['orderid'], - )); - } - exit('OK'); - } catch (Exception $e) { - exit(get_class($e) . ': ' . $e->getMessage()); - } - } -} diff --git a/mokejimai/controllers/front/cancel.php b/mokejimai/controllers/front/cancel.php deleted file mode 100755 index 4da02c0..0000000 --- a/mokejimai/controllers/front/cancel.php +++ /dev/null @@ -1,12 +0,0 @@ - -* @copyright 2007-2012 PrestaShop SA -* @version Release: $Revision: 13573 $ -* @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) -* International Registered Trademark & Property of PrestaShop SA -*/ - -/** - * @since 1.5.0 - */ -class MokejimaiPaymentModuleFrontController extends ModuleFrontController { - public $display_column_left = false; - public $ssl = true; - - /** - * @see FrontController::initContent() - */ - public function initContent() { - parent::initContent(); - - global $cookie; - - $cart = $this->context->cart; - if (!$this->module->checkCurrency($cart)) { - Tools::redirect('index.php?controller=order'); - } - - $payCurrency = Context::getContext()->currency; - $payAmount = $cart->getOrderTotal() * 100; - - //siuo metu pasirinkta kalba - $language = Language::getIsoById(intval($cookie->id_lang)); - $language = (!in_array($language, array('lt', 'en', 'ru'))) ? 'en' : $language; - - $methods = WebToPay::getPaymentMethodList($this->module->project_id, $payCurrency->iso_code) - ->filterForAmount($payAmount, $payCurrency->iso_code) - ->setDefaultLanguage($language) - ->getCountries(); - - $this->context->smarty->assign(array( - 'this_path_ssl' => Tools::getShopDomainSsl(true, true) . __PS_BASE_URI__ . 'modules/' . $this->module->name . '/', - 'amount' => ($payAmount / 100), - 'currency' => $payCurrency->iso_code, - 'displayPayments' => $this->module->paymentList, - 'isoCode' => $language, //Language::getIsoById(intval($cookie->id_lang)), - 'defaultCountry' => $this->module->defaultCountry, - 'payMethods' => $methods, - )); - - $this->setTemplate('payment_execution.tpl'); - } -} diff --git a/mokejimai/controllers/front/redirect.php b/mokejimai/controllers/front/redirect.php deleted file mode 100755 index a002e03..0000000 --- a/mokejimai/controllers/front/redirect.php +++ /dev/null @@ -1,71 +0,0 @@ -context->cart; - if (!$this->module->checkCurrency($cart)) { - Tools::redirect('index.php?controller=order'); - } - - $address = new Address(intval($cart->id_address_invoice)); - $customer = new Customer(intval($cart->id_customer)); - $country = new Country(intval($address->id_country)); - $currency = Context::getContext()->currency; - $total = floatval(number_format($cart->getOrderTotal(true, 3), 2, '.', '')); - $languageCode = strtoupper(Language::getIsoById(intval($cookie->id_lang))); - $urlLanguage = ($languageCode == 'LT') ? 'LIT' : 'ENG'; - - $this->module->validateOrder($cart->id, Configuration::get('PAYSERA_PENDING'), $total, $this->module->displayName, NULL, NULL, $currency->id); - - try { - $request = WebToPay::buildRequest(array( - 'projectid' => $this->module->project_id, - 'sign_password' => $this->module->signature, - - 'orderid' => $this->module->currentOrder, - 'amount' => intval(number_format($total, 2, '', '')), - 'currency' => $currency->iso_code, - 'lang' => ($languageCode == 'LT') ? 'LTU' : 'ENG', - - 'accepturl' => $link->getModuleLink('mokejimai', 'validation'), - 'cancelurl' => $link->getModuleLink('mokejimai', 'cancel'), - 'callbackurl' => $link->getModuleLink('mokejimai', 'callback'), - 'payment' => (isset($_POST['payment'])) ? $_POST['payment'] : '', - - 'p_firstname' => $customer->firstname, - 'p_lastname' => $customer->lastname, - 'p_email' => $customer->email, - 'p_street' => $address->address1, - 'p_city' => $address->city, - 'p_zip' => $address->postcode, - 'p_countrycode' => $country->iso_code, - 'test' => $this->module->sandbox, - )); - } catch (WebToPayException $e) { - echo get_class($e) . ': ' . $e->getMessage(); - } - - $this->context->smarty->assign(array( - 'payUrl' => WebToPay::getPaymentUrl($urlLanguage), - 'request' => $request, - )); - - $this->setTemplate('redirect.tpl'); - } -} diff --git a/mokejimai/controllers/front/validation.php b/mokejimai/controllers/front/validation.php deleted file mode 100755 index c7a6dc2..0000000 --- a/mokejimai/controllers/front/validation.php +++ /dev/null @@ -1,22 +0,0 @@ -context->cart; - if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) { - Tools::redirect('index.php?controller=order&step=1'); - } - - $customer = new Customer($cart->id_customer); - if (!Validate::isLoadedObject($customer)) { - Tools::redirect('index.php?controller=order&step=1'); - } - - Tools::redirect('index.php?controller=order-confirmation&id_cart=' . $cart->id . '&id_module=' . $this->module->id . '&id_order=' . $this->module->currentOrder . '&key=' . $customer->secure_key); - } -} \ No newline at end of file diff --git a/mokejimai/img/logo-en.png b/mokejimai/img/logo-en.png deleted file mode 100755 index 448f8863c0d78f3abdb4ea655e78687651db8532..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 9163 zcmW+*1z1#F6JA&v3F(v;2|-Za{UQtM_T-g%o%gi6wXSzfHm|3cE28oSIh*JPo zpNUDN`l6!o^vTGd=PBv+ewx8k%8y;nLffq?;GK6R4! zXg}Qn=m3uy9#)cpwWr7q&6frM#$>=MGszA`O4HKO2B*xT_p}69u1KFN|6;^suN(T7op9K4(kRKRZB7RV8Ck8 zKt?V6is&E+CcrPjFo{UY5&+7U;T{Dril75zUyzOg8P$MAZ{X0?N(+yuHYGFwY$Saw zQx*P}tSx<##{cwqb)9Lw+ofK{ijsra4tJ9|FEf{gRA~pOHvS9%pt+g){U{=tw6ndr zwr#iLa&+ET^5}f*&Md)nvhw&V4jltP{9)o~(PC?B7U(g6R_6H{2BZp_{y zaEpxbCWCHb14ZtoUKA8-4!)6Ia1j* zu+qo}Pb)XSTJ40L5eykVx2qkN$APHuhXjtPb%A~$OselmdAUVuOF3IIrj z-XuzKp#jD+!5aX;uU#tB?`f23{Wt)CTu}sPoiz5d-(=M=!o1(~zhIQ;R# z5^O+Ie1vv!3s$CaU*#>o8PdEQps?986x2@?w4pZ?_9Lf-6<8hNu%gF;NDpw#KNEMm zd`e1EG*mN`{myp4(nQjMV}Kj^nXj9jIrY0n6I&3;O>cm;Xnm5QLiNi-rWZ^FZ078Q zq!y`4tb{`;n;-C)*pm2_@s*vG5K6DXI$#Mnv16Xv%l#zRp}(6r4WMeq%;eT2q9l!! zyP=-VRx;7P=yf&R5>{<+8i|Uat>hL)Ss}kncF_;5vC4u!I6tCA3yqasi~KZsb-q@T z3i#%*jpb6vj(}g6&P?Vw+B;r3@b39^;4VkLkk6dVggftI@9peGp8G!|_(Bjlpk)1u z+L=0-x`L{enm1dm9CJD|drn6E!E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+{aXIkt_|FOvnuj!nb4-Ye~Af)fwbFR=uRpomK1y(5Z=G*&hZiUo-^WPsnj z(%v2~vccka2vmlU2ehIpZU0AZHDBIWkirFhglhS?)x8d~BT}&5Ftj(M7{1KjX0T1%tJe=b(Ha6Mv&yr6RKNb7|an_9(c1>1{XZ7&v>fFjC^(EBEYj7rA ze-SH=k6A(lR?3;vS&h7Ee{4^0o(Z?_I26`-&u;qaCL1OzII9bG2jI)NBU_gOm3a~7 z%zGy&16`A&zdw?MBA%yca2v8yZY0H9pK34HgVH~RQ`0!Lc{~+h?mMeK5ellUi8#vs zk=g3tcb_#pJ1iNHfR2!vRLp&Q`Xsd@At3g9UPkP*&p#&a~V3;vbO|3%%Y0VxN^|Z1BqN~=Q5ULLXra9 zQ4IA2FyXUeQqvR2f35Z-rF*&KZfWs}>RQhxR2kY;A!ygTQ)oVin~yvTT}|s`O5v#N z+9MXohh4Px!k7^xxM~nF6D|4aus(DL)xoLDu>7w!JyY^@dwxiO=}6O;@Lng$PBSFo zS~n)qUPbFbvJibN^%p@Owz8Y@^Cc4?!o}lSBpXZbV6g!wK!2U%_$>@?QZ+I%Y%SV^ zV%AR|Rj1Yx+>Mwxn6kVBD4&6hzGTm%o?hq0AjrBL$!=|3R)+#`4qu E0FhWF=>Px# diff --git a/mokejimai/img/logo-lt.png b/mokejimai/img/logo-lt.png deleted file mode 100755 index 2eb25cf04c72afe7a828b5ab5a09e6dd1d918d3d..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 8151 zcmV;|A1L67P)X1^@s6RMtM}00004XF*Lt006JZ zHwB960000PbVXQnQ*UN;cVTj606}DLVr3vnZDD6+Qe|Oed2z{QJOBV6X-PyuRCwC# zdk1)&)s^=7X1?h&>ax{~B};OXEjQdSu2{y{RBu9E*xdlxmQ6Ohq%6x%$e+GRfMhrP zA&`VXVyXdSaBtX_Em>W%sx4Vv8qH`ly?*ZW@B&uXCJap=Hc_8nXjCC?m6#y z-*fLszDsSSC}C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aua| diff --git a/mokejimai/img/order-logo.gif b/mokejimai/img/order-logo.gif deleted file mode 100755 index 4cb058fe1b8897bbf50893bd8c25d67e2ff847e4..0000000000000000000000000000000000000000 GIT binary patch literal 0 HcmV?d00001 literal 923 zcmbu;jZYhO90u@96y1m~yv$7mBPv7V7IffLQj-;j(1MH(DNaS+x|z+*fd!pIRAd|C z3j@)iSzwUOO$Kb@T0kL8nBrhY5qfPm5%FO@2>vpzu=S4_sR1QeDkGw z&t+G~L2;1F4gI|ZS`@`Bitbo?K1R1=yC6DM|PScfc)|aN~OE>G}X?l6Oz6^LwU-r1+wXMe2GYsV!hBuxxR6J#< z*k-E8G*o69E3-_MnWoAtV^x+Z>S<&3c2mtWX2rASH$~ejW){B#xnGSGHcT-Xwx2B(;oE0SJ98lZO!GjmMVKo6?(h| zJ)y9lsIj#wY^{6kt%{Y;_OE<#(D5a3$kF~b2An+X=%{sc)L|X9SZ5v9sl>igVqNvl z?)RPDM_t`Vo!>UPfYTqjdzxLnpWN(iarYhfeE+%ULOXupB!02WGuVX>evJ=(;~hTb zz5Ja;b)FbGOl;7o`}v%2;=FI-2mj=N zcj}UVYRLWT2zhnbHLaqq4wKWD$>|@d=}Y9y2zl)%>Nh||{SK(9+0nqPIxstiU!SD@ z7^SX{2j+hX%ulS|m?Zz4T3wh4E?f&P&fWsxxuAA_&F~j(TAkNBcEa49Oan6s2NiPRb z1WyrMz{dqhZk6PLAjRJb@N`h1*Z9zyz|cG!;#o#uLjve9zzSSA!f_FviwJx~5Cm`$ zkpC(={%;-@;&&?dRX6P0n|kCx!~WEKX^{-t3V}o)1X_0xT3nwZ8R?%nwl49B@;Mor zu26Z}=IaakheXxh<^+j-t}D9@xjm^QudU~WcRGi~pWe1BCsiJch)*4p=WJ<@tw~a! sE1gL{6MHyY{itSPcg&FgG(V zIdd%oFPT#_49sOmCzfTmnaCaFCJ4%%OyuhR>?`a!zxO%M7kKw2Cd5SN27`h?3MJ^D zt)R(R*U4BndYmh37lgBG6+PaAzIPo1y?*M;^?bDFR05RY1Y;y@oZ9Ejz-(Y(d>Dy7 z%tSaN3C>IOW+wTHFi=J^g6ZVP-0wG&=*3L&W2X4Cz6y{f!&nDC;vVp49Smdx4h69f zhp^H%v(rM@X`5N;A?)-m>Y z;N_sWI26w*lA9aF%iF=vkLLdn%P-h1D2x{zLko*Ag5t#KVvMjPNm!CB#3zeR9uS>6 zDEc{7d^TNtHbZxQbkLEZD4y0=L{xvL@H(mcGa zdDtv^)TyD|(NKt5O0#gFQ$rY@9(p>E~hWc_fD zVuWHC?$M9*>PH?JM(*orWc_HL;VFP(cm|*v#`=w8RO8qq)r%*F=lzBk1ICw+jV}k^ zzj~s7J@kHpwlFceFgf-Cz!+a(zFg$IHSs1){C6e+-6WVYO;4GGtR*pfNdn-RWdgH& z+AJ5EXN6{k$l@e6D<$SRsRb}UV^PVhD!E0iw5n&VYK29kwCYqgoyw|L+W-cQ-Jr1< zwKk*P_FiuXEEwz`jCRw4!?b8$T6CCAcFU68Vs==T96(zE7KhEcY_l!fZOab(vcus3 zZW+jbd-N5(=l~g`bY0y9Co# zK!W$g#egKw8q$@d$GN#Jw9D)Kd;*(rL6CbzE3Vd&iqYfsQFzeDtJ@VRO@S*baG|jH zO5dFq+&4&J3J)lFYZ?T-n7`69?)6A@FsAnpWH{8n;V4DL-}y>#tPfHwhktP-CURu1 zL%+cblz!*4kW+hILh<8;?PRJK;s*Gn5jnPlXfQn$KB Rzms$Fo45+@!QG(Pe*sy(&W`{9 diff --git a/mokejimai/mokejimai.php b/mokejimai/mokejimai.php deleted file mode 100755 index 5d25c75..0000000 --- a/mokejimai/mokejimai.php +++ /dev/null @@ -1,280 +0,0 @@ -name = 'mokejimai'; - $this->tab = 'payments_gateways'; - $this->version = WebToPay::VERSION; - $this->author = 'EVP International'; - - $config = Configuration::getMultiple(array( - 'PAYSERA_PROJECT_ID', - 'PAYSERA_SIGNATURE', - 'PAYSERA_SANDBOX', - 'PAYSERA_PAYMENTLIST', - 'PAYSERA_DEFAULT_COUNTRY' - )); - - $this->project_id = self::setValue($config, 'PAYSERA_PROJECT_ID'); - $this->signature = self::setValue($config, 'PAYSERA_SIGNATURE', ''); - $this->sandbox = self::setValue($config, 'PAYSERA_SANDBOX'); - $this->paymentList = self::setValue($config, 'PAYSERA_PAYMENTLIST', 1); - $this->defaultCountry = self::setValue($config, 'PAYSERA_DEFAULT_COUNTRY', 'lt'); - - if (!$this->project_id) { - $this->project_id = '12345'; - } - - parent::__construct(); - - $this->page = basename(__FILE__, '.php'); - $this->displayName = $this->l('Mokejimai'); - $this->description = $this->l('Accept payments by Mokejimai.lt system'); - $this->confirmUninstall = $this->l('Are you sure you want to delete your details?'); - - if (!isset($this->project_id) || !isset($this->signature)) { - $this->warning = $this->l('Project details must be configured in order to use this module correctly.'); - } - - if (!count(Currency::checkPaymentCurrencies($this->id))) { - $this->warning = $this->l('No currency set for this module'); - } - } - - public function install() { - if (!parent::install() OR !$this->registerHook('payment') OR !$this->registerHook('paymentReturn')) { - return false; - } - - /* add pending order state */ - $OrderPending = new OrderState(); - $OrderPending->name = array_fill(0, 10, 'AWAITING MOKEJIMAI.LT PAYMENT'); - $OrderPending->send_email = 0; - $OrderPending->invoice = 0; - $OrderPending->color = 'RoyalBlue'; - $OrderPending->unremovable = false; - $OrderPending->logable = 0; - - if ($OrderPending->add()) { - @copy(_PS_ROOT_DIR_ . '/modules/mokejimai/img/order-logo.gif', _PS_ROOT_DIR_ . '/img/os/' . (int)$OrderPending->id . '.gif'); - } - - Configuration::updateValue('PAYSERA_PENDING', $OrderPending->id); - - return true; - } - - public function uninstall() { - $OrderStatePending = new OrderState(Configuration::get('PAYSERA_PENDING')); - - return ( - Configuration::deleteByName('PAYSERA_PROJECT_ID') AND - Configuration::deleteByName('PAYSERA_SIGNATURE') AND - Configuration::deleteByName('PAYSERA_SANDBOX') AND - Configuration::deleteByName('PAYSERA_PAYMENTLIST') AND - Configuration::deleteByName('PAYSERA_DEFAULT_COUNTRY') AND - Configuration::deleteByName('PAYSERA_PENDING') AND - $OrderStatePending->delete() AND - parent::uninstall() - ); - } - - private function validatePostRequest() { - if (isset($_POST['btnSubmit'])) { - if (empty($_POST['project_id'])) { - $this->messages[] = array( - 'class' => 'warning warn', - 'src' => '../img/admin/warning.gif', - 'msg' => $this->l('Project ID is required!'), - ); - - return false; - } - } - - return true; - } - - private function processPostRequest() { - if (isset($_POST['btnSubmit'])) { - Configuration::updateValue('PAYSERA_PROJECT_ID', intval($_POST['project_id'])); - Configuration::updateValue('PAYSERA_SIGNATURE', $_POST['signature']); - Configuration::updateValue('PAYSERA_SANDBOX', intval($_POST['sandbox'])); - Configuration::updateValue('PAYSERA_PAYMENTLIST', intval($_POST['paymentList'])); - Configuration::updateValue('PAYSERA_DEFAULT_COUNTRY', $_POST['defaultCountry']); - - $this->project_id = intval($_POST['project_id']); - $this->signature = $_POST['signature']; - $this->sandbox = intval($_POST['sandbox']); - $this->paymentList = intval($_POST['paymentList']); - $this->defaultCountry = $_POST['defaultCountry']; - - $this->messages[] = array( - 'class' => 'conf confirm', - 'src' => '../img/admin/ok.gif', - 'msg' => $this->l('Settings updated'), - ); - } - } - - public function getContent() { - global $cookie, $smarty; - - if ($this->validatePostRequest()) { - $this->processPostRequest(); - } - - $methods = WebToPay::getPaymentMethodList($this->project_id) - ->setDefaultLanguage(Language::getIsoById(intval($cookie->id_lang))) - ->getCountries(); - - $smarty->assign(array( - 'messages' => $this->messages, - 'lang' => $cookie->id_lang, - 'requestUrl' => $_SERVER['REQUEST_URI'], - 'projectId' => $this->project_id, - 'projectPass' => $this->signature, - 'defaultCountry' => $this->defaultCountry, - 'sandboxOn' => ($this->sandbox) ? 'checked="checked"' : '', - 'sandboxOff' => (!$this->sandbox) ? 'checked="checked"' : '', - 'payListOn' => ($this->paymentList) ? 'checked="checked"' : '', - 'payListOff' => (!$this->paymentList) ? 'checked="checked"' : '', - 'countries' => $methods, - )); - - return $this->display(__FILE__, 'views/templates/front/configuration.tpl'); - } - - - /** - * NOT IMPLEMENTED - * - * @param int $orderId - * @return string - */ - private function restoreOrder($orderId) { - global $smarty, $cookie; - - $order = new Order($orderId); - - if (Validate::isLoadedObject($order) && $order->id_customer == $cookie->id_customer) { - try { - $request = WebToPay::buildRepeatRequest(array( - 'projectid' => $this->project_id, - 'sign_password' => $this->signature, - 'orderid' => $orderId, - )); - } catch (WebToPayException $e) { - echo get_class($e) . ': ' . $e->getMessage(); - } - - $smarty->assign(array( - 'payUrl' => WebToPay::PAY_URL, - 'request' => $request, - )); - - return $this->display(__FILE__, 'views/templates/front/restore.tpl'); - } else { - exit('Bad restore number!'); - } - } - - public function hookPayment($params) { - global $smarty; - - $iso_code = $this->context->language->iso_code; - $smarty->assign(array( - 'lang' => $iso_code, - 'this_path' => $this->_path, - 'this_path_ssl' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://') . htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8') . __PS_BASE_URI__ . 'modules/' . $this->name . '/' - )); - - return $this->display(__FILE__, 'views/templates/hook/payment.tpl'); - } - - public function hookPaymentReturn($params) { - global $smarty; - - $state = $params['objOrder']->getCurrentState(); - if ($state == Configuration::get('PAYSERA_ACCEPTED') OR $state == _PS_OS_OUTOFSTOCK_ || 1) { - $smarty->assign(array( - 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false, false), - 'status' => 'ok', - 'id_order' => $params['objOrder']->id - )); - } else { - $smarty->assign('status', 'failed'); - } - - return $this->display(__FILE__, 'views/templates/front/payment_return.tpl'); - } - - /** - * @param int $id_currency : this parameter is optionnal but on 1.5 version of Prestashop, it will be REQUIRED - * @return Currency - */ - public function getCurrency($current_id_currency = null) { - if (!(int)$current_id_currency) - $current_id_currency = Context::getContext()->currency->id; - - if (!$this->currencies) - return false; - if ($this->currencies_mode == 'checkbox') { - $currencies = Currency::getPaymentCurrencies($this->id); - return $currencies; - } elseif ($this->currencies_mode == 'radio') { - $currencies = Currency::getPaymentCurrenciesSpecial($this->id); - $currency = $currencies['id_currency']; - if ($currency == -1) - $id_currency = (int)$current_id_currency; - elseif ($currency == -2) - $id_currency = (int)Configuration::get('PS_CURRENCY_DEFAULT'); else - $id_currency = $currency; - } - if (!isset($id_currency) || empty($id_currency)) - return false; - return (new Currency($id_currency)); - } - - public function checkCurrency($cart) { - $currency_order = new Currency($cart->id_currency); - $currencies_module = $this->getCurrency($cart->id_currency); - - if (is_array($currencies_module)) { - foreach ($currencies_module as $currency_module) { - if ($currency_order->id == $currency_module['id_currency']) { - return true; - } - } - } - - return false; - } - - private static function setValue($config = array(), $value = '', $default = 0) { - return (isset($config[$value])) ? $config[$value] : $default; - } - - /** - * Debug function - * - * @param $var - */ - private static function d($var) { - echo '
';
-        print_r($var);
-        echo '
'; - } - -} diff --git a/mokejimai/translations/en.php b/mokejimai/translations/en.php deleted file mode 100755 index 6022bdd..0000000 --- a/mokejimai/translations/en.php +++ /dev/null @@ -1,18 +0,0 @@ -configuration_3f86574ad34d16a8cf2ba530c9aafee7'] = 'This module allows you to accept payments by Paysera.com'; -$_MODULE['<{mokejimai}default>configuration_b6af2d31afe71aedcceca73cc27fec29'] = 'If the client chooses this payment mode, the order will change its status into a \'Waiting for payment\' status.'; -$_MODULE['<{mokejimai}default>configuration_aa9f04d1be872e3bdaca1cccf7f02d12'] = 'Payment module details'; -$_MODULE['<{mokejimai}default>configuration_f5f04b11870f0822cfc263fdc6214528'] = 'Please specify the Paysera.com details'; -$_MODULE['<{mokejimai}default>configuration_e082f55a3e947645b3cfc4a3837564be'] = 'Paysera.com project ID:'; -$_MODULE['<{mokejimai}default>configuration_ae71d10996c375bccc46d24665b318a9'] = 'Paysera.com project passaword:'; -$_MODULE['<{mokejimai}default>configuration_2f1120281bc59dbf84f4b7d9f210b421'] = 'Test mode:'; -$_MODULE['<{mokejimai}default>configuration_93cba07454f06a4a960172bbd6e2a435'] = 'Yes'; -$_MODULE['<{mokejimai}default>configuration_bafd7322c6e97d25b6299b5d6fe8920b'] = 'No'; -$_MODULE['<{mokejimai}default>configuration_2f8251979372d44fa8e3df67202cbef1'] = 'Display payments list:'; -$_MODULE['<{mokejimai}default>configuration_49b80feb114d68c0b124c0129536bd02'] = 'Default payment country:'; -$_MODULE['<{mokejimai}default>configuration_b17f3f4dcf653a5776792498a9b44d6a'] = 'Update settings'; -$_MODULE['<{mokejimai}default>payment_8d0e94f6e1d030f33f8ce19548051b3d'] = 'Pay by Paysera.com'; -$_MODULE['<{mokejimai}default>payment_3af059bc2293e9e46a898bdc659e0a0c'] = 'Pay by Paysera.com (order process will be faster) '; diff --git a/mokejimai/translations/lt.php b/mokejimai/translations/lt.php deleted file mode 100755 index da0122b..0000000 --- a/mokejimai/translations/lt.php +++ /dev/null @@ -1,35 +0,0 @@ -mokejimai_2d2b05368867f2d9b017e65ce9c1526a'] = 'Mokėjimai.lt'; -$_MODULE['<{mokejimai}default>mokejimai_e0355bb27ba85e136a8eddc1d95ada91'] = 'Prrimti mokėjimus per Mokėjimai.lt sistemą'; -$_MODULE['<{mokejimai}default>mokejimai_69a1a3ad8dd5da6db3c4da838a0cf9c7'] = 'Ar tikrai norite ištrinti nustatymus'; -$_MODULE['<{mokejimai}default>mokejimai_ef6222485ff756bb929a8dfc9c722ea9'] = 'Turi būti suvesti projekto nustatymai, kad veiktų teisingai apmokėjimas.'; -$_MODULE['<{mokejimai}default>mokejimai_4402acab1c8f90dcf4a31dc96833bd86'] = 'Nepasirinkta valiuta šiame modulyje'; -$_MODULE['<{mokejimai}default>mokejimai_b4ba0005dcd53932c2b8106963281b62'] = 'Privaloma įvesti projekto ID'; -$_MODULE['<{mokejimai}default>mokejimai_c888438d14855d7d96a2724ee9c306bd'] = 'Nustatymai atnaujinti'; -$_MODULE['<{mokejimai}default>configuration_3f86574ad34d16a8cf2ba530c9aafee7'] = 'Šis modulis leidžia priimti mokėjimus per Mokėjimai.lt sistemą.'; -$_MODULE['<{mokejimai}default>configuration_b6af2d31afe71aedcceca73cc27fec29'] = 'Jeigu klientas pasirinks šį mokėjimo būdą, užsakymas pakeis savo būklę į \"Laukiama\" apmokėjimo'; -$_MODULE['<{mokejimai}default>configuration_aa9f04d1be872e3bdaca1cccf7f02d12'] = 'Mokėjimo modulio nustatymai'; -$_MODULE['<{mokejimai}default>configuration_f5f04b11870f0822cfc263fdc6214528'] = 'Įrašykite mokėjimai.lt modulio duomenis.'; -$_MODULE['<{mokejimai}default>configuration_e082f55a3e947645b3cfc4a3837564be'] = 'Mokėjimai.lt projekto ID'; -$_MODULE['<{mokejimai}default>configuration_ae71d10996c375bccc46d24665b318a9'] = 'Mokėjimai.lt projekto slaptažodis:'; -$_MODULE['<{mokejimai}default>configuration_2f1120281bc59dbf84f4b7d9f210b421'] = 'Testinis režimas?'; -$_MODULE['<{mokejimai}default>configuration_93cba07454f06a4a960172bbd6e2a435'] = 'Taip'; -$_MODULE['<{mokejimai}default>configuration_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Ne'; -$_MODULE['<{mokejimai}default>configuration_2f8251979372d44fa8e3df67202cbef1'] = 'Rodyti mokėjimo būdų pasirinkimą?'; -$_MODULE['<{mokejimai}default>configuration_49b80feb114d68c0b124c0129536bd02'] = 'Pradinė mokėjimo būdų pasirinkimo šalis'; -$_MODULE['<{mokejimai}default>configuration_b17f3f4dcf653a5776792498a9b44d6a'] = 'Atnaujinti nustatymus'; -$_MODULE['<{mokejimai}default>payment_execution_289148aed2fe892082cadcfd5c1e5805'] = 'Mokėjimai.lt mokėjimo būdas'; -$_MODULE['<{mokejimai}default>payment_execution_f1d3b424cd68795ecaa552883759aceb'] = 'Užsąkymo detalės:'; -$_MODULE['<{mokejimai}default>payment_execution_e0b4f8216cad5c2c286f08d187503ed0'] = 'Mokėjimai.lt mokėjimo būdas'; -$_MODULE['<{mokejimai}default>payment_execution_2d2b05368867f2d9b017e65ce9c1526a'] = 'Mokėjimai'; -$_MODULE['<{mokejimai}default>payment_execution_c047e6ab568a2227653f7d1d30bcf1c2'] = 'Jūs pasirinkote mokėti per Mokejimai.lt'; -$_MODULE['<{mokejimai}default>payment_execution_c884ed19483d45970c5bf23a681e2dd2'] = 'Užsąkymo detalės:'; -$_MODULE['<{mokejimai}default>payment_execution_e2867a925cba382f1436d1834bb52a1c'] = 'Bendra užsąkymo suma'; -$_MODULE['<{mokejimai}default>payment_execution_48034ce5085e9fd93c65ce59966acf9e'] = 'Pakeikite mokėjimo šalį'; -$_MODULE['<{mokejimai}default>payment_execution_46b9e3665f187c739c55983f757ccda0'] = 'Patvirtinti užsąkymą'; -$_MODULE['<{mokejimai}default>payment_8d0e94f6e1d030f33f8ce19548051b3d'] = 'Mokėti per Mokejimai.lt'; -$_MODULE['<{mokejimai}default>payment_3af059bc2293e9e46a898bdc659e0a0c'] = 'Mokėti per Mokejimai.lt (užsąkymas bus atliktas greičiau)'; -$_MODULE['<{mokejimai}default>payment_fb1b6ccdcee225de3d8caf01885d2204'] = 'Toliau >>'; diff --git a/mokejimai/translations/ru.php b/mokejimai/translations/ru.php deleted file mode 100755 index 601358d..0000000 --- a/mokejimai/translations/ru.php +++ /dev/null @@ -1,4 +0,0 @@ -. - * - * @package WebToPay - * @author EVP International - * @license http://www.gnu.org/licenses/lgpl.html - * @version 1.6 - * @link http://www.webtopay.com/ - */ - - -/** - * Contains static methods for most used scenarios. - */ -class WebToPay { - - /** - * WebToPay Library version. - */ - const VERSION = '1.6'; - - /** - * Server URL where all requests should go. - */ - const PAY_URL = 'https://www.mokejimai.lt/pay/'; - - /** - * Server URL where all non-lithuanian language requests should go. - */ - const PAYSERA_PAY_URL = 'https://www.paysera.com/pay/'; - - /** - * Server URL where we can get XML with payment method data. - */ - const XML_URL = 'https://www.mokejimai.lt/new/api/paymentMethods/'; - - /** - * SMS answer url. - */ - const SMS_ANSWER_URL = 'https://www.mokejimai.lt/psms/respond/'; - - /** - * Builds request data array. - * - * This method checks all given data and generates correct request data - * array or raises WebToPayException on failure. - * - * Possible keys: - * https://www.mokejimai.lt/makro_specifikacija.html - * - * @param array $data Information about current payment request - * - * @return array - * - * @throws WebToPayException on data validation error - */ - public static function buildRequest($data) { - if (!isset($data['sign_password']) || !isset($data['projectid'])) { - throw new WebToPayException('sign_password or projectid is not provided'); - } - $password = $data['sign_password']; - $projectId = $data['projectid']; - unset($data['sign_password']); - unset($data['projectid']); - - $factory = new WebToPay_Factory(array('projectId' => $projectId, 'password' => $password)); - $requestBuilder = $factory->getRequestBuilder(); - return $requestBuilder->buildRequest($data); - } - - - /** - * Builds request and redirects user to payment window with generated request data - * - * Possible array keys are described here: - * https://www.mokejimai.lt/makro_specifikacija.html - * - * @param array $data Information about current payment request. - * @param boolean $exit if true, exits after sending Location header; default false - * - * @throws WebToPayException on data validation error - */ - public static function redirectToPayment($data, $exit = false) { - if (!isset($data['sign_password']) || !isset($data['projectid'])) { - throw new WebToPayException('sign_password or projectid is not provided'); - } - $password = $data['sign_password']; - $projectId = $data['projectid']; - unset($data['sign_password']); - unset($data['projectid']); - - $factory = new WebToPay_Factory(array('projectId' => $projectId, 'password' => $password)); - $url = $factory->getRequestBuilder() - ->buildRequestUrlFromData($data); - - if (headers_sent()) { - echo ''; - } else { - header("Location: $url", true); - } - printf( - 'Redirecting to %s. Please wait.', - htmlentities($url, ENT_QUOTES, 'UTF-8'), - htmlentities($url, ENT_QUOTES, 'UTF-8') - ); - if ($exit) { - exit(); - } - } - - /** - * Builds repeat request data array. - * - * This method checks all given data and generates correct request data - * array or raises WebToPayException on failure. - * - * Method accepts single parameter $data of array type. All possible array - * keys are described here: - * https://www.mokejimai.lt/makro_specifikacija.html - * - * @param array $data Information about current payment request - * - * @return array - * - * @throws WebToPayException on data validation error - */ - public static function buildRepeatRequest($data) { - if (!isset($data['sign_password']) || !isset($data['projectid']) || !isset($data['orderid'])) { - throw new WebToPayException('sign_password, projectid or orderid is not provided'); - } - $password = $data['sign_password']; - $projectId = $data['projectid']; - $orderId = $data['orderid']; - - $factory = new WebToPay_Factory(array('projectId' => $projectId, 'password' => $password)); - $requestBuilder = $factory->getRequestBuilder(); - return $requestBuilder->buildRepeatRequest($orderId); - } - - /** - * Returns payment url. Argument is same as lang parameter in request data - * - * @param string $language - * @return string $url - */ - public static function getPaymentUrl($language = 'LIT') { - return (in_array($language, array('lt', 'lit', 'LIT'))) - ? self::PAY_URL - : self::PAYSERA_PAY_URL; - } - - /** - * Parses response from WebToPay server and validates signs. - * - * This function accepts both micro and macro responses. - * - * First parameter usualy should be $_GET array. - * - * Description about response can be found here: - * makro: https://www.mokejimai.lt/makro_specifikacija.html - * mikro: https://www.mokejimai.lt/mikro_mokejimu_specifikacija_SMS.html - * - * If response is not correct, WebToPayException will be raised. - * - * @param array $query Response array - * @param array $userData - * - * @return array - * - * @throws WebToPayException - * @deprecated use validateAndParseData() and check status code yourself - */ - public static function checkResponse($query, $userData = array()) { - $projectId = isset($userData['projectid']) ? $userData['projectid'] : null; - $password = isset($userData['sign_password']) ? $userData['sign_password'] : null; - $logFile = isset($userData['log']) ? $userData['log'] : null; - - try { - $data = self::validateAndParseData($query, $projectId, $password); - if ($data['type'] == 'macro' && $data['status'] != 1) { - throw new WebToPayException('Expected status code 1', WebToPayException::E_DEPRECATED_USAGE); - } - - if ($logFile) { - self::log('OK', http_build_query($data), $logFile); - } - return $data; - - } catch (WebToPayException $exception) { - if ($logFile && $exception->getCode() != WebToPayException::E_DEPRECATED_USAGE) { - self::log('ERR', $exception . "\nQuery: " . http_build_query($query), $logFile); - } - throw $exception; - } - } - - /** - * Parses request (query) data and validates its signature. - * - * @param array $query usually $_GET - * @param integer $projectId - * @param string $password - * - * @return array - * - * @throws WebToPayException - */ - public static function validateAndParseData(array $query, $projectId, $password) { - $factory = new WebToPay_Factory(array('projectId' => $projectId, 'password' => $password)); - $validator = $factory->getCallbackValidator(); - $data = $validator->validateAndParseData($query); - return $data; - } - - /** - * Sends SMS answer - * - * @param array $userData - * - * @throws WebToPayException - * @throws WebToPay_Exception_Validation - */ - public static function smsAnswer($userData) { - if (!isset($userData['id']) || !isset($userData['msg']) || !isset($userData['sign_password'])) { - throw new WebToPay_Exception_Validation('id, msg and sign_password are required'); - } - - $smsId = $userData['id']; - $text = $userData['msg']; - $password = $userData['sign_password']; - $logFile = isset($userData['log']) ? $userData['log'] : null; - - try { - - $factory = new WebToPay_Factory(array('password' => $password)); - $factory->getSmsAnswerSender()->sendAnswer($smsId, $text); - - if ($logFile) { - self::log('OK', 'SMS ANSWER ' . $smsId . ' ' . $text, $logFile); - } - - } catch (WebToPayException $e) { - if ($logFile) { - self::log('ERR', 'SMS ANSWER ' . $e, $logFile); - } - throw $e; - } - - } - - - /** - * Gets available payment methods for project. Gets methods min and max amounts in specified currency. - * - * @param integer $projectId - * @param string $currency - * - * @return WebToPay_PaymentMethodList - * - * @throws WebToPayException - */ - public static function getPaymentMethodList($projectId, $currency = 'LTL') { - $factory = new WebToPay_Factory(array('projectId' => $projectId)); - return $factory->getPaymentMethodListProvider()->getPaymentMethodList($currency); - } - - /** - * Logs to file. Just skips logging if file is not writeable - * - * @param string $type - * @param string $msg - * @param string $logfile - */ - protected static function log($type, $msg, $logfile) { - $fp = @fopen($logfile, 'a'); - if (!$fp) { - return; - } - - $logline = array( - $type, - isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '-', - date('[Y-m-d H:i:s O]'), - 'v' . self::VERSION . ':', - $msg - ); - - $logline = implode(' ', $logline)."\n"; - fwrite($fp, $logline); - fclose($fp); - - // clear big log file - if (filesize($logfile) > 1024 * 1024 * pi()) { - copy($logfile, $logfile.'.old'); - unlink($logfile); - } - } -} - - - - -/** - * Base exception class for all exceptions in this library - */ -class WebToPayException extends Exception { - - /** - * Missing field. - */ - const E_MISSING = 1; - - /** - * Invalid field value. - */ - const E_INVALID = 2; - - /** - * Max length exceeded. - */ - const E_MAXLEN = 3; - - /** - * Regexp for field value doesn't match. - */ - const E_REGEXP = 4; - - /** - * Missing or invalid user given parameters. - */ - const E_USER_PARAMS = 5; - - /** - * Logging errors - */ - const E_LOG = 6; - - /** - * SMS answer errors - */ - const E_SMS_ANSWER = 7; - - /** - * Macro answer errors - */ - const E_STATUS = 8; - - /** - * Library errors - if this happens, bug-report should be sent; also you can check for newer version - */ - const E_LIBRARY = 9; - - /** - * Errors in remote service - it returns some invalid data - */ - const E_SERVICE = 10; - - /** - * Deprecated usage errors - */ - const E_DEPRECATED_USAGE = 11; - - /** - * @var string|boolean - */ - protected $fieldName = false; - - /** - * Sets field which failed - * - * @param string $fieldName - */ - public function setField($fieldName) { - $this->fieldName = $fieldName; - } - - /** - * Gets field which failed - * - * @return string|boolean false - */ - public function getField() { - return $this->fieldName; - } -} - -/** - * Parses and validates callbacks - */ -class WebToPay_CallbackValidator { - - /** - * @var WebToPay_Sign_SignCheckerInterface - */ - protected $signer; - - /** - * @var WebToPay_Util - */ - protected $util; - - /** - * @var integer - */ - protected $projectId; - - /** - * Constructs object - * - * @param integer $projectId - * @param WebToPay_Sign_SignCheckerInterface $signer - * @param WebToPay_Util $util - */ - public function __construct($projectId, WebToPay_Sign_SignCheckerInterface $signer, WebToPay_Util $util) { - $this->signer = $signer; - $this->util = $util; - $this->projectId = $projectId; - } - - /** - * Parses callback parameters from query parameters and checks if sign is correct. - * Request has parameter "data", which is signed and holds all callback parameters - * - * @param array $requestData - * - * @return array Parsed callback parameters - * - * @throws WebToPayException - * @throws WebToPay_Exception_Callback - */ - public function validateAndParseData(array $requestData) { - if (!$this->signer->checkSign($requestData)) { - throw new WebToPay_Exception_Callback('Invalid sign parameters, check $_GET length limit'); - } - - if (!isset($requestData['data'])) { - throw new WebToPay_Exception_Callback('"data" parameter not found'); - } - $data = $requestData['data']; - - $queryString = $this->util->decodeSafeUrlBase64($data); - $request = $this->util->parseHttpQuery($queryString); - - if (!isset($request['projectid'])) { - throw new WebToPay_Exception_Callback( - 'Project ID not provided in callback', - WebToPayException::E_INVALID - ); - } - - if ((string) $request['projectid'] !== (string) $this->projectId) { - throw new WebToPay_Exception_Callback( - sprintf('Bad projectid: %s, should be: %s', $request['projectid'], $this->projectId), - WebToPayException::E_INVALID - ); - } - - if (!isset($request['type']) || !in_array($request['type'], array('micro', 'macro'))) { - $micro = ( - isset($request['to']) - && isset($request['from']) - && isset($request['sms']) - ); - $request['type'] = $micro ? 'micro' : 'macro'; - } - - return $request; - } - - /** - * Checks data to have all the same parameters provided in expected array - * - * @param array $data - * @param array $expected - * - * @throws WebToPayException - */ - public function checkExpectedFields(array $data, array $expected) { - foreach ($expected as $key => $value) { - $passedValue = isset($data[$key]) ? $data[$key] : null; - if ($passedValue != $value) { - throw new WebToPayException( - sprintf('Field %s is not as expected (expected %s, got %s)', $key, $value, $passedValue) - ); - } - } - } -} - -/** - * Raised if configuration is incorrect - */ -class WebToPay_Exception_Configuration extends WebToPayException { - -} - - -/** - * Raised on validation error in passed data when building the request - */ -class WebToPay_Exception_Validation extends WebToPayException { - - public function __construct($message, $code = 0, $field = null, Exception $previousException = null) { - parent::__construct($message, $code, $previousException); - if ($field) { - $this->setField($field); - } - } -} - -/** - * Raised on error in callback - */ -class WebToPay_Exception_Callback extends WebToPayException { - -} - -/** - * Simple web client - */ -class WebToPay_WebClient { - - /** - * Gets page contents by specified URI. Adds query data if provided to the URI - * Ignores status code of the response and header fields - * - * @param string $uri - * @param array $queryData - * - * @return string - * - * @throws WebToPayException - */ - public function get($uri, array $queryData = array()) { - if (count($queryData) > 0) { - $uri .= strpos($uri, '?') === false ? '?' : '&'; - $uri .= http_build_query($queryData); - } - $url = parse_url($uri); - if ('https' == $url['scheme']) { - $host = 'ssl://'.$url['host']; - $port = 443; - } else { - $host = $url['host']; - $port = 80; - } - - $fp = fsockopen($host, $port, $errno, $errstr, 30); - if (!$fp) { - throw new WebToPayException(sprintf('Cannot connect to %s', $uri), WebToPayException::E_INVALID); - } - - if(isset($url['query'])) { - $data = $url['path'].'?'.$url['query']; - } else { - $data = $url['path']; - } - - $out = "GET " . $data . " HTTP/1.0\r\n"; - $out .= "Host: ".$url['host']."\r\n"; - $out .= "Connection: Close\r\n\r\n"; - - $content = ''; - - fwrite($fp, $out); - while (!feof($fp)) $content .= fgets($fp, 8192); - fclose($fp); - - list($header, $content) = explode("\r\n\r\n", $content, 2); - - return trim($content); - } -} - -/** - * Utility class - */ -class WebToPay_Util { - - /** - * Decodes url-safe-base64 encoded string - * Url-safe-base64 is same as base64, but + is replaced to - and / to _ - * - * @param string $encodedText - * - * @return string - */ - public function decodeSafeUrlBase64($encodedText) { - return base64_decode(strtr($encodedText, array('-' => '+', '_' => '/'))); - } - - /** - * Encodes string to url-safe-base64 - * Url-safe-base64 is same as base64, but + is replaced to - and / to _ - * - * @param string $text - * - * @return string - */ - public function encodeSafeUrlBase64($text) { - return strtr(base64_encode($text), array('+' => '-', '/' => '_')); - } - - /** - * Parses HTTP query to array - * - * @param string $query - * - * @return array - */ - public function parseHttpQuery($query) { - $params = array(); - parse_str($query, $params); - if (get_magic_quotes_gpc()) { - $params = $this->stripSlashesRecursively($params); - } - return $params; - } - - /** - * Strips slashes recursively, so this method can be used on arrays with more than one level - * - * @param mixed $data - * - * @return mixed - */ - protected function stripSlashesRecursively($data) { - if (is_array($data)) { - $result = array(); - foreach ($data as $key => $value) { - $result[stripslashes($key)] = $this->stripSlashesRecursively($value); - } - return $result; - } else { - return stripslashes($data); - } - } -} - - -/** - * Used to build a complete request URL. - * - * Class WebToPay_UrlBuilder - */ -class WebToPay_UrlBuilder { - - const PLACEHOLDER_KEY = '[domain]'; - - /** - * @var array - */ - protected $configuration = array(); - - /** - * @var string - */ - protected $environment; - - /** - * @var array - */ - protected $environmentSettings; - - /** - * @param array $configuration - * @param string $environment - */ - function __construct($configuration, $environment) - { - $this->configuration = $configuration; - $this->environment = $environment; - $this->environmentSettings = $this->configuration['routes'][$this->environment]; - } - - /** - * Builds a complete request URL based on the provided parameters - * - * @param $request - * @param null $language - * @return string - */ - public function buildForRequest($request, $language = null) { - return $this->createUrlFromRequestAndLanguage($request, $language); - } - - /** - * Builds a complete URL for payment list API - * - * @param int $projectId - * @param string $currency - * @return string - */ - public function buildForPaymentsMethodList($projectId, $currency) { - $routeWithNoDomain = $this->environmentSettings['paymentMethodList']; - $route = str_replace(self::PLACEHOLDER_KEY, $this->getDefaultDomain(), $routeWithNoDomain); - return $route . $projectId . '/currency:' . $currency; - } - - /** - * Builds a complete URL for Sms Answer - * - * @return string - */ - public function buildForSmsAnswer() { - $routeWithNoDomain = $this->environmentSettings['smsAnswer']; - $route = str_replace(self::PLACEHOLDER_KEY, $this->getDefaultDomain(), $routeWithNoDomain); - return $route; - } - - /** - * Build the url to the public key - * - * @return string - */ - public function buildForPublicKey() { - $routeWithNoDomain = $this->environmentSettings['publicKey']; - $route = str_replace(self::PLACEHOLDER_KEY, $this->getDefaultDomain(), $routeWithNoDomain); - return $route; - } - - /** - * Creates an URL from the request and data provided. - * - * @param array $request - * @param array $language - * @return string - */ - protected function createUrlFromRequestAndLanguage($request, $language) { - $url = $this->getPaymentUrl($language) . '?' . http_build_query($request); - return preg_replace('/[\r\n]+/is', '', $url); - } - - /** - * Returns payment url. Argument is same as lang parameter in request data - * - * @param string $language - * @return string $url - */ - protected function getPaymentUrl($language) { - $routeWithNoDomain = $this->environmentSettings['payment']; - $route = str_replace(self::PLACEHOLDER_KEY, $this->getDomainByLanguage($language), $routeWithNoDomain); - return $route; - } - - /** - * Gets the domain by lang variable - * lit -> mokejimai.lt - * eng -> paysera - * etc - * - * @param $language - * @return string - */ - protected function getDomainByLanguage($language) { - if (isset($this->configuration['domains'][$language])) { - return $this->configuration['domains'][$language]; - } else { - $defaultLanguage = $this->configuration['defaultDomainLanguage']; - return $this->configuration['domains'][$defaultLanguage]; - } - } - - /** - * Gets the domain for the default language - * - * @return string - */ - protected function getDefaultDomain() - { - return $this->getDomainByLanguage($this->configuration['defaultDomainLanguage']); - } -} - - -/** - * Wrapper class to group payment methods. Each country can have several payment method groups, each of them - * have one or more payment methods. - */ -class WebToPay_PaymentMethodGroup { - /** - * Some unique (in the scope of country) key for this group - * - * @var string - */ - protected $groupKey; - - /** - * Translations array for this group. Holds associative array of group title by country codes. - * - * @var array - */ - protected $translations; - - /** - * Holds actual payment methods - * - * @var WebToPay_PaymentMethod[] - */ - protected $paymentMethods; - - /** - * Default language for titles - * - * @var string - */ - protected $defaultLanguage; - - /** - * Constructs object - * - * @param string $groupKey - * @param array $translations - * @param string $defaultLanguage - */ - public function __construct($groupKey, array $translations = array(), $defaultLanguage = 'lt') { - $this->groupKey = $groupKey; - $this->translations = $translations; - $this->defaultLanguage = $defaultLanguage; - $this->paymentMethods = array(); - } - - /** - * Sets default language for titles. - * Returns itself for fluent interface - * - * @param string $language - * - * @return WebToPay_PaymentMethodGroup - */ - public function setDefaultLanguage($language) { - $this->defaultLanguage = $language; - foreach ($this->paymentMethods as $paymentMethod) { - $paymentMethod->setDefaultLanguage($language); - } - return $this; - } - - /** - * Gets default language for titles - * - * @return string - */ - public function getDefaultLanguage() { - return $this->defaultLanguage; - } - - /** - * Gets title of the group. Tries to get title in specified language. If it is not found or if language is not - * specified, uses default language, given to constructor. - * - * @param string [Optional] $languageCode - * - * @return string - */ - public function getTitle($languageCode = null) { - if ($languageCode !== null && isset($this->translations[$languageCode])) { - return $this->translations[$languageCode]; - } elseif (isset($this->translations[$this->defaultLanguage])) { - return $this->translations[$this->defaultLanguage]; - } else { - return $this->groupKey; - } - } - - /** - * Returns group key - * - * @return string - */ - public function getKey() { - return $this->groupKey; - } - - /** - * Returns available payment methods for this group - * - * @return WebToPay_PaymentMethod[] - */ - public function getPaymentMethods() { - return $this->paymentMethods; - } - - - /** - * Adds new payment method for this group. - * If some other payment method with specified key was registered earlier, overwrites it. - * Returns given payment method - * - * @param WebToPay_PaymentMethod $paymentMethod - * - * @return WebToPay_PaymentMethod - */ - public function addPaymentMethod(WebToPay_PaymentMethod $paymentMethod) { - return $this->paymentMethods[$paymentMethod->getKey()] = $paymentMethod; - } - - /** - * Gets payment method object with key. If no payment method with such key is found, returns null. - * - * @param string $key - * - * @return null|WebToPay_PaymentMethod - */ - public function getPaymentMethod($key) { - return isset($this->paymentMethods[$key]) ? $this->paymentMethods[$key] : null; - } - - /** - * Returns new group instance with only those payment methods, which are available for provided amount. - * - * @param integer $amount - * @param string $currency - * - * @return WebToPay_PaymentMethodGroup - */ - public function filterForAmount($amount, $currency) { - $group = new WebToPay_PaymentMethodGroup($this->groupKey, $this->translations, $this->defaultLanguage); - foreach ($this->getPaymentMethods() as $paymentMethod) { - if ($paymentMethod->isAvailableForAmount($amount, $currency)) { - $group->addPaymentMethod($paymentMethod); - } - } - return $group; - } - - /** - * Returns new country instance with only those payment methods, which are returns or not iban number after payment - * - * @param boolean $isIban - * - * @return WebToPay_PaymentMethodGroup - */ - public function filterForIban($isIban = true) { - $group = new WebToPay_PaymentMethodGroup($this->groupKey, $this->translations, $this->defaultLanguage); - foreach ($this->getPaymentMethods() as $paymentMethod) { - if ($paymentMethod->isIban() == $isIban) { - $group->addPaymentMethod($paymentMethod); - } - } - return $group; - } - - /** - * Returns whether this group has no payment methods - * - * @return boolean - */ - public function isEmpty() { - return count($this->paymentMethods) === 0; - } - - /** - * Loads payment methods from given XML node - * - * @param SimpleXMLElement $groupNode - */ - public function fromXmlNode($groupNode) { - foreach ($groupNode->payment_type as $paymentTypeNode) { - $key = (string) $paymentTypeNode->attributes()->key; - $titleTranslations = array(); - foreach ($paymentTypeNode->title as $titleNode) { - $titleTranslations[(string) $titleNode->attributes()->language] = (string) $titleNode; - } - $logoTranslations = array(); - foreach ($paymentTypeNode->logo_url as $logoNode) { - if ((string) $logoNode !== '') { - $logoTranslations[(string) $logoNode->attributes()->language] = (string) $logoNode; - } - } - $minAmount = null; - $maxAmount = null; - $currency = null; - $isIban = false; - $baseCurrency = null; - if (isset($paymentTypeNode->min)) { - $minAmount = (int) $paymentTypeNode->min->attributes()->amount; - $currency = (string) $paymentTypeNode->min->attributes()->currency; - } - if (isset($paymentTypeNode->max)) { - $maxAmount = (int) $paymentTypeNode->max->attributes()->amount; - $currency = (string) $paymentTypeNode->max->attributes()->currency; - } - - if (isset($paymentTypeNode->is_iban)) { - $isIban = (int) $paymentTypeNode->is_iban; - } - if (isset($paymentTypeNode->base_currency)) { - $baseCurrency = (string) $paymentTypeNode->base_currency; - } - $this->addPaymentMethod($this->createPaymentMethod( - $key, $minAmount, $maxAmount, $currency, $logoTranslations, $titleTranslations, $isIban, $baseCurrency - )); - } - } - - /** - * Method to create new payment method instances. Overwrite if you have to use some other subclass. - * - * @param string $key - * @param integer $minAmount - * @param integer $maxAmount - * @param string $currency - * @param array $logoList - * @param array $titleTranslations - * @param bool $isIban - * @param null $baseCurrency - * - * @return WebToPay_PaymentMethod - */ - protected function createPaymentMethod( - $key, $minAmount, $maxAmount, $currency, array $logoList = array(), array $titleTranslations = array(), - $isIban = false, $baseCurrency = null - ) { - return new WebToPay_PaymentMethod( - $key, $minAmount, $maxAmount, $currency, $logoList, $titleTranslations, $this->defaultLanguage, - $isIban, $baseCurrency - ); - } -} - -/** - * Sends answer to SMS payment if it was not provided with response to callback - */ -class WebToPay_SmsAnswerSender { - - /** - * @var string - */ - protected $password; - - /** - * @var WebToPay_WebClient - */ - protected $webClient; - - /** - * @var WebToPay_UrlBuilder $urlBuilder - */ - protected $urlBuilder; - - /** - * Constructs object - * - * @param string $password - * @param WebToPay_WebClient $webClient - * @param WebToPay_UrlBuilder $urlBuilder - */ - public function __construct( - $password, - WebToPay_WebClient $webClient, - WebToPay_UrlBuilder $urlBuilder - ) { - $this->password = $password; - $this->webClient = $webClient; - $this->urlBuilder = $urlBuilder; - } - - /** - * Sends answer by sms ID get from callback. Answer can be send only if it was not provided - * when responding to callback - * - * @param integer $smsId - * @param string $text - * - * @throws WebToPayException - */ - public function sendAnswer($smsId, $text) { - $content = $this->webClient->get($this->urlBuilder->buildForSmsAnswer(), array( - 'id' => $smsId, - 'msg' => $text, - 'transaction' => md5($this->password . '|' . $smsId), - )); - if (strpos($content, 'OK') !== 0) { - throw new WebToPayException( - sprintf('Error: %s', $content), - WebToPayException::E_SMS_ANSWER - ); - } - } -} - - -/** - * Class to hold information about payment method - */ -class WebToPay_PaymentMethod { - /** - * Assigned key for this payment method - * - * @var string - */ - protected $key; - - /** - * Logo url list by language. Usually logo is same for all languages, but exceptions exist - * - * @var array - */ - protected $logoList; - - /** - * Title list by language - * - * @var array - */ - protected $titleTranslations; - - /** - * Default language to use for titles - * - * @var string - */ - protected $defaultLanguage; - - /** - * @var boolean - */ - protected $isIban; - - /** - * @var string - */ - protected $baseCurrency; - - /** - * Constructs object - * - * @param string $key - * @param integer $minAmount - * @param integer $maxAmount - * @param string $currency - * @param array $logoList - * @param array $titleTranslations - * @param string $defaultLanguage - * @param bool $isIban - * @param string $baseCurrency - */ - public function __construct( - $key, $minAmount, $maxAmount, $currency, array $logoList = array(), array $titleTranslations = array(), - $defaultLanguage = 'lt', $isIban = false, $baseCurrency = null - ) { - $this->key = $key; - $this->minAmount = $minAmount; - $this->maxAmount = $maxAmount; - $this->currency = $currency; - $this->logoList = $logoList; - $this->titleTranslations = $titleTranslations; - $this->defaultLanguage = $defaultLanguage; - $this->isIban = $isIban; - $this->baseCurrency = $baseCurrency; - } - - /** - * Sets default language for titles. - * Returns itself for fluent interface - * - * @param string $language - * - * @return WebToPay_PaymentMethod - */ - public function setDefaultLanguage($language) { - $this->defaultLanguage = $language; - return $this; - } - - /** - * Gets default language for titles - * - * @return string - */ - public function getDefaultLanguage() { - return $this->defaultLanguage; - } - - /** - * Get assigned payment method key - * - * @return string - */ - public function getKey() { - return $this->key; - } - - /** - * Gets logo url for this payment method. Uses specified language or default one. - * If logotype is not found for specified language, null is returned. - * - * @param string [Optional] $languageCode - * - * @return string|null - */ - public function getLogoUrl($languageCode = null) { - if ($languageCode !== null && isset($this->logoList[$languageCode])) { - return $this->logoList[$languageCode]; - } elseif (isset($this->logoList[$this->defaultLanguage])) { - return $this->logoList[$this->defaultLanguage]; - } else { - return null; - } - } - - /** - * Gets title for this payment method. Uses specified language or default one. - * - * @param string [Optional] $languageCode - * - * @return string - */ - public function getTitle($languageCode = null) { - if ($languageCode !== null && isset($this->titleTranslations[$languageCode])) { - return $this->titleTranslations[$languageCode]; - } elseif (isset($this->titleTranslations[$this->defaultLanguage])) { - return $this->titleTranslations[$this->defaultLanguage]; - } else { - return $this->key; - } - } - - /** - * Checks if this payment method can be used for specified amount. - * Throws exception if currency checked is not the one, for which payment method list was downloaded. - * - * @param integer $amount - * @param string $currency - * - * @return boolean - * - * @throws WebToPayException - */ - public function isAvailableForAmount($amount, $currency) { - if ($this->currency !== $currency) { - throw new WebToPayException( - 'Currencies does not match. You have to get payment types for the currency you are checking. Given currency: ' - . $currency . ', available currency: ' . $this->currency - ); - } - return ( - ($this->minAmount === null || $amount >= $this->minAmount) - && ($this->maxAmount === null || $amount <= $this->maxAmount) - ); - } - - /** - * Returns min amount for this payment method. If no min amount is specified, returns empty string. - * - * @return string - */ - public function getMinAmountAsString() { - return $this->minAmount === null ? '' : ($this->minAmount . ' ' . $this->currency); - } - - /** - * Returns max amount for this payment method. If no max amount is specified, returns empty string. - * - * @return string - */ - public function getMaxAmountAsString() { - return $this->maxAmount === null ? '' : ($this->maxAmount . ' ' . $this->currency); - } - - /** - * Set if this method returns IBAN number after payment - * - * @param boolean $isIban - */ - public function setIsIban($isIban) { - $this->isIban = $isIban == 1; - } - - /** - * Get if this method returns IBAN number after payment - * - * @return bool - */ - public function isIban() { - return $this->isIban; - } - - /** - * Setter of BaseCurrency - * - * @param string $baseCurrency - */ - public function setBaseCurrency($baseCurrency) - { - $this->baseCurrency = $baseCurrency; - } - - /** - * Getter of BaseCurrency - * - * @return string - */ - public function getBaseCurrency() - { - return $this->baseCurrency; - } -} - - -/** - * Class with all information about available payment methods for some project, optionally filtered by some amount. - */ -class WebToPay_PaymentMethodList { - /** - * Holds available payment countries - * - * @var WebToPay_PaymentMethodCountry[] - */ - protected $countries; - - /** - * Default language for titles - * - * @var string - */ - protected $defaultLanguage; - - /** - * Project ID, to which this method list is valid - * - * @var integer - */ - protected $projectId; - - /** - * Currency for min and max amounts in this list - * - * @var string - */ - protected $currency; - - /** - * If this list is filtered for some amount, this field defines it - * - * @var integer - */ - protected $amount; - - /** - * Constructs object - * - * @param integer $projectId - * @param string $currency currency for min and max amounts in this list - * @param string $defaultLanguage - * @param integer $amount null if this list is not filtered by amount - */ - public function __construct($projectId, $currency, $defaultLanguage = 'lt', $amount = null) { - $this->projectId = $projectId; - $this->countries = array(); - $this->defaultLanguage = $defaultLanguage; - $this->currency = $currency; - $this->amount = $amount; - } - - /** - * Sets default language for titles. - * Returns itself for fluent interface - * - * @param string $language - * - * @return WebToPay_PaymentMethodList - */ - public function setDefaultLanguage($language) { - $this->defaultLanguage = $language; - foreach ($this->countries as $country) { - $country->setDefaultLanguage($language); - } - return $this; - } - - /** - * Gets default language for titles - * - * @return string - */ - public function getDefaultLanguage() { - return $this->defaultLanguage; - } - - /** - * Gets project ID for this payment method list - * - * @return integer - */ - public function getProjectId() { - return $this->projectId; - } - - /** - * Gets currency for min and max amounts in this list - * - * @return string - */ - public function getCurrency() { - return $this->currency; - } - - /** - * Gets whether this list is already filtered for some amount - * - * @return boolean - */ - public function isFiltered() { - return $this->amount !== null; - } - - /** - * Returns available countries - * - * @return WebToPay_PaymentMethodCountry[] - */ - public function getCountries() { - return $this->countries; - } - - /** - * Adds new country to payment methods. If some other country with same code was registered earlier, overwrites it. - * Returns added country instance - * - * @param WebToPay_PaymentMethodCountry $country - * - * @return WebToPay_PaymentMethodCountry - */ - public function addCountry(WebToPay_PaymentMethodCountry $country) { - return $this->countries[$country->getCode()] = $country; - } - - /** - * Gets country object with specified country code. If no country with such country code is found, returns null. - * - * @param string $countryCode - * - * @return null|WebToPay_PaymentMethodCountry - */ - public function getCountry($countryCode) { - return isset($this->countries[$countryCode]) ? $this->countries[$countryCode] : null; - } - - /** - * Returns new payment method list instance with only those payment methods, which are available for provided - * amount. - * Returns itself, if list is already filtered and filter amount matches the given one. - * - * @param integer $amount - * @param string $currency - * - * @return WebToPay_PaymentMethodList - * - * @throws WebToPayException if this list is already filtered and not for provided amount - */ - public function filterForAmount($amount, $currency) { - if ($currency !== $this->currency) { - throw new WebToPayException( - 'Currencies do not match. Given currency: ' . $currency . ', currency in list: ' . $this->currency - ); - } - if ($this->isFiltered()) { - if ($this->amount === $amount) { - return $this; - } else { - throw new WebToPayException('This list is already filtered, use unfiltered list instead'); - } - } else { - $list = new WebToPay_PaymentMethodList($this->projectId, $currency, $this->defaultLanguage, $amount); - foreach ($this->getCountries() as $country) { - $country = $country->filterForAmount($amount, $currency); - if (!$country->isEmpty()) { - $list->addCountry($country); - } - } - return $list; - } - } - - /** - * Loads countries from given XML node - * - * @param SimpleXMLElement $xmlNode - */ - public function fromXmlNode($xmlNode) { - foreach ($xmlNode->country as $countryNode) { - $titleTranslations = array(); - foreach ($countryNode->title as $titleNode) { - $titleTranslations[(string) $titleNode->attributes()->language] = (string) $titleNode; - } - $this->addCountry($this->createCountry((string) $countryNode->attributes()->code, $titleTranslations)) - ->fromXmlNode($countryNode); - } - } - - /** - * Method to create new country instances. Overwrite if you have to use some other country subtype. - * - * @param string $countryCode - * @param array $titleTranslations - * - * @return WebToPay_PaymentMethodCountry - */ - protected function createCountry($countryCode, array $titleTranslations = array()) { - return new WebToPay_PaymentMethodCountry($countryCode, $titleTranslations, $this->defaultLanguage); - } -} - -/** - * Builds and signs requests - */ -class WebToPay_RequestBuilder { - - /** - * @var string - */ - protected $projectPassword; - - /** - * @var WebToPay_Util - */ - protected $util; - - /** - * @var integer - */ - protected $projectId; - - - /** - * @var WebToPay_UrlBuilder $urlBuilder - */ - protected $urlBuilder; - - /** - * Constructs object - * - * @param integer $projectId - * @param string $projectPassword - * @param WebToPay_Util $util - * @param WebToPay_UrlBuilder $urlBuilder - */ - public function __construct( - $projectId, - $projectPassword, - WebToPay_Util $util, - WebToPay_UrlBuilder $urlBuilder - ) - { - $this->projectId = $projectId; - $this->projectPassword = $projectPassword; - $this->util = $util; - $this->urlBuilder = $urlBuilder; - } - - /** - * Builds request data array. - * - * This method checks all given data and generates correct request data - * array or raises WebToPayException on failure. - * - * @param array $data information about current payment request - * - * @return array - * - * @throws WebToPayException - */ - public function buildRequest($data) { - $this->validateRequest($data, self::getRequestSpec()); - $data['version'] = WebToPay::VERSION; - $data['projectid'] = $this->projectId; - unset($data['repeat_request']); - return $this->createRequest($data); - } - - /** - * Builds the full request url (including the protocol and the domain) - * - * @param array $data - * @return string - */ - public function buildRequestUrlFromData($data) { - $language = isset($data['lang']) ? $data['lang'] : null; - $request = $this->buildRequest($data); - return $this->urlBuilder->buildForRequest($request, $language); - } - - /** - * Builds repeat request data array. - * - * This method checks all given data and generates correct request data - * array or raises WebToPayException on failure. - * - * @param string $orderId order id of repeated request - * - * @return array - * - * @throws WebToPayException - */ - public function buildRepeatRequest($orderId) { - $data['orderid'] = $orderId; - $data['version'] = WebToPay::VERSION; - $data['projectid'] = $this->projectId; - $data['repeat_request'] = '1'; - return $this->createRequest($data); - } - - /** - * Builds the full request url for a repeated request (including the protocol and the domain) - * - * @param string $orderId order id of repeated request - * @return string - */ - public function buildRepeatRequestUrlFromOrderId($orderId) { - $request = $this->buildRepeatRequest($orderId); - return $this->urlBuilder->buildForRequest($request); - } - - /** - * Checks data to be valid by passed specification - * - * @param array $data - * @param array $specs - * - * @throws WebToPay_Exception_Validation - */ - protected function validateRequest($data, $specs) { - foreach ($specs as $spec) { - list($name, $maxlen, $required, $regexp) = $spec; - if ($required && !isset($data[$name])) { - throw new WebToPay_Exception_Validation( - sprintf("'%s' is required but missing.", $name), - WebToPayException::E_MISSING, - $name - ); - } - - if (!empty($data[$name])) { - if ($maxlen && strlen($data[$name]) > $maxlen) { - throw new WebToPay_Exception_Validation(sprintf( - "'%s' value is too long (%d), %d characters allowed.", - $name, - strlen($data[$name]), - $maxlen - ), WebToPayException::E_MAXLEN, $name); - } - - if ($regexp !== '' && !preg_match($regexp, $data[$name])) { - throw new WebToPay_Exception_Validation( - sprintf("'%s' value '%s' is invalid.", $name, $data[$name]), - WebToPayException::E_REGEXP, - $name - ); - } - } - } - } - - /** - * Makes request data array from parameters, also generates signature - * - * @param array $request - * - * @return array - */ - protected function createRequest(array $request) { - $data = $this->util->encodeSafeUrlBase64(http_build_query($request)); - return array( - 'data' => $data, - 'sign' => md5($data . $this->projectPassword), - ); - } - - /** - * Returns specification of fields for request. - * - * Array structure: - * name – request item name - * maxlen – max allowed value for item - * required – is this item is required - * regexp – regexp to test item value - * - * @return array - */ - protected static function getRequestSpec() { - return array( - array('orderid', 40, true, ''), - array('accepturl', 255, true, ''), - array('cancelurl', 255, true, ''), - array('callbackurl', 255, true, ''), - array('lang', 3, false, '/^[a-z]{3}$/i'), - array('amount', 11, false, '/^\d+$/'), - array('currency', 3, false, '/^[a-z]{3}$/i'), - array('payment', 20, false, ''), - array('country', 2, false, '/^[a-z_]{2}$/i'), - array('paytext', 255, false, ''), - array('p_firstname', 255, false, ''), - array('p_lastname', 255, false, ''), - array('p_email', 255, false, ''), - array('p_street', 255, false, ''), - array('p_city', 255, false, ''), - array('p_state', 20, false, ''), - array('p_zip', 20, false, ''), - array('p_countrycode', 2, false, '/^[a-z]{2}$/i'), - array('test', 1, false, '/^[01]$/'), - array('time_limit', 19, false, '/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/'), - ); - } -} - -/** - * Checks SS2 signature. Depends on SSL functions - */ -class WebToPay_Sign_SS2SignChecker implements WebToPay_Sign_SignCheckerInterface { - - /** - * @var string - */ - protected $publicKey; - - /** - * @var WebToPay_Util - */ - protected $util; - - /** - * Constructs object - * - * @param string $publicKey - * @param WebToPay_Util $util - */ - public function __construct($publicKey, WebToPay_Util $util) { - $this->publicKey = $publicKey; - $this->util = $util; - } - - /** - * Checks signature - * - * @param array $request - * - * @return boolean - * - * @throws WebToPay_Exception_Callback - */ - public function checkSign(array $request) { - if (!isset($request['data']) || !isset($request['ss2'])) { - throw new WebToPay_Exception_Callback('Not enough parameters in callback. Possible version mismatch'); - } - - $ss2 = $this->util->decodeSafeUrlBase64($request['ss2']); - $ok = openssl_verify($request['data'], $ss2, $this->publicKey); - return $ok === 1; - } -} - -/** - * Sign checker which checks SS1 signature. SS1 does not depend on SSL functions - */ -class WebToPay_Sign_SS1SignChecker implements WebToPay_Sign_SignCheckerInterface { - - /** - * @var string - */ - protected $projectPassword; - - /** - * Constructs object - * - * @param string $projectPassword - */ - public function __construct($projectPassword) { - $this->projectPassword = $projectPassword; - } - - /** - * Check for SS1, which is not depend on openssl functions. - * - * @param array $request - * - * @return boolean - * - * @throws WebToPay_Exception_Callback - */ - public function checkSign(array $request) { - if (!isset($request['data']) || !isset($request['ss1'])) { - throw new WebToPay_Exception_Callback('Not enough parameters in callback. Possible version mismatch'); - } - - return md5($request['data'] . $this->projectPassword) === $request['ss1']; - } -} - -/** - * Interface for sign checker - */ -interface WebToPay_Sign_SignCheckerInterface { - - /** - * Checks whether request is signed properly - * - * @param array $request - * - * @return boolean - */ - public function checkSign(array $request); -} - -/** - * Loads data about payment methods and constructs payment method list object from that data - * You need SimpleXML support to use this feature - */ -class WebToPay_PaymentMethodListProvider { - - /** - * @var integer - */ - protected $projectId; - - /** - * @var WebToPay_WebClient - */ - protected $webClient; - - /** - * Holds constructed method lists by currency - * - * @var WebToPay_PaymentMethodList[] - */ - protected $methodListCache = array(); - - /** - * Builds various request URLs - * - * @var WebToPay_UrlBuilder $urlBuilder - */ - protected $urlBuilder; - - /** - * Constructs object - * - * @param integer $projectId - * @param WebToPay_WebClient $webClient - * @param WebToPay_UrlBuilder $urlBuilder - * - * @throws WebToPayException if SimpleXML is not available - */ - public function __construct( - $projectId, - WebToPay_WebClient $webClient, - WebToPay_UrlBuilder $urlBuilder - ) - { - $this->projectId = $projectId; - $this->webClient = $webClient; - $this->urlBuilder = $urlBuilder; - - if (!function_exists('simplexml_load_string')) { - throw new WebToPayException('You have to install libxml to use payment methods API'); - } - } - - /** - * Gets payment method list for specified currency - * - * @param string $currency - * - * @return WebToPay_PaymentMethodList - * - * @throws WebToPayException - */ - public function getPaymentMethodList($currency) { - if (!isset($this->methodListCache[$currency])) { - $xmlAsString = $this->webClient->get($this->urlBuilder->buildForPaymentsMethodList($this->projectId, $currency)); - $useInternalErrors = libxml_use_internal_errors(false); - $rootNode = simplexml_load_string($xmlAsString); - libxml_clear_errors(); - libxml_use_internal_errors($useInternalErrors); - if (!$rootNode) { - throw new WebToPayException('Unable to load XML from remote server'); - } - $methodList = new WebToPay_PaymentMethodList($this->projectId, $currency); - $methodList->fromXmlNode($rootNode); - $this->methodListCache[$currency] = $methodList; - } - return $this->methodListCache[$currency]; - } -} - -/** - * Payment method configuration for some country - */ -class WebToPay_PaymentMethodCountry { - /** - * @var string - */ - protected $countryCode; - - /** - * Holds available payment types for this country - * - * @var WebToPay_PaymentMethodGroup[] - */ - protected $groups; - - /** - * Default language for titles - * - * @var string - */ - protected $defaultLanguage; - - /** - * Translations array for this country. Holds associative array of country title by language codes. - * - * @var array - */ - protected $titleTranslations; - - /** - * Constructs object - * - * @param string $countryCode - * @param array $titleTranslations - * @param string $defaultLanguage - */ - public function __construct($countryCode, $titleTranslations, $defaultLanguage = 'lt') { - $this->countryCode = $countryCode; - $this->defaultLanguage = $defaultLanguage; - $this->titleTranslations = $titleTranslations; - $this->groups = array(); - } - - /** - * Sets default language for titles. - * Returns itself for fluent interface - * - * @param string $language - * - * @return WebToPay_PaymentMethodCountry - */ - public function setDefaultLanguage($language) { - $this->defaultLanguage = $language; - foreach ($this->groups as $group) { - $group->setDefaultLanguage($language); - } - return $this; - } - - /** - * Gets title of the group. Tries to get title in specified language. If it is not found or if language is not - * specified, uses default language, given to constructor. - * - * @param string [Optional] $languageCode - * - * @return string - */ - public function getTitle($languageCode = null) { - if ($languageCode !== null && isset($this->titleTranslations[$languageCode])) { - return $this->titleTranslations[$languageCode]; - } elseif (isset($this->titleTranslations[$this->defaultLanguage])) { - return $this->titleTranslations[$this->defaultLanguage]; - } else { - return $this->countryCode; - } - } - - /** - * Gets default language for titles - * - * @return string - */ - public function getDefaultLanguage() { - return $this->defaultLanguage; - } - - /** - * Gets country code - * - * @return string - */ - public function getCode() { - return $this->countryCode; - } - - /** - * Adds new group to payment methods for this country. - * If some other group was registered earlier with same key, overwrites it. - * Returns given group - * - * @param WebToPay_PaymentMethodGroup $group - * - * @return WebToPay_PaymentMethodGroup - */ - public function addGroup(WebToPay_PaymentMethodGroup $group) { - return $this->groups[$group->getKey()] = $group; - } - - /** - * Gets group object with specified group key. If no group with such key is found, returns null. - * - * @param string $groupKey - * - * @return null|WebToPay_PaymentMethodGroup - */ - public function getGroup($groupKey) { - return isset($this->groups[$groupKey]) ? $this->groups[$groupKey] : null; - } - - /** - * Returns payment method groups registered for this country. - * - * @return WebToPay_PaymentMethodGroup[] - */ - public function getGroups() { - return $this->groups; - } - - /** - * Gets payment methods in all groups - * - * @return WebToPay_PaymentMethod[] - */ - public function getPaymentMethods() { - $paymentMethods = array(); - foreach ($this->groups as $group) { - $paymentMethods = array_merge($paymentMethods, $group->getPaymentMethods()); - } - return $paymentMethods; - } - - /** - * Returns new country instance with only those payment methods, which are available for provided amount. - * - * @param integer $amount - * @param string $currency - * - * @return WebToPay_PaymentMethodCountry - */ - public function filterForAmount($amount, $currency) { - $country = new WebToPay_PaymentMethodCountry($this->countryCode, $this->titleTranslations, $this->defaultLanguage); - foreach ($this->getGroups() as $group) { - $group = $group->filterForAmount($amount, $currency); - if (!$group->isEmpty()) { - $country->addGroup($group); - } - } - return $country; - } - - /** - * Returns new country instance with only those payment methods, which are returns or not iban number after payment - * - * @param boolean $isIban - * - * @return WebToPay_PaymentMethodCountry - */ - public function filterForIban($isIban = true) { - $country = new WebToPay_PaymentMethodCountry($this->countryCode, $this->titleTranslations, $this->defaultLanguage); - foreach ($this->getGroups() as $group) { - $group = $group->filterForIban($isIban); - if (!$group->isEmpty()) { - $country->addGroup($group); - } - } - return $country; - } - - /** - * Returns whether this country has no groups - * - * @return boolean - */ - public function isEmpty() { - return count($this->groups) === 0; - } - - /** - * Loads groups from given XML node - * - * @param SimpleXMLElement $countryNode - */ - public function fromXmlNode($countryNode) { - foreach ($countryNode->payment_group as $groupNode) { - $key = (string) $groupNode->attributes()->key; - $titleTranslations = array(); - foreach ($groupNode->title as $titleNode) { - $titleTranslations[(string) $titleNode->attributes()->language] = (string) $titleNode; - } - $this->addGroup($this->createGroup($key, $titleTranslations))->fromXmlNode($groupNode); - } - } - - /** - * Method to create new group instances. Overwrite if you have to use some other group subtype. - * - * @param string $groupKey - * @param array $translations - * - * @return WebToPay_PaymentMethodGroup - */ - protected function createGroup($groupKey, array $translations = array()) { - return new WebToPay_PaymentMethodGroup($groupKey, $translations, $this->defaultLanguage); - } -} - -/** - * Creates objects. Also caches to avoid creating several instances of same objects - */ -class WebToPay_Factory { - - const ENV_PRODUCTION = 'production'; - const ENV_SANDBOX = 'sandbox'; - - /** - * @var array - */ - protected static $defaultConfiguration = array( - 'routes' => array( - self::ENV_PRODUCTION => array( - 'publicKey' => 'http://downloads.[domain]/download/public.key', - 'payment' => 'https://www.[domain]/pay/', - 'paymentMethodList' => 'https://www.[domain]/new/api/paymentMethods/', - 'smsAnswer' => 'https://www.[domain]/psms/respond/', - ), - self::ENV_SANDBOX => array( - 'publicKey' => 'http://downloads-sandbox.[domain]/download/public.key', - 'payment' => 'https://sandbox.[domain]/pay/', - 'paymentMethodList' => 'https://sandbox.[domain]/new/api/paymentMethods/', - 'smsAnswer' => 'https://sandbox.[domain]/psms/respond/', - ), - ), - - 'domains' => array( - 'lit' => 'mokejimai.lt', - 'eng' => 'paysera.com', - ), - - 'defaultDomainLanguage' => 'lit' - ); - - /** - * @var string - */ - protected $environment; - - /** - * @var array - */ - protected $configuration; - - /** - * @var WebToPay_WebClient - */ - protected $webClient = null; - - /** - * @var WebToPay_CallbackValidator - */ - protected $callbackValidator = null; - - /** - * @var WebToPay_RequestBuilder - */ - protected $requestBuilder = null; - - /** - * @var WebToPay_Sign_SignCheckerInterface - */ - protected $signer = null; - - /** - * @var WebToPay_SmsAnswerSender - */ - protected $smsAnswerSender = null; - - /** - * @var WebToPay_PaymentMethodListProvider - */ - protected $paymentMethodListProvider = null; - - /** - * @var WebToPay_Util - */ - protected $util = null; - - /** - * @var WebToPay_UrlBuilder - */ - protected $urlBuilder = null; - - - /** - * Constructs object. - * Configuration keys: projectId, password - * They are required only when some object being created needs them, - * if they are not found at that moment - exception is thrown - * - * @param array $configuration - */ - public function __construct(array $configuration = array()) { - - $this->configuration = array_merge(self::$defaultConfiguration, $configuration); - $this->environment = self::ENV_PRODUCTION; - } - - /** - * If passed true the factory will use sandbox when constructing URLs - * - * @param $enableSandbox - * @return self - */ - public function useSandbox($enableSandbox) - { - if ($enableSandbox) { - $this->environment = self::ENV_SANDBOX; - } else { - $this->environment = self::ENV_PRODUCTION; - } - return $this; - } - - /** - * Creates or gets callback validator instance - * - * @return WebToPay_CallbackValidator - * - * @throws WebToPay_Exception_Configuration - */ - public function getCallbackValidator() { - if ($this->callbackValidator === null) { - if (!isset($this->configuration['projectId'])) { - throw new WebToPay_Exception_Configuration('You have to provide project ID'); - } - $this->callbackValidator = new WebToPay_CallbackValidator( - $this->configuration['projectId'], - $this->getSigner(), - $this->getUtil() - ); - } - return $this->callbackValidator; - } - - /** - * Creates or gets request builder instance - * - * @throws WebToPay_Exception_Configuration - * - * @return WebToPay_RequestBuilder - */ - public function getRequestBuilder() { - if ($this->requestBuilder === null) { - if (!isset($this->configuration['password'])) { - throw new WebToPay_Exception_Configuration('You have to provide project password to sign request'); - } - if (!isset($this->configuration['projectId'])) { - throw new WebToPay_Exception_Configuration('You have to provide project ID'); - } - $this->requestBuilder = new WebToPay_RequestBuilder( - $this->configuration['projectId'], - $this->configuration['password'], - $this->getUtil(), - $this->getUrlBuilder() - ); - } - return $this->requestBuilder; - } - - /** - * @return WebToPay_UrlBuilder - */ - public function getUrlBuilder() { - if ($this->urlBuilder === null) { - $this->urlBuilder = new WebToPay_UrlBuilder( - $this->configuration, - $this->environment - ); - } - return $this->urlBuilder; - } - - /** - * Creates or gets SMS answer sender instance - * - * @throws WebToPay_Exception_Configuration - * - * @return WebToPay_SmsAnswerSender - */ - public function getSmsAnswerSender() { - if ($this->smsAnswerSender === null) { - if (!isset($this->configuration['password'])) { - throw new WebToPay_Exception_Configuration('You have to provide project password'); - } - $this->smsAnswerSender = new WebToPay_SmsAnswerSender( - $this->configuration['password'], - $this->getWebClient(), - $this->getUrlBuilder() - ); - } - return $this->smsAnswerSender; - } - - /** - * Creates or gets payment list provider instance - * - * @throws WebToPay_Exception_Configuration - * - * @return WebToPay_PaymentMethodListProvider - */ - public function getPaymentMethodListProvider() { - if ($this->paymentMethodListProvider === null) { - if (!isset($this->configuration['projectId'])) { - throw new WebToPay_Exception_Configuration('You have to provide project ID'); - } - $this->paymentMethodListProvider = new WebToPay_PaymentMethodListProvider( - $this->configuration['projectId'], - $this->getWebClient(), - $this->getUrlBuilder() - - ); - } - return $this->paymentMethodListProvider; - } - - /** - * Creates or gets signer instance. Chooses SS2 signer if openssl functions are available, SS1 in other case - * - * @throws WebToPay_Exception_Configuration - * - * @return WebToPay_Sign_SignCheckerInterface - * - * @throws WebToPayException - */ - protected function getSigner() { - if ($this->signer === null) { - if (function_exists('openssl_pkey_get_public')) { - $webClient = $this->getWebClient(); - $publicKey = $webClient->get($this->getUrlBuilder()->buildForPublicKey()); - if (!$publicKey) { - throw new WebToPayException('Cannot download public key from WebToPay website'); - } - $this->signer = new WebToPay_Sign_SS2SignChecker($publicKey, $this->getUtil()); - } else { - if (!isset($this->configuration['password'])) { - throw new WebToPay_Exception_Configuration( - 'You have to provide project password if OpenSSL is unavailable' - ); - } - $this->signer = new WebToPay_Sign_SS1SignChecker($this->configuration['password']); - } - } - return $this->signer; - } - - /** - * Creates or gets web client instance - * - * @throws WebToPay_Exception_Configuration - * - * @return WebToPay_WebClient - */ - protected function getWebClient() { - if ($this->webClient === null) { - $this->webClient = new WebToPay_WebClient(); - } - return $this->webClient; - } - - /** - * Creates or gets util instance - * - * @throws WebToPay_Exception_Configuration - * - * @return WebToPay_Util - */ - protected function getUtil() { - if ($this->util === null) { - $this->util = new WebToPay_Util(); - } - return $this->util; - } -} diff --git a/mokejimai/views/templates/front/configuration.tpl b/mokejimai/views/templates/front/configuration.tpl deleted file mode 100755 index 64df758..0000000 --- a/mokejimai/views/templates/front/configuration.tpl +++ /dev/null @@ -1,66 +0,0 @@ - -{l s='This module allows you to accept payments by mokejimai.lt.' mod='mokejimai'} -
-{l s='If the client chooses this payment mode, the order will change its status into a \'Waiting for payment\' status.' mod='mokejimai'} -
-
- -{if $messages ne ''} - {foreach from=$messages item=message} -
- # - {$message.msg} -
- {/foreach} -{/if} - -
-
- {l s='Payment module details' mod='mokejimai'} - - - - - - - - - - - - - - - - - - - - - - - - - - -
{l s='Please specify the mokejimai.lt details' mod='mokejimai'}

{l s='Paysera.com project ID:' mod='mokejimai'}
{l s='Signature password:' mod='mokejimai'}
{l s='Test mode:' mod='mokejimai'} - {l s='Yes' mod='mokejimai'} - {l s='No' mod='mokejimai'} -
{l s='Display payments list:' mod='mokejimai'} - {l s='Yes' mod='mokejimai'} - {l s='No' mod='mokejimai'} -
{l s='Default payment country:' mod='mokejimai'} - -
- -
-
-
\ No newline at end of file diff --git a/mokejimai/views/templates/front/payment_execution.tpl b/mokejimai/views/templates/front/payment_execution.tpl deleted file mode 100755 index 2dcbe1b..0000000 --- a/mokejimai/views/templates/front/payment_execution.tpl +++ /dev/null @@ -1,152 +0,0 @@ - - - - -{capture name=path}{l s='Paysera.com payment' mod='mokejimai'}{/capture} -{include file="$tpl_dir./breadcrumb.tpl"} - -

{l s='Order summary' mod='mokejimai'}

- -{assign var='current_step' value='payment'} -{include file="$tpl_dir./order-steps.tpl"} - -

{l s='Mokejimai.lt payment' mod='mokejimai'}

- - - - - - - - - - - - - -
- - - - - {l s='You have chosen to pay by Paysera.com/Mokejimai.lt.' mod='mokejimai'}
- {l s='Here is a short summary of your order:' mod='mokejimai'} -
{l s='The total amount of your order is' mod='mokejimai'} - {$amount} {$currency} -
- -{if $displayPayments == 1} - - - - - -
{l s='Select payment country' mod='mokejimai'} - -
-{/if} - -
- {if $displayPayments == 1} -
-
- {foreach from=$payMethods item=country} -
- {foreach from=$country->getGroups() item=group} -
-
{$group->getTitle()}
- {foreach from=$group->getPaymentMethods() item=paymentMethod} -
- - - -
-
- {/foreach} -
-
- {/foreach} -
- {/foreach} -
-
- {/if} -

- {l s='Other payment methods' mod='cashondelivery'} - -

-
diff --git a/mokejimai/views/templates/front/redirect.tpl b/mokejimai/views/templates/front/redirect.tpl deleted file mode 100755 index 4663ac5..0000000 --- a/mokejimai/views/templates/front/redirect.tpl +++ /dev/null @@ -1,16 +0,0 @@ - - -... - -
- {foreach from=$request key=name item=value} - - {/foreach} - -
diff --git a/mokejimai/views/templates/hook/payment.tpl b/mokejimai/views/templates/hook/payment.tpl deleted file mode 100755 index 6cdd7eb..0000000 --- a/mokejimai/views/templates/hook/payment.tpl +++ /dev/null @@ -1,7 +0,0 @@ -

- - - {l s='Pay by Paysera.com/Mokejimai.lt (order process will be faster)' mod='mokejimai'} - {l s='Continue >>' mod='mokejimai'} - -

\ No newline at end of file diff --git a/mokejimai/views/templates/hook/payment_return.tpl b/mokejimai/views/templates/hook/payment_return.tpl deleted file mode 100755 index 00e28bf..0000000 --- a/mokejimai/views/templates/hook/payment_return.tpl +++ /dev/null @@ -1,15 +0,0 @@ -{if $status == 'ok'} -

{l s='Your order on' mod='mokejimai'} {$shop_name} {l s='is complete.' mod='mokejimai'} -

- Apmokėjimą už prekes gavome ir Jūsų užsakymas Nr. {$id_order} perduotas vykdymui.
-
- Užsakymą peržiūrėti galite paspaudę šią nuorodą.
-
- Apie tolimesnę užsakymo vykdymo eigą būsite informuoti elektroniniu paštu.
-

-{else} -

- {l s='We noticed a problem with your order. If you think this is an error, you can contact our' mod='mokejimai'} - {l s='customer support' mod='mokejimai'}. -

-{/if} \ No newline at end of file From bbeb4b597e3917ce47f0f291e25e9c44ac7e36af Mon Sep 17 00:00:00 2001 From: tkasparaitis Date: Fri, 23 Jan 2015 17:39:24 +0200 Subject: [PATCH 2/6] Changed to paysera --- paysera/config.xml | 13 + paysera/controllers/front/callback.php | 70 + paysera/controllers/front/cancel.php | 35 + paysera/controllers/front/index.php | 35 + paysera/controllers/front/payment.php | 63 + paysera/controllers/front/redirect.php | 91 + paysera/controllers/front/validation.php | 43 + paysera/controllers/index.php | 35 + paysera/img/index.php | 35 + paysera/img/logo-en.png | Bin 0 -> 9163 bytes paysera/img/logo-lt.png | Bin 0 -> 9163 bytes paysera/img/order-logo.gif | Bin 0 -> 139 bytes paysera/index.php | 35 + paysera/logo.gif | Bin 0 -> 931 bytes paysera/paysera.php | 305 +++ paysera/translations/en.php | 18 + paysera/translations/index.php | 35 + paysera/translations/lt.php | 35 + paysera/translations/ru.php | 4 + paysera/vendor/index.php | 35 + paysera/vendor/webtopay/index.php | 35 + paysera/vendor/webtopay/libwebtopay/.hgignore | 25 + paysera/vendor/webtopay/libwebtopay/.hgtags | 9 + .../vendor/webtopay/libwebtopay/WebToPay.php | 2397 +++++++++++++++++ paysera/vendor/webtopay/libwebtopay/index.php | 35 + paysera/views/index.php | 35 + .../views/templates/front/configuration.tpl | 90 + paysera/views/templates/front/index.php | 35 + .../templates/front/payment_execution.tpl | 178 ++ paysera/views/templates/front/redirect.tpl | 43 + paysera/views/templates/hook/index.php | 35 + paysera/views/templates/hook/payment.tpl | 34 + .../views/templates/hook/payment_return.tpl | 39 + paysera/views/templates/index.php | 35 + 34 files changed, 3912 insertions(+) create mode 100644 paysera/config.xml create mode 100755 paysera/controllers/front/callback.php create mode 100755 paysera/controllers/front/cancel.php create mode 100755 paysera/controllers/front/index.php create mode 100755 paysera/controllers/front/payment.php create mode 100755 paysera/controllers/front/redirect.php create mode 100755 paysera/controllers/front/validation.php create mode 100755 paysera/controllers/index.php create mode 100755 paysera/img/index.php create mode 100755 paysera/img/logo-en.png create mode 100755 paysera/img/logo-lt.png create mode 100755 paysera/img/order-logo.gif create mode 100755 paysera/index.php create mode 100755 paysera/logo.gif create mode 100755 paysera/paysera.php create mode 100755 paysera/translations/en.php create mode 100755 paysera/translations/index.php create mode 100755 paysera/translations/lt.php create mode 100755 paysera/translations/ru.php create mode 100755 paysera/vendor/index.php create mode 100755 paysera/vendor/webtopay/index.php create mode 100755 paysera/vendor/webtopay/libwebtopay/.hgignore create mode 100755 paysera/vendor/webtopay/libwebtopay/.hgtags create mode 100755 paysera/vendor/webtopay/libwebtopay/WebToPay.php create mode 100755 paysera/vendor/webtopay/libwebtopay/index.php create mode 100755 paysera/views/index.php create mode 100755 paysera/views/templates/front/configuration.tpl create mode 100755 paysera/views/templates/front/index.php create mode 100755 paysera/views/templates/front/payment_execution.tpl create mode 100755 paysera/views/templates/front/redirect.tpl create mode 100755 paysera/views/templates/hook/index.php create mode 100755 paysera/views/templates/hook/payment.tpl create mode 100755 paysera/views/templates/hook/payment_return.tpl create mode 100755 paysera/views/templates/index.php diff --git a/paysera/config.xml b/paysera/config.xml new file mode 100644 index 0000000..c833989 --- /dev/null +++ b/paysera/config.xml @@ -0,0 +1,13 @@ + + + paysera + + + + + + + 1 + 1 + + \ No newline at end of file diff --git a/paysera/controllers/front/callback.php b/paysera/controllers/front/callback.php new file mode 100755 index 0000000..51619e8 --- /dev/null +++ b/paysera/controllers/front/callback.php @@ -0,0 +1,70 @@ + + * @copyright 2004-2014 EVP International, JSC + * @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) + * International Registered Trademark & Property of PrestaShop SA + */ + +require_once(_PS_MODULE_DIR_.'/paysera/vendor/webtopay/libwebtopay/WebToPay.php'); + +class PayseraCallbackModuleFrontController extends ModuleFrontController { + public $display_column_left = false; + public $display_column_right = false; + public $display_header = false; + public $display_footer = false; + public $ssl = true; + + /** + * @see FrontController::postProcess() + */ + public function postProcess() + { + try { + $response = WebToPay::checkResponse($_REQUEST, array( + 'projectid' => $this->module->project_id, + 'sign_password' => $this->module->signature, + )); + + if ($response['status'] == 1) + { + $orderid = $response['orderid']; + $order = new Order($orderid); + $order_amount = $order->getOrdersTotalPaid(); + $cart_currency = Currency::getCurrency($order->id_currency); + + if (number_format($response['amount'], 0, '', '') < number_format(($order_amount * 100), 0, '', '')) exit('Bad amount: '.$response['amount']); + + if ($response['currency'] != $cart_currency['iso_code']) exit('Bad currency: '.$response['currency']); + + $history = new OrderHistory(); + $history->id_order = $orderid; + $history->changeIdOrderState((int)Configuration::get('PS_OS_PAYMENT'), $response['orderid']); + $history->addWithemail(true, array( + 'order_name' => $orderid, + )); + exit('OK'); + } + } catch (Exception $e) { + exit(get_class($e).': '.$e->getMessage()); + } + } +} diff --git a/paysera/controllers/front/cancel.php b/paysera/controllers/front/cancel.php new file mode 100755 index 0000000..1871737 --- /dev/null +++ b/paysera/controllers/front/cancel.php @@ -0,0 +1,35 @@ + +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +class PayseraCancelModuleFrontController extends ModuleFrontController { + /** + * @see FrontController::postProcess() + */ + public function postProcess() + { + Tools::redirect('index.php?controller=order&step=1'); + } +} diff --git a/paysera/controllers/front/index.php b/paysera/controllers/front/index.php new file mode 100755 index 0000000..e62f4c7 --- /dev/null +++ b/paysera/controllers/front/index.php @@ -0,0 +1,35 @@ + +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/paysera/controllers/front/payment.php b/paysera/controllers/front/payment.php new file mode 100755 index 0000000..4bf186e --- /dev/null +++ b/paysera/controllers/front/payment.php @@ -0,0 +1,63 @@ + + * @copyright 2007-2014 Illicopresta + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + * International Registered Trademark & Property of PrestaShop SA + */ + +class PayseraPaymentModuleFrontController extends ModuleFrontController { + public $display_column_left = false; + public $ssl = true; + + /** + * @see FrontController::initContent() + */ + public function initContent() + { + parent::initContent(); + + $cart = $this->context->cart; + if (!$this->module->checkCurrency($cart)) Tools::redirect('index.php?controller=order'); + + $pay_currency = Context::getContext()->currency; + $pay_amount = $cart->getOrderTotal() * 100; + + //siuo metu pasirinkta kalba + $language = Language::getIsoById($this->context->language->id); + $language = (!in_array($language, array('lt', 'en', 'ru'))) ? 'en' : $language; + + $methods = WebToPay::getPaymentMethodList($this->module->project_id, $pay_currency->iso_code)->filterForAmount($pay_amount, + $pay_currency->iso_code)->setDefaultLanguage($language)->getCountries(); + + $this->context->smarty->assign(array( + 'this_path_ssl' => Tools::getShopDomainSsl(true, true).__PS_BASE_URI__.'modules/'.$this->module->name.'/', + 'amount' => ($pay_amount / 100), + 'currency' => $pay_currency->iso_code, + 'displayPayments' => $this->module->payment_list, + 'isoCode' => $language, //Language::getIsoById(intval($cookie->id_lang)), + 'defaultCountry' => $this->module->default_country, + 'payMethods' => $methods, + )); + + $this->setTemplate('payment_execution.tpl'); + } +} diff --git a/paysera/controllers/front/redirect.php b/paysera/controllers/front/redirect.php new file mode 100755 index 0000000..7a1b307 --- /dev/null +++ b/paysera/controllers/front/redirect.php @@ -0,0 +1,91 @@ + + * @copyright 2004-2014 EVP International, JSC + * @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) + * International Registered Trademark & Property of PrestaShop SA + */ + +class PayseraRedirectModuleFrontController extends ModuleFrontController { + public $display_column_left = true; + public $display_column_right = true; + public $display_header = true; + public $display_footer = true; + public $ssl = true; + + /** + * @see FrontController::initContent() + */ + public function initContent() + { + parent::initContent(); + + $cart = $this->context->cart; + if (!$this->module->checkCurrency($cart)) Tools::redirect('index.php?controller=order'); + + $address = new Address((int)$cart->id_address_invoice); + $customer = new Customer((int)$cart->id_customer); + $country = new Country((int)$address->id_country); + $currency = Context::getContext()->currency; + $total = (float)number_format($cart->getOrderTotal(true, 3), 2, '.', ''); + $language_code = Tools::strtoupper(Language::getIsoById((int)$this->context->language->id)); + $url_language = ($language_code == 'LT') ? 'LIT' : 'ENG'; + + $this->module->validateOrder($cart->id, Configuration::get('PAYSERA_PENDING'), $total, $this->module->displayName, null, null, $currency->id); + + try { + $request = WebToPay::buildRequest(array( + 'projectid' => $this->module->project_id, + 'sign_password' => $this->module->signature, + + 'orderid' => $this->module->currentOrder, + 'amount' => (int)number_format($total, 2, '', ''), + 'currency' => $currency->iso_code, + 'lang' => ($language_code == 'LT') ? 'LTU' : 'ENG', + 'country' => $country->iso_code, + 'accepturl' => $this->context->link->getModuleLink('paysera', 'validation'), + 'cancelurl' => $this->context->link->getModuleLink('paysera', 'cancel'), + 'callbackurl' => $this->context->link->getModuleLink('paysera', 'callback'), + 'payment' => Tools::getValue('payment_method'), + 'p_firstname' => $customer->firstname, + 'p_lastname' => $customer->lastname, + 'p_email' => $customer->email, + 'p_street' => $address->address1, + 'p_city' => $address->city, + 'p_zip' => $address->postcode, + 'p_countrycode' => $country->iso_code, + 'test' => $this->module->sandbox, + 'delivery' => '', + 'system' => 'Prestashop 1.6', + 'component' => '', + )); + } catch (WebToPayException $e) { + echo get_class($e).': '.$e->getMessage(); + } + + $this->context->smarty->assign(array( + 'payUrl' => WebToPay::getPaymentUrl($url_language), + 'request' => $request, + )); + + $this->setTemplate('redirect.tpl'); + } +} diff --git a/paysera/controllers/front/validation.php b/paysera/controllers/front/validation.php new file mode 100755 index 0000000..d17cb91 --- /dev/null +++ b/paysera/controllers/front/validation.php @@ -0,0 +1,43 @@ + + * @copyright 2007-2014 Illicopresta + * @license http://opensource.org/licenses/afl-3.0.php Academic Free License (AFL 3.0) + * International Registered Trademark & Property of PrestaShop SA + */ + +class PayseraValidationModuleFrontController extends ModuleFrontController { + /** + * @see FrontController::postProcess() + */ + public function postProcess() + { + $cart = $this->context->cart; + if ($cart->id_customer == 0 || $cart->id_address_delivery == 0 || $cart->id_address_invoice == 0 || !$this->module->active) + Tools::redirect('index.php?controller=order&step=1'); + + $customer = new Customer($cart->id_customer); + if (!Validate::isLoadedObject($customer)) Tools::redirect('index.php?controller=order&step=1'); + + Tools::redirect('index.php?controller=order-confirmation&id_cart='.$cart->id.'&id_module='.$this->module->id. + '&id_order='.$this->module->currentOrder.'&key='.$customer->secure_key); + } +} diff --git a/paysera/controllers/index.php b/paysera/controllers/index.php new file mode 100755 index 0000000..e62f4c7 --- /dev/null +++ b/paysera/controllers/index.php @@ -0,0 +1,35 @@ + +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/paysera/img/index.php b/paysera/img/index.php new file mode 100755 index 0000000..e62f4c7 --- /dev/null +++ b/paysera/img/index.php @@ -0,0 +1,35 @@ + +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/paysera/img/logo-en.png b/paysera/img/logo-en.png new file mode 100755 index 0000000000000000000000000000000000000000..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7{1KjX0T1%tJe=b(Ha6Mv&yr6RKNb7|an_9(c1>1{XZ7&v>fFjC^(EBEYj7rA ze-SH=k6A(lR?3;vS&h7Ee{4^0o(Z?_I26`-&u;qaCL1OzII9bG2jI)NBU_gOm3a~7 z%zGy&16`A&zdw?MBA%yca2v8yZY0H9pK34HgVH~RQ`0!Lc{~+h?mMeK5ellUi8#vs zk=g3tcb_#pJ1iNHfR2!vRLp&Q`Xsd@At3g9UPkP*&p#&a~V3;vbO|3%%Y0VxN^|Z1BqN~=Q5ULLXra9 zQ4IA2FyXUeQqvR2f35Z-rF*&KZfWs}>RQhxR2kY;A!ygTQ)oVin~yvTT}|s`O5v#N z+9MXohh4Px!k7^xxM~nF6D|4aus(DL)xoLDu>7w!JyY^@dwxiO=}6O;@Lng$PBSFo zS~n)qUPbFbvJibN^%p@Owz8Y@^Cc4?!o}lSBpXZbV6g!wK!2U%_$>@?QZ+I%Y%SV^ zV%AR|Rj1Yx+>Mwxn6kVBD4&6hzGTm%o?hq0AjrBL$!=|3R)+#`4qu E0FhWF=>Px# literal 0 HcmV?d00001 diff --git a/paysera/img/logo-lt.png b/paysera/img/logo-lt.png new file mode 100755 index 0000000000000000000000000000000000000000..448f8863c0d78f3abdb4ea655e78687651db8532 GIT binary patch literal 9163 zcmW+*1z1#F6JA&v3F(v;2|-Za{UQtM_T-g%o%gi6wXSzfHm|3cE28oSIh*JPo zpNUDN`l6!o^vTGd=PBv+ewx8k%8y;nLffq?;GK6R4! zXg}Qn=m3uy9#)cpwWr7q&6frM#$>=MGszA`O4HKO2B*xT_p}69u1KFN|6;^suN(T7op9K4(kRKRZB7RV8Ck8 zKt?V6is&E+CcrPjFo{UY5&+7U;T{Dril75zUyzOg8P$MAZ{X0?N(+yuHYGFwY$Saw zQx*P}tSx<##{cwqb)9Lw+ofK{ijsra4tJ9|FEf{gRA~pOHvS9%pt+g){U{=tw6ndr zwr#iLa&+ET^5}f*&Md)nvhw&V4jltP{9)o~(PC?B7U(g6R_6H{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ng$PBSFo zS~n)qUPbFbvJibN^%p@Owz8Y@^Cc4?!o}lSBpXZbV6g!wK!2U%_$>@?QZ+I%Y%SV^ zV%AR|Rj1Yx+>Mwxn6kVBD4&6hzGTm%o?hq0AjrBL$!=|3R)+#`4qu E0FhWF=>Px# literal 0 HcmV?d00001 diff --git a/paysera/img/order-logo.gif b/paysera/img/order-logo.gif new file mode 100755 index 0000000000000000000000000000000000000000..85006598a41412a9df072c895a820a88e3054f62 GIT binary patch literal 139 zcmZ?wbhEHb6krfwc+AdlEmY-3jNYwyqgx5a_lmrp^kl!7)9@cRQ2Zz8T$GwvlA5AW zo>`Ki;O^-gz@Ye(g^`PagF%M@2tWoiuqb~x;kkP64XMegns;3U9-8nxRpD5 +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/paysera/logo.gif b/paysera/logo.gif new file mode 100755 index 0000000000000000000000000000000000000000..f1f8005cbbc5cc407e1e3c52776a6f27907b6c9b GIT binary patch literal 931 zcmbu;i&GQ@90%~tNz{RK)AFd=<=b`9LZop;1!| z70o~hU#Ms&$0K1dKtQn!;r8CIy~o}i?Css|ak962yL;{RFZ7+y?>par;Frcv-SB?# zDj*WDJAi-I0^^CZ#}nsFY@Dq~nx{&7X(IWRi7gAjln~k05N*nQS?VG%C=^V6U6!^O zzZjZ)^uCog_nwZiwbpC@YfY}V~f*6mL*l=5_Ce0>?uAWAog zG7RMz#;>!C2eOR^w?h@VP=x?GA~05d1XbplD)XRkK8C)_HyzD4RTY`5ilAd9P_@up zU1F*cnre2MYlN2LyDca8S%2c}x1RbE=A8b@T3c$ZErV-I;WK6M84>)m2(Bx))gQ9e zAGX&Ywq2;Ob1r@BXgF$b{C={r%F%Re>gtK9>!*tfE^~V)g&ox)i4R>#=v+s_( z@3!Ml3HG4P-Y>-;v|;^svHsuj{yW%!1RK1EKjcX9Ax;NA-02za@CVe=q3oAjL^#ngTeZ;mAIr6$L$S0!K+^$+4zNssWm)b5T>h)z z_`g}nhHMe-Di-hB8F6rrcy~k^KQkLxNxt~P%Rm5#1-Jws1(>@J2+RxTNty?Km>aq# z|FPt^hd(Y{wMmzJ&piM5tT%TI9eNg-R=p%C#=E-RGEx_l)e_4SMGw@+B?yK>%9}?{ zt_$e@zFGdo(_c3TXTg)xH%1z^Ru78ri{b58*8H*_z9=?lU(S>6)jv63v>8bJ7rPi? ArT_o{ literal 0 HcmV?d00001 diff --git a/paysera/paysera.php b/paysera/paysera.php new file mode 100755 index 0000000..b1ba631 --- /dev/null +++ b/paysera/paysera.php @@ -0,0 +1,305 @@ + + * @copyright 2004-2014 EVP International, JSC + * @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) + * International Registered Trademark & Property of PrestaShop SA + */ + +if (!defined('_PS_VERSION_')) + exit; + +require_once(_PS_MODULE_DIR_.'/paysera/vendor/webtopay/libwebtopay/WebToPay.php'); + +class Paysera extends PaymentModule { + + private $messages = array(); + + public $project_id; + public $signature; + public $sandbox; + public $payment_list; + public $default_country; + + public function __construct() + { + $this->name = 'paysera'; + $this->tab = 'payments_gateways'; + $this->version = '1.6'; + $this->author = 'EVP International'; + $this->module_key = 'b830e1e952dfce7551c31477a86221af'; + + $config = Configuration::getMultiple(array( + 'PAYSERA_PROJECT_ID', + 'PAYSERA_SIGNATURE', + 'PAYSERA_SANDBOX', + 'PAYSERA_PAYMENTLIST', + 'PAYSERA_DEFAULT_COUNTRY' + )); + + $this->project_id = self::setValue($config, 'PAYSERA_PROJECT_ID'); + $this->signature = self::setValue($config, 'PAYSERA_SIGNATURE', ''); + $this->sandbox = self::setValue($config, 'PAYSERA_SANDBOX'); + $this->payment_list = self::setValue($config, 'PAYSERA_PAYMENTLIST', 1); + $this->default_country = self::setValue($config, 'PAYSERA_DEFAULT_COUNTRY', 'lt'); + + if (!$this->project_id) $this->project_id = '12345'; + + parent::__construct(); + + $this->page = basename(__FILE__, '.php'); + $this->displayName = $this->l('Paysera'); + $this->description = $this->l('Accept payments by Paysera system'); + $this->confirmUninstall = $this->l('Are you sure you want to delete your details?'); + + if (!isset($this->project_id) || !isset($this->signature)) + $this->warning = $this->l('Project details must be configured in order to use this module correctly.'); + + if (!count(Currency::checkPaymentCurrencies($this->id))) $this->warning = $this->l('No currency set for this module'); + } + + public function install() + { + if (!parent::install() || !$this->registerHook('payment') || !$this->registerHook('paymentReturn')) return false; + + /* add pending order state */ + $order_pending = new OrderState(); + $order_pending->name = array_fill(0, 10, 'AWAITING PAYSERA PAYMENT'); + $order_pending->send_email = 0; + $order_pending->invoice = 0; + $order_pending->color = 'RoyalBlue'; + $order_pending->unremovable = false; + $order_pending->logable = 0; + + if ($order_pending->add()) copy(_PS_ROOT_DIR_.'/modules/paysera/img/order-logo.gif', _PS_ROOT_DIR_.'/img/os/'.(int)$order_pending->id.'.gif'); + + Configuration::updateValue('PAYSERA_PENDING', $order_pending->id); + + return true; + } + + public function uninstall() + { + $order_state_pending = new OrderState(Configuration::get('PAYSERA_PENDING')); + + return ( + Configuration::deleteByName('PAYSERA_PROJECT_ID') && + Configuration::deleteByName('PAYSERA_SIGNATURE') && + Configuration::deleteByName('PAYSERA_SANDBOX') && + Configuration::deleteByName('PAYSERA_PAYMENTLIST') && + Configuration::deleteByName('PAYSERA_DEFAULT_COUNTRY') && + Configuration::deleteByName('PAYSERA_PENDING') && + $order_state_pending->delete() && + parent::uninstall() + ); + } + + private function validatePostRequest() + { + if (Tools::getValue('btnSubmit')) + { + $pro_id = Tools::getValue('project_id'); + if (empty($pro_id)) + { + $this->messages[] = array( + 'class' => 'warning warn', + 'src' => '../img/admin/warning.gif', + 'msg' => $this->l('Project ID is required!'), + ); + + return false; + } + } + + return true; + } + + private function processPostRequest() + { + if (Tools::getValue('btnSubmit')) + { + Configuration::updateValue('PAYSERA_PROJECT_ID', (int)Tools::getValue('project_id')); + Configuration::updateValue('PAYSERA_SIGNATURE', Tools::getValue('signature')); + Configuration::updateValue('PAYSERA_SANDBOX', (int)Tools::getValue('sandbox')); + Configuration::updateValue('PAYSERA_PAYMENTLIST', (int)Tools::getValue('paymentList')); + Configuration::updateValue('PAYSERA_DEFAULT_COUNTRY', Tools::getValue('defaultCountry')); + + $this->project_id = (int)Tools::getValue('project_id'); + $this->signature = Tools::getValue('signature'); + $this->sandbox = (int)Tools::getValue('sandbox'); + $this->payment_list = (int)Tools::getValue('paymentList'); + $this->default_country = Tools::getValue('defaultCountry'); + + $this->messages[] = array( + 'class' => 'conf confirm', + 'src' => '../img/admin/ok.gif', + 'msg' => $this->l('Settings updated'), + ); + } + } + + public function getContent() + { + if ($this->validatePostRequest()) $this->processPostRequest(); + + $methods = WebToPay::getPaymentMethodList($this->project_id)->setDefaultLanguage( + Language::getIsoById($this->context->language->id))->getCountries(); + + $this->smarty->assign(array( + 'messages' => $this->messages, + 'lang' => $this->context->language->id, + 'requestUrl' => $_SERVER['REQUEST_URI'], + 'projectId' => $this->project_id, + 'projectPass' => $this->signature, + 'defaultCountry' => $this->default_country, + 'sandboxOn' => ($this->sandbox) ? 'checked="checked"' : '', + 'sandboxOff' => (!$this->sandbox) ? 'checked="checked"' : '', + 'payListOn' => ($this->payment_list) ? 'checked="checked"' : '', + 'payListOff' => (!$this->payment_list) ? 'checked="checked"' : '', + 'countries' => $methods, + )); + + return $this->display(__FILE__, 'views/templates/front/configuration.tpl'); + } + + + /** + * NOT IMPLEMENTED + * + * @param int $order_id + * @return string + */ + private function restoreOrder($order_id) + { + $order = new Order($order_id); + + if (Validate::isLoadedObject($order) && $order->id_customer == $this->context->customer->id) + { + try { + $request = WebToPay::buildRepeatRequest(array( + 'projectid' => $this->project_id, + 'sign_password' => $this->signature, + 'orderid' => $order_id, + )); + } catch (WebToPayException $e) { + echo get_class($e).':'.$e->getMessage(); + } + + $this->smarty->assign(array( + 'payUrl' => WebToPay::PAY_URL, + 'request' => $request, + )); + + return $this->display(__FILE__, 'views/templates/front/restore.tpl'); + } + else exit('Bad restore number!'); + } + + public function hookPayment() + { + $iso_code = $this->context->language->iso_code; + $this->smarty->assign(array( + 'lang' => $iso_code, + 'this_path' => $this->_path, + 'this_path_ssl' => (Configuration::get('PS_SSL_ENABLED') ? 'https://' : 'http://'). + htmlspecialchars($_SERVER['HTTP_HOST'], ENT_COMPAT, 'UTF-8').__PS_BASE_URI__.'modules/'.$this->name.'/' + )); + + return $this->display(__FILE__, 'views/templates/hook/payment.tpl'); + } + + public function hookPaymentReturn($params) + { + $state = $params['objOrder']->getCurrentState(); + if ($state == Configuration::get('PAYSERA_ACCEPTED') || $state == _PS_OS_OUTOFSTOCK_ || 1) + { + $this->smarty->assign(array( + 'total_to_pay' => Tools::displayPrice($params['total_to_pay'], $params['currencyObj'], false, null), + 'status' => 'ok', + 'id_order' => $params['objOrder']->id + )); + } + else + $this->smarty->assign('status', 'failed'); + + return $this->display(__FILE__, 'views/templates/front/payment_return.tpl'); + } + + /** + * @param int $id_currency : this parameter is optionnal but on 1.5 version of Prestashop, it will be REQUIRED + * @return Currency + */ + public function getCurrency($current_id_currency = null) + { + if (!(int)$current_id_currency) + $current_id_currency = Context::getContext()->currency->id; + + if (!$this->currencies) + return false; + if ($this->currencies_mode == 'checkbox') + { + $currencies = Currency::getPaymentCurrencies($this->id); + return $currencies; + } + elseif ($this->currencies_mode == 'radio') + { + $currencies = Currency::getPaymentCurrenciesSpecial($this->id); + $currency = $currencies['id_currency']; + if ($currency == -1) + $id_currency = (int)$current_id_currency; + elseif ($currency == -2) + $id_currency = (int)Configuration::get('PS_CURRENCY_DEFAULT'); else + $id_currency = $currency; + } + if (!isset($id_currency) || empty($id_currency)) + return false; + return (new Currency($id_currency)); + } + + public function checkCurrency($cart) + { + $currency_order = new Currency($cart->id_currency); + $currencies_module = $this->getCurrency($cart->id_currency); + + if (is_array($currencies_module)) + foreach ($currencies_module as $currency_module) if ($currency_order->id == $currency_module['id_currency']) return true; + + return false; + } + + private static function setValue($config = array(), $value = '', $default = 0) + { + return (isset($config[$value])) ? $config[$value] : $default; + } + + /** + * Debug function + * + * @param $var + */ + private static function d($var) + { + echo '
';
+		print_r($var);
+		echo '
'; + } + +} diff --git a/paysera/translations/en.php b/paysera/translations/en.php new file mode 100755 index 0000000..3e08b37 --- /dev/null +++ b/paysera/translations/en.php @@ -0,0 +1,18 @@ +configuration_3f86574ad34d16a8cf2ba530c9aafee7'] = 'This module allows you to accept payments by Paysera'; +$_MODULE['<{paysera}default>configuration_b6af2d31afe71aedcceca73cc27fec29'] = 'If the client chooses this payment mode, the order will change its status into a \'Waiting for payment\' status.'; +$_MODULE['<{paysera}default>configuration_aa9f04d1be872e3bdaca1cccf7f02d12'] = 'Payment module details'; +$_MODULE['<{paysera}default>configuration_f5f04b11870f0822cfc263fdc6214528'] = 'Please specify the Paysera details'; +$_MODULE['<{paysera}default>configuration_e082f55a3e947645b3cfc4a3837564be'] = 'Paysera.com project ID:'; +$_MODULE['<{paysera}default>configuration_ae71d10996c375bccc46d24665b318a9'] = 'Paysera.com project passaword:'; +$_MODULE['<{paysera}default>configuration_2f1120281bc59dbf84f4b7d9f210b421'] = 'Test mode:'; +$_MODULE['<{paysera}default>configuration_93cba07454f06a4a960172bbd6e2a435'] = 'Yes'; +$_MODULE['<{paysera}default>configuration_bafd7322c6e97d25b6299b5d6fe8920b'] = 'No'; +$_MODULE['<{paysera}default>configuration_2f8251979372d44fa8e3df67202cbef1'] = 'Display payments list:'; +$_MODULE['<{paysera}default>configuration_49b80feb114d68c0b124c0129536bd02'] = 'Default payment country:'; +$_MODULE['<{paysera}default>configuration_b17f3f4dcf653a5776792498a9b44d6a'] = 'Update settings'; +$_MODULE['<{paysera}default>payment_8d0e94f6e1d030f33f8ce19548051b3d'] = 'Pay by Paysera'; +$_MODULE['<{paysera}default>payment_3af059bc2293e9e46a898bdc659e0a0c'] = 'Pay by Paysera (order process will be faster) '; diff --git a/paysera/translations/index.php b/paysera/translations/index.php new file mode 100755 index 0000000..e62f4c7 --- /dev/null +++ b/paysera/translations/index.php @@ -0,0 +1,35 @@ + +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/paysera/translations/lt.php b/paysera/translations/lt.php new file mode 100755 index 0000000..c713e3c --- /dev/null +++ b/paysera/translations/lt.php @@ -0,0 +1,35 @@ +mokejimai_2d2b05368867f2d9b017e65ce9c1526a'] = 'Paysera'; +$_MODULE['<{paysera}default>mokejimai_e0355bb27ba85e136a8eddc1d95ada91'] = 'Prrimti mokėjimus per Mokėjimai.lt sistemą'; +$_MODULE['<{paysera}default>mokejimai_69a1a3ad8dd5da6db3c4da838a0cf9c7'] = 'Ar tikrai norite ištrinti nustatymus'; +$_MODULE['<{paysera}default>mokejimai_ef6222485ff756bb929a8dfc9c722ea9'] = 'Turi būti suvesti projekto nustatymai, kad veiktų teisingai apmokėjimas.'; +$_MODULE['<{paysera}default>mokejimai_4402acab1c8f90dcf4a31dc96833bd86'] = 'Nepasirinkta valiuta šiame modulyje'; +$_MODULE['<{paysera}default>mokejimai_b4ba0005dcd53932c2b8106963281b62'] = 'Privaloma įvesti projekto ID'; +$_MODULE['<{paysera}default>mokejimai_c888438d14855d7d96a2724ee9c306bd'] = 'Nustatymai atnaujinti'; +$_MODULE['<{paysera}default>configuration_3f86574ad34d16a8cf2ba530c9aafee7'] = 'Šis modulis leidžia priimti mokėjimus per Paysera sistemą.'; +$_MODULE['<{paysera}default>configuration_b6af2d31afe71aedcceca73cc27fec29'] = 'Jeigu klientas pasirinks šį mokėjimo būdą, užsakymas pakeis savo būklę į \"Laukiama\" apmokėjimo'; +$_MODULE['<{paysera}default>configuration_aa9f04d1be872e3bdaca1cccf7f02d12'] = 'Mokėjimo modulio nustatymai'; +$_MODULE['<{paysera}default>configuration_f5f04b11870f0822cfc263fdc6214528'] = 'Įrašykite Paysera modulio duomenis.'; +$_MODULE['<{paysera}default>configuration_e082f55a3e947645b3cfc4a3837564be'] = 'Paysera projekto ID'; +$_MODULE['<{paysera}default>configuration_ae71d10996c375bccc46d24665b318a9'] = 'Paysera projekto slaptažodis:'; +$_MODULE['<{paysera}default>configuration_2f1120281bc59dbf84f4b7d9f210b421'] = 'Testinis režimas?'; +$_MODULE['<{paysera}default>configuration_93cba07454f06a4a960172bbd6e2a435'] = 'Taip'; +$_MODULE['<{paysera}default>configuration_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Ne'; +$_MODULE['<{paysera}default>configuration_2f8251979372d44fa8e3df67202cbef1'] = 'Rodyti mokėjimo būdų pasirinkimą?'; +$_MODULE['<{paysera}default>configuration_49b80feb114d68c0b124c0129536bd02'] = 'Pradinė mokėjimo būdų pasirinkimo šalis'; +$_MODULE['<{paysera}default>configuration_b17f3f4dcf653a5776792498a9b44d6a'] = 'Atnaujinti nustatymus'; +$_MODULE['<{paysera}default>payment_execution_289148aed2fe892082cadcfd5c1e5805'] = 'Paysera mokėjimo būdas'; +$_MODULE['<{paysera}default>payment_execution_f1d3b424cd68795ecaa552883759aceb'] = 'Užsąkymo detalės:'; +$_MODULE['<{paysera}default>payment_execution_e0b4f8216cad5c2c286f08d187503ed0'] = 'Paysera mokėjimo būdas'; +$_MODULE['<{paysera}default>payment_execution_2d2b05368867f2d9b017e65ce9c1526a'] = 'Paysera'; +$_MODULE['<{paysera}default>payment_execution_c047e6ab568a2227653f7d1d30bcf1c2'] = 'Jūs pasirinkote mokėti per Paysera'; +$_MODULE['<{paysera}default>payment_execution_c884ed19483d45970c5bf23a681e2dd2'] = 'Užsąkymo detalės:'; +$_MODULE['<{paysera}default>payment_execution_e2867a925cba382f1436d1834bb52a1c'] = 'Bendra užsąkymo suma'; +$_MODULE['<{paysera}default>payment_execution_48034ce5085e9fd93c65ce59966acf9e'] = 'Pakeikite mokėjimo šalį'; +$_MODULE['<{paysera}default>payment_execution_46b9e3665f187c739c55983f757ccda0'] = 'Patvirtinti užsąkymą'; +$_MODULE['<{paysera}default>payment_8d0e94f6e1d030f33f8ce19548051b3d'] = 'Mokėti per Paysera'; +$_MODULE['<{paysera}default>payment_3af059bc2293e9e46a898bdc659e0a0c'] = 'Mokėti per Paysera (užsąkymas bus atliktas greičiau)'; +$_MODULE['<{paysera}default>payment_fb1b6ccdcee225de3d8caf01885d2204'] = 'Toliau >>'; diff --git a/paysera/translations/ru.php b/paysera/translations/ru.php new file mode 100755 index 0000000..601358d --- /dev/null +++ b/paysera/translations/ru.php @@ -0,0 +1,4 @@ + +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/paysera/vendor/webtopay/index.php b/paysera/vendor/webtopay/index.php new file mode 100755 index 0000000..e62f4c7 --- /dev/null +++ b/paysera/vendor/webtopay/index.php @@ -0,0 +1,35 @@ + +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/paysera/vendor/webtopay/libwebtopay/.hgignore b/paysera/vendor/webtopay/libwebtopay/.hgignore new file mode 100755 index 0000000..dfd15be --- /dev/null +++ b/paysera/vendor/webtopay/libwebtopay/.hgignore @@ -0,0 +1,25 @@ +syntax: regexp +^demo/var/(?!__empty__).* + +syntax: glob +*.swp + +# Stuff from text editors and IDE's +(^|/)tags$ +^\.cache$ +^\.settings$ +^\.project$ +syntax: regexp +^\.project$ +syntax: regexp +^\.hgignore$ +syntax: regexp +\.hgignore$ +syntax: regexp +^\.project$ +syntax: regexp +^demo_shop/var/data\.php$ +syntax: regexp +^\.buildpath$ +syntax: regexp +^\.settings$ \ No newline at end of file diff --git a/paysera/vendor/webtopay/libwebtopay/.hgtags b/paysera/vendor/webtopay/libwebtopay/.hgtags new file mode 100755 index 0000000..e705d88 --- /dev/null +++ b/paysera/vendor/webtopay/libwebtopay/.hgtags @@ -0,0 +1,9 @@ +4c30c7337fbb643138ab92ada95053803a75525a 1.2.1 +7bd54ef0282ae192f708265d710588bfe512c579 1.2.2 +ba6bffed693f2a836aebd5bc5ba35fecf31f696d 1.2.3 +be45e46f64085c9c12beb9ad88c1bd4933db5bb0 1.2.4 +be45e46f64085c9c12beb9ad88c1bd4933db5bb0 1.2.4 +b914d3c0fe137afa0c6a405ff4084d1e3fdb24fe 1.2.4 +7777c1f942afc29808110183ee40ebcd0a63f365 1.3.0 +2656b3069d0d28427e7b675ab1587a8bae924b3c 1.2.5 +a9937e0358d3336896db1d6637f2455387e6a29d 1.2.5 diff --git a/paysera/vendor/webtopay/libwebtopay/WebToPay.php b/paysera/vendor/webtopay/libwebtopay/WebToPay.php new file mode 100755 index 0000000..926be72 --- /dev/null +++ b/paysera/vendor/webtopay/libwebtopay/WebToPay.php @@ -0,0 +1,2397 @@ +. + * + * @package WebToPay + * @author EVP International + * @license http://www.gnu.org/licenses/lgpl.html + * @version 1.6 + * @link http://www.webtopay.com/ + */ + + +/** + * Contains static methods for most used scenarios. + */ +class WebToPay { + + /** + * WebToPay Library version. + */ + const VERSION = '1.6'; + + /** + * Server URL where all requests should go. + */ + const PAY_URL = 'https://www.mokejimai.lt/pay/'; + + /** + * Server URL where all non-lithuanian language requests should go. + */ + const PAYSERA_PAY_URL = 'https://www.paysera.com/pay/'; + + /** + * Server URL where we can get XML with payment method data. + */ + const XML_URL = 'https://www.mokejimai.lt/new/api/paymentMethods/'; + + /** + * SMS answer url. + */ + const SMS_ANSWER_URL = 'https://www.mokejimai.lt/psms/respond/'; + + /** + * Builds request data array. + * + * This method checks all given data and generates correct request data + * array or raises WebToPayException on failure. + * + * Possible keys: + * https://www.mokejimai.lt/makro_specifikacija.html + * + * @param array $data Information about current payment request + * + * @return array + * + * @throws WebToPayException on data validation error + */ + public static function buildRequest($data) { + if (!isset($data['sign_password']) || !isset($data['projectid'])) { + throw new WebToPayException('sign_password or projectid is not provided'); + } + $password = $data['sign_password']; + $projectId = $data['projectid']; + unset($data['sign_password']); + unset($data['projectid']); + + $factory = new WebToPay_Factory(array('projectId' => $projectId, 'password' => $password)); + $requestBuilder = $factory->getRequestBuilder(); + return $requestBuilder->buildRequest($data); + } + + + /** + * Builds request and redirects user to payment window with generated request data + * + * Possible array keys are described here: + * https://www.mokejimai.lt/makro_specifikacija.html + * + * @param array $data Information about current payment request. + * @param boolean $exit if true, exits after sending Location header; default false + * + * @throws WebToPayException on data validation error + */ + public static function redirectToPayment($data, $exit = false) { + if (!isset($data['sign_password']) || !isset($data['projectid'])) { + throw new WebToPayException('sign_password or projectid is not provided'); + } + $password = $data['sign_password']; + $projectId = $data['projectid']; + unset($data['sign_password']); + unset($data['projectid']); + + $factory = new WebToPay_Factory(array('projectId' => $projectId, 'password' => $password)); + $url = $factory->getRequestBuilder() + ->buildRequestUrlFromData($data); + + if (headers_sent()) { + echo ''; + } else { + header("Location: $url", true); + } + printf( + 'Redirecting to %s. Please wait.', + htmlentities($url, ENT_QUOTES, 'UTF-8'), + htmlentities($url, ENT_QUOTES, 'UTF-8') + ); + if ($exit) { + exit(); + } + } + + /** + * Builds repeat request data array. + * + * This method checks all given data and generates correct request data + * array or raises WebToPayException on failure. + * + * Method accepts single parameter $data of array type. All possible array + * keys are described here: + * https://www.mokejimai.lt/makro_specifikacija.html + * + * @param array $data Information about current payment request + * + * @return array + * + * @throws WebToPayException on data validation error + */ + public static function buildRepeatRequest($data) { + if (!isset($data['sign_password']) || !isset($data['projectid']) || !isset($data['orderid'])) { + throw new WebToPayException('sign_password, projectid or orderid is not provided'); + } + $password = $data['sign_password']; + $projectId = $data['projectid']; + $orderId = $data['orderid']; + + $factory = new WebToPay_Factory(array('projectId' => $projectId, 'password' => $password)); + $requestBuilder = $factory->getRequestBuilder(); + return $requestBuilder->buildRepeatRequest($orderId); + } + + /** + * Returns payment url. Argument is same as lang parameter in request data + * + * @param string $language + * @return string $url + */ + public static function getPaymentUrl($language = 'LIT') { + return (in_array($language, array('lt', 'lit', 'LIT'))) + ? self::PAY_URL + : self::PAYSERA_PAY_URL; + } + + /** + * Parses response from WebToPay server and validates signs. + * + * This function accepts both micro and macro responses. + * + * First parameter usualy should be $_GET array. + * + * Description about response can be found here: + * makro: https://www.mokejimai.lt/makro_specifikacija.html + * mikro: https://www.mokejimai.lt/mikro_mokejimu_specifikacija_SMS.html + * + * If response is not correct, WebToPayException will be raised. + * + * @param array $query Response array + * @param array $userData + * + * @return array + * + * @throws WebToPayException + * @deprecated use validateAndParseData() and check status code yourself + */ + public static function checkResponse($query, $userData = array()) { + $projectId = isset($userData['projectid']) ? $userData['projectid'] : null; + $password = isset($userData['sign_password']) ? $userData['sign_password'] : null; + $logFile = isset($userData['log']) ? $userData['log'] : null; + + try { + $data = self::validateAndParseData($query, $projectId, $password); + if ($data['type'] == 'macro' && $data['status'] != 1) { + throw new WebToPayException('Expected status code 1', WebToPayException::E_DEPRECATED_USAGE); + } + + if ($logFile) { + self::log('OK', http_build_query($data), $logFile); + } + return $data; + + } catch (WebToPayException $exception) { + if ($logFile && $exception->getCode() != WebToPayException::E_DEPRECATED_USAGE) { + self::log('ERR', $exception . "\nQuery: " . http_build_query($query), $logFile); + } + throw $exception; + } + } + + /** + * Parses request (query) data and validates its signature. + * + * @param array $query usually $_GET + * @param integer $projectId + * @param string $password + * + * @return array + * + * @throws WebToPayException + */ + public static function validateAndParseData(array $query, $projectId, $password) { + $factory = new WebToPay_Factory(array('projectId' => $projectId, 'password' => $password)); + $validator = $factory->getCallbackValidator(); + $data = $validator->validateAndParseData($query); + return $data; + } + + /** + * Sends SMS answer + * + * @param array $userData + * + * @throws WebToPayException + * @throws WebToPay_Exception_Validation + */ + public static function smsAnswer($userData) { + if (!isset($userData['id']) || !isset($userData['msg']) || !isset($userData['sign_password'])) { + throw new WebToPay_Exception_Validation('id, msg and sign_password are required'); + } + + $smsId = $userData['id']; + $text = $userData['msg']; + $password = $userData['sign_password']; + $logFile = isset($userData['log']) ? $userData['log'] : null; + + try { + + $factory = new WebToPay_Factory(array('password' => $password)); + $factory->getSmsAnswerSender()->sendAnswer($smsId, $text); + + if ($logFile) { + self::log('OK', 'SMS ANSWER ' . $smsId . ' ' . $text, $logFile); + } + + } catch (WebToPayException $e) { + if ($logFile) { + self::log('ERR', 'SMS ANSWER ' . $e, $logFile); + } + throw $e; + } + + } + + + /** + * Gets available payment methods for project. Gets methods min and max amounts in specified currency. + * + * @param integer $projectId + * @param string $currency + * + * @return WebToPay_PaymentMethodList + * + * @throws WebToPayException + */ + public static function getPaymentMethodList($projectId, $currency = 'LTL') { + $factory = new WebToPay_Factory(array('projectId' => $projectId)); + return $factory->getPaymentMethodListProvider()->getPaymentMethodList($currency); + } + + /** + * Logs to file. Just skips logging if file is not writeable + * + * @param string $type + * @param string $msg + * @param string $logfile + */ + protected static function log($type, $msg, $logfile) { + $fp = @fopen($logfile, 'a'); + if (!$fp) { + return; + } + + $logline = array( + $type, + isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : '-', + date('[Y-m-d H:i:s O]'), + 'v' . self::VERSION . ':', + $msg + ); + + $logline = implode(' ', $logline)."\n"; + fwrite($fp, $logline); + fclose($fp); + + // clear big log file + if (filesize($logfile) > 1024 * 1024 * pi()) { + copy($logfile, $logfile.'.old'); + unlink($logfile); + } + } +} + + + + +/** + * Base exception class for all exceptions in this library + */ +class WebToPayException extends Exception { + + /** + * Missing field. + */ + const E_MISSING = 1; + + /** + * Invalid field value. + */ + const E_INVALID = 2; + + /** + * Max length exceeded. + */ + const E_MAXLEN = 3; + + /** + * Regexp for field value doesn't match. + */ + const E_REGEXP = 4; + + /** + * Missing or invalid user given parameters. + */ + const E_USER_PARAMS = 5; + + /** + * Logging errors + */ + const E_LOG = 6; + + /** + * SMS answer errors + */ + const E_SMS_ANSWER = 7; + + /** + * Macro answer errors + */ + const E_STATUS = 8; + + /** + * Library errors - if this happens, bug-report should be sent; also you can check for newer version + */ + const E_LIBRARY = 9; + + /** + * Errors in remote service - it returns some invalid data + */ + const E_SERVICE = 10; + + /** + * Deprecated usage errors + */ + const E_DEPRECATED_USAGE = 11; + + /** + * @var string|boolean + */ + protected $fieldName = false; + + /** + * Sets field which failed + * + * @param string $fieldName + */ + public function setField($fieldName) { + $this->fieldName = $fieldName; + } + + /** + * Gets field which failed + * + * @return string|boolean false + */ + public function getField() { + return $this->fieldName; + } +} + +/** + * Parses and validates callbacks + */ +class WebToPay_CallbackValidator { + + /** + * @var WebToPay_Sign_SignCheckerInterface + */ + protected $signer; + + /** + * @var WebToPay_Util + */ + protected $util; + + /** + * @var integer + */ + protected $projectId; + + /** + * Constructs object + * + * @param integer $projectId + * @param WebToPay_Sign_SignCheckerInterface $signer + * @param WebToPay_Util $util + */ + public function __construct($projectId, WebToPay_Sign_SignCheckerInterface $signer, WebToPay_Util $util) { + $this->signer = $signer; + $this->util = $util; + $this->projectId = $projectId; + } + + /** + * Parses callback parameters from query parameters and checks if sign is correct. + * Request has parameter "data", which is signed and holds all callback parameters + * + * @param array $requestData + * + * @return array Parsed callback parameters + * + * @throws WebToPayException + * @throws WebToPay_Exception_Callback + */ + public function validateAndParseData(array $requestData) { + if (!$this->signer->checkSign($requestData)) { + throw new WebToPay_Exception_Callback('Invalid sign parameters, check $_GET length limit'); + } + + if (!isset($requestData['data'])) { + throw new WebToPay_Exception_Callback('"data" parameter not found'); + } + $data = $requestData['data']; + + $queryString = $this->util->decodeSafeUrlBase64($data); + $request = $this->util->parseHttpQuery($queryString); + + if (!isset($request['projectid'])) { + throw new WebToPay_Exception_Callback( + 'Project ID not provided in callback', + WebToPayException::E_INVALID + ); + } + + if ((string) $request['projectid'] !== (string) $this->projectId) { + throw new WebToPay_Exception_Callback( + sprintf('Bad projectid: %s, should be: %s', $request['projectid'], $this->projectId), + WebToPayException::E_INVALID + ); + } + + if (!isset($request['type']) || !in_array($request['type'], array('micro', 'macro'))) { + $micro = ( + isset($request['to']) + && isset($request['from']) + && isset($request['sms']) + ); + $request['type'] = $micro ? 'micro' : 'macro'; + } + + return $request; + } + + /** + * Checks data to have all the same parameters provided in expected array + * + * @param array $data + * @param array $expected + * + * @throws WebToPayException + */ + public function checkExpectedFields(array $data, array $expected) { + foreach ($expected as $key => $value) { + $passedValue = isset($data[$key]) ? $data[$key] : null; + if ($passedValue != $value) { + throw new WebToPayException( + sprintf('Field %s is not as expected (expected %s, got %s)', $key, $value, $passedValue) + ); + } + } + } +} + +/** + * Raised if configuration is incorrect + */ +class WebToPay_Exception_Configuration extends WebToPayException { + +} + + +/** + * Raised on validation error in passed data when building the request + */ +class WebToPay_Exception_Validation extends WebToPayException { + + public function __construct($message, $code = 0, $field = null, Exception $previousException = null) { + parent::__construct($message, $code, $previousException); + if ($field) { + $this->setField($field); + } + } +} + +/** + * Raised on error in callback + */ +class WebToPay_Exception_Callback extends WebToPayException { + +} + +/** + * Simple web client + */ +class WebToPay_WebClient { + + /** + * Gets page contents by specified URI. Adds query data if provided to the URI + * Ignores status code of the response and header fields + * + * @param string $uri + * @param array $queryData + * + * @return string + * + * @throws WebToPayException + */ + public function get($uri, array $queryData = array()) { + if (count($queryData) > 0) { + $uri .= strpos($uri, '?') === false ? '?' : '&'; + $uri .= http_build_query($queryData); + } + $url = parse_url($uri); + if ('https' == $url['scheme']) { + $host = 'ssl://'.$url['host']; + $port = 443; + } else { + $host = $url['host']; + $port = 80; + } + + $fp = fsockopen($host, $port, $errno, $errstr, 30); + if (!$fp) { + throw new WebToPayException(sprintf('Cannot connect to %s', $uri), WebToPayException::E_INVALID); + } + + if(isset($url['query'])) { + $data = $url['path'].'?'.$url['query']; + } else { + $data = $url['path']; + } + + $out = "GET " . $data . " HTTP/1.0\r\n"; + $out .= "Host: ".$url['host']."\r\n"; + $out .= "Connection: Close\r\n\r\n"; + + $content = ''; + + fwrite($fp, $out); + while (!feof($fp)) $content .= fgets($fp, 8192); + fclose($fp); + + list($header, $content) = explode("\r\n\r\n", $content, 2); + + return trim($content); + } +} + +/** + * Utility class + */ +class WebToPay_Util { + + /** + * Decodes url-safe-base64 encoded string + * Url-safe-base64 is same as base64, but + is replaced to - and / to _ + * + * @param string $encodedText + * + * @return string + */ + public function decodeSafeUrlBase64($encodedText) { + return base64_decode(strtr($encodedText, array('-' => '+', '_' => '/'))); + } + + /** + * Encodes string to url-safe-base64 + * Url-safe-base64 is same as base64, but + is replaced to - and / to _ + * + * @param string $text + * + * @return string + */ + public function encodeSafeUrlBase64($text) { + return strtr(base64_encode($text), array('+' => '-', '/' => '_')); + } + + /** + * Parses HTTP query to array + * + * @param string $query + * + * @return array + */ + public function parseHttpQuery($query) { + $params = array(); + parse_str($query, $params); + if (get_magic_quotes_gpc()) { + $params = $this->stripSlashesRecursively($params); + } + return $params; + } + + /** + * Strips slashes recursively, so this method can be used on arrays with more than one level + * + * @param mixed $data + * + * @return mixed + */ + protected function stripSlashesRecursively($data) { + if (is_array($data)) { + $result = array(); + foreach ($data as $key => $value) { + $result[stripslashes($key)] = $this->stripSlashesRecursively($value); + } + return $result; + } else { + return stripslashes($data); + } + } +} + + +/** + * Used to build a complete request URL. + * + * Class WebToPay_UrlBuilder + */ +class WebToPay_UrlBuilder { + + const PLACEHOLDER_KEY = '[domain]'; + + /** + * @var array + */ + protected $configuration = array(); + + /** + * @var string + */ + protected $environment; + + /** + * @var array + */ + protected $environmentSettings; + + /** + * @param array $configuration + * @param string $environment + */ + function __construct($configuration, $environment) + { + $this->configuration = $configuration; + $this->environment = $environment; + $this->environmentSettings = $this->configuration['routes'][$this->environment]; + } + + /** + * Builds a complete request URL based on the provided parameters + * + * @param $request + * @param null $language + * @return string + */ + public function buildForRequest($request, $language = null) { + return $this->createUrlFromRequestAndLanguage($request, $language); + } + + /** + * Builds a complete URL for payment list API + * + * @param int $projectId + * @param string $currency + * @return string + */ + public function buildForPaymentsMethodList($projectId, $currency) { + $routeWithNoDomain = $this->environmentSettings['paymentMethodList']; + $route = str_replace(self::PLACEHOLDER_KEY, $this->getDefaultDomain(), $routeWithNoDomain); + return $route . $projectId . '/currency:' . $currency; + } + + /** + * Builds a complete URL for Sms Answer + * + * @return string + */ + public function buildForSmsAnswer() { + $routeWithNoDomain = $this->environmentSettings['smsAnswer']; + $route = str_replace(self::PLACEHOLDER_KEY, $this->getDefaultDomain(), $routeWithNoDomain); + return $route; + } + + /** + * Build the url to the public key + * + * @return string + */ + public function buildForPublicKey() { + $routeWithNoDomain = $this->environmentSettings['publicKey']; + $route = str_replace(self::PLACEHOLDER_KEY, $this->getDefaultDomain(), $routeWithNoDomain); + return $route; + } + + /** + * Creates an URL from the request and data provided. + * + * @param array $request + * @param array $language + * @return string + */ + protected function createUrlFromRequestAndLanguage($request, $language) { + $url = $this->getPaymentUrl($language) . '?' . http_build_query($request); + return preg_replace('/[\r\n]+/is', '', $url); + } + + /** + * Returns payment url. Argument is same as lang parameter in request data + * + * @param string $language + * @return string $url + */ + protected function getPaymentUrl($language) { + $routeWithNoDomain = $this->environmentSettings['payment']; + $route = str_replace(self::PLACEHOLDER_KEY, $this->getDomainByLanguage($language), $routeWithNoDomain); + return $route; + } + + /** + * Gets the domain by lang variable + * lit -> mokejimai.lt + * eng -> paysera + * etc + * + * @param $language + * @return string + */ + protected function getDomainByLanguage($language) { + if (isset($this->configuration['domains'][$language])) { + return $this->configuration['domains'][$language]; + } else { + $defaultLanguage = $this->configuration['defaultDomainLanguage']; + return $this->configuration['domains'][$defaultLanguage]; + } + } + + /** + * Gets the domain for the default language + * + * @return string + */ + protected function getDefaultDomain() + { + return $this->getDomainByLanguage($this->configuration['defaultDomainLanguage']); + } +} + + +/** + * Wrapper class to group payment methods. Each country can have several payment method groups, each of them + * have one or more payment methods. + */ +class WebToPay_PaymentMethodGroup { + /** + * Some unique (in the scope of country) key for this group + * + * @var string + */ + protected $groupKey; + + /** + * Translations array for this group. Holds associative array of group title by country codes. + * + * @var array + */ + protected $translations; + + /** + * Holds actual payment methods + * + * @var WebToPay_PaymentMethod[] + */ + protected $paymentMethods; + + /** + * Default language for titles + * + * @var string + */ + protected $defaultLanguage; + + /** + * Constructs object + * + * @param string $groupKey + * @param array $translations + * @param string $defaultLanguage + */ + public function __construct($groupKey, array $translations = array(), $defaultLanguage = 'lt') { + $this->groupKey = $groupKey; + $this->translations = $translations; + $this->defaultLanguage = $defaultLanguage; + $this->paymentMethods = array(); + } + + /** + * Sets default language for titles. + * Returns itself for fluent interface + * + * @param string $language + * + * @return WebToPay_PaymentMethodGroup + */ + public function setDefaultLanguage($language) { + $this->defaultLanguage = $language; + foreach ($this->paymentMethods as $paymentMethod) { + $paymentMethod->setDefaultLanguage($language); + } + return $this; + } + + /** + * Gets default language for titles + * + * @return string + */ + public function getDefaultLanguage() { + return $this->defaultLanguage; + } + + /** + * Gets title of the group. Tries to get title in specified language. If it is not found or if language is not + * specified, uses default language, given to constructor. + * + * @param string [Optional] $languageCode + * + * @return string + */ + public function getTitle($languageCode = null) { + if ($languageCode !== null && isset($this->translations[$languageCode])) { + return $this->translations[$languageCode]; + } elseif (isset($this->translations[$this->defaultLanguage])) { + return $this->translations[$this->defaultLanguage]; + } else { + return $this->groupKey; + } + } + + /** + * Returns group key + * + * @return string + */ + public function getKey() { + return $this->groupKey; + } + + /** + * Returns available payment methods for this group + * + * @return WebToPay_PaymentMethod[] + */ + public function getPaymentMethods() { + return $this->paymentMethods; + } + + + /** + * Adds new payment method for this group. + * If some other payment method with specified key was registered earlier, overwrites it. + * Returns given payment method + * + * @param WebToPay_PaymentMethod $paymentMethod + * + * @return WebToPay_PaymentMethod + */ + public function addPaymentMethod(WebToPay_PaymentMethod $paymentMethod) { + return $this->paymentMethods[$paymentMethod->getKey()] = $paymentMethod; + } + + /** + * Gets payment method object with key. If no payment method with such key is found, returns null. + * + * @param string $key + * + * @return null|WebToPay_PaymentMethod + */ + public function getPaymentMethod($key) { + return isset($this->paymentMethods[$key]) ? $this->paymentMethods[$key] : null; + } + + /** + * Returns new group instance with only those payment methods, which are available for provided amount. + * + * @param integer $amount + * @param string $currency + * + * @return WebToPay_PaymentMethodGroup + */ + public function filterForAmount($amount, $currency) { + $group = new WebToPay_PaymentMethodGroup($this->groupKey, $this->translations, $this->defaultLanguage); + foreach ($this->getPaymentMethods() as $paymentMethod) { + if ($paymentMethod->isAvailableForAmount($amount, $currency)) { + $group->addPaymentMethod($paymentMethod); + } + } + return $group; + } + + /** + * Returns new country instance with only those payment methods, which are returns or not iban number after payment + * + * @param boolean $isIban + * + * @return WebToPay_PaymentMethodGroup + */ + public function filterForIban($isIban = true) { + $group = new WebToPay_PaymentMethodGroup($this->groupKey, $this->translations, $this->defaultLanguage); + foreach ($this->getPaymentMethods() as $paymentMethod) { + if ($paymentMethod->isIban() == $isIban) { + $group->addPaymentMethod($paymentMethod); + } + } + return $group; + } + + /** + * Returns whether this group has no payment methods + * + * @return boolean + */ + public function isEmpty() { + return count($this->paymentMethods) === 0; + } + + /** + * Loads payment methods from given XML node + * + * @param SimpleXMLElement $groupNode + */ + public function fromXmlNode($groupNode) { + foreach ($groupNode->payment_type as $paymentTypeNode) { + $key = (string) $paymentTypeNode->attributes()->key; + $titleTranslations = array(); + foreach ($paymentTypeNode->title as $titleNode) { + $titleTranslations[(string) $titleNode->attributes()->language] = (string) $titleNode; + } + $logoTranslations = array(); + foreach ($paymentTypeNode->logo_url as $logoNode) { + if ((string) $logoNode !== '') { + $logoTranslations[(string) $logoNode->attributes()->language] = (string) $logoNode; + } + } + $minAmount = null; + $maxAmount = null; + $currency = null; + $isIban = false; + $baseCurrency = null; + if (isset($paymentTypeNode->min)) { + $minAmount = (int) $paymentTypeNode->min->attributes()->amount; + $currency = (string) $paymentTypeNode->min->attributes()->currency; + } + if (isset($paymentTypeNode->max)) { + $maxAmount = (int) $paymentTypeNode->max->attributes()->amount; + $currency = (string) $paymentTypeNode->max->attributes()->currency; + } + + if (isset($paymentTypeNode->is_iban)) { + $isIban = (int) $paymentTypeNode->is_iban; + } + if (isset($paymentTypeNode->base_currency)) { + $baseCurrency = (string) $paymentTypeNode->base_currency; + } + $this->addPaymentMethod($this->createPaymentMethod( + $key, $minAmount, $maxAmount, $currency, $logoTranslations, $titleTranslations, $isIban, $baseCurrency + )); + } + } + + /** + * Method to create new payment method instances. Overwrite if you have to use some other subclass. + * + * @param string $key + * @param integer $minAmount + * @param integer $maxAmount + * @param string $currency + * @param array $logoList + * @param array $titleTranslations + * @param bool $isIban + * @param null $baseCurrency + * + * @return WebToPay_PaymentMethod + */ + protected function createPaymentMethod( + $key, $minAmount, $maxAmount, $currency, array $logoList = array(), array $titleTranslations = array(), + $isIban = false, $baseCurrency = null + ) { + return new WebToPay_PaymentMethod( + $key, $minAmount, $maxAmount, $currency, $logoList, $titleTranslations, $this->defaultLanguage, + $isIban, $baseCurrency + ); + } +} + +/** + * Sends answer to SMS payment if it was not provided with response to callback + */ +class WebToPay_SmsAnswerSender { + + /** + * @var string + */ + protected $password; + + /** + * @var WebToPay_WebClient + */ + protected $webClient; + + /** + * @var WebToPay_UrlBuilder $urlBuilder + */ + protected $urlBuilder; + + /** + * Constructs object + * + * @param string $password + * @param WebToPay_WebClient $webClient + * @param WebToPay_UrlBuilder $urlBuilder + */ + public function __construct( + $password, + WebToPay_WebClient $webClient, + WebToPay_UrlBuilder $urlBuilder + ) { + $this->password = $password; + $this->webClient = $webClient; + $this->urlBuilder = $urlBuilder; + } + + /** + * Sends answer by sms ID get from callback. Answer can be send only if it was not provided + * when responding to callback + * + * @param integer $smsId + * @param string $text + * + * @throws WebToPayException + */ + public function sendAnswer($smsId, $text) { + $content = $this->webClient->get($this->urlBuilder->buildForSmsAnswer(), array( + 'id' => $smsId, + 'msg' => $text, + 'transaction' => md5($this->password . '|' . $smsId), + )); + if (strpos($content, 'OK') !== 0) { + throw new WebToPayException( + sprintf('Error: %s', $content), + WebToPayException::E_SMS_ANSWER + ); + } + } +} + + +/** + * Class to hold information about payment method + */ +class WebToPay_PaymentMethod { + /** + * Assigned key for this payment method + * + * @var string + */ + protected $key; + + /** + * Logo url list by language. Usually logo is same for all languages, but exceptions exist + * + * @var array + */ + protected $logoList; + + /** + * Title list by language + * + * @var array + */ + protected $titleTranslations; + + /** + * Default language to use for titles + * + * @var string + */ + protected $defaultLanguage; + + /** + * @var boolean + */ + protected $isIban; + + /** + * @var string + */ + protected $baseCurrency; + + /** + * Constructs object + * + * @param string $key + * @param integer $minAmount + * @param integer $maxAmount + * @param string $currency + * @param array $logoList + * @param array $titleTranslations + * @param string $defaultLanguage + * @param bool $isIban + * @param string $baseCurrency + */ + public function __construct( + $key, $minAmount, $maxAmount, $currency, array $logoList = array(), array $titleTranslations = array(), + $defaultLanguage = 'lt', $isIban = false, $baseCurrency = null + ) { + $this->key = $key; + $this->minAmount = $minAmount; + $this->maxAmount = $maxAmount; + $this->currency = $currency; + $this->logoList = $logoList; + $this->titleTranslations = $titleTranslations; + $this->defaultLanguage = $defaultLanguage; + $this->isIban = $isIban; + $this->baseCurrency = $baseCurrency; + } + + /** + * Sets default language for titles. + * Returns itself for fluent interface + * + * @param string $language + * + * @return WebToPay_PaymentMethod + */ + public function setDefaultLanguage($language) { + $this->defaultLanguage = $language; + return $this; + } + + /** + * Gets default language for titles + * + * @return string + */ + public function getDefaultLanguage() { + return $this->defaultLanguage; + } + + /** + * Get assigned payment method key + * + * @return string + */ + public function getKey() { + return $this->key; + } + + /** + * Gets logo url for this payment method. Uses specified language or default one. + * If logotype is not found for specified language, null is returned. + * + * @param string [Optional] $languageCode + * + * @return string|null + */ + public function getLogoUrl($languageCode = null) { + if ($languageCode !== null && isset($this->logoList[$languageCode])) { + return $this->logoList[$languageCode]; + } elseif (isset($this->logoList[$this->defaultLanguage])) { + return $this->logoList[$this->defaultLanguage]; + } else { + return null; + } + } + + /** + * Gets title for this payment method. Uses specified language or default one. + * + * @param string [Optional] $languageCode + * + * @return string + */ + public function getTitle($languageCode = null) { + if ($languageCode !== null && isset($this->titleTranslations[$languageCode])) { + return $this->titleTranslations[$languageCode]; + } elseif (isset($this->titleTranslations[$this->defaultLanguage])) { + return $this->titleTranslations[$this->defaultLanguage]; + } else { + return $this->key; + } + } + + /** + * Checks if this payment method can be used for specified amount. + * Throws exception if currency checked is not the one, for which payment method list was downloaded. + * + * @param integer $amount + * @param string $currency + * + * @return boolean + * + * @throws WebToPayException + */ + public function isAvailableForAmount($amount, $currency) { + if ($this->currency !== $currency) { + throw new WebToPayException( + 'Currencies does not match. You have to get payment types for the currency you are checking. Given currency: ' + . $currency . ', available currency: ' . $this->currency + ); + } + return ( + ($this->minAmount === null || $amount >= $this->minAmount) + && ($this->maxAmount === null || $amount <= $this->maxAmount) + ); + } + + /** + * Returns min amount for this payment method. If no min amount is specified, returns empty string. + * + * @return string + */ + public function getMinAmountAsString() { + return $this->minAmount === null ? '' : ($this->minAmount . ' ' . $this->currency); + } + + /** + * Returns max amount for this payment method. If no max amount is specified, returns empty string. + * + * @return string + */ + public function getMaxAmountAsString() { + return $this->maxAmount === null ? '' : ($this->maxAmount . ' ' . $this->currency); + } + + /** + * Set if this method returns IBAN number after payment + * + * @param boolean $isIban + */ + public function setIsIban($isIban) { + $this->isIban = $isIban == 1; + } + + /** + * Get if this method returns IBAN number after payment + * + * @return bool + */ + public function isIban() { + return $this->isIban; + } + + /** + * Setter of BaseCurrency + * + * @param string $baseCurrency + */ + public function setBaseCurrency($baseCurrency) + { + $this->baseCurrency = $baseCurrency; + } + + /** + * Getter of BaseCurrency + * + * @return string + */ + public function getBaseCurrency() + { + return $this->baseCurrency; + } +} + + +/** + * Class with all information about available payment methods for some project, optionally filtered by some amount. + */ +class WebToPay_PaymentMethodList { + /** + * Holds available payment countries + * + * @var WebToPay_PaymentMethodCountry[] + */ + protected $countries; + + /** + * Default language for titles + * + * @var string + */ + protected $defaultLanguage; + + /** + * Project ID, to which this method list is valid + * + * @var integer + */ + protected $projectId; + + /** + * Currency for min and max amounts in this list + * + * @var string + */ + protected $currency; + + /** + * If this list is filtered for some amount, this field defines it + * + * @var integer + */ + protected $amount; + + /** + * Constructs object + * + * @param integer $projectId + * @param string $currency currency for min and max amounts in this list + * @param string $defaultLanguage + * @param integer $amount null if this list is not filtered by amount + */ + public function __construct($projectId, $currency, $defaultLanguage = 'lt', $amount = null) { + $this->projectId = $projectId; + $this->countries = array(); + $this->defaultLanguage = $defaultLanguage; + $this->currency = $currency; + $this->amount = $amount; + } + + /** + * Sets default language for titles. + * Returns itself for fluent interface + * + * @param string $language + * + * @return WebToPay_PaymentMethodList + */ + public function setDefaultLanguage($language) { + $this->defaultLanguage = $language; + foreach ($this->countries as $country) { + $country->setDefaultLanguage($language); + } + return $this; + } + + /** + * Gets default language for titles + * + * @return string + */ + public function getDefaultLanguage() { + return $this->defaultLanguage; + } + + /** + * Gets project ID for this payment method list + * + * @return integer + */ + public function getProjectId() { + return $this->projectId; + } + + /** + * Gets currency for min and max amounts in this list + * + * @return string + */ + public function getCurrency() { + return $this->currency; + } + + /** + * Gets whether this list is already filtered for some amount + * + * @return boolean + */ + public function isFiltered() { + return $this->amount !== null; + } + + /** + * Returns available countries + * + * @return WebToPay_PaymentMethodCountry[] + */ + public function getCountries() { + return $this->countries; + } + + /** + * Adds new country to payment methods. If some other country with same code was registered earlier, overwrites it. + * Returns added country instance + * + * @param WebToPay_PaymentMethodCountry $country + * + * @return WebToPay_PaymentMethodCountry + */ + public function addCountry(WebToPay_PaymentMethodCountry $country) { + return $this->countries[$country->getCode()] = $country; + } + + /** + * Gets country object with specified country code. If no country with such country code is found, returns null. + * + * @param string $countryCode + * + * @return null|WebToPay_PaymentMethodCountry + */ + public function getCountry($countryCode) { + return isset($this->countries[$countryCode]) ? $this->countries[$countryCode] : null; + } + + /** + * Returns new payment method list instance with only those payment methods, which are available for provided + * amount. + * Returns itself, if list is already filtered and filter amount matches the given one. + * + * @param integer $amount + * @param string $currency + * + * @return WebToPay_PaymentMethodList + * + * @throws WebToPayException if this list is already filtered and not for provided amount + */ + public function filterForAmount($amount, $currency) { + if ($currency !== $this->currency) { + throw new WebToPayException( + 'Currencies do not match. Given currency: ' . $currency . ', currency in list: ' . $this->currency + ); + } + if ($this->isFiltered()) { + if ($this->amount === $amount) { + return $this; + } else { + throw new WebToPayException('This list is already filtered, use unfiltered list instead'); + } + } else { + $list = new WebToPay_PaymentMethodList($this->projectId, $currency, $this->defaultLanguage, $amount); + foreach ($this->getCountries() as $country) { + $country = $country->filterForAmount($amount, $currency); + if (!$country->isEmpty()) { + $list->addCountry($country); + } + } + return $list; + } + } + + /** + * Loads countries from given XML node + * + * @param SimpleXMLElement $xmlNode + */ + public function fromXmlNode($xmlNode) { + foreach ($xmlNode->country as $countryNode) { + $titleTranslations = array(); + foreach ($countryNode->title as $titleNode) { + $titleTranslations[(string) $titleNode->attributes()->language] = (string) $titleNode; + } + $this->addCountry($this->createCountry((string) $countryNode->attributes()->code, $titleTranslations)) + ->fromXmlNode($countryNode); + } + } + + /** + * Method to create new country instances. Overwrite if you have to use some other country subtype. + * + * @param string $countryCode + * @param array $titleTranslations + * + * @return WebToPay_PaymentMethodCountry + */ + protected function createCountry($countryCode, array $titleTranslations = array()) { + return new WebToPay_PaymentMethodCountry($countryCode, $titleTranslations, $this->defaultLanguage); + } +} + +/** + * Builds and signs requests + */ +class WebToPay_RequestBuilder { + + /** + * @var string + */ + protected $projectPassword; + + /** + * @var WebToPay_Util + */ + protected $util; + + /** + * @var integer + */ + protected $projectId; + + + /** + * @var WebToPay_UrlBuilder $urlBuilder + */ + protected $urlBuilder; + + /** + * Constructs object + * + * @param integer $projectId + * @param string $projectPassword + * @param WebToPay_Util $util + * @param WebToPay_UrlBuilder $urlBuilder + */ + public function __construct( + $projectId, + $projectPassword, + WebToPay_Util $util, + WebToPay_UrlBuilder $urlBuilder + ) + { + $this->projectId = $projectId; + $this->projectPassword = $projectPassword; + $this->util = $util; + $this->urlBuilder = $urlBuilder; + } + + /** + * Builds request data array. + * + * This method checks all given data and generates correct request data + * array or raises WebToPayException on failure. + * + * @param array $data information about current payment request + * + * @return array + * + * @throws WebToPayException + */ + public function buildRequest($data) { + $this->validateRequest($data, self::getRequestSpec()); + $data['version'] = WebToPay::VERSION; + $data['projectid'] = $this->projectId; + unset($data['repeat_request']); + return $this->createRequest($data); + } + + /** + * Builds the full request url (including the protocol and the domain) + * + * @param array $data + * @return string + */ + public function buildRequestUrlFromData($data) { + $language = isset($data['lang']) ? $data['lang'] : null; + $request = $this->buildRequest($data); + return $this->urlBuilder->buildForRequest($request, $language); + } + + /** + * Builds repeat request data array. + * + * This method checks all given data and generates correct request data + * array or raises WebToPayException on failure. + * + * @param string $orderId order id of repeated request + * + * @return array + * + * @throws WebToPayException + */ + public function buildRepeatRequest($orderId) { + $data['orderid'] = $orderId; + $data['version'] = WebToPay::VERSION; + $data['projectid'] = $this->projectId; + $data['repeat_request'] = '1'; + return $this->createRequest($data); + } + + /** + * Builds the full request url for a repeated request (including the protocol and the domain) + * + * @param string $orderId order id of repeated request + * @return string + */ + public function buildRepeatRequestUrlFromOrderId($orderId) { + $request = $this->buildRepeatRequest($orderId); + return $this->urlBuilder->buildForRequest($request); + } + + /** + * Checks data to be valid by passed specification + * + * @param array $data + * @param array $specs + * + * @throws WebToPay_Exception_Validation + */ + protected function validateRequest($data, $specs) { + foreach ($specs as $spec) { + list($name, $maxlen, $required, $regexp) = $spec; + if ($required && !isset($data[$name])) { + throw new WebToPay_Exception_Validation( + sprintf("'%s' is required but missing.", $name), + WebToPayException::E_MISSING, + $name + ); + } + + if (!empty($data[$name])) { + if ($maxlen && strlen($data[$name]) > $maxlen) { + throw new WebToPay_Exception_Validation(sprintf( + "'%s' value is too long (%d), %d characters allowed.", + $name, + strlen($data[$name]), + $maxlen + ), WebToPayException::E_MAXLEN, $name); + } + + if ($regexp !== '' && !preg_match($regexp, $data[$name])) { + throw new WebToPay_Exception_Validation( + sprintf("'%s' value '%s' is invalid.", $name, $data[$name]), + WebToPayException::E_REGEXP, + $name + ); + } + } + } + } + + /** + * Makes request data array from parameters, also generates signature + * + * @param array $request + * + * @return array + */ + protected function createRequest(array $request) { + $data = $this->util->encodeSafeUrlBase64(http_build_query($request)); + return array( + 'data' => $data, + 'sign' => md5($data . $this->projectPassword), + ); + } + + /** + * Returns specification of fields for request. + * + * Array structure: + * name – request item name + * maxlen – max allowed value for item + * required – is this item is required + * regexp – regexp to test item value + * + * @return array + */ + protected static function getRequestSpec() { + return array( + array('orderid', 40, true, ''), + array('accepturl', 255, true, ''), + array('cancelurl', 255, true, ''), + array('callbackurl', 255, true, ''), + array('lang', 3, false, '/^[a-z]{3}$/i'), + array('amount', 11, false, '/^\d+$/'), + array('currency', 3, false, '/^[a-z]{3}$/i'), + array('payment', 20, false, ''), + array('country', 2, false, '/^[a-z_]{2}$/i'), + array('paytext', 255, false, ''), + array('p_firstname', 255, false, ''), + array('p_lastname', 255, false, ''), + array('p_email', 255, false, ''), + array('p_street', 255, false, ''), + array('p_city', 255, false, ''), + array('p_state', 20, false, ''), + array('p_zip', 20, false, ''), + array('p_countrycode', 2, false, '/^[a-z]{2}$/i'), + array('test', 1, false, '/^[01]$/'), + array('time_limit', 19, false, '/^\d{4}-\d{2}-\d{2} \d{2}:\d{2}:\d{2}$/'), + ); + } +} + +/** + * Checks SS2 signature. Depends on SSL functions + */ +class WebToPay_Sign_SS2SignChecker implements WebToPay_Sign_SignCheckerInterface { + + /** + * @var string + */ + protected $publicKey; + + /** + * @var WebToPay_Util + */ + protected $util; + + /** + * Constructs object + * + * @param string $publicKey + * @param WebToPay_Util $util + */ + public function __construct($publicKey, WebToPay_Util $util) { + $this->publicKey = $publicKey; + $this->util = $util; + } + + /** + * Checks signature + * + * @param array $request + * + * @return boolean + * + * @throws WebToPay_Exception_Callback + */ + public function checkSign(array $request) { + if (!isset($request['data']) || !isset($request['ss2'])) { + throw new WebToPay_Exception_Callback('Not enough parameters in callback. Possible version mismatch'); + } + + $ss2 = $this->util->decodeSafeUrlBase64($request['ss2']); + $ok = openssl_verify($request['data'], $ss2, $this->publicKey); + return $ok === 1; + } +} + +/** + * Sign checker which checks SS1 signature. SS1 does not depend on SSL functions + */ +class WebToPay_Sign_SS1SignChecker implements WebToPay_Sign_SignCheckerInterface { + + /** + * @var string + */ + protected $projectPassword; + + /** + * Constructs object + * + * @param string $projectPassword + */ + public function __construct($projectPassword) { + $this->projectPassword = $projectPassword; + } + + /** + * Check for SS1, which is not depend on openssl functions. + * + * @param array $request + * + * @return boolean + * + * @throws WebToPay_Exception_Callback + */ + public function checkSign(array $request) { + if (!isset($request['data']) || !isset($request['ss1'])) { + throw new WebToPay_Exception_Callback('Not enough parameters in callback. Possible version mismatch'); + } + + return md5($request['data'] . $this->projectPassword) === $request['ss1']; + } +} + +/** + * Interface for sign checker + */ +interface WebToPay_Sign_SignCheckerInterface { + + /** + * Checks whether request is signed properly + * + * @param array $request + * + * @return boolean + */ + public function checkSign(array $request); +} + +/** + * Loads data about payment methods and constructs payment method list object from that data + * You need SimpleXML support to use this feature + */ +class WebToPay_PaymentMethodListProvider { + + /** + * @var integer + */ + protected $projectId; + + /** + * @var WebToPay_WebClient + */ + protected $webClient; + + /** + * Holds constructed method lists by currency + * + * @var WebToPay_PaymentMethodList[] + */ + protected $methodListCache = array(); + + /** + * Builds various request URLs + * + * @var WebToPay_UrlBuilder $urlBuilder + */ + protected $urlBuilder; + + /** + * Constructs object + * + * @param integer $projectId + * @param WebToPay_WebClient $webClient + * @param WebToPay_UrlBuilder $urlBuilder + * + * @throws WebToPayException if SimpleXML is not available + */ + public function __construct( + $projectId, + WebToPay_WebClient $webClient, + WebToPay_UrlBuilder $urlBuilder + ) + { + $this->projectId = $projectId; + $this->webClient = $webClient; + $this->urlBuilder = $urlBuilder; + + if (!function_exists('simplexml_load_string')) { + throw new WebToPayException('You have to install libxml to use payment methods API'); + } + } + + /** + * Gets payment method list for specified currency + * + * @param string $currency + * + * @return WebToPay_PaymentMethodList + * + * @throws WebToPayException + */ + public function getPaymentMethodList($currency) { + if (!isset($this->methodListCache[$currency])) { + $xmlAsString = $this->webClient->get($this->urlBuilder->buildForPaymentsMethodList($this->projectId, $currency)); + $useInternalErrors = libxml_use_internal_errors(false); + $rootNode = simplexml_load_string($xmlAsString); + libxml_clear_errors(); + libxml_use_internal_errors($useInternalErrors); + if (!$rootNode) { + throw new WebToPayException('Unable to load XML from remote server'); + } + $methodList = new WebToPay_PaymentMethodList($this->projectId, $currency); + $methodList->fromXmlNode($rootNode); + $this->methodListCache[$currency] = $methodList; + } + return $this->methodListCache[$currency]; + } +} + +/** + * Payment method configuration for some country + */ +class WebToPay_PaymentMethodCountry { + /** + * @var string + */ + protected $countryCode; + + /** + * Holds available payment types for this country + * + * @var WebToPay_PaymentMethodGroup[] + */ + protected $groups; + + /** + * Default language for titles + * + * @var string + */ + protected $defaultLanguage; + + /** + * Translations array for this country. Holds associative array of country title by language codes. + * + * @var array + */ + protected $titleTranslations; + + /** + * Constructs object + * + * @param string $countryCode + * @param array $titleTranslations + * @param string $defaultLanguage + */ + public function __construct($countryCode, $titleTranslations, $defaultLanguage = 'lt') { + $this->countryCode = $countryCode; + $this->defaultLanguage = $defaultLanguage; + $this->titleTranslations = $titleTranslations; + $this->groups = array(); + } + + /** + * Sets default language for titles. + * Returns itself for fluent interface + * + * @param string $language + * + * @return WebToPay_PaymentMethodCountry + */ + public function setDefaultLanguage($language) { + $this->defaultLanguage = $language; + foreach ($this->groups as $group) { + $group->setDefaultLanguage($language); + } + return $this; + } + + /** + * Gets title of the group. Tries to get title in specified language. If it is not found or if language is not + * specified, uses default language, given to constructor. + * + * @param string [Optional] $languageCode + * + * @return string + */ + public function getTitle($languageCode = null) { + if ($languageCode !== null && isset($this->titleTranslations[$languageCode])) { + return $this->titleTranslations[$languageCode]; + } elseif (isset($this->titleTranslations[$this->defaultLanguage])) { + return $this->titleTranslations[$this->defaultLanguage]; + } else { + return $this->countryCode; + } + } + + /** + * Gets default language for titles + * + * @return string + */ + public function getDefaultLanguage() { + return $this->defaultLanguage; + } + + /** + * Gets country code + * + * @return string + */ + public function getCode() { + return $this->countryCode; + } + + /** + * Adds new group to payment methods for this country. + * If some other group was registered earlier with same key, overwrites it. + * Returns given group + * + * @param WebToPay_PaymentMethodGroup $group + * + * @return WebToPay_PaymentMethodGroup + */ + public function addGroup(WebToPay_PaymentMethodGroup $group) { + return $this->groups[$group->getKey()] = $group; + } + + /** + * Gets group object with specified group key. If no group with such key is found, returns null. + * + * @param string $groupKey + * + * @return null|WebToPay_PaymentMethodGroup + */ + public function getGroup($groupKey) { + return isset($this->groups[$groupKey]) ? $this->groups[$groupKey] : null; + } + + /** + * Returns payment method groups registered for this country. + * + * @return WebToPay_PaymentMethodGroup[] + */ + public function getGroups() { + return $this->groups; + } + + /** + * Gets payment methods in all groups + * + * @return WebToPay_PaymentMethod[] + */ + public function getPaymentMethods() { + $paymentMethods = array(); + foreach ($this->groups as $group) { + $paymentMethods = array_merge($paymentMethods, $group->getPaymentMethods()); + } + return $paymentMethods; + } + + /** + * Returns new country instance with only those payment methods, which are available for provided amount. + * + * @param integer $amount + * @param string $currency + * + * @return WebToPay_PaymentMethodCountry + */ + public function filterForAmount($amount, $currency) { + $country = new WebToPay_PaymentMethodCountry($this->countryCode, $this->titleTranslations, $this->defaultLanguage); + foreach ($this->getGroups() as $group) { + $group = $group->filterForAmount($amount, $currency); + if (!$group->isEmpty()) { + $country->addGroup($group); + } + } + return $country; + } + + /** + * Returns new country instance with only those payment methods, which are returns or not iban number after payment + * + * @param boolean $isIban + * + * @return WebToPay_PaymentMethodCountry + */ + public function filterForIban($isIban = true) { + $country = new WebToPay_PaymentMethodCountry($this->countryCode, $this->titleTranslations, $this->defaultLanguage); + foreach ($this->getGroups() as $group) { + $group = $group->filterForIban($isIban); + if (!$group->isEmpty()) { + $country->addGroup($group); + } + } + return $country; + } + + /** + * Returns whether this country has no groups + * + * @return boolean + */ + public function isEmpty() { + return count($this->groups) === 0; + } + + /** + * Loads groups from given XML node + * + * @param SimpleXMLElement $countryNode + */ + public function fromXmlNode($countryNode) { + foreach ($countryNode->payment_group as $groupNode) { + $key = (string) $groupNode->attributes()->key; + $titleTranslations = array(); + foreach ($groupNode->title as $titleNode) { + $titleTranslations[(string) $titleNode->attributes()->language] = (string) $titleNode; + } + $this->addGroup($this->createGroup($key, $titleTranslations))->fromXmlNode($groupNode); + } + } + + /** + * Method to create new group instances. Overwrite if you have to use some other group subtype. + * + * @param string $groupKey + * @param array $translations + * + * @return WebToPay_PaymentMethodGroup + */ + protected function createGroup($groupKey, array $translations = array()) { + return new WebToPay_PaymentMethodGroup($groupKey, $translations, $this->defaultLanguage); + } +} + +/** + * Creates objects. Also caches to avoid creating several instances of same objects + */ +class WebToPay_Factory { + + const ENV_PRODUCTION = 'production'; + const ENV_SANDBOX = 'sandbox'; + + /** + * @var array + */ + protected static $defaultConfiguration = array( + 'routes' => array( + self::ENV_PRODUCTION => array( + 'publicKey' => 'http://downloads.[domain]/download/public.key', + 'payment' => 'https://www.[domain]/pay/', + 'paymentMethodList' => 'https://www.[domain]/new/api/paymentMethods/', + 'smsAnswer' => 'https://www.[domain]/psms/respond/', + ), + self::ENV_SANDBOX => array( + 'publicKey' => 'http://downloads-sandbox.[domain]/download/public.key', + 'payment' => 'https://sandbox.[domain]/pay/', + 'paymentMethodList' => 'https://sandbox.[domain]/new/api/paymentMethods/', + 'smsAnswer' => 'https://sandbox.[domain]/psms/respond/', + ), + ), + + 'domains' => array( + 'lit' => 'mokejimai.lt', + 'eng' => 'paysera.com', + ), + + 'defaultDomainLanguage' => 'lit' + ); + + /** + * @var string + */ + protected $environment; + + /** + * @var array + */ + protected $configuration; + + /** + * @var WebToPay_WebClient + */ + protected $webClient = null; + + /** + * @var WebToPay_CallbackValidator + */ + protected $callbackValidator = null; + + /** + * @var WebToPay_RequestBuilder + */ + protected $requestBuilder = null; + + /** + * @var WebToPay_Sign_SignCheckerInterface + */ + protected $signer = null; + + /** + * @var WebToPay_SmsAnswerSender + */ + protected $smsAnswerSender = null; + + /** + * @var WebToPay_PaymentMethodListProvider + */ + protected $paymentMethodListProvider = null; + + /** + * @var WebToPay_Util + */ + protected $util = null; + + /** + * @var WebToPay_UrlBuilder + */ + protected $urlBuilder = null; + + + /** + * Constructs object. + * Configuration keys: projectId, password + * They are required only when some object being created needs them, + * if they are not found at that moment - exception is thrown + * + * @param array $configuration + */ + public function __construct(array $configuration = array()) { + + $this->configuration = array_merge(self::$defaultConfiguration, $configuration); + $this->environment = self::ENV_PRODUCTION; + } + + /** + * If passed true the factory will use sandbox when constructing URLs + * + * @param $enableSandbox + * @return self + */ + public function useSandbox($enableSandbox) + { + if ($enableSandbox) { + $this->environment = self::ENV_SANDBOX; + } else { + $this->environment = self::ENV_PRODUCTION; + } + return $this; + } + + /** + * Creates or gets callback validator instance + * + * @return WebToPay_CallbackValidator + * + * @throws WebToPay_Exception_Configuration + */ + public function getCallbackValidator() { + if ($this->callbackValidator === null) { + if (!isset($this->configuration['projectId'])) { + throw new WebToPay_Exception_Configuration('You have to provide project ID'); + } + $this->callbackValidator = new WebToPay_CallbackValidator( + $this->configuration['projectId'], + $this->getSigner(), + $this->getUtil() + ); + } + return $this->callbackValidator; + } + + /** + * Creates or gets request builder instance + * + * @throws WebToPay_Exception_Configuration + * + * @return WebToPay_RequestBuilder + */ + public function getRequestBuilder() { + if ($this->requestBuilder === null) { + if (!isset($this->configuration['password'])) { + throw new WebToPay_Exception_Configuration('You have to provide project password to sign request'); + } + if (!isset($this->configuration['projectId'])) { + throw new WebToPay_Exception_Configuration('You have to provide project ID'); + } + $this->requestBuilder = new WebToPay_RequestBuilder( + $this->configuration['projectId'], + $this->configuration['password'], + $this->getUtil(), + $this->getUrlBuilder() + ); + } + return $this->requestBuilder; + } + + /** + * @return WebToPay_UrlBuilder + */ + public function getUrlBuilder() { + if ($this->urlBuilder === null) { + $this->urlBuilder = new WebToPay_UrlBuilder( + $this->configuration, + $this->environment + ); + } + return $this->urlBuilder; + } + + /** + * Creates or gets SMS answer sender instance + * + * @throws WebToPay_Exception_Configuration + * + * @return WebToPay_SmsAnswerSender + */ + public function getSmsAnswerSender() { + if ($this->smsAnswerSender === null) { + if (!isset($this->configuration['password'])) { + throw new WebToPay_Exception_Configuration('You have to provide project password'); + } + $this->smsAnswerSender = new WebToPay_SmsAnswerSender( + $this->configuration['password'], + $this->getWebClient(), + $this->getUrlBuilder() + ); + } + return $this->smsAnswerSender; + } + + /** + * Creates or gets payment list provider instance + * + * @throws WebToPay_Exception_Configuration + * + * @return WebToPay_PaymentMethodListProvider + */ + public function getPaymentMethodListProvider() { + if ($this->paymentMethodListProvider === null) { + if (!isset($this->configuration['projectId'])) { + throw new WebToPay_Exception_Configuration('You have to provide project ID'); + } + $this->paymentMethodListProvider = new WebToPay_PaymentMethodListProvider( + $this->configuration['projectId'], + $this->getWebClient(), + $this->getUrlBuilder() + + ); + } + return $this->paymentMethodListProvider; + } + + /** + * Creates or gets signer instance. Chooses SS2 signer if openssl functions are available, SS1 in other case + * + * @throws WebToPay_Exception_Configuration + * + * @return WebToPay_Sign_SignCheckerInterface + * + * @throws WebToPayException + */ + protected function getSigner() { + if ($this->signer === null) { + if (function_exists('openssl_pkey_get_public')) { + $webClient = $this->getWebClient(); + $publicKey = $webClient->get($this->getUrlBuilder()->buildForPublicKey()); + if (!$publicKey) { + throw new WebToPayException('Cannot download public key from WebToPay website'); + } + $this->signer = new WebToPay_Sign_SS2SignChecker($publicKey, $this->getUtil()); + } else { + if (!isset($this->configuration['password'])) { + throw new WebToPay_Exception_Configuration( + 'You have to provide project password if OpenSSL is unavailable' + ); + } + $this->signer = new WebToPay_Sign_SS1SignChecker($this->configuration['password']); + } + } + return $this->signer; + } + + /** + * Creates or gets web client instance + * + * @throws WebToPay_Exception_Configuration + * + * @return WebToPay_WebClient + */ + protected function getWebClient() { + if ($this->webClient === null) { + $this->webClient = new WebToPay_WebClient(); + } + return $this->webClient; + } + + /** + * Creates or gets util instance + * + * @throws WebToPay_Exception_Configuration + * + * @return WebToPay_Util + */ + protected function getUtil() { + if ($this->util === null) { + $this->util = new WebToPay_Util(); + } + return $this->util; + } +} diff --git a/paysera/vendor/webtopay/libwebtopay/index.php b/paysera/vendor/webtopay/libwebtopay/index.php new file mode 100755 index 0000000..e62f4c7 --- /dev/null +++ b/paysera/vendor/webtopay/libwebtopay/index.php @@ -0,0 +1,35 @@ + +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/paysera/views/index.php b/paysera/views/index.php new file mode 100755 index 0000000..e62f4c7 --- /dev/null +++ b/paysera/views/index.php @@ -0,0 +1,35 @@ + +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/paysera/views/templates/front/configuration.tpl b/paysera/views/templates/front/configuration.tpl new file mode 100755 index 0000000..e9cc528 --- /dev/null +++ b/paysera/views/templates/front/configuration.tpl @@ -0,0 +1,90 @@ +{* +* 2007-2014 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author EVP International, JSC +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + +{l s='This module allows you to accept payments by Paysera.' mod='paysera'} +
+{l s='If the client chooses this payment mode, the order will change its status into a \'Waiting for payment\' status.' mod='paysera'} +
+
+ +{if $messages ne ''} + {foreach from=$messages item=message} +
+ # + {$message.msg|escape:'quotes'} +
+ {/foreach} +{/if} + +
+
+ {l s='Payment module details' mod='paysera'} + + + + + + + + + + + + + + + + + + + + + + + + + + +
{l s='Please specify the Paysera details' mod='paysera'}

{l s='Paysera project ID:' mod='paysera'}
{l s='Signature password:' mod='paysera'}
{l s='Test mode:' mod='paysera'} + {l s='Yes' mod='paysera'} + {l s='No' mod='paysera'} +
{l s='Display payments list:' mod='paysera'} + {l s='Yes' mod='paysera'} + {l s='No' mod='paysera'} +
{l s='Default payment country:' mod='paysera'} + +
+ +
+
+
diff --git a/paysera/views/templates/front/index.php b/paysera/views/templates/front/index.php new file mode 100755 index 0000000..e62f4c7 --- /dev/null +++ b/paysera/views/templates/front/index.php @@ -0,0 +1,35 @@ + +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/paysera/views/templates/front/payment_execution.tpl b/paysera/views/templates/front/payment_execution.tpl new file mode 100755 index 0000000..a71714c --- /dev/null +++ b/paysera/views/templates/front/payment_execution.tpl @@ -0,0 +1,178 @@ +{* +* 2007-2014 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author EVP International, JSC +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + + + +{capture name=path}{l s='Paysera.com payment' mod='paysera'}{/capture} + + +

{l s='Order summary' mod='paysera'}

+ +{assign var='current_step' value='payment'} +{include file="$tpl_dir./order-steps.tpl"} + +

{l s='Paysera payment' mod='paysera'}

+ + + + + + + + + + + + + +
+ + + + + {l s='You have chosen to pay by Paysera' mod='paysera'}
+ {l s='Here is a short summary of your order:' mod='paysera'} +
{l s='The total amount of your order is' mod='paysera'} + {$amount|escape:'quotes'} {$currency|escape:'quotes'} +
+ +{if $displayPayments == 1} + + + + + +
{l s='Select payment country' mod='paysera'} + +
+{/if} + +
+ {if $displayPayments == 1} +
+
+ {foreach from=$payMethods item=country} +
+ {foreach from=$country->getGroups() item=group} +
+
{$group->getTitle()|escape:'quotes'}
+ {foreach from=$group->getPaymentMethods() item=paymentMethod} +
+ + + +
+
+ {/foreach} +
+
+ {/foreach} +
+ {/foreach} +
+
+ {/if} +

+ {l s='Other payment methods' mod='paysera'} + +

+
diff --git a/paysera/views/templates/front/redirect.tpl b/paysera/views/templates/front/redirect.tpl new file mode 100755 index 0000000..ee0b93d --- /dev/null +++ b/paysera/views/templates/front/redirect.tpl @@ -0,0 +1,43 @@ +{* +* 2007-2014 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author EVP International, JSC +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + + +... + +
+ {foreach from=$request key=name item=value} + + {/foreach} + +
diff --git a/paysera/views/templates/hook/index.php b/paysera/views/templates/hook/index.php new file mode 100755 index 0000000..e62f4c7 --- /dev/null +++ b/paysera/views/templates/hook/index.php @@ -0,0 +1,35 @@ + +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; diff --git a/paysera/views/templates/hook/payment.tpl b/paysera/views/templates/hook/payment.tpl new file mode 100755 index 0000000..c8ab2a6 --- /dev/null +++ b/paysera/views/templates/hook/payment.tpl @@ -0,0 +1,34 @@ +{* +* 2007-2014 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author EVP International, JSC +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*} + diff --git a/paysera/views/templates/hook/payment_return.tpl b/paysera/views/templates/hook/payment_return.tpl new file mode 100755 index 0000000..9835db3 --- /dev/null +++ b/paysera/views/templates/hook/payment_return.tpl @@ -0,0 +1,39 @@ +{* +* 2007-2014 PrestaShop +* +* NOTICE OF LICENSE +* +* This source file is subject to the Academic Free License (AFL 3.0) +* that is bundled with this package in the file LICENSE.txt. +* It is also available through the world-wide-web at this URL: +* http://opensource.org/licenses/afl-3.0.php +* If you did not receive a copy of the license and are unable to +* obtain it through the world-wide-web, please send an email +* to license@prestashop.com so we can send you a copy immediately. +* +* DISCLAIMER +* +* Do not edit or add to this file if you wish to upgrade PrestaShop to newer +* versions in the future. If you wish to customize PrestaShop for your +* needs please refer to http://www.prestashop.com for more information. +* +* @author EVP International, JSC +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*} +{if $status == 'ok'} +

{l s='Your order on' mod='paysera'} {$shop_name|escape:'quotes'} {l s='is complete.' mod='paysera'} +

+ Apmokėjimą už prekes gavome ir Jūsų užsakymas Nr. {$id_order|escape:'quotes'} perduotas vykdymui.
+
+ Užsakymą peržiūrėti galite paspaudę šią nuorodą.
+
+ Apie tolimesnę užsakymo vykdymo eigą būsite informuoti elektroniniu paštu.
+

+{else} +

+ {l s='We noticed a problem with your order. If you think this is an error, you can contact our' mod='paysera'} + {l s='customer support' mod='paysera'}. +

+{/if} diff --git a/paysera/views/templates/index.php b/paysera/views/templates/index.php new file mode 100755 index 0000000..e62f4c7 --- /dev/null +++ b/paysera/views/templates/index.php @@ -0,0 +1,35 @@ + +* @copyright 2004-2014 EVP International, JSC +* @license http://opensource.org/licenses/GPL-3.0 GNU GENERAL PUBLIC LICENSE (GPL-3.0) +* International Registered Trademark & Property of PrestaShop SA +*/ + +header("Expires: Mon, 26 Jul 1997 05:00:00 GMT"); +header("Last-Modified: ".gmdate("D, d M Y H:i:s")." GMT"); + +header("Cache-Control: no-store, no-cache, must-revalidate"); +header("Cache-Control: post-check=0, pre-check=0", false); +header("Pragma: no-cache"); + +header("Location: ../"); +exit; From 3a3f3f36b1c83d883015be355cebddc4e55d6a67 Mon Sep 17 00:00:00 2001 From: tkasparaitis Date: Fri, 23 Jan 2015 17:50:51 +0200 Subject: [PATCH 3/6] test test --- README.md | 1 - 1 file changed, 1 deletion(-) diff --git a/README.md b/README.md index bd3c454..f0469b9 100644 --- a/README.md +++ b/README.md @@ -15,7 +15,6 @@ Installation 2. In admin panel go to Modules->Payment and click "Click to see the list of payment modules." button. 3. In mokejimai module area press "Install" button, after installation is complete press "Configure" button and fill in required details. - OR 1. Download this repository as zip and Go to "Modules" and click "Add new module" From 4a01b8fe85a5586eb0e8303b1c5808ee578da48e Mon Sep 17 00:00:00 2001 From: tkasparaitis Date: Fri, 23 Jan 2015 17:57:41 +0200 Subject: [PATCH 4/6] version update --- README.md | 2 ++ 1 file changed, 2 insertions(+) diff --git a/README.md b/README.md index f0469b9..7dd0924 100644 --- a/README.md +++ b/README.md @@ -15,8 +15,10 @@ Installation 2. In admin panel go to Modules->Payment and click "Click to see the list of payment modules." button. 3. In mokejimai module area press "Install" button, after installation is complete press "Configure" button and fill in required details. + OR + 1. Download this repository as zip and Go to "Modules" and click "Add new module" 2. Browse for module and upload. 3. In mokejimai module area press "Install" button, after installation is complete press "Configure" button and fill in required details; From 7b5391be2f36d66ec4d83409c11d0312f6981930 Mon Sep 17 00:00:00 2001 From: tkasparaitis Date: Fri, 23 Jan 2015 18:02:17 +0200 Subject: [PATCH 5/6] updated lt translation --- paysera/translations/lt.php | 60 +++++++++++++++++++++++++++++-------- 1 file changed, 48 insertions(+), 12 deletions(-) diff --git a/paysera/translations/lt.php b/paysera/translations/lt.php index c713e3c..5b2de6d 100755 --- a/paysera/translations/lt.php +++ b/paysera/translations/lt.php @@ -2,34 +2,70 @@ global $_MODULE; $_MODULE = array(); -$_MODULE['<{paysera}default>mokejimai_2d2b05368867f2d9b017e65ce9c1526a'] = 'Paysera'; -$_MODULE['<{paysera}default>mokejimai_e0355bb27ba85e136a8eddc1d95ada91'] = 'Prrimti mokėjimus per Mokėjimai.lt sistemą'; +$_MODULE['<{paysera}default>mokejimai_2d2b05368867f2d9b017e65ce9c1526a'] = 'Paysera.lt'; +$_MODULE['<{paysera}default>mokejimai_e0355bb27ba85e136a8eddc1d95ada91'] = 'Prrimti mokėjimus per Paysera.lt sistemą'; $_MODULE['<{paysera}default>mokejimai_69a1a3ad8dd5da6db3c4da838a0cf9c7'] = 'Ar tikrai norite ištrinti nustatymus'; $_MODULE['<{paysera}default>mokejimai_ef6222485ff756bb929a8dfc9c722ea9'] = 'Turi būti suvesti projekto nustatymai, kad veiktų teisingai apmokėjimas.'; $_MODULE['<{paysera}default>mokejimai_4402acab1c8f90dcf4a31dc96833bd86'] = 'Nepasirinkta valiuta šiame modulyje'; $_MODULE['<{paysera}default>mokejimai_b4ba0005dcd53932c2b8106963281b62'] = 'Privaloma įvesti projekto ID'; $_MODULE['<{paysera}default>mokejimai_c888438d14855d7d96a2724ee9c306bd'] = 'Nustatymai atnaujinti'; -$_MODULE['<{paysera}default>configuration_3f86574ad34d16a8cf2ba530c9aafee7'] = 'Šis modulis leidžia priimti mokėjimus per Paysera sistemą.'; +$_MODULE['<{paysera}default>configuration_3f86574ad34d16a8cf2ba530c9aafee7'] = 'Šis modulis leidžia priimti mokėjimus per Mokėjimai.lt sistemą.'; $_MODULE['<{paysera}default>configuration_b6af2d31afe71aedcceca73cc27fec29'] = 'Jeigu klientas pasirinks šį mokėjimo būdą, užsakymas pakeis savo būklę į \"Laukiama\" apmokėjimo'; $_MODULE['<{paysera}default>configuration_aa9f04d1be872e3bdaca1cccf7f02d12'] = 'Mokėjimo modulio nustatymai'; -$_MODULE['<{paysera}default>configuration_f5f04b11870f0822cfc263fdc6214528'] = 'Įrašykite Paysera modulio duomenis.'; -$_MODULE['<{paysera}default>configuration_e082f55a3e947645b3cfc4a3837564be'] = 'Paysera projekto ID'; -$_MODULE['<{paysera}default>configuration_ae71d10996c375bccc46d24665b318a9'] = 'Paysera projekto slaptažodis:'; +$_MODULE['<{paysera}default>configuration_f5f04b11870f0822cfc263fdc6214528'] = 'Įrašykite mokėjimai.lt modulio duomenis.'; +$_MODULE['<{paysera}default>configuration_e082f55a3e947645b3cfc4a3837564be'] = 'Paysera.lt projekto ID'; +$_MODULE['<{paysera}default>configuration_ae71d10996c375bccc46d24665b318a9'] = 'Paysera.lt projekto slaptažodis:'; $_MODULE['<{paysera}default>configuration_2f1120281bc59dbf84f4b7d9f210b421'] = 'Testinis režimas?'; $_MODULE['<{paysera}default>configuration_93cba07454f06a4a960172bbd6e2a435'] = 'Taip'; $_MODULE['<{paysera}default>configuration_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Ne'; $_MODULE['<{paysera}default>configuration_2f8251979372d44fa8e3df67202cbef1'] = 'Rodyti mokėjimo būdų pasirinkimą?'; $_MODULE['<{paysera}default>configuration_49b80feb114d68c0b124c0129536bd02'] = 'Pradinė mokėjimo būdų pasirinkimo šalis'; $_MODULE['<{paysera}default>configuration_b17f3f4dcf653a5776792498a9b44d6a'] = 'Atnaujinti nustatymus'; -$_MODULE['<{paysera}default>payment_execution_289148aed2fe892082cadcfd5c1e5805'] = 'Paysera mokėjimo būdas'; +$_MODULE['<{paysera}default>payment_execution_289148aed2fe892082cadcfd5c1e5805'] = 'Paysera.lt mokėjimo būdas'; $_MODULE['<{paysera}default>payment_execution_f1d3b424cd68795ecaa552883759aceb'] = 'Užsąkymo detalės:'; -$_MODULE['<{paysera}default>payment_execution_e0b4f8216cad5c2c286f08d187503ed0'] = 'Paysera mokėjimo būdas'; -$_MODULE['<{paysera}default>payment_execution_2d2b05368867f2d9b017e65ce9c1526a'] = 'Paysera'; -$_MODULE['<{paysera}default>payment_execution_c047e6ab568a2227653f7d1d30bcf1c2'] = 'Jūs pasirinkote mokėti per Paysera'; +$_MODULE['<{paysera}default>payment_execution_e0b4f8216cad5c2c286f08d187503ed0'] = 'Paysera.lt mokėjimo būdas'; +$_MODULE['<{paysera}default>payment_execution_2d2b05368867f2d9b017e65ce9c1526a'] = 'Mokėjimai'; +$_MODULE['<{paysera}default>payment_execution_c047e6ab568a2227653f7d1d30bcf1c2'] = 'Jūs pasirinkote mokėti per Mokejimai.lt'; $_MODULE['<{paysera}default>payment_execution_c884ed19483d45970c5bf23a681e2dd2'] = 'Užsąkymo detalės:'; $_MODULE['<{paysera}default>payment_execution_e2867a925cba382f1436d1834bb52a1c'] = 'Bendra užsąkymo suma'; $_MODULE['<{paysera}default>payment_execution_48034ce5085e9fd93c65ce59966acf9e'] = 'Pakeikite mokėjimo šalį'; $_MODULE['<{paysera}default>payment_execution_46b9e3665f187c739c55983f757ccda0'] = 'Patvirtinti užsąkymą'; -$_MODULE['<{paysera}default>payment_8d0e94f6e1d030f33f8ce19548051b3d'] = 'Mokėti per Paysera'; -$_MODULE['<{paysera}default>payment_3af059bc2293e9e46a898bdc659e0a0c'] = 'Mokėti per Paysera (užsąkymas bus atliktas greičiau)'; +$_MODULE['<{paysera}default>payment_8d0e94f6e1d030f33f8ce19548051b3d'] = 'Mokėti per Paysera.lt'; +$_MODULE['<{paysera}default>payment_3af059bc2293e9e46a898bdc659e0a0c'] = 'Mokėti per Paysera.lt (užsąkymas bus atliktas greičiau)'; $_MODULE['<{paysera}default>payment_fb1b6ccdcee225de3d8caf01885d2204'] = 'Toliau >>'; +$_MODULE['<{paysera}prestashop>paysera_b246b83153b335903d29fae121e0e75c'] = 'Paysera'; +$_MODULE['<{paysera}prestashop>paysera_19e3b9538dc6293bc44f2b70245b924c'] = 'Gauti mokėjimus per Paysera '; +$_MODULE['<{paysera}prestashop>paysera_69a1a3ad8dd5da6db3c4da838a0cf9c7'] = 'Ar tikrai norite ištrinti duomenis?'; +$_MODULE['<{paysera}prestashop>paysera_ef6222485ff756bb929a8dfc9c722ea9'] = 'Projekto informacija turi įvesta, norint naudoti modulį.'; +$_MODULE['<{paysera}prestashop>paysera_4402acab1c8f90dcf4a31dc96833bd86'] = 'Nėra priskirtos valiutos šiam moduliui.'; +$_MODULE['<{paysera}prestashop>paysera_b4ba0005dcd53932c2b8106963281b62'] = 'Projekto ID yra privalomas'; +$_MODULE['<{paysera}prestashop>paysera_c888438d14855d7d96a2724ee9c306bd'] = 'Nustatymai atnaujinti'; +$_MODULE['<{paysera}prestashop>configuration_1114e078142b1c96114ff8c129ab8b31'] = 'Šis modulis leis gauti mokėjimus per Paysera'; +$_MODULE['<{paysera}prestashop>configuration_b6af2d31afe71aedcceca73cc27fec29'] = 'Jei klientas apmokės per payserą, užsakymo statusas bus \"Laukiamas apmokėjimas\"'; +$_MODULE['<{paysera}prestashop>configuration_aa9f04d1be872e3bdaca1cccf7f02d12'] = 'Mokėjimo būdo informacija'; +$_MODULE['<{paysera}prestashop>configuration_bf2ae895e3cc22f3232cc3b76cf1ea12'] = 'Patikslinkite informaciją'; +$_MODULE['<{paysera}prestashop>configuration_bfe77056046f0cd49d88c469f8abbe18'] = 'Projekto ID:'; +$_MODULE['<{paysera}prestashop>configuration_ae71d10996ccc375bccc46d24665b318a9'] = 'Projekto slaptažodis:'; +$_MODULE['<{paysera}prestashop>configuration_2f1120281bc59dbf84f4b7d9f210b421'] = 'Testavimo režimas:'; +$_MODULE['<{paysera}prestashop>configuration_93cba07454f06a4a960172bbd6e2a435'] = 'Taip'; +$_MODULE['<{paysera}prestashop>configuration_bafd7322c6e97d25b6299b5d6fe8920b'] = 'Ne'; +$_MODULE['<{paysera}prestashop>configuration_2f8251979372d44fa8e3df67202cbef1'] = 'Atvaizduoti mokėjimo būdus:'; +$_MODULE['<{paysera}prestashop>configuration_49b80feb114d68c0b124c0129536bd02'] = 'Šalis pagal nutylėjimą:'; +$_MODULE['<{paysera}prestashop>configuration_b17f3f4dcf653a5776792498a9b44d6a'] = 'Atnaujintį nustatymus'; +$_MODULE['<{paysera}prestashop>payment_execution_289148aed2fe892082cadcfd5c1e5805'] = 'Paysera mokėjimo būdas'; +$_MODULE['<{paysera}prestashop>payment_execution_f1d3b424cd68795ecaa552883759aceb'] = 'Užsakymo detalės'; +$_MODULE['<{paysera}prestashop>payment_execution_ba26c386695bf530997971eb4005c0a5'] = 'Paysera mokėjimo būdas'; +$_MODULE['<{paysera}prestashop>payment_execution_b246b83153b335903d29fae121e0e75c'] = 'Paysera'; +$_MODULE['<{paysera}prestashop>payment_execution_086ce42431bcf38825ea2c06fbb4b395'] = 'Jūs pasirinkote apmokėti per Paysera'; +$_MODULE['<{paysera}prestashop>payment_execution_c884ed19483d45970c5bf23a681e2dd2'] = 'Jūsų užsakymo detalės:'; +$_MODULE['<{paysera}prestashop>payment_execution_e2867a925cba382f1436d1834bb52a1c'] = 'Bendra užsakymo suma '; +$_MODULE['<{paysera}prestashop>payment_execution_48034ce5085e9fd93c65ce59966acf9e'] = 'Pasirinkite mokėjimo šalį'; +$_MODULE['<{paysera}prestashop>payment_execution_569fd05bdafa1712c4f6be5b153b8418'] = 'Kiti mokėjimo būdai'; +$_MODULE['<{paysera}prestashop>payment_execution_46b9e3665f187c739c55983f757ccda0'] = 'Patvirtinu užsakymą'; +$_MODULE['<{paysera}prestashop>redirect_fb1b6ccdcee225de3d8caf01885d2204'] = 'Tęsti >>'; +$_MODULE['<{paysera}prestashop>payment_7bb6728c85d67886c2da0b9fc433d85a'] = 'Mokėti per Paysera'; +$_MODULE['<{paysera}prestashop>payment_17def51ac90b26b3cbb0fb8d105ef18b'] = 'apmokėsite greičiau'; +$_MODULE['<{paysera}prestashop>payment_return_2e2117b7c81aa9ea6931641ea2c6499f'] = 'jūsų užsakymas '; +$_MODULE['<{paysera}prestashop>payment_return_75fbf512d744977d62599cc3f0ae2bb4'] = 'baigtas.'; +$_MODULE['<{paysera}prestashop>payment_return_8de637e24570c1edb0357826a2ad5aea'] = 'Pastebėjome problemą su Jūsų užsakymu, susisiekite su mūsų'; +$_MODULE['<{paysera}prestashop>payment_return_64430ad2835be8ad60c59e7d44e4b0b1'] = 'klientų pagalbos skyriumi.'; From e1f589c240f23f23c7ad255669126900684ddf9c Mon Sep 17 00:00:00 2001 From: tkasparaitis Date: Thu, 5 Feb 2015 11:05:01 +0200 Subject: [PATCH 6/6] ssl fix --- paysera/views/templates/front/payment_execution.tpl | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/paysera/views/templates/front/payment_execution.tpl b/paysera/views/templates/front/payment_execution.tpl index a71714c..516d62d 100755 --- a/paysera/views/templates/front/payment_execution.tpl +++ b/paysera/views/templates/front/payment_execution.tpl @@ -142,7 +142,7 @@ {/if} -
+ {if $displayPayments == 1}