« lib/WebService/Braintree/PaginatedCollection.pm
↑ Summary
lib/WebService/Braintree/PaymentMethodGatewayBase.pm »
| 1 | # vim: sw=4 ts=4 ft=perl | ||||||||||
| 2 | |||||||||||
| 3 | package # hide from pause | ||||||||||
| 4 | WebService::Braintree::PayPalAccountGateway; | ||||||||||
| 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 | extends 'WebService::Braintree::PaymentMethodGatewayBase'; | |||||||||
| 11 | |||||||||||
| 12 | 22 | ▶ | use Carp qw(confess); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 13 | |||||||||||
| 14 | 22 | ▶ | use WebService::Braintree::Util qw(validate_id); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 15 | 22 | ▶ | use WebService::Braintree::Validations qw(verify_params); | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 16 | |||||||||||
| 17 | 22 | ▶ | use WebService::Braintree::_::PayPalAccount; | ||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||
| 18 | |||||||||||
| 19 | 0 | ▶ | sub find { | ||||||||
|
Subroutine
find: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 20 | 0 | my ($self, $token) = @_; | |||||||||
| 21 | 0 | ▶ | confess "NotFoundError" if !validate_id($token); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 22 | 0 | $self->_find(paypal_account => ( | |||||||||
| 23 | "/payment_methods/paypal_account/$token", 'get', undef, | ||||||||||
| 24 | )); | ||||||||||
| 25 | } | ||||||||||
| 26 | |||||||||||
| 27 | 0 | ▶ | sub create { | ||||||||
|
Subroutine
create: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 28 | 0 | my ($self, $token, $params) = @_; | |||||||||
| 29 | |||||||||||
| 30 | 0 | ▶ | confess "NotFoundError" if !validate_id($token); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 31 | 0 | ▶ | confess "ArgumentError" unless verify_params($params, { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 32 | billing_agreement_id => 1, | ||||||||||
| 33 | customer_id => 1, | ||||||||||
| 34 | email => 1, | ||||||||||
| 35 | options => { | ||||||||||
| 36 | fail_on_duplicate_payment_method => 1, | ||||||||||
| 37 | make_default => 1, | ||||||||||
| 38 | }, | ||||||||||
| 39 | token => 1, | ||||||||||
| 40 | }); | ||||||||||
| 41 | |||||||||||
| 42 | 0 | $self->_create( | |||||||||
| 43 | "/payment_methods", 'post', { paypal_account => $params }, | ||||||||||
| 44 | ); | ||||||||||
| 45 | } | ||||||||||
| 46 | |||||||||||
| 47 | 0 | ▶ | sub update { | ||||||||
|
Subroutine
update: not called CC=3 SCAR=24.8
Pod
undocumented
| |||||||||||
| 48 | 0 | my ($self, $token, $params) = @_; | |||||||||
| 49 | |||||||||||
| 50 | 0 | ▶ | confess "NotFoundError" if !validate_id($token); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 51 | 0 | ▶ | confess "ArgumentError" unless verify_params($params, { | ||||||||
|
Branch: 1 branch
| |||||||||||
| 52 | billing_agreement_id => 1, | ||||||||||
| 53 | email => 1, | ||||||||||
| 54 | options => { | ||||||||||
| 55 | fail_on_duplicate_payment_method => 1, | ||||||||||
| 56 | make_default => 1, | ||||||||||
| 57 | }, | ||||||||||
| 58 | token => 1, | ||||||||||
| 59 | }); | ||||||||||
| 60 | |||||||||||
| 61 | 0 | $self->_update( | |||||||||
| 62 | "/payment_methods/paypal_account/$token", 'put', { | ||||||||||
| 63 | paypal_account => $params, | ||||||||||
| 64 | }, | ||||||||||
| 65 | ); | ||||||||||
| 66 | } | ||||||||||
| 67 | |||||||||||
| 68 | 0 | ▶ | sub delete { | ||||||||
|
Subroutine
delete: not called CC=2 SCAR=17.9
Pod
undocumented
| |||||||||||
| 69 | 0 | my ($self, $token) = @_; | |||||||||
| 70 | 0 | ▶ | confess "NotFoundError" if !validate_id($token); | ||||||||
|
Branch: 1 branch
| |||||||||||
| 71 | 0 | $self->_make_request( | |||||||||
| 72 | "/payment_methods/paypal_account/$token", 'delete', undef, | ||||||||||
| 73 | ); | ||||||||||
| 74 | } | ||||||||||
| 75 | |||||||||||
| 76 | 22 | __PACKAGE__->meta->make_immutable; | |||||||||
| 77 | |||||||||||
| 78 | 22 | 1; | |||||||||
| 79 | __END__ | ||||||||||