Subversion Repositories VORC

Rev

Rev 159 | Rev 235 | Go to most recent revision | Show entire file | Ignore whitespace | Details | Blame | Last modification | View Log | RSS feed

Rev 159 Rev 173
Line 14... Line 14...
14
 
14
 
Line 15... Line 15...
15
my $inputfile = shift // "";
15
my $inputfile = shift // "";
16
 
16
 
-
 
17
if ($inputfile) {
17
if ($inputfile) {
18
	process_file ($inputfile);
18
	process_file ($inputfile);
19
	add_wrstbnd_ids ();
19
} else {
20
} else {
Line 20... Line 21...
20
	error ("No input file specified.");
21
	error ("No input file specified.");
Line 86... Line 87...
86
	my $msg = shift;
87
	my $msg = shift;
87
	logit (0, "Problem with Bulk MVP Pass upload: ".$msg);
88
	logit (0, "Problem with Bulk MVP Pass upload: ".$msg);
88
	print "Error: $msg\n";
89
	print "Error: $msg\n";
89
	exit (1);
90
	exit (1);
90
}
91
}
-
 
92
 
-
 
93
sub add_wrstbnd_ids {
-
 
94
  use REST::Client;
-
 
95
  use JSON;
-
 
96
  
-
 
97
  my $sth = $dbh->prepare ("update ticket set wrstbnd_accountid = ? where id = ?");
-
 
98
  my @REGIDS;
-
 
99
  push @REGIDS, map { @{$_} } @{ $dbh->selectall_arrayref ("select id from ticket where event_name = ? and isnull(wrstbnd_accountid) = 1", undef, "RollerCon 2024") };
-
 
100
  foreach (@REGIDS) {
-
 
101
    my $regid = $_;
-
 
102
  	my $wbdid = getAccountId ($regid);
-
 
103
  	$sth->execute ($wbdid, $regid);
-
 
104
  }
-
 
105
}
-
 
106
 
-
 
107
sub getAccountId {
-
 
108
	my $eventsReg = shift // "";
-
 
109
	warn "ERROR: No Events.com Regstration provided to getAccountId()!" and return "" unless $eventsReg;
-
 
110
	
-
 
111
	my $headers = { Authorization => '601037851507c624' };
-
 
112
	my $wb_event_id = "event_Y5567UWwS5";
-
 
113
	my $client = REST::Client->new();
-
 
114
	
-
 
115
	$client->setHost('https://core.wrstbnd.io');
-
 
116
	$client->GET(
-
 
117
    '/rest/core/v1/ticket?eventid='.$wb_event_id.'&barcode='.$eventsReg,
-
 
118
    $headers
-
 
119
	);
-
 
120
	my $response = from_json($client->responseContent());
-
 
121
 
-
 
122
	return $response->{accountId};
-
 
123
}