line |
stmt |
bran |
cond |
sub |
pod |
time |
code |
1
|
|
|
|
|
|
|
package WebService::Braintree::CreditCardVerificationGateway; |
2
|
|
|
|
|
|
|
$WebService::Braintree::CreditCardVerificationGateway::VERSION = '0.93'; |
3
|
1
|
|
|
1
|
|
8
|
use Moose; |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
9
|
|
4
|
1
|
|
|
1
|
|
8868
|
use WebService::Braintree::CreditCardVerificationSearch; |
|
1
|
|
|
|
|
6
|
|
|
1
|
|
|
|
|
60
|
|
5
|
1
|
|
|
1
|
|
14
|
use WebService::Braintree::Util; |
|
1
|
|
|
|
|
3
|
|
|
1
|
|
|
|
|
131
|
|
6
|
1
|
|
|
1
|
|
8
|
use Carp qw(confess); |
|
1
|
|
|
|
|
2
|
|
|
1
|
|
|
|
|
427
|
|
7
|
|
|
|
|
|
|
|
8
|
|
|
|
|
|
|
has 'gateway' => (is => 'ro'); |
9
|
|
|
|
|
|
|
|
10
|
|
|
|
|
|
|
sub find { |
11
|
0
|
|
|
0
|
0
|
|
my ($self, $id) = @_; |
12
|
0
|
0
|
|
|
|
|
confess "NotFoundError" unless validate_id($id); |
13
|
0
|
|
|
|
|
|
my $response = $self->gateway->http->get("/verifications/$id"); |
14
|
0
|
|
|
|
|
|
return WebService::Braintree::CreditCardVerification->new($response->{'verification'}); |
15
|
|
|
|
|
|
|
} |
16
|
|
|
|
|
|
|
|
17
|
|
|
|
|
|
|
sub search { |
18
|
0
|
|
|
0
|
0
|
|
my ($self, $block) = @_; |
19
|
0
|
|
|
|
|
|
my $search = WebService::Braintree::CreditCardVerificationSearch->new; |
20
|
0
|
|
|
|
|
|
my $params = $block->($search)->to_hash; |
21
|
0
|
|
|
|
|
|
my $response = $self->gateway->http->post("/verifications/advanced_search_ids", {search => $params}); |
22
|
|
|
|
|
|
|
return WebService::Braintree::ResourceCollection->new()->init($response, sub { |
23
|
0
|
|
|
0
|
|
|
$self->fetch_verifications($search, shift); |
24
|
0
|
|
|
|
|
|
}); |
25
|
|
|
|
|
|
|
} |
26
|
|
|
|
|
|
|
|
27
|
|
|
|
|
|
|
sub all { |
28
|
0
|
|
|
0
|
0
|
|
my $self = shift; |
29
|
0
|
|
|
|
|
|
my $response = $self->gateway->http->post("/verifications/advanced_search_ids"); |
30
|
|
|
|
|
|
|
return WebService::Braintree::ResourceCollection->new()->init($response, sub { |
31
|
0
|
|
|
0
|
|
|
$self->fetch_verifications(WebService::Braintree::CreditCardVerificationSearch->new, shift); |
32
|
0
|
|
|
|
|
|
}); |
33
|
|
|
|
|
|
|
} |
34
|
|
|
|
|
|
|
|
35
|
|
|
|
|
|
|
sub fetch_verifications { |
36
|
0
|
|
|
0
|
0
|
|
my ($self, $search, $ids) = @_; |
37
|
0
|
|
|
|
|
|
$search->ids->in($ids); |
38
|
0
|
0
|
|
|
|
|
return [] if scalar @{$ids} == 0; |
|
0
|
|
|
|
|
|
|
39
|
0
|
|
|
|
|
|
my $response = $self->gateway->http->post("/verifications/advanced_search/", {search => $search->to_hash}); |
40
|
0
|
|
|
|
|
|
my $attrs = $response->{'credit_card_verifications'}->{'verification'}; |
41
|
0
|
|
|
|
|
|
return to_instance_array($attrs, "WebService::Braintree::CreditCardVerification"); |
42
|
|
|
|
|
|
|
} |
43
|
|
|
|
|
|
|
|
44
|
|
|
|
|
|
|
__PACKAGE__->meta->make_immutable; |
45
|
|
|
|
|
|
|
1; |
46
|
|
|
|
|
|
|
|