lib/WebService/Braintree/_/MasterpassCard.pm

filter: Statementstmt 85.7% 48 / 56 Branchbran n/a Conditioncond 0.0% 0 / 2 MC/DCmcdc 0.0% 0 / 1 Subroutinesub 66.6% 6 / 9 Podpod 100% 3 / 3 totaltotal 80.2% 57 / 71 CC 2 SCAR 7.9
CC
2
Cov
83%
verification
6.0
expiration_date
2.0
masked_number
2.0
CRAP 2.2
« lib/WebService/Braintree/Util.pm ↑ Summary lib/WebService/Braintree/_/VisaCheckoutCard.pm »
1 # vim: sw=4 ts=4 ft=perl
2  
3 package WebService::Braintree::_::MasterpassCard;
4 22 $WebService::Braintree::_::MasterpassCard::VERSION = '1.7';
5 22 ▶use 5.010_001;
Subroutine BEGIN: called CC=1 SCAR=0.0
6 22 ▶use strictures 1;
Subroutine BEGIN: called CC=1 SCAR=0.0
7  
8 =head1 NAME
9  
10 WebService::Braintree::_::MasterpassCard
11  
12 =head1 PURPOSE
13  
14 This class represents a Masterpass card.
15  
16 This class will only be created as part of a L<response|WebService::Braintree::Result> or L<error response|WebService::Braintree::ErrorResult>.
17  
18 =cut
19  
20 22 ▶use Moo;
Subroutine BEGIN: called CC=1 SCAR=0.0
21 22 ▶use MooX::Aliases;
Subroutine BEGIN: called CC=1 SCAR=0.0
22  
23 22 extends 'WebService::Braintree::_';
24  
25 22 ▶use Types::Standard qw(ArrayRef);
Subroutine BEGIN: called CC=1 SCAR=0.0
26 22 ▶use WebService::Braintree::Types qw(
Subroutine BEGIN: called CC=1 SCAR=0.0
27 Address
28 CreditCardVerification
29 Subscription
30 22 );
31  
32 =head1 ATTRIBUTES
33  
34 =cut
35  
36 =head2 billing_address()
37  
38 This returns the card's billing address. This will be an object of type
39 L<address|WebService::Braintree::_::Address/>.
40  
41 =cut
42  
43 22 has billing_address => (
44 is => 'ro',
45 isa => Address,
46 coerce => 1,
47 );
48  
49 =head2 bin()
50  
51 This is the bin for this card.
52  
53 =cut
54  
55 22 has bin => (
56 is => 'ro',
57 );
58  
59 =head2 card_type()
60  
61 This is the type for this card.
62  
63 =cut
64  
65 22 has card_type => (
66 is => 'ro',
67 );
68  
69 =head2 cardholder_name()
70  
71 This is the cardholder name for this card.
72  
73 =cut
74  
75 22 has cardholder_name => (
76 is => 'ro',
77 );
78  
79 =head2 commercial()
80  
81 This is true if this card is commerical.
82  
83 =cut
84  
85 22 has commercial => (
86 is => 'ro',
87 );
88  
89 =head2 country_of_issuance()
90  
91 This is true if this card is country-of-issuance.
92  
93 =cut
94  
95 22 has country_of_issuance => (
96 is => 'ro',
97 );
98  
99 =head2 created_at()
100  
101 This returns when this card was created.
102  
103 =cut
104  
105 22 has created_at => (
106 is => 'ro',
107 );
108  
109 =head2 customer_id()
110  
111 This is the customer ID for this card.
112  
113 =cut
114  
115 22 has customer_id => (
116 is => 'ro',
117 );
118  
119 =head2 customer_location()
120  
121 This is the customer location for this card.
122  
123 =cut
124  
125 22 has customer_location => (
126 is => 'ro',
127 );
128  
129 =head2 debit()
130  
131 This is true if this card is debit.
132  
133 =cut
134  
135 22 has debit => (
136 is => 'ro',
137 );
138  
139 =head2 default()
140  
141 This is true if this card is default.
142  
143 C<< is_default() >> is an alias for this attribute.
144  
145 =cut
146  
147 22 has default => (
148 is => 'ro',
149 alias => 'is_default',
150 );
151  
152 =head2 durbin_regulated()
153  
154 This is true if this card is Durbin-regulated.
155  
156 =cut
157  
158 22 has durbin_regulated => (
159 is => 'ro',
160 );
161  
162 =head2 expiration_month()
163  
164 This is the expiration month for this card.
165  
166 =cut
167  
168 22 has expiration_month => (
169 is => 'ro',
170 );
171  
172 =head2 expiration_year()
173  
174 This is the expiration year for this card.
175  
176 =cut
177  
178 22 has expiration_year => (
179 is => 'ro',
180 );
181  
182 =head2 expired()
183  
184 This is true if this card is expired.
185  
186 C<< is_expired() >> is an alias for this attribute.
187  
188 =cut
189  
190 22 has expired => (
191 is => 'ro',
192 alias => 'is_expired',
193 );
194  
195 =head2 healthcare()
196  
197 This is true if this card is healthcare.
198  
199 =cut
200  
201 22 has healthcare => (
202 is => 'ro',
203 );
204  
205 =head2 image_url()
206  
207 This is the image URL for this card.
208  
209 =cut
210  
211 22 has image_url => (
212 is => 'ro',
213 );
214  
215 =head2 issuing_bank()
216  
217 This is the issuing bank for this card.
218  
219 =cut
220  
221 22 has issuing_bank => (
222 is => 'ro',
223 );
224  
225 =head2 last_4()
226  
227 This is the last-4 for this card.
228  
229 =cut
230  
231 22 has last_4 => (
232 is => 'ro',
233 );
234  
235 =head2 payroll()
236  
237 This is true if this card is payroll.
238  
239 =cut
240  
241 22 has payroll => (
242 is => 'ro',
243 );
244  
245 =head2 prepaid()
246  
247 This is true if this card is prepaid.
248  
249 =cut
250  
251 22 has prepaid => (
252 is => 'ro',
253 );
254  
255 =head2 product_id()
256  
257 This is the product ID for this card.
258  
259 =cut
260  
261 22 has product_id => (
262 is => 'ro',
263 );
264  
265 =head2 subscriptions()
266  
267 This returns the card's subscriptions. This will be an arrayref of
268 L<subscriptions|WebService::Braintree::_::Subscription/>.
269  
270 =cut
271  
272 22 has subscriptions => (
273 is => 'ro',
274 isa => ArrayRef[Subscription],
275 coerce => 1,
276 );
277  
278 =head2 token()
279  
280 This is the token for this card.
281  
282 =cut
283  
284 22 has token => (
285 is => 'ro',
286 );
287  
288 =head2 unique_number_identifier()
289  
290 This is the unique number identifier for this card.
291  
292 =cut
293  
294 22 has unique_number_identifier => (
295 is => 'ro',
296 );
297  
298 =head2 updated_at()
299  
300 This returns when this card was last updated.
301  
302 =cut
303  
304 22 has updated_at => (
305 is => 'ro',
306 );
307  
308 =head2 verifications()
309  
310 This returns the card's credit card verifications. This will be an arrayref of
311 L<credit card verifications|WebService::Braintree::_::CreditCardVerification/>.
312  
313 =cut
314  
315 22 has verifications => (
316 is => 'ro',
317 isa => ArrayRef[CreditCardVerification],
318 coerce => 1,
319 );
320  
321 =head1 METHODS
322  
323 =head2 expiration_date()
324  
325 This returns the expiration date in MM/YYYY format.
326  
327 =cut
328  
329 0 ▶sub expiration_date {
Subroutine expiration_date: not called CC=1 SCAR=6.9
Pod documented
330 0 my $self = shift;
331 0 return join('/', $self->expiration_month, $self->expiration_year);
332 }
333  
334 =head2 masked_number()
335  
336 This returns the card number with the center masked out.
337  
338 =cut
339  
340 0 ▶sub masked_number {
Subroutine masked_number: not called CC=1 SCAR=6.9
Pod documented
341 0 my $self = shift;
342 0 return join('******', $self->bin, $self->last_4);
343 }
344  
345 =head2 verification()
346  
347 This returns the most recent verification from the arrayref in L</verifications()>.
348  
349 =cut
350  
351 0 ▶sub verification {
Subroutine verification: not called CC=2 SCAR=17.9
Pod documented
352 0 my $self = shift;
353  
354 return (
355 sort {
356 0 $b->created_at cmp $a->created_at
357 0 ▶ } @{$self->verifications // []}
Condition0%0/2
$self->verifications // []
l!l
00
MC/DC0%0/1
$self->verifications // []
$self->verifications
Truth table0%0/2
A
A= $self->verifications
Aresult
11
00
358 )[0];
359 }
360  
361 22 __PACKAGE__->meta->make_immutable;
362  
363 22 1;
364 __END__
« lib/WebService/Braintree/Util.pm ↑ Summary lib/WebService/Braintree/_/VisaCheckoutCard.pm »