mirror of
https://gitlab.com/t6353/sharee.bike.git
synced 2025-02-23 04:06:27 +01:00
sig minor changes2
This commit is contained in:
parent
a0872ed063
commit
d918794ef0
2 changed files with 8 additions and 5 deletions
|
@ -64,7 +64,8 @@ sub handler {
|
||||||
|
|
||||||
|
|
||||||
my $response = {
|
my $response = {
|
||||||
response_state => "OK, nothing todo",
|
event => "",
|
||||||
|
response_state => "Event doesn't match",
|
||||||
};
|
};
|
||||||
|
|
||||||
my $http_sharee_api_key = $headers{HTTP_SHAREE_API_KEY} || $R::HTTP_SHAREE_API_KEY || "";
|
my $http_sharee_api_key = $headers{HTTP_SHAREE_API_KEY} || $R::HTTP_SHAREE_API_KEY || "";
|
||||||
|
@ -122,6 +123,7 @@ sub sig_booking_update {
|
||||||
my $response_in = {};
|
my $response_in = {};
|
||||||
$response_in = decode_json($POSTDATA) if($POSTDATA);
|
$response_in = decode_json($POSTDATA) if($POSTDATA);
|
||||||
|
|
||||||
|
$response->{event} = "$response_in->{event}";
|
||||||
if($response_in->{event} && $response_in->{event} eq "RENTAL_END"){
|
if($response_in->{event} && $response_in->{event} eq "RENTAL_END"){
|
||||||
|
|
||||||
my $rentalId = $q->escapeHTML($response_in->{data}->{rentalId}) || "";
|
my $rentalId = $q->escapeHTML($response_in->{data}->{rentalId}) || "";
|
||||||
|
@ -160,11 +162,12 @@ sub sig_booking_update {
|
||||||
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book) if($authraw->{c_id});
|
($rows, $booking_values) = $apif->booking_update($q,\%varenv,$authraw,$aowner,$sig_book) if($authraw->{c_id});
|
||||||
|
|
||||||
#response is for sig json after rental-end
|
#response is for sig json after rental-end
|
||||||
delete $booking_values->{geo_distance};
|
|
||||||
delete $booking_values->{response_state};
|
|
||||||
delete $booking_values->{response_text};
|
|
||||||
$booking_values->{bikeId} = $sig_book->{bikeId};
|
$booking_values->{bikeId} = $sig_book->{bikeId};
|
||||||
$booking_values->{rentalId} = $sig_book->{rentalId};
|
$booking_values->{rentalId} = $sig_book->{rentalId};
|
||||||
|
delete $booking_values->{geo_distance};
|
||||||
|
delete $booking_values->{co2saving};
|
||||||
|
delete $booking_values->{bike};
|
||||||
|
delete $booking_values->{response_text};
|
||||||
$response = {%$response, %$booking_values};
|
$response = {%$response, %$booking_values};
|
||||||
}else{
|
}else{
|
||||||
$response->{response_state} = "Failure: there is no rental with rentalID=$rentalId";
|
$response->{response_state} = "Failure: there is no rental with rentalID=$rentalId";
|
||||||
|
@ -180,6 +183,7 @@ sub sig_booking_update {
|
||||||
print FILE "failure! can not decode POST json, POSTDATA:\n" . Dumper($q->param('POSTDATA')) . "\n" if($debug);
|
print FILE "failure! can not decode POST json, POSTDATA:\n" . Dumper($q->param('POSTDATA')) . "\n" if($debug);
|
||||||
#warn $@;
|
#warn $@;
|
||||||
print FILE "warn:" . $@ . "\n" if($debug);
|
print FILE "warn:" . $@ . "\n" if($debug);
|
||||||
|
$response->{response_state} = "Failure: can not decode POST json";
|
||||||
}
|
}
|
||||||
|
|
||||||
}#end sig json booking_update
|
}#end sig json booking_update
|
||||||
|
|
|
@ -311,7 +311,6 @@ sub sig_booking {
|
||||||
elsif($todo eq "rental"){
|
elsif($todo eq "rental"){
|
||||||
$endpoint .= "rental";
|
$endpoint .= "rental";
|
||||||
my $sig_bikeId = $ctpos->{txt22} || $ct_bike->{txt22};
|
my $sig_bikeId = $ctpos->{txt22} || $ct_bike->{txt22};
|
||||||
#my $sig_bikeId = "380116b5-0522-43da-ab66-477744a731a3";
|
|
||||||
%json = (
|
%json = (
|
||||||
bikeId => "$sig_bikeId",
|
bikeId => "$sig_bikeId",
|
||||||
email => "$ctadr->{txt08}"
|
email => "$ctadr->{txt08}"
|
||||||
|
|
Loading…
Add table
Reference in a new issue