Subversion Repositories VORC

Rev

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

Rev 235 Rev 236
Line 15... Line 15...
15
my @REGIDS;
15
my @REGIDS;
16
push @REGIDS, map { @{$_} } @{ $dbh->selectall_arrayref ("select id from ticket where event_name = ?", undef, "RollerCon 2025") };
16
push @REGIDS, map { @{$_} } @{ $dbh->selectall_arrayref ("select id from ticket where event_name = ?", undef, "RollerCon 2025") };
17
foreach (@REGIDS) {
17
foreach (@REGIDS) {
18
  my $regid = $_;
18
  my $regid = $_;
19
  print "Updating RegID: $regid - ";
19
  print "Updating RegID: $regid - ";
20
	my $wbdid = getAccountId ($regid);
20
  my $wbdid = getAccountId ($regid);
-
 
21
  unless ($wbdid) { print "ERROR: No Wrstbnd ID found for ticket.\n" and next; }
21
	print "$wbdid";
22
  print "$wbdid";
22
	$sth->execute ($wbdid, $regid);
23
  $sth->execute ($wbdid, $regid);
23
	print " - Done.\n";
24
  print " - Done.\n";
24
}
25
}
Line 25... Line 26...
25
 
26
 
Line 36... Line 37...
36
       [];
37
       [];
37
   }
38
   }
38
}
39
}
Line 39... Line 40...
39
 
40
 
40
sub getAccountId {
41
sub getAccountId {
41
	my $eventsReg = shift // "";
42
  my $eventsReg = shift // "";
42
	warn "ERROR: No Events.com Regstration provided to getAccountId()!" and return "" unless $eventsReg;
43
  warn "ERROR: No Events.com Regstration provided to getAccountId()!" and return "" unless $eventsReg;
43
	
44
  
44
	my $headers = { Authorization => '601037851507c624' };
45
  my $headers = { Authorization => getSetting ("WRSTBND_API_KEY") };
45
	my $wb_event_id = "event_893C6u5olU";
46
  my $wb_event_id = "event_893C6u5olU";
46
	my $client = REST::Client->new();
47
  my $client = REST::Client->new();
47
	
48
  
48
	$client->setHost('https://core.wrstbnd.io');
49
  $client->setHost('https://core.wrstbnd.io');
49
	$client->GET(
50
  $client->GET(
50
    '/rest/core/v1/ticket?eventid='.$wb_event_id.'&barcode='.$eventsReg,
51
    '/rest/core/v1/ticket/actcode/'.$eventsReg'?eventid='.$wb_event_id,
51
    $headers
52
    $headers
52
	);
53
  );
Line 53... Line 54...
53
	my $response = from_json($client->responseContent());
54
  my $response = from_json($client->responseContent());
Line 54... Line 55...
54
 
55
 
55
	warn Dumper $response if $DEBUG;
56
  warn Dumper $response if $DEBUG;