Stripe/Connect/Person.pm

filter: Statementstmt 32.1% 26 / 81 Branchbran 0.0% 0 / 14 Conditioncond 0.0% 0 / 9 MC/DCmcdc 0.0% 0 / 5 Subroutinesub 21.9% 9 / 41 Podpod 100% 32 / 32 totaltotal 36.8% 67 / 182 CC 12 SCAR 36.2
CC
12
Cov
25%
dob
156.0
id
2.0
object
2.0
CRAP 37.4
« Stripe/Generic.pm ↑ Summary Stripe/Connect/Account/ExternalAccounts.pm »
1 ##----------------------------------------------------------------------------
2 ## Stripe API - ~/lib/Net/API/Stripe/Connect/Person.pm
3 ## Version v0.201.1
4 ## Copyright(c) 2022 DEGUEST Pte. Ltd.
5 ## Author: Jacques Deguest <jack@deguest.jp>
6 ## Created 2019/11/02
7 ## Modified 2024/09/05
8 ## All rights reserved.
9 ##
10 ##
11 ## This program is free software; you can redistribute it and/or modify it
12 ## under the same terms as Perl itself.
13 ##----------------------------------------------------------------------------
14 package Net::API::Stripe::Connect::Person;
15 BEGIN
16 2 ▶{
Subroutine BEGIN: called CC=1 SCAR=0.0
17 2 ▶ use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
18 2 ▶ use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
19 2 ▶ use parent qw( Net::API::Stripe::Generic );
Subroutine BEGIN: called CC=1 SCAR=0.0
20 2 ▶ use vars qw( $VERSION );
Subroutine BEGIN: called CC=1 SCAR=0.0
21 2 ▶ use DateTime;
Subroutine BEGIN: called CC=1 SCAR=0.0
22 2 ▶ use DateTime::Format::Strptime;
Subroutine BEGIN: called CC=1 SCAR=0.0
23 2 our( $VERSION ) = 'v0.201.1';
24 };
25  
26 2 ▶use strict;
Subroutine BEGIN: called CC=1 SCAR=0.0
27 2 ▶use warnings;
Subroutine BEGIN: called CC=1 SCAR=0.0
28  
29 0 ▶sub id { return( shift->_set_get_scalar( 'id', @_ ) ); }
Subroutine id: not called CC=1 SCAR=6.9
Pod documented
30  
31 0 ▶sub object { return( shift->_set_get_scalar( 'object', @_ ) ); }
Subroutine object: not called CC=1 SCAR=6.9
Pod documented
32  
33 0 ▶sub account { return( shift->_set_get_scalar_or_object( 'account', 'Net::API::Stripe::Connect::Account', @_ ) ); }
Subroutine account: not called CC=1 SCAR=6.9
Pod documented
34  
35 0 ▶sub additional { return( shift->_set_get_array( 'additional', @_ ) ); }
Subroutine additional: not called CC=1 SCAR=6.9
Pod documented
36  
37 0 ▶sub address { return( shift->_set_get_object( 'address', 'Net::API::Stripe::Address', @_ ) ); }
Subroutine address: not called CC=1 SCAR=6.9
Pod documented
38  
39 0 ▶sub address_kana { return( shift->_set_get_object( 'address_kana', 'Net::API::Stripe::Address', @_ ) ); }
Subroutine address_kana: not called CC=1 SCAR=6.9
Pod documented
40  
41 0 ▶sub address_kanji { return( shift->_set_get_object( 'address_kanji', 'Net::API::Stripe::Address', @_ ) ); }
Subroutine address_kanji: not called CC=1 SCAR=6.9
Pod documented
42  
43 0 ▶sub created { return( shift->_set_get_datetime( 'created', @_ ) ); }
Subroutine created: not called CC=1 SCAR=6.9
Pod documented
44  
45 sub dob
46 0 ▶{
Subroutine dob: not called CC=12 SCAR=50.5
Pod documented
47 0 my $self = shift( @_ );
48 0 ▶ if( @_ )
Branch: 1 branch
BranchTrueFalseTotal
if (@_) 0 0 0
49 {
50 0 local $@;
51 # There may be a hash provided with undefined values for each of the properties, so we need to check that
52 0 my $ref = shift( @_ );
53 0 my $dt;
54 0 ▶ if( $self->_is_object( $ref ) && $ref->isa( 'DateTime' ) )
Branch: 2 branches
BranchTrueFalseTotal
if ($self->_is_object($ref) and $ref->isa('DateTime')) { } 0 0 0
elsif ($self->_is_hash($ref)) { } 0 0 0
Condition0%0/3
$self->_is_object($ref) and $ref->isa("DateTime")
!ll&&!rl&&r
000
MC/DC0%0/2
$self->_is_object($ref) and $ref->isa("DateTime")
$self->_is_object($ref) $ref->isa("DateTime")
Truth table0%0/3
A and B
A= $self->_is_object($ref)B= $ref->isa("DateTime")
ABresult
0X0
100
111
55 {
56 0 $dt = $ref;
57 }
58 elsif( $self->_is_hash( $ref ) )
59 {
60 0 ▶ return if( !length( $ref->{year} ) && !length( $ref->{month} ) && !length( $ref->{day} ) );
Branch: 1 branch
BranchTrueFalseTotal
unless length $ref->{"year"} or length $ref->{"month"} or length $ref->{"day"} 0 0 0
Condition0%0/6
length $ref->{"year"} or length $ref->{"month"} or length $ref->{"day"}
l!l&&r!l&&!r
000
length $ref->{"year"} or length $ref->{"month"}
l!l&&r!l&&!r
000
MC/DC0%0/3
length $ref->{"year"} or length $ref->{"month"} or length $ref->{"day"}
length $ref->{"year"} length $ref->{"month"} length $ref->{"day"}
Truth table0%0/4
A or B or C
A= length $ref->{"year"}B= length $ref->{"month"}C= length $ref->{"day"}
ABCresult
1XX1
01X1
0011
0000
61
62 0 foreach my $k ( qw( year month day ) )
63 {
64 0 ▶ return( $self->error( "Hash provided for person date of birth is missing the $k property" ) ) if( !$ref->{ $k } );
Branch: 1 branch
BranchTrueFalseTotal
unless $ref->{$k} 0 0 0
65 }
66 0 @$ref{ qw( hour minute second ) } = ( 0, 0, 0 );
67 # try-catch
68 eval
69 0 {
70 0 $dt = DateTime->new( %$ref );
71 };
72 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
73 {
74 0 return( $self->error( "An error occurred while trying to create a datetime object from this person's date of birth (year = '$ref->{year}', month = '$ref->{month}', day = '$ref->{day}'." ) );
75 }
76 }
77
78 0 my $tz;
79 # try-catch
80 eval
81 0 {
82 0 $tz = DateTime::TimeZone->new( name => 'local' );
83 };
84 0 ▶ if( $@ )
Branch: 1 branch
BranchTrueFalseTotal
if ($@) 0 0 0
85 {
86 0 $tz = DateTime::TimeZone->new( name => 'UTC' );
87 }
88
89 0 my $fmt = DateTime::Format::Strptime->new(
90 pattern => '%Y-%m-%d',
91 locale => 'en_GB',
92 time_zone => $tz->name,
93 );
94 0 $dt->set_formatter( $fmt );
95 0 $self->{dob} = $dt;
96 }
97 0 return( $self->{dob} );
98 }
99  
100 0 ▶sub email { return( shift->_set_get_scalar( 'email', @_ ) ); }
Subroutine email: not called CC=1 SCAR=6.9
Pod documented
101  
102 0 ▶sub first_name { return( shift->_set_get_scalar( 'first_name', @_ ) ); }
Subroutine first_name: not called CC=1 SCAR=6.9
Pod documented
103  
104 0 ▶sub first_name_kana { return( shift->_set_get_scalar( 'first_name_kana', @_ ) ); }
Subroutine first_name_kana: not called CC=1 SCAR=6.9
Pod documented
105  
106 0 ▶sub first_name_kanji { return( shift->_set_get_scalar( 'first_name_kanji', @_ ) ); }
Subroutine first_name_kanji: not called CC=1 SCAR=6.9
Pod documented
107  
108 0 ▶sub full_name_aliases { return( shift->_set_get_array( 'full_name_aliases', @_ ) ); }
Subroutine full_name_aliases: not called CC=1 SCAR=6.9
Pod documented
109  
110 0 ▶sub future_requirements { return( shift->_set_get_object( 'future_requirements', 'Net::API::Stripe::Connect::Account::Requirements', @_ ) ); }
Subroutine future_requirements: not called CC=1 SCAR=6.9
Pod documented
111  
112 0 ▶sub gender { return( shift->_set_get_scalar( 'gender', @_ ) ); }
Subroutine gender: not called CC=1 SCAR=6.9
Pod documented
113  
114 0 ▶sub id_number_provided { return( shift->_set_get_boolean( 'id_number_provided', @_ ) ); }
Subroutine id_number_provided: not called CC=1 SCAR=6.9
Pod documented
115  
116 0 ▶sub id_number_secondary_provided { return( shift->_set_get_boolean( 'id_number_secondary_provided', @_ ) ); }
Subroutine id_number_secondary_provided: not called CC=1 SCAR=6.9
Pod documented
117  
118 0 ▶sub last_name { return( shift->_set_get_scalar( 'last_name', @_ ) ); }
Subroutine last_name: not called CC=1 SCAR=6.9
Pod documented
119  
120 0 ▶sub last_name_kana { return( shift->_set_get_scalar( 'last_name_kana', @_ ) ); }
Subroutine last_name_kana: not called CC=1 SCAR=6.9
Pod documented
121  
122 0 ▶sub last_name_kanji { return( shift->_set_get_scalar( 'last_name_kanji', @_ ) ); }
Subroutine last_name_kanji: not called CC=1 SCAR=6.9
Pod documented
123  
124 0 ▶sub maiden_name { return( shift->_set_get_scalar( 'maiden_name', @_ ) ); }
Subroutine maiden_name: not called CC=1 SCAR=6.9
Pod documented
125  
126 0 ▶sub metadata { return( shift->_set_get_hash( 'metadata', @_ ) ); }
Subroutine metadata: not called CC=1 SCAR=6.9
Pod documented
127  
128 0 ▶sub minimum { return( shift->_set_get_array( 'minimum', @_ ) ); }
Subroutine minimum: not called CC=1 SCAR=6.9
Pod documented
129  
130 0 ▶sub nationality { return( shift->_set_get_scalar( 'nationality', @_ ) ); }
Subroutine nationality: not called CC=1 SCAR=6.9
Pod documented
131  
132 0 ▶sub phone { return( shift->_set_get_scalar( 'phone', @_ ) ); }
Subroutine phone: not called CC=1 SCAR=6.9
Pod documented
133  
134 0 ▶sub political_exposure { return( shift->_set_get_scalar( 'political_exposure', @_ ) ); }
Subroutine political_exposure: not called CC=1 SCAR=6.9
Pod documented
135  
136 0 ▶sub registered_address { return( shift->_set_get_object( 'registered_address', 'Net::API::Stripe::Address', @_ ) ); }
Subroutine registered_address: not called CC=1 SCAR=6.9
Pod documented
137  
138 0 ▶sub relationship { return( shift->_set_get_object( 'relationship', 'Net::API::Stripe::Connect::Account::Relationship', @_ ) ); }
Subroutine relationship: not called CC=1 SCAR=6.9
Pod documented
139  
140 0 ▶sub requirements { return( shift->_set_get_object( 'requirements', 'Net::API::Stripe::Connect::Account::Requirements', @_ ) ); }
Subroutine requirements: not called CC=1 SCAR=6.9
Pod documented
141  
142 0 ▶sub ssn_last_4_provided { return( shift->_set_get_boolean( 'ssn_last_4_provided', @_ ) ); }
Subroutine ssn_last_4_provided: not called CC=1 SCAR=6.9
Pod documented
143  
144 0 ▶sub verification { return( shift->_set_get_object( 'verification', 'Net::API::Stripe::Connect::Account::Verification', @_ ) ); }
Subroutine verification: not called CC=1 SCAR=6.9
Pod documented
145  
146 2 1;
147  
148 __END__
« Stripe/Generic.pm ↑ Summary Stripe/Connect/Account/ExternalAccounts.pm »