Subversion Repositories VORC

Rev

Rev 235 | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 235 Rev 236
Line 950... Line 950...
950
 
950
 
951
sub updateWRSTBND {
951
sub updateWRSTBND {
952
  my ($change, $wb_act_code, $shift_id, $user_id) = @_;
952
  my ($change, $wb_act_code, $shift_id, $user_id) = @_;
953
  use REST::Client;
953
  use REST::Client;
954
  use JSON;
954
  use JSON;
955
  my $headers = { Authorization => '601037851507c624' };
955
  my $headers = { Authorization => getSetting ("WRSTBND_API_KEY") };
956
  my $client = REST::Client->new();
956
  my $client = REST::Client->new();
Line 957... Line 957...
957
  $client->setHost('https://core.wrstbnd.io');
957
  $client->setHost('https://core.wrstbnd.io');
Line 975... Line 975...
975
    );
975
    );
976
    my $response = from_json($client->responseContent());
976
    my $response = from_json($client->responseContent());
Line 977... Line 977...
977
    
977
    
Line -... Line 978...
-
 
978
    my $activationCode = $response->{activationCode};
978
    my $activationCode = $response->{activationCode};
979
    
979
    
980
    my $api_key = getSetting ("WRSTBND_API_KEY");
980
    my @add_response = `/bin/curl --location --request POST 'https://core.wrstbnd.io/rest/core/v1/assign' --header 'Authorization: 601037851507c624' --form accountid=$accountid --form ticketactcode=$activationCode --output /dev/null --silent --write-out '%{http_code}\n'`;
981
    my @add_response = `/bin/curl --location --request POST 'https://core.wrstbnd.io/rest/core/v1/assign' --header 'Authorization: $api_key' --form accountid=$accountid --form ticketactcode=$activationCode --output /dev/null --silent --write-out '%{http_code}\n'`;
Line 981... Line 982...
981
    my $add_response = $add_response[$#add_response];
982
    my $add_response = $add_response[$#add_response];
Line 982... Line 983...
982
    chomp $add_response;
983
    chomp $add_response;
983
    
984
    
984
    $dbh->do ("update assignment set wb_ticket_act = ? where Gid = ? and RCid = ? and role like ?", undef, $activationCode, $shift_id, $user_id, 'CLA-%') unless $add_response ne "200";
985
    $dbh->do ("update assignment set wb_ticket_act = ? where Gid = ? and RCid = ? and role like ?", undef, $activationCode, $shift_id, $user_id, 'CLA-%') unless $add_response ne "200";
-
 
986
    
985
    
987
    return;
986
    return;
988
  } elsif ($change eq "del") {
Line 987... Line 989...
987
  } elsif ($change eq "del") {
989
    my $activationCode = $wb_act_code;
Line 988... Line 990...
988
    my $activationCode = $wb_act_code;
990
    my $api_key = getSetting ("WRSTBND_API_KEY");