mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-05-11 06:17:27 +02:00
Adding payment-type prepaid and refactoring payment selection.
This commit is contained in:
parent
e7959e2da9
commit
b6100696a5
15 changed files with 154 additions and 152 deletions
|
@ -931,7 +931,7 @@ sub booking_request(){
|
|||
if($ct_bike->{barcode} && $ct_tariff->{barcode}){
|
||||
my $ctt = {};
|
||||
my $rentable_check=0;
|
||||
$rentable_check = $self->isuser_rentable($auth,$varenv);
|
||||
$rentable_check = $bw->isuser_rentable($auth,$varenv);
|
||||
|
||||
$bw->log("booking_request isuser_rentable:",$rentable_check,"");
|
||||
|
||||
|
@ -1034,26 +1034,6 @@ sub booking_request(){
|
|||
return $return;
|
||||
}
|
||||
|
||||
#int03=1 if sepa, 2=CC
|
||||
#int04==1 if email Ack
|
||||
#int13==1 if sms Ack
|
||||
#int12!=1|2|3 if Vde
|
||||
#int14==1 if AGB
|
||||
sub isuser_rentable {
|
||||
my $self = shift;
|
||||
my $auth = shift;
|
||||
my $varenv = shift;
|
||||
|
||||
my $rentable_check=0;
|
||||
if(($auth->{int03} == 1 && $auth->{ct_name} =~ /\w{2}-\d+/ && $auth->{ct_name} !~ /LV-\d+/) || ($auth->{int03} == 2 && length($auth->{ct_name}) >= 19) || ($auth->{int03} == 1 && $varenv->{dbname} eq "sharee_lv" && $auth->{ct_name} =~ /LV-\d+/)){
|
||||
$rentable_check=1;
|
||||
if($auth->{txt08} && $auth->{int04} == 1 && $auth->{int13} == 1 && !$auth->{int12} && $auth->{int14}){
|
||||
$rentable_check=2;
|
||||
}
|
||||
}
|
||||
return $rentable_check;
|
||||
}
|
||||
|
||||
#booking_cancel changed to booking_update
|
||||
sub booking_update(){
|
||||
my $self = shift;
|
||||
|
|
|
@ -117,8 +117,15 @@ if(!$coo && !$q->param('merchant_id')){
|
|||
}else{
|
||||
my $return_merchant = { project_id => "" };
|
||||
($aowner, $return_merchant) = $apif->fetch_merchant($q,\%varenv,$coo,$q->param('merchant_id'));
|
||||
#if($aowner && ($aowner == 195 || $aowner == 185 || $aowner == 176)){
|
||||
if($return_merchant->{project_id} eq "Konstanz"){
|
||||
if($return_merchant->{project_id} eq "Freiburg"){
|
||||
$response->{agb_html} = "$dbt->{project_conf}->{Freiburg}->{agb_html}";
|
||||
$response->{tariff_info_html} = "$dbt->{project_conf}->{Freiburg}->{tariff_info_html}";
|
||||
$response->{bike_info_html} = "$dbt->{project_conf}->{Freiburg}->{bike_info_html}";
|
||||
if($lang ne "de"){
|
||||
$response->{tariff_info_html} =~ s/\.html/_en\.html/;
|
||||
}
|
||||
}
|
||||
elsif($return_merchant->{project_id} eq "Konstanz"){
|
||||
$response->{agb_html} = "$dbt->{project_conf}->{Konstanz}->{agb_html}";
|
||||
$response->{tariff_info_html} = "$dbt->{project_conf}->{Konstanz}->{tariff_info_html}";
|
||||
$response->{bike_info_html} = "$dbt->{project_conf}->{Konstanz}->{bike_info_html}";
|
||||
|
@ -127,7 +134,7 @@ if(!$coo && !$q->param('merchant_id')){
|
|||
$response->{bike_info_html} =~ s/\.html/_en\.html/;
|
||||
}
|
||||
}
|
||||
if($return_merchant->{project_id} eq "Bayern"){
|
||||
elsif($return_merchant->{project_id} eq "Bayern"){
|
||||
$response->{agb_html} = "$dbt->{project_conf}->{Bayern}->{agb_html}";
|
||||
$response->{privacy_html} = "$dbt->{project_conf}->{Bayern}->{privacy_html}";
|
||||
$response->{tariff_info_html} = "$dbt->{project_conf}->{Bayern}->{tariff_info_html}";
|
||||
|
|
|
@ -121,5 +121,26 @@ sub battery_percent {
|
|||
return $current_percent;
|
||||
}
|
||||
|
||||
#payable_check and rentable_check
|
||||
#int03==1 if sepa, 2 if CC, 3 if prepaid
|
||||
#int04==1 if email Ack
|
||||
#int13==1 if sms Ack
|
||||
#int12==1|2|3|4 then Vde
|
||||
#int14==1 if AGB
|
||||
sub isuser_rentable {
|
||||
my $self = shift;
|
||||
my $auth = shift;
|
||||
my $varenv = shift;
|
||||
|
||||
my $rentable_check=0;
|
||||
if($auth->{int03} && $auth->{ct_name} && ($auth->{int03} == 1 && $auth->{ct_name} =~ /\w{2}-\d+/) || ($auth->{int03} == 2 && length($auth->{ct_name}) >= 19) || ($auth->{int03} == 3 && $auth->{ct_name} =~ /Prepaid-\d+/i)){
|
||||
$rentable_check=1;
|
||||
if($auth->{txt08} && $auth->{int04} == 1 && $auth->{int13} == 1 && !$auth->{int12} && $auth->{int14}){
|
||||
$rentable_check=2;#if 2 then everything should be alright. rental is enabled
|
||||
}
|
||||
}
|
||||
return $rentable_check;
|
||||
}
|
||||
|
||||
|
||||
1;
|
||||
|
|
|
@ -1897,4 +1897,22 @@ sub search_json(){
|
|||
return ($rows,$sth);
|
||||
}
|
||||
|
||||
#just counting
|
||||
sub count_content(){
|
||||
my $self = shift;
|
||||
my $dbh = shift || $dbh_intern;
|
||||
my $table = shift;
|
||||
my $main_ids = shift;
|
||||
my $tplids = shift;
|
||||
|
||||
$main_ids =~ s/,$//;
|
||||
$tplids =~ s/,$//;
|
||||
my $where = "WHERE rel.content_id=ct.c_id and rel.main_id IN ($main_ids)";
|
||||
$where .= " and rel.template_id IN ($tplids)" if($tplids =~ /\d/);
|
||||
my $sth = $dbh->prepare("SELECT DISTINCT(ct.c_id) FROM relation rel, $table ct $where");
|
||||
my $rc = $sth->execute();
|
||||
my $rows = $sth->rows;
|
||||
return $rows;
|
||||
}
|
||||
|
||||
1;
|
||||
|
|
|
@ -236,12 +236,11 @@ sub handler {
|
|||
}
|
||||
}
|
||||
|
||||
my $payable_check=0;
|
||||
if($users_sharee->{int03} && $users_sharee->{ct_name} && ($users_sharee->{int03} == 1 && $users_sharee->{ct_name} =~ /\w{2}-\d+/) || ($users_sharee->{int03} == 2 && length($users_sharee->{ct_name}) >= 19)){
|
||||
$payable_check=1;
|
||||
}
|
||||
|
||||
|
||||
#$payable_check==1 if payment data OK
|
||||
#$payable_check==2 if payment data AND sms-,email-Ack,:!Vde,AGB OK
|
||||
my $payable_check=0;
|
||||
$payable_check = $bw->isuser_rentable($users_sharee,\%varenv);
|
||||
|
||||
# Logout
|
||||
if($mode =~ /logout/){
|
||||
if($mode =~ /logout_sharee/){
|
||||
|
@ -258,7 +257,7 @@ sub handler {
|
|||
|
||||
|
||||
if($R::login_sharee){
|
||||
if($users_sharee->{c_id} && (($users_sharee->{int03} != 1 && $users_sharee->{int03} != 2)|| ($users_sharee->{txt31} && $tpl->{tpl_order} =~ /$users_sharee->{txt31}/))){
|
||||
if($users_sharee->{c_id} && (!$payable_check || ($users_sharee->{txt31} && $tpl->{tpl_order} =~ /$users_sharee->{txt31}/))){
|
||||
my $row = $db->updater("contentadr","c_id","$users_sharee->{c_id}","int12","1");#Vde
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}$session");
|
||||
exit 0;
|
||||
|
@ -675,7 +674,7 @@ sub handler {
|
|||
}else{
|
||||
my $field = "int13";
|
||||
$field = "int04" if(!$users_sharee->{int04});
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=3$session_and\&failure=$field#top");
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=5$session_and\&failure=$field#top");
|
||||
exit 0;
|
||||
}
|
||||
|
||||
|
@ -700,6 +699,8 @@ sub handler {
|
|||
|
||||
if($R::sharee_edit =~ /save_account/){
|
||||
$returnwww =~ s/::/=/g if($returnwww && $returnwww =~ /success::\w+/);
|
||||
($api_return,$users_sharee) = $apif->auth_verify($q,$coo,"");
|
||||
$payable_check = $bw->isuser_rentable($users_sharee,\%varenv);
|
||||
|
||||
if((!$users_sharee->{int14}) || ($users_sharee->{txt31} && $tpl->{tpl_order} =~ /$users_sharee->{txt31}/)){
|
||||
#failure redirect should do the delete job
|
||||
|
@ -710,16 +711,16 @@ sub handler {
|
|||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1_5}$session");
|
||||
exit 0;
|
||||
}
|
||||
elsif(!$payable_check && $users_sharee->{int03}){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_2}$session");
|
||||
exit 0;
|
||||
}
|
||||
elsif($payable_check && (!$users_sharee->{int04} || !$users_sharee->{int13})){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=2$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}
|
||||
elsif($users_sharee->{int03} && (($users_sharee->{int03} == 1 && $users_sharee->{ct_name} !~ /\w{2}-\d+/) || ($users_sharee->{int03} == 2 && length($users_sharee->{ct_name}) < 19))){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_2}$session");
|
||||
exit 0;
|
||||
}
|
||||
elsif($payable_check){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=2$session_and\&$returnwww");
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=2-$payable_check$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}
|
||||
}elsif($path =~ /$varenv{mandant}\/$varenv{profile}/ && $referer !~ /failure=\w/){
|
||||
|
@ -730,19 +731,19 @@ sub handler {
|
|||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1_5}$session");
|
||||
exit 0;
|
||||
}else{
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=2$session_and\&$returnwww");
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=3$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
}elsif($users_sharee->{c_id} && ($path =~ /$varenv{mandant}\/Anmelden|$varenv{mandant}\/$varenv{profile}/)){
|
||||
if(!$users_sharee->{int14}){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}?cum=2$session_and\&$returnwww");
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1}?cum=4$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}elsif(!$payable_check){
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_1_5}$session");
|
||||
exit 0;
|
||||
}else{
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=2$session_and\&$returnwww");
|
||||
print redirect("$varenv{wwwhost}/$varenv{mandant}/Account/$varenv{accounting_3}?cum=4$session_and\&$returnwww");
|
||||
exit 0;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -21,7 +21,6 @@ use Mod::Libenzdb;
|
|||
use Mod::Libenz;
|
||||
use Mod::DBtank;
|
||||
use Mod::Basework;
|
||||
use Mod::APIfunc;
|
||||
use Mod::Pricing;
|
||||
use Mod::APIsigclient;
|
||||
use Data::Dumper;
|
||||
|
@ -31,7 +30,6 @@ my $db = new Libenzdb;
|
|||
my $lb = new Libenz;
|
||||
my $dbt = new DBtank;
|
||||
my $bw = new Basework;
|
||||
my $apif = new APIfunc;
|
||||
my $pri = new Pricing;
|
||||
my $si = new APIsigclient;
|
||||
|
||||
|
|
|
@ -761,6 +761,17 @@ EOF
|
|||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector_class("$key","eselect","",$ctrel->{$key},@_lock_valxx));
|
||||
}
|
||||
#payment_type by select
|
||||
elsif($node_meta->{tpl_id} == 202 && $key eq "int03" && $size eq "select"){
|
||||
my @_payment_type = ();
|
||||
foreach my $s_key (sort keys (%{ $dbt->{copri_conf}->{payment_type} })) {
|
||||
push @_payment_type, "$s_key:$dbt->{copri_conf}->{payment_type}->{$s_key}";
|
||||
}
|
||||
print $q->Tr();
|
||||
print $q->td({-class=>'left_italic_cms'},"$des"),"\n";
|
||||
print $q->td({-class=>'content1_cms',-colspan=>'2'},$but->selector_class("$key","eselect","",$ctrel->{$key},@_payment_type));
|
||||
}
|
||||
|
||||
elsif($key =~ /int/){
|
||||
$ctrel->{$key} = "75" if($key eq "int06" && !$ctrel->{$key} && $node_meta->{tpl_id} == 225);
|
||||
print $q->Tr();
|
||||
|
|
|
@ -461,7 +461,7 @@ EOF
|
|||
unlink $hashfile;
|
||||
}
|
||||
}
|
||||
$rows = $db->count_content($table,"$main_ids","$tplids");
|
||||
$rows = $dbt->count_content($dbh,$table,$main_ids,$tplids);
|
||||
|
||||
#reload sig bikes and stations states
|
||||
#$bw->log("Liste3 condition",$node_meta,"");
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue