| 1 | package WWW::PayPal::Subscription; | ||||||||||||||||||||||||||||
| 2 | |||||||||||||||||||||||||||||
| 3 | # ABSTRACT: PayPal Billing Subscription entity | ||||||||||||||||||||||||||||
| 4 | |||||||||||||||||||||||||||||
| 5 | 3 | ▶ | use Moo; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 6 | 3 | ▶ | use namespace::clean; | ||||||||||||||||||||||||||
|
Subroutine
BEGIN: called CC=1 SCAR=0.0
| |||||||||||||||||||||||||||||
| 7 | |||||||||||||||||||||||||||||
| 8 | 3 | our $VERSION = '0.003'; | |||||||||||||||||||||||||||
| 9 | |||||||||||||||||||||||||||||
| 10 | |||||||||||||||||||||||||||||
| 11 | 3 | has _client => ( | |||||||||||||||||||||||||||
| 12 | is => 'ro', | ||||||||||||||||||||||||||||
| 13 | required => 1, | ||||||||||||||||||||||||||||
| 14 | weak_ref => 1, | ||||||||||||||||||||||||||||
| 15 | init_arg => 'client', | ||||||||||||||||||||||||||||
| 16 | ); | ||||||||||||||||||||||||||||
| 17 | |||||||||||||||||||||||||||||
| 18 | 3 | has data => ( is => 'rw', required => 1 ); | |||||||||||||||||||||||||||
| 19 | |||||||||||||||||||||||||||||
| 20 | |||||||||||||||||||||||||||||
| 21 | 1 | ▶ | sub id { $_[0]->data->{id} } | ||||||||||||||||||||||||||
|
Subroutine
id: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 22 | 1 | ▶ | sub status { $_[0]->data->{status} } | ||||||||||||||||||||||||||
|
Subroutine
status: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 23 | 0 | ▶ | sub plan_id { $_[0]->data->{plan_id} } | ||||||||||||||||||||||||||
|
Subroutine
plan_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 24 | 0 | ▶ | sub custom_id { $_[0]->data->{custom_id} } | ||||||||||||||||||||||||||
|
Subroutine
custom_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 25 | 0 | ▶ | sub start_time { $_[0]->data->{start_time} } | ||||||||||||||||||||||||||
|
Subroutine
start_time: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 26 | 0 | ▶ | sub create_time { $_[0]->data->{create_time} } | ||||||||||||||||||||||||||
|
Subroutine
create_time: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 27 | 0 | ▶ | sub update_time { $_[0]->data->{update_time} } | ||||||||||||||||||||||||||
|
Subroutine
update_time: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 28 | |||||||||||||||||||||||||||||
| 29 | |||||||||||||||||||||||||||||
| 30 | 1 | ▶ | sub _links { $_[0]->data->{links} || [] } | ||||||||||||||||||||||||||
|
Subroutine
_links: called CC=2 SCAR=7.6
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 31 | |||||||||||||||||||||||||||||
| 32 | 1 | ▶ | sub link_for { | ||||||||||||||||||||||||||
|
Subroutine
link_for: called CC=4 SCAR=16.1
Pod
documented
| |||||||||||||||||||||||||||||
| 33 | 1 | my ($self, $rel) = @_; | |||||||||||||||||||||||||||
| 34 | 1 | for my $l (@{ $self->_links }) { | |||||||||||||||||||||||||||
| 35 | 1 | ▶ | return $l->{href} if $l->{rel} && $l->{rel} eq $rel; | ||||||||||||||||||||||||||
|
Branch: 1 branch
Condition33%1/3
$l->{"rel"} and $l->{"rel"} eq $rel
MC/DC0%0/2
$l->{"rel"} and $l->{"rel"} eq $rel
$l->{"rel"}
$l->{"rel"} eq $rel
Truth table33%1/3
A and B
A= $l->{"rel"}B= $l->{"rel"} eq $rel
| |||||||||||||||||||||||||||||
| 36 | } | ||||||||||||||||||||||||||||
| 37 | 0 | return; | |||||||||||||||||||||||||||
| 38 | } | ||||||||||||||||||||||||||||
| 39 | |||||||||||||||||||||||||||||
| 40 | |||||||||||||||||||||||||||||
| 41 | 1 | ▶ | sub approve_url { | ||||||||||||||||||||||||||
|
Subroutine
approve_url: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 42 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 43 | 1 | return $self->link_for('approve'); | |||||||||||||||||||||||||||
| 44 | } | ||||||||||||||||||||||||||||
| 45 | |||||||||||||||||||||||||||||
| 46 | |||||||||||||||||||||||||||||
| 47 | 1 | ▶ | sub subscriber_email { | ||||||||||||||||||||||||||
|
Subroutine
subscriber_email: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 48 | 1 | $_[0]->data->{subscriber}{email_address}; | |||||||||||||||||||||||||||
| 49 | } | ||||||||||||||||||||||||||||
| 50 | |||||||||||||||||||||||||||||
| 51 | 1 | ▶ | sub subscriber_name { | ||||||||||||||||||||||||||
|
Subroutine
subscriber_name: called CC=3 SCAR=12.0
Pod
documented
| |||||||||||||||||||||||||||||
| 52 | 1 | my ($self) = @_; | |||||||||||||||||||||||||||
| 53 | 1 | ▶ | my $n = $self->data->{subscriber}{name} or return; | ||||||||||||||||||||||||||
|
Branch: 1 branch
| |||||||||||||||||||||||||||||
| 54 | 1 | ▶ | return join(' ', grep { defined && length } $n->{given_name}, $n->{surname}); | ||||||||||||||||||||||||||
|
Condition33%1/3
defined $_ && length $_
MC/DC0%0/2
defined $_ && length $_
defined $_
length $_
Truth table33%1/3
A && B
A= defined $_B= length $_
| |||||||||||||||||||||||||||||
| 55 | } | ||||||||||||||||||||||||||||
| 56 | |||||||||||||||||||||||||||||
| 57 | 0 | ▶ | sub subscriber_payer_id { | ||||||||||||||||||||||||||
|
Subroutine
subscriber_payer_id: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 58 | 0 | $_[0]->data->{subscriber}{payer_id}; | |||||||||||||||||||||||||||
| 59 | } | ||||||||||||||||||||||||||||
| 60 | |||||||||||||||||||||||||||||
| 61 | |||||||||||||||||||||||||||||
| 62 | 1 | ▶ | sub next_billing_time { | ||||||||||||||||||||||||||
|
Subroutine
next_billing_time: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 63 | 1 | $_[0]->data->{billing_info}{next_billing_time}; | |||||||||||||||||||||||||||
| 64 | } | ||||||||||||||||||||||||||||
| 65 | |||||||||||||||||||||||||||||
| 66 | 1 | ▶ | sub last_payment_amount { | ||||||||||||||||||||||||||
|
Subroutine
last_payment_amount: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 67 | 1 | $_[0]->data->{billing_info}{last_payment}{amount}{value}; | |||||||||||||||||||||||||||
| 68 | } | ||||||||||||||||||||||||||||
| 69 | |||||||||||||||||||||||||||||
| 70 | 1 | ▶ | sub last_payment_currency { | ||||||||||||||||||||||||||
|
Subroutine
last_payment_currency: called CC=1 SCAR=0.0
Pod
documented
| |||||||||||||||||||||||||||||
| 71 | 1 | $_[0]->data->{billing_info}{last_payment}{amount}{currency_code}; | |||||||||||||||||||||||||||
| 72 | } | ||||||||||||||||||||||||||||
| 73 | |||||||||||||||||||||||||||||
| 74 | 0 | ▶ | sub cycle_executions { | ||||||||||||||||||||||||||
|
Subroutine
cycle_executions: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 75 | 0 | $_[0]->data->{billing_info}{cycle_executions}; | |||||||||||||||||||||||||||
| 76 | } | ||||||||||||||||||||||||||||
| 77 | |||||||||||||||||||||||||||||
| 78 | |||||||||||||||||||||||||||||
| 79 | 0 | ▶ | sub refresh { | ||||||||||||||||||||||||||
|
Subroutine
refresh: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 80 | 0 | my ($self) = @_; | |||||||||||||||||||||||||||
| 81 | 0 | my $fresh = $self->_client->subscriptions->get($self->id); | |||||||||||||||||||||||||||
| 82 | 0 | $self->data($fresh->data); | |||||||||||||||||||||||||||
| 83 | 0 | return $self; | |||||||||||||||||||||||||||
| 84 | } | ||||||||||||||||||||||||||||
| 85 | |||||||||||||||||||||||||||||
| 86 | 0 | ▶ | sub suspend { my $s = shift; $s->_client->subscriptions->suspend($s->id, @_); $s->refresh } | ||||||||||||||||||||||||||
|
Subroutine
suspend: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 87 | 0 | ▶ | sub activate { my $s = shift; $s->_client->subscriptions->activate($s->id, @_); $s->refresh } | ||||||||||||||||||||||||||
|
Subroutine
activate: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 88 | 0 | ▶ | sub cancel { my $s = shift; $s->_client->subscriptions->cancel($s->id, @_); $s->refresh } | ||||||||||||||||||||||||||
|
Subroutine
cancel: not called CC=1 SCAR=6.9
Pod
documented
| |||||||||||||||||||||||||||||
| 89 | |||||||||||||||||||||||||||||
| 90 | |||||||||||||||||||||||||||||
| 91 | |||||||||||||||||||||||||||||
| 92 | 3 | 1; | |||||||||||||||||||||||||||
| 93 | |||||||||||||||||||||||||||||
| 94 | __END__ | ||||||||||||||||||||||||||||