From 75160b12821f7f4299cce7f0b69c83c1502ae071 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Anton=20Luka=20=C5=A0ijanec?= Date: Mon, 27 May 2024 13:08:29 +0200 Subject: 2024-02-19 upstream --- .../classes/class.ApiNarocilaController.php | 46 ++++- frontend/payments/classes/class.UserAccess.php | 85 ++++++-- frontend/payments/classes/class.UserNarocila.php | 229 ++++++++++++++++++--- .../classes/class.UserNarocilaCebelica.php | 4 +- .../payments/classes/class.UserNarocilaCron.php | 1 - .../payments/classes/class.UserNarocilaPaypal.php | 17 +- .../payments/classes/class.UserNarocilaStripe.php | 13 +- frontend/payments/classes/class.UserPlacila.php | 8 +- 8 files changed, 325 insertions(+), 78 deletions(-) (limited to 'frontend/payments/classes') diff --git a/frontend/payments/classes/class.ApiNarocilaController.php b/frontend/payments/classes/class.ApiNarocilaController.php index 6c9daed..6a92fb6 100644 --- a/frontend/payments/classes/class.ApiNarocilaController.php +++ b/frontend/payments/classes/class.ApiNarocilaController.php @@ -36,8 +36,11 @@ class ApiNarocilaController{ // Logiramo response klica $SL = new SurveyLog(); - if($this->response['success'] == true){ - + // Napaka pri klicu + if(isset($this->response['success']) && $this->response['success'] == false){ + $SL->addMessage(SurveyLog::PAYMENT, "NAPAKA pri klicu za plačevanje ".$this->params['action'].": ".$this->response['error']); + } + else{ if(isset($this->data['email'])) $call_data = ', '.$this->data['email']; elseif(isset($this->data['narocilo_id'])) @@ -47,9 +50,6 @@ class ApiNarocilaController{ $SL->addMessage(SurveyLog::PAYMENT, "USPEŠEN KLIC (".$this->params['action'] . $call_data.")"); } - else{ - $SL->addMessage(SurveyLog::PAYMENT, "NAPAKA pri klicu za plačevanje ".$this->params['action'].": ".$this->response['error']); - } $SL->write(); @@ -128,6 +128,7 @@ class ApiNarocilaController{ switch ($this->params['action']) { + // Ustvari novo narocilo case 'create_narocilo': $narocilo = new UserNarocila(); @@ -135,6 +136,7 @@ class ApiNarocilaController{ break; + // Posodobi obstoječe narocilo (npr. nastavi nacin placila) case 'update_narocilo': $narocilo = new UserNarocila(); @@ -142,6 +144,36 @@ class ApiNarocilaController{ break; + + // Dobi podatke zadnjega narocila za uporabnika + case 'get_last_narocilo': + + $usr_id = 0; + + // Dobimo user id iz emaila + if(isset($this->data['email'])){ + $sqlU = sisplet_query("SELECT id FROM users WHERE email='".$this->data['email']."'"); + $rowU = mysqli_fetch_array($sqlU); + + $usr_id = $rowU['id']; + } + + if($usr_id == '' || $usr_id == 0){ + $this->response['error'] = 'ERROR! Missing user ID.'; + $this->response['success'] = false; + + break; + } + + // Dobimo podatke zadnjega narocila + $narocilo = new UserNarocila(); + $last_narocilo = $narocilo->getLastNarocilo($usr_id); + + $this->response = $last_narocilo; + + break; + + // Dobimo pdf predracun (ce ne obstaja ga ustvarimo) case 'get_predracun': @@ -156,6 +188,7 @@ class ApiNarocilaController{ break; + // Dobimo pdf racun case 'get_racun': @@ -170,6 +203,7 @@ class ApiNarocilaController{ break; + // Placamo narocilo - aktiviramo uporabniku paket za uporabo, zgeneriramo in vrnemo url do pdf racuna in ga tudi posljemo po mailu case 'placaj_narocilo': @@ -349,7 +383,7 @@ class ApiNarocilaController{ $podatki = $reader->city($this->data['ip']); // Vrnemo ime države - $this->response['drzava'] = $podatki->country->name; + $this->response['drzava'] = $podatki->country->name ?? ''; break; } diff --git a/frontend/payments/classes/class.UserAccess.php b/frontend/payments/classes/class.UserAccess.php index 105d4c9..070c723 100644 --- a/frontend/payments/classes/class.UserAccess.php +++ b/frontend/payments/classes/class.UserAccess.php @@ -80,6 +80,7 @@ class UserAccess{ 'telephone' => 3, // Telefonska anketa 'chat' => 3, // Chat 'panel' => 3, // Panel + 'email_access' => 3, // Dostop z emailom /* Ostale funkcionalnosti */ 'prevajanje' => 2, // Vecjezikovna anketa @@ -120,10 +121,9 @@ class UserAccess{ } private function __construct($usr_id){ - global $app_settings; // Ce so paketi onemogoceni nič ne preverjamo - if(!isset($app_settings['commercial_packages']) || $app_settings['commercial_packages'] == false){ + if(AppSettings::getInstance()->getSetting('app_settings-commercial_packages') !== true){ return; } @@ -133,7 +133,11 @@ class UserAccess{ if(isset($_POST['anketa']) || isset($_GET['anketa'])){ $ank_id = (isset($_GET['anketa'])) ? $_GET['anketa'] : $_POST['anketa']; - + + // Pogledamo, ce smo v izpolnjevanju ankete - imamo hash in pridobimo id iz njega + if($_SERVER["SCRIPT_NAME"] == '/main/survey/index.php') + $ank_id = getSurveyIdFromHash($ank_id); + $sqlU = sisplet_query("SELECT insert_uid FROM srv_anketa WHERE id='".$ank_id."'"); $rowU = mysqli_fetch_array($sqlU); @@ -163,6 +167,8 @@ class UserAccess{ echo 'Napaka! Manjka ID uporabnika.'; die(); } + + } @@ -202,12 +208,12 @@ class UserAccess{ private function checkAnketaOld(){ // Ce nismo znotraj ankete ti ignoriramo - if(!isset($_GET['anketa'])){ + if(!isset($_GET['anketa']) && !isset($_POST['anketa'])){ return; } // Nastavimo id ankete - $ank_id = $_GET['anketa']; + $ank_id = isset($_GET['anketa']) ? $_GET['anketa'] : $_POST['anketa']; $sqlA = sisplet_query("SELECT insert_time FROM srv_anketa WHERE id='".$ank_id."'"); $rowA = mysqli_fetch_array($sqlA); @@ -229,13 +235,12 @@ class UserAccess{ // Preverimo ce ima uporabnik dostop do neke funkcionalnosti public function checkUserAccess($what=''){ - global $app_settings; global $admin_type; global $global_user_id; global $mysql_database_name; // Ce so paketi onemogoceni vrnemo vedno true - if(!isset($app_settings['commercial_packages']) || $app_settings['commercial_packages'] == false){ + if(AppSettings::getInstance()->getSetting('app_settings-commercial_packages') !== true){ return true; } @@ -277,11 +282,10 @@ class UserAccess{ // Vrnemo paket uporabnika public function getPackage(){ - global $app_settings; global $admin_type; // Ce so paketi onemogoceni vrnemo -1 - if(!isset($app_settings['commercial_packages']) || $app_settings['commercial_packages'] == false){ + if(AppSettings::getInstance()->getSetting('app_settings-commercial_packages') !== true){ return -1; } @@ -345,25 +349,44 @@ class UserAccess{ // Kateri paket je potreben za to funkcionalnost $package_required = (isset($this->functionality_package[$what])) ? $this->functionality_package[$what] : 3; - $package_required_name = $this->packages[$package_required]['name']; + $package_temp = $this->packages[$package_required]['name']; + $package_required_name = $lang['paket_opis_'.$package_temp]; if($lang['id'] == '2') $drupal_url = $site_url.'d/en/purchase/'.$package_required.'/package'; else $drupal_url = $site_url.'d/izvedi-nakup/'.$package_required.'/podatki'; - + echo '
'; echo '
'; - + + echo '
'.$lang['srv_access_no_access_title'].'
'; + // Ce user ni avtor ankete if($this->user_not_author){ echo '

'.$lang['srv_access_no_access_not_author'].'

'; } - + echo '
'; echo '

'.$lang['srv_access_no_access'].' "'.$package_required_name.'".

'; + + echo '

'.$lang['srv_access_no_access_funkcionalnosti_intro'].'

'; + + echo '
    '; + echo '
  • '.$lang['srv_access_no_access_funkcionalnost_1'].'
  • '; + echo '
  • '.$lang['srv_access_no_access_funkcionalnost_2'].'
  • '; + echo '
  • '.$lang['srv_access_no_access_funkcionalnost_3'].'
  • '; + echo '
  • '.$lang['srv_access_no_access_funkcionalnost_4'].'
  • '; + echo '
'; + + + echo '
'; + if(!$this->user_not_author) - echo ''; + echo '
'; + echo ''; + echo '
'; echo '
'; + echo '
'; } // Izpisemo popup obvestilo, da je funkcionalnost onemogocena in naj kupi paket @@ -373,22 +396,31 @@ class UserAccess{ // Kateri paket je potreben za to funkcionalnost $package_required = (isset($this->functionality_package[$what])) ? $this->functionality_package[$what] : 3; - $package_required_name = $this->packages[$package_required]['name']; + $package_temp = $this->packages[$package_required]['name']; + $package_required_name = $lang['paket_opis_'.$package_temp]; if($lang['id'] == '2') $drupal_url = $site_url.'d/en/purchase/'.$package_required.'/package'; else $drupal_url = $site_url.'d/izvedi-nakup/'.$package_required.'/podatki'; + + echo '

'.$lang['srv_access_upgrade'].'

'; + + echo ''; + // Ce user ni avtor ankete if($this->user_not_author){ echo '

'.$lang['srv_access_no_access_not_author'].'

'; } echo '

'.$lang['srv_access_no_access'].' "'.$package_required_name.'".

'; + + echo '
'; + echo ' '; if(!$this->user_not_author) - echo ''; - echo ''; + echo ' '; + echo '
'; } // Izpisemo obvestilo, da je funkcionalnost onemogocena in naj kupi paket @@ -402,7 +434,8 @@ class UserAccess{ // Kateri paket je potreben za to funkcionalnost $package_required = (isset($this->functionality_package[$what])) ? $this->functionality_package[$what] : 3; - $package_required_name = $this->packages[$package_required]['name']; + $package_temp = $this->packages[$package_required]['name']; + $package_required_name = $lang['paket_opis_'.$package_temp]; echo '

'; @@ -459,6 +492,22 @@ class UserAccess{ return $what; } + public function getPackageName($package_id) { + global $lang; + + $string = ''; + + if ($package_id == 1) { + $string = $lang['paket_opis_1ka']; + } else if($package_id == 2) { + $string = $lang['paket_opis_2ka']; + } else if($package_id == 3) { + $string = $lang['paket_opis_3ka']; + } + + return $string; + } + // Ajax klici public function ajax(){ diff --git a/frontend/payments/classes/class.UserNarocila.php b/frontend/payments/classes/class.UserNarocila.php index e831e33..cc562c2 100644 --- a/frontend/payments/classes/class.UserNarocila.php +++ b/frontend/payments/classes/class.UserNarocila.php @@ -32,6 +32,39 @@ class UserNarocila{ } + // Dobimo podatke zadnjega narocila za dolocenega uporabnika + public function getNarocilo($narocilo_id){ + global $admin_type; + + $return = array(); + + // Dobimo narocilo uporabnika + $sqlNarocilo = sisplet_query("SELECT un.*, up.name AS package_name, up.description AS package_description, up.price AS package_price + FROM user_access_narocilo un, user_access_paket up + WHERE un.id='".$narocilo_id."' AND un.package_id=up.id + "); + + // Uporabnik nima se nobenega narocila + if(mysqli_num_rows($sqlNarocilo) == 0){ + $return['id'] = '0'; + } + else{ + $row = mysqli_fetch_array($sqlNarocilo); + $return = $row; + + // Cena + $cena = $this->getPrice($row['package_name'], $row['trajanje'], $row['discount'], $row['time']); + + // Zavezanec iz tujine nima ddv-ja + if($this->isWithoutDDV($row['id'])) + $return['koncna_cena'] = $cena['final_without_tax']; + else + $return['koncna_cena'] = $cena['final']; + } + + return $return; + } + // Dobimo array narocil (vseh oz. za dolocenega uporabnika) private function getNarocila($usr_id=0){ global $admin_type; @@ -77,6 +110,30 @@ class UserNarocila{ return $narocila; } + // Dobimo podatke zadnjega narocila za dolocenega uporabnika + public function getLastNarocilo($usr_id){ + global $admin_type; + + $return = array(); + + // Dobimo zadnje narocilo uporabnika + $sqlNarocilo = sisplet_query("SELECT un.*, up.name AS package_name, up.description AS package_description, up.price AS package_price + FROM user_access_narocilo un, user_access_paket up + WHERE un.usr_id='".$usr_id."' AND un.package_id=up.id + ORDER BY un.time DESC + "); + + // Uporabnik nima se nobenega narocila + if(mysqli_num_rows($sqlNarocilo) == 0){ + $return['id'] = '0'; + } + else{ + $return = mysqli_fetch_array($sqlNarocilo); + } + + return $return; + } + // Izracunamo koncno ceno glede na paket, trajanje in popust (v eur) public function getPrice($package_name, $trajanje, $discount=0, $time=''){ @@ -294,16 +351,71 @@ class UserNarocila{ $ua = UserAccess::getInstance($global_user_id); $user_access = $ua->getAccess(); - // Ce ni polja v bazi oz je nastavljen paket na 1 ima osnovni paket - if(!$user_access || $user_access['package_id'] == '1'){ - echo '

'.$lang['srv_narocila_current_package'].': 1KA

'; + $sqlA = sisplet_query("SELECT ua.time_activate, ua.time_expire, uap.id AS package_id, uap.name AS package_name + FROM user_access ua, user_access_paket uap + WHERE ua.usr_id='$global_user_id' AND uap.id=ua.package_id + "); + $rowA = mysqli_fetch_array($sqlA); + + echo '
'; + + echo ''; + + echo ''; + + echo '
'; echo ''; @@ -337,37 +449,55 @@ class UserNarocila{ echo ' '; echo ' '; - echo ' '.$lang['srv_narocilo_paket'].''; - echo ' '.$lang['srv_narocilo_trajanje'].' ('.$lang['srv_narocilo_trajanje_mesecev'].')'; echo ' '.$lang['srv_narocilo_cas'].''; - echo ' '.$lang['srv_narocilo_nacin_placila'].''; - echo ' '.$lang['srv_narocilo_cena'].''; + echo ' '.$lang['srv_narocilo_paket'].''; + echo ' '.$lang['srv_narocilo_veljavnodo'].''; + echo ' '.$lang['srv_narocilo_samo_cena'].''; echo ' '.$lang['srv_narocilo_status'].''; - echo ' '.$lang['srv_narocilo_pdf'].''; - + echo ' '.$lang['srv_narocilo_pdf_predracun'].''; + echo ' '.$lang['srv_narocilo_pdf_racun'].''; echo ' '; echo ' '; // Vsebina tabele echo ' '; + $userAccess = UserAccess::getInstance($global_user_id); + foreach($data as $usr_id => $data_row){ + $package_name = $userAccess->getPackageName($data_row['package_id']); + echo ''; - echo ''.$data_row['package_name'].''; - echo ''.$data_row['trajanje'].''; echo ''.date("j.n.Y H:i", strtotime($data_row['time'])).''; - echo ''.$data_row['payment_method'].''; + + //Sklanjanje za število mesecev + if ($data_row['trajanje'] == 1) + $trajanje = $data_row['trajanje'] .' '. $lang['srv_narocilo_trajanje_1']; + else if ($data_row['trajanje'] == 2) + $trajanje = $data_row['trajanje'] .' '. $lang['srv_narocilo_trajanje_2']; + else if ($data_row['trajanje'] == 3 || $data_row['trajanje'] == 4) + $trajanje = $data_row['trajanje'] .' '. $lang['srv_narocilo_trajanje_3_4']; + else + $trajanje = $data_row['trajanje'] .' '. $lang['srv_narocilo_trajanje_5']; + + echo ''.$package_name.' ('.$trajanje.')'; + + //Veljavnost paketa + $meseci = $data_row['trajanje']; + $veljaven_do = date("j.n.Y H:i", strtotime("+$meseci months", strtotime($data_row['time']))); + + echo ''.$veljaven_do.''; // Cena $cena = $this->getPrice($data_row['package_name'], $data_row['trajanje'], $data_row['discount'], $data_row['time']); // Zavezanec iz tujine nima ddv-ja if($this->isWithoutDDV($data_row['id'])) - echo ''.$cena['final_without_tax'].''; + echo ''.$cena['final_without_tax'].'€'; else - echo ''.$cena['final'].''; + echo ''.$cena['final'].'€'; if($data_row['status'] == '0') $status_color = 'red'; @@ -378,12 +508,13 @@ class UserNarocila{ echo ''.$lang['srv_narocilo_status_'.$data_row['status']].''; // PDF - echo ''; - echo ''.$lang['srv_narocilo_pdf_predracun'].''; + echo ''; + if($data_row['status'] == '1'){ - echo ' | '.$lang['srv_narocilo_pdf_racun'].''; + echo ''; } - echo ''; + else + echo ''; echo ''; } @@ -395,16 +526,16 @@ class UserNarocila{ // Izpisemo seznam vseh narocil - admin public function displayNarocilaTableAdmin(){ - global $lang, $global_user_id, $app_settings; + global $lang, $global_user_id; // Admini vidijo vsa narocila $data = $this->getNarocila(); // Filtri po statusu echo '
'; - echo ''; - echo ''; - echo ''; + echo ' narocila_filter['neplacana'] == 1 ? 'checked="checked"' : '').' onClick="filterNarocila(\'0\', this.checked)">'; + echo ' narocila_filter['placana'] == 1 ? 'checked="checked"' : '').' onClick="filterNarocila(\'1\', this.checked)">'; + echo ' narocila_filter['stornirana'] == 1 ? 'checked="checked"' : '').' onClick="filterNarocila(\'2\', this.checked)">'; echo '
'; echo ''; @@ -468,7 +599,7 @@ class UserNarocila{ echo $lang['srv_narocilo_status_'.$data_row['status']]; // Na www.1ka.si lahko narocilo placa samo Goran - if($data_row['status'] != '1' && $data_row['status'] != '2' && ($app_settings['app_name'] != 'www.1ka.si' || $global_user_id == '112696')){ + if($data_row['status'] != '1' && $data_row['status'] != '2' && (AppSettings::getInstance()->getSetting('app_settings-app_name') != 'www.1ka.si' || $global_user_id == '112696')){ echo '
'; echo ''.$lang['srv_narocilo_placaj'].''; @@ -761,6 +892,10 @@ class UserNarocila{ return $response; } + + // Ce je slucajno drzava prazna jo nastavimo na slovenijo - zankrat pustimo, da vidimo, ce se se kdaj poslje prazno polje (naceloma se nebi smelo) + /*if($podjetje_drzava == '') + $podjetje_drzava = 'Slovenija';*/ // Nastavimo ce placa DDV (zavezanci iz EU ga ne placajo) if(self::checkPayDDV($podjetje_davcna, $podjetje_drzava)) @@ -1112,8 +1247,27 @@ class UserNarocila{ // Ustvarimo racun - $cebelica = new UserNarocilaCebelica($narocilo_id); - $response['racun'] = $cebelica->getNarociloRacun(); + try{ + $cebelica = new UserNarocilaCebelica($narocilo_id); + $response['racun'] = $cebelica->getNarociloRacun(); + } + // Napaka pri komunikaciji s cebelco - posljemo mail Goranu + catch (Exception $e){ + + // Posljemo mail Goranu, da je prislo do napake pri generiranju racuna + $subject = '1ka - napaka pri generiranju računa'; + $content = 'Prišlo je do napake pri generiranju računa (komunikacija s čebelco) pri naročilu št. '.$rowNarocilo['id'].' (uporabnik '.$rowNarocilo['email'].')!'; + $content .= '

Preveri in samo še enkrat odpri račun za to plačilo preko vmesnika (ga bo zgeneriralo avtomatsko).'; + + $MA = new MailAdapter($anketa=null, $type='payments'); + $MA->addRecipients('goran@go-tel.si'); + $MA->addRecipients('peter@1ka.si'); + $resultX = $MA->sendMail($content, $subject); + + $response['false'] = true; + + return $response; + } // Posljemo mail z racunom @@ -1314,6 +1468,22 @@ class UserNarocila{ // Lastna instalacija - paket $strinjanje_s_pogoji = isset($narocilo_data['strinjanje_s_pogoji']) ? $narocilo_data['strinjanje_s_pogoji'] : ''; + // Varnostno preverimo, če robot izpolni polje + $varnostno_polje = isset($narocilo_data['varnostno-polje']) ? $narocilo_data['varnostno-polje'] : ''; + if(!empty($varnostno_polje)){ + return ['false' => true]; + } + + // Preverimo ReCaptcha + if (in_array($paket, [1,2,3]) && AppSettings::getInstance()->getSetting('google-secret_captcha') !== false) { + $recaptchaResponse = isset($narocilo_data['g-recaptcha-response']) ? $narocilo_data['g-recaptcha-response'] : ''; + $requestReCaptcha = file_get_contents('https://www.google.com/recaptcha/api/siteverify?secret=' . AppSettings::getInstance()->getSetting('google-secret_captcha') . '&response=' . $recaptchaResponse); + + if (!strstr($requestReCaptcha, 'true')) { + return ['false' => true]; + } + } + // Posljemo mail s podatki povprasevanja $subject = $lang['srv_narocilo_poslovni_email_1ka_subject']; @@ -1414,6 +1584,7 @@ class UserNarocila{ $countries_eu['Bulgaria'] = 'BG'; $countries_eu['Cyprus'] = 'CY'; $countries_eu['Czech Republic'] = 'CZ'; + $countries_eu['Czechia'] = 'CZ'; $countries_eu['Germany'] = 'DE'; $countries_eu['Denmark'] = 'DK'; $countries_eu['Estonia'] = 'EE'; diff --git a/frontend/payments/classes/class.UserNarocilaCebelica.php b/frontend/payments/classes/class.UserNarocilaCebelica.php index f7c823b..0cd8e84 100644 --- a/frontend/payments/classes/class.UserNarocilaCebelica.php +++ b/frontend/payments/classes/class.UserNarocilaCebelica.php @@ -29,10 +29,9 @@ class UserNarocilaCebelica{ public function __construct($narocilo_id=0){ - global $cebelica_api; // Api koda za komunikacijo s cebelico - define("API_KODA", $cebelica_api); + define("API_KODA", AppSettings::getInstance()->getSetting('cebelica_api')); if($narocilo_id > 0){ @@ -211,6 +210,7 @@ class UserNarocilaCebelica{ return $cebelica_id_new; } else{ + throw new Exception("Napaka pri vnosu dokumenta v cebelca.biz."); return "Napaka pri vnosu dokumenta v cebelca.biz."; } } diff --git a/frontend/payments/classes/class.UserNarocilaCron.php b/frontend/payments/classes/class.UserNarocilaCron.php index a763dad..92ff8eb 100644 --- a/frontend/payments/classes/class.UserNarocilaCron.php +++ b/frontend/payments/classes/class.UserNarocilaCron.php @@ -16,7 +16,6 @@ class UserNarocilaCron{ public function __construct(){ - global $app_settings; } diff --git a/frontend/payments/classes/class.UserNarocilaPaypal.php b/frontend/payments/classes/class.UserNarocilaPaypal.php index de8bb64..d7c0189 100644 --- a/frontend/payments/classes/class.UserNarocilaPaypal.php +++ b/frontend/payments/classes/class.UserNarocilaPaypal.php @@ -21,10 +21,7 @@ class UserNarocilaPaypal{ private $paypal_client; - public function __construct($narocilo_id){ - global $app_settings; - global $paypal_client_id; - global $paypal_secret; + public function __construct($narocilo_id){ global $mysql_database_name; if($narocilo_id > 0){ @@ -43,9 +40,9 @@ class UserNarocilaPaypal{ // Ustvarimo okolje za paypal if($mysql_database_name == 'real1kasi') - $environment = new ProductionEnvironment($paypal_client_id, $paypal_secret); + $environment = new ProductionEnvironment(AppSettings::getInstance()->getSetting('paypal-client_id'), AppSettings::getInstance()->getSetting('paypal-secret')); else - $environment = new SandboxEnvironment($paypal_client_id, $paypal_secret); + $environment = new SandboxEnvironment(AppSettings::getInstance()->getSetting('paypal-client_id'), AppSettings::getInstance()->getSetting('paypal-secret')); $this->paypal_client = new PayPalHttpClient($environment); } @@ -135,12 +132,12 @@ class UserNarocilaPaypal{ //$request->headers["prefer"] = "return=representation"; if($lang['id'] == '2'){ - $drupal_url_confirm = $site_url.'/d/en/paypal-purchase/success?narocilo_id='.$orderDetails['narocilo_id']; - $drupal_url_cancel = $site_url.'/d/en/paypal-purchase/cancel?narocilo_id='.$orderDetails['narocilo_id']; + $drupal_url_confirm = $site_url.'/d/en/purchase/paypal?narocilo_id='.$orderDetails['narocilo_id']; + $drupal_url_cancel = $site_url.'/d/en/purchase/paypal-cancel?narocilo_id='.$orderDetails['narocilo_id']; } else{ - $drupal_url_confirm = $site_url.'/d/narocilo/paypal?narocilo_id='.$orderDetails['narocilo_id']; - $drupal_url_cancel = $site_url.'/d/narocilo/paypal-cancel?narocilo_id='.$orderDetails['narocilo_id']; + $drupal_url_confirm = $site_url.'/d/sl/narocilo/paypal?narocilo_id='.$orderDetails['narocilo_id']; + $drupal_url_cancel = $site_url.'/d/sl/narocilo/paypal-cancel?narocilo_id='.$orderDetails['narocilo_id']; } $request->body = [ diff --git a/frontend/payments/classes/class.UserNarocilaStripe.php b/frontend/payments/classes/class.UserNarocilaStripe.php index 82efce2..d0b3ef5 100644 --- a/frontend/payments/classes/class.UserNarocilaStripe.php +++ b/frontend/payments/classes/class.UserNarocilaStripe.php @@ -25,11 +25,8 @@ class UserNarocilaStripe{ public function __construct($narocilo_id){ - global $app_settings; - global $stripe_secret; - global $stripe_key; - $this->stripeService = new \Stripe\StripeClient($stripe_secret); + $this->stripeService = new \Stripe\StripeClient(AppSettings::getInstance()->getSetting('stripe-secret')); if($narocilo_id > 0){ @@ -84,12 +81,12 @@ class UserNarocilaStripe{ // URL po potrditvi oz preklicu if($lang['id'] == '2'){ - $drupal_url_confirm = $site_url.'/d/en/stripe-purchase/success?narocilo_id='.$this->narocilo['id']; - $drupal_url_cancel = $site_url.'/d/en/stripe-purchase/cancel?narocilo_id='.$this->narocilo['id']; + $drupal_url_confirm = $site_url.'/d/en/purchase/stripe?narocilo_id='.$this->narocilo['id']; + $drupal_url_cancel = $site_url.'/d/en/purchase/stripe-cancel?narocilo_id='.$this->narocilo['id']; } else{ - $drupal_url_confirm = $site_url.'/d/narocilo/stripe?narocilo_id='.$this->narocilo['id']; - $drupal_url_cancel = $site_url.'/d/narocilo/stripe-cancel?narocilo_id='.$this->narocilo['id']; + $drupal_url_confirm = $site_url.'/d/sl/narocilo/stripe?narocilo_id='.$this->narocilo['id']; + $drupal_url_cancel = $site_url.'/d/sl/narocilo/stripe-cancel?narocilo_id='.$this->narocilo['id']; } // Ustvarimo checkout session diff --git a/frontend/payments/classes/class.UserPlacila.php b/frontend/payments/classes/class.UserPlacila.php index a21d6fb..53305fa 100644 --- a/frontend/payments/classes/class.UserPlacila.php +++ b/frontend/payments/classes/class.UserPlacila.php @@ -105,7 +105,7 @@ class UserPlacila{ // Izpisemo podatke o placilih public function displayPlacila(){ - global $lang, $global_user_id, $app_settings; + global $lang, $global_user_id; // Tabela vseh placil $this->displayPlacilaTable(); @@ -116,13 +116,13 @@ class UserPlacila{ echo '';*/ // Izracun zasluzka in provizij po mesecih - samo Goran - if($app_settings['app_name'] == 'www.1ka.si' && $global_user_id == '112696') + if(AppSettings::getInstance()->getSetting('app_settings-app_name') == 'www.1ka.si' && $global_user_id == '112696') $this->displayPlacilaPovzetek(); } // Izpisemo seznam vseh placil public function displayPlacilaTable(){ - global $lang, $global_user_id, $app_settings; + global $lang, $global_user_id; // Admini vidijo vsa placila $data = $this->getPlacila(); @@ -194,7 +194,7 @@ class UserPlacila{ // Edit / delete echo '
'; // Na www.1ka.si lahko placilo ureja samo Goran - if($app_settings['app_name'] != 'www.1ka.si' || $global_user_id == '112696'){ + if(AppSettings::getInstance()->getSetting('app_settings-app_name') != 'www.1ka.si' || $global_user_id == '112696'){ // Uredi echo ' | '; -- cgit v1.2.3