1 package WebService::Northern911::Response;
10 $tree = $tree->{'parameters'} if exists $tree->{'parameters'};
11 my ($key) = grep /Result$/, keys(%$tree); # should only ever be one key
12 $tree = $tree->{$key} or die "can't parse transaction result";
14 my $error_message = join("\n",
15 map { $_->{ErrorMessage} }
16 @{ $tree->{Errors}{Error} }
20 is_success => $tree->{Accepted},
21 error_message => $error_message,
24 if ( $key eq 'QueryCustomerResult' ) {
25 if ($tree->{Accepted}) {
26 $self->{customer} = $tree->{Customer};
27 } elsif ( $tree->{Errors}{Error}[0]{ErrorCode} == 101 ) {
28 # 101 = Customer does not exist. But the query was successful...
29 $self->{is_success} = 1;
31 } elsif ( $key eq 'GetVendorDumpURL' ) {
32 $self->{url} = $tree->{VendorDumpURL};
43 $_[0]->{error_message};
56 WebService::Northern911::Response - Response object returned by
57 WebService::Northern911 API calls
65 1 if the API method was a success, 0 if not. If it's 0, C<error_message>
66 will contain any error returned. Note that we report the C<QueryCustomer>
67 method as a success if it returns a negative result; in that case,
68 C<customer> will be undef.
72 Any error messages returned from the web service, separated by newlines.
76 For C<QueryCustomer> calls, returns a hashref of the customer information
77 per the field names used by C<AddorUpdateCustomer>.
81 For C<GetVendorDumpURL> calls, returns the URL where the data dump can be