diff --git a/copri4/main/src/Mod/APIjsonserver.pm b/copri4/main/src/Mod/APIjsonserver.pm
index 6cf2840..00fd759 100755
--- a/copri4/main/src/Mod/APIjsonserver.pm
+++ b/copri4/main/src/Mod/APIjsonserver.pm
@@ -296,7 +296,7 @@ elsif($q->param('request') eq "booking_request"){
#usecase with reservationId (in ctpos) is in sig not defined, thats because using ct_bike.txt22
#$sig_book = $si->sig_booking(\%varenv,"rental",$authraw,$ct_bike,$ctpos);
#we have to use $ct_bike->{txt22} because we doesn't using sig reserve in this case
- system("$varenv{basedir}/src/scripts/sig_client.pl $varenv{syshost} 'rental' $authraw->{c_id} $ct_bike->{txt22} $ctpos->{c_id} &");
+ system("$varenv{basedir}/src/scripts/sig_client.pl '$varenv{syshost}' 'rental' '$authraw->{c_id}' '$ct_bike->{txt22}' '$ctpos->{c_id}' &");
$sig_book->{rentalId} = "$R::rentalId" if($R::rentalId);#only for cmd tests
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book);
$response = {%$response, %$booking_values};
@@ -379,12 +379,13 @@ elsif($q->param('request') eq "booking_cancel" || $q->param('request') eq "booki
#update on sig
if($ctpos->{int11} == 3){
if($q->param('state') eq "occupied"){
- system("$varenv{basedir}/src/scripts/sig_client.pl $varenv{syshost} 'rental' $authraw->{c_id} $ctpos->{txt22} $ctpos->{c_id} &");
+ system("$varenv{basedir}/src/scripts/sig_client.pl '$varenv{syshost}' 'rental' '$authraw->{c_id}' '$ctpos->{txt22}' '$ctpos->{c_id}' &");
}
#rental/end will be done by sig push-notification
- #if($q->param('state') eq "available"){
- #system("$varenv{basedir}/src/scripts/sig_client.pl $varenv{syshost} 'rental_end' $authraw->{c_id} '' $ctpos->{c_id} &");
- #}
+ #
+ if($q->param('lock_state') eq "unlocking" && !$q->param('state')){
+ system("$varenv{basedir}/src/scripts/sig_client.pl '$varenv{syshost}' 'unlock' '$authraw->{c_id}' '$ctpos->{txt22}' '$ctpos->{c_id}' &");
+ }
#TODO, check if booking_values in both cases: push-notify and/or app trigger works
$sig_book->{rentalId} = "$R::rentalId" if($R::rentalId);#only for cmd tests
diff --git a/copri4/main/src/Mod/APIshareeio.pm b/copri4/main/src/Mod/APIshareeio.pm
index b920f55..f084286 100644
--- a/copri4/main/src/Mod/APIshareeio.pm
+++ b/copri4/main/src/Mod/APIshareeio.pm
@@ -212,7 +212,8 @@ sub sig_booking_update {
my $jrout = $json->pretty->encode({shareeio => $response});
print $jrout;
- $bw->log("APIjsonserver response by $user_agent mapped aowner:$aowner",$jrout,"");
+ print FILE "APIshareeio jrout:\n" . Dumper($jrout) . "\n" if($debug);
+ $bw->log("APIshareeio response by $user_agent mapped aowner:$aowner",$jrout,"");
#end JSON ----------------------------------------------------------------------------
close(FILE) if($debug);
diff --git a/copri4/main/src/Mod/APIsigclient.pm b/copri4/main/src/Mod/APIsigclient.pm
index 1c7dbd0..7d1dbb4 100755
--- a/copri4/main/src/Mod/APIsigclient.pm
+++ b/copri4/main/src/Mod/APIsigclient.pm
@@ -83,7 +83,7 @@ sub sig_available {
my $td_template = $dbt->rental_description_template();
open(FILE,">>$varenv->{logdir}/APIsigclient.log");
- print FILE "\n*** $now_dt 'sig_available' \n";
+ print FILE "\n0. *** $now_dt 'sig_available' \n";
#my $endpoint = "https://sigo.dev.sigo.green/api/v1/bikes";
my $endpoint = "$dbt->{operator}->{$varenv->{dbname}}->{endpoint}/bikes";
@@ -151,8 +151,8 @@ sub sig_available {
$return2copri->{$station}->{int10} = $key;
}
}
-
- delete $response_out->{$station} if(uc($resp->{site}->{status}) ne "ACTIVE" || !$resp->{site}->{lat} || !$resp->{site}->{lon});
+ #TODO, disabled for workaround to see what happens. 22.06.2022
+ #delete $response_out->{$station} if(uc($resp->{site}->{status}) ne "ACTIVE" || !$resp->{site}->{lat} || !$resp->{site}->{lon});
}
}#end stations_available
@@ -270,6 +270,46 @@ sub sig_available {
return ($response_out,$return2copri);
}#end sig_available
+#bike smartlock unlocking
+sub sig_unlock {
+ my $self = shift;
+ my $varenv = shift || {};
+ my $todo = shift || "";
+ my $ctadr = shift || {};
+ my $ct_bike = shift || {};
+ my $ctpos = shift || {};
+ my $sig_bikeId = $ctpos->{txt22} || $ct_bike->{txt22};
+
+ my $response_in = {};
+ my $dbh = "";
+ my $owner = 169;
+
+ open(FILE,">>$varenv->{logdir}/APIsigclient.log");
+ print FILE "\n3. *** $now_dt 'sig_unlock' \n";
+
+ my $endpoint = "$dbt->{operator}->{$varenv->{dbname}}->{endpoint}/bikes/unlock";
+ my $response_out = {};
+ my $return2copri = {};
+ my $rest_json = $sig_bikeId;
+ (my $ret_json, my $ret_status) = $self->get_sig("$endpoint",$rest_json);
+ eval {
+ $response_in = decode_json($ret_json);
+ $now_dt = strftime "%Y-%m-%d %H:%M:%S", localtime;
+ print FILE "<--- $now_dt sig_unlock response_in with status_line: $ret_status:\n";
+
+ };
+ if ($@){
+ print FILE "<--- failure sig_unlock raw response_in with status_line: $ret_status\n" . Dumper($ret_json) . "\n";
+ #warn $@;
+ print FILE "warn:" . $@ . "\n";
+ }
+
+ print FILE "sig_unlock ret_json from response_in\n" . Dumper($ret_json) . "\n";
+ close(FILE);
+
+ return;
+}
+
#POST resverve, rental, ...
#will be called by sig_client
sub sig_booking {
diff --git a/copri4/main/src/scripts/sig_client.pl b/copri4/main/src/scripts/sig_client.pl
index 7447c50..3520d82 100755
--- a/copri4/main/src/scripts/sig_client.pl
+++ b/copri4/main/src/scripts/sig_client.pl
@@ -71,6 +71,12 @@ $ctpos = $dbt->fetch_tablerecord($dbh,$posref) if($user_id =~ /^\d+$/ && $user_i
print FILE "fetched from DB ctadr:$ctadr->{c_id}|ctpos:$ctpos->{c_id}\n";
+#sig => copri key mapping
+#bike id => txt22
+#reservationId => txt10
+#renatlId => txt11
+
+
#only for tests
if($todo eq "stations_available"){
$q->param(-name=>'request',-value=>"stations_available");
@@ -87,11 +93,6 @@ if($todo eq "bikes_available"){
#print $0 . Dumper($return) . "\n";
}
-#sig => copri key mapping
-#bike id => txt22
-#reservationId => txt10
-#renatlId => txt11
-
#only for tests. build in methode
elsif($todo eq "reserve"){
#$ctadr = { c_id => 1842 };
@@ -108,6 +109,14 @@ elsif($todo eq "rental" && $ctadr->{c_id} > 0){
#print $0 . Dumper($return) . "\n";
}
+#live! Fork unlock by lock_state=unlocking request with bike "id"
+elsif($todo eq "unlock" && $ctadr->{c_id} > 0){
+ #$ctadr = { c_id => 1842 };
+ #$ct_bike = { txt22 => "380116b5-0522-43da-ab66-477744a731a3" };
+ my $return = $si->sig_unlock(\%varenv,$todo,$ctadr,$ct_bike,$ctpos);
+ #print $0 . Dumper($return) . "\n";
+}
+
#live! Fork rental_end request with "rentalId"
elsif($todo eq "rental_end" && $ctadr->{c_id} > 0 && $ctpos->{txt11}){
my $return = $si->sig_booking(\%varenv,$todo,$ctadr,$ct_bike,$ctpos);
diff --git a/copri4/shareeapp-operator/src/Tpl/FormEdit.pm b/copri4/shareeapp-operator/src/Tpl/FormEdit.pm
index f772260..a0e5b9c 100755
--- a/copri4/shareeapp-operator/src/Tpl/FormEdit.pm
+++ b/copri4/shareeapp-operator/src/Tpl/FormEdit.pm
@@ -676,7 +676,8 @@ Nach Abschluss der Registrierung erhalten Sie sowohl auf die von Ihnen hinterleg
}#ende e-Mail iif
- print $q->div({-class=>'content2'}, "Bei Problemen während der Registrierung bitte unsere Account-hotline hotline\@sharee.bike kontaktieren."),"\n" if($project eq "Bayern" && $path =~ /$varenv->{accounting_1}|$varenv->{accounting_3}/);
+ #print $q->div({-class=>'content2'}, "Bei Problemen während der Registrierung bitte unsere Account-hotline hotline\@sharee.bike kontaktieren."),"\n" if($project eq "Bayern" && $path =~ /$varenv->{accounting_1}|$varenv->{accounting_3}/);
+ print $q->div({-class=>'content2', -style=>'margin-top:2em;'}, "Bei Problemen während der Registrierung bitte unsere Account-hotline hotline\@sharee.bike kontaktieren."),"\n" if($project eq "Bayern" && $path =~ /$varenv->{accounting_1}|$varenv->{accounting_3}/);
print "\n";
print $q->end_form,"\n";