« lib/WebService/Braintree/PayPalAccountGateway.pm
↑ Summary
lib/WebService/Braintree/SubscriptionGateway.pm »
| 1 | # vim: sw=4 ts=4 ft=perl | ||||||||||||
| 2 | |||||||||||||
| 3 | package # hide from pause | ||||||||||||
| 4 | WebService::Braintree::PaymentMethodGatewayBase; | ||||||||||||
| 5 | |||||||||||||
| 6 | 22 | ▶ | use 5.010_001; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 7 | 22 | ▶ | use strictures 1; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 8 | |||||||||||||
| 9 | 22 | ▶ | use Moo; | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 10 | 22 | with 'WebService::Braintree::Role::MakeRequest'; | |||||||||||
| 11 | |||||||||||||
| 12 | 22 | ▶ | use Carp qw(confess); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 13 | 22 | ▶ | use Scalar::Util qw(blessed); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 14 | |||||||||||||
| 15 | 22 | ▶ | use WebService::Braintree::Util qw(validate_id); | ||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||
| 16 | |||||||||||||
| 17 | 0 | ▶ | sub _create { | ||||||||||
|
Subroutine
_create: not called CC=2 SCAR=17.9
| |||||||||||||
| 18 | 0 | my ($self, @args) = @_; | |||||||||||
| 19 | 0 | my $response = $self->_make_raw_request(@args); | |||||||||||
| 20 | 0 | ▶ | return $response if blessed($response); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 21 | 0 | return $self->_handle_response($response); | |||||||||||
| 22 | } | ||||||||||||
| 23 | |||||||||||||
| 24 | 0 | ▶ | sub _update { | ||||||||||
|
Subroutine
_update: not called CC=2 SCAR=17.9
| |||||||||||||
| 25 | 0 | my ($self, @args) = @_; | |||||||||||
| 26 | 0 | my $response = $self->_make_raw_request(@args); | |||||||||||
| 27 | 0 | ▶ | return $response if blessed($response); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 28 | 0 | return $self->_handle_response($response); | |||||||||||
| 29 | } | ||||||||||||
| 30 | |||||||||||||
| 31 | 0 | ▶ | sub _find { | ||||||||||
|
Subroutine
_find: not called CC=2 SCAR=17.9
| |||||||||||||
| 32 | 0 | my ($self, $method, @args) = @_; | |||||||||||
| 33 | 0 | my $response = $self->_make_raw_request(@args); | |||||||||||
| 34 | 0 | ▶ | return $response if blessed($response); | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 35 | 0 | return $self->_handle_response($response)->$method; | |||||||||||
| 36 | } | ||||||||||||
| 37 | |||||||||||||
| 38 | 0 | ▶ | sub _handle_response { | ||||||||||
|
Subroutine
_handle_response: not called CC=3 SCAR=24.8
| |||||||||||||
| 39 | 0 | my ($self, $response) = @_; | |||||||||||
| 40 | |||||||||||||
| 41 | 0 | ▶ | my @keys = keys %{$response // {}}; | ||||||||||
|
Condition0%0/2
$response // {}
MC/DC0%0/1
$response // {}
$response
Truth table0%0/2
A
A= $response
| |||||||||||||
| 42 | 0 | ▶ | confess "Expected payment_method or api_error_response" unless @keys; | ||||||||||
|
Branch: 1 branch
| |||||||||||||
| 43 | |||||||||||||
| 44 | 0 | return WebService::Braintree::PaymentMethodResult->new($response); | |||||||||||
| 45 | } | ||||||||||||
| 46 | |||||||||||||
| 47 | 22 | __PACKAGE__->meta->make_immutable; | |||||||||||
| 48 | |||||||||||||
| 49 | 22 | 1; | |||||||||||
| 50 | __END__ | ||||||||||||